fix(examWords): 修复考试单词顺序混乱和标记阈值调整

- 限制单词释义显示长度,避免过长显示问题
- 修复获取单词后单词 ID 顺序混乱问题,增加更新考试记录单词 ID 顺序功能
- 增加 ExamWordsDOMapper 中更新单词 ID 顺序的方法及对应 XML 配置
- 在 ExamWordsService 中新增更新单词 ID 顺序方法及其实现
- 调整 PngUtil 中未背熟单词标记阈值由 800 降至 500,增强识别准确性
- 优化测试用例,增加对未掌握单词的输出日志
- 更新测试数据文件路径及格式对应关系,改进词汇插入逻辑,完善变量赋值
- 统一单词实体中音标和词性赋值,保证完整词汇信息展现
This commit is contained in:
lbw
2025-12-25 17:01:21 +08:00
parent aff862d161
commit bc9334f5ab
10 changed files with 64 additions and 10 deletions

View File

@@ -35,9 +35,9 @@ public class TestVocabularyBankInsert {
private GradeUnitDOMapper gradeUnitDOMapper;
@Test
void test() {
String file = "C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\test\\java\\com\\yinlihupo\\enlish\\service\\mapper\\3上.xlsx";
String file = "C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\test\\java\\com\\yinlihupo\\enlish\\service\\mapper\\八下.xlsx";
HashMap<String, Integer> map = new HashMap<>();
int gradeId = 3;
int gradeId = 8;
try (FileInputStream fis = new FileInputStream(file); Workbook workbook = new XSSFWorkbook(fis)) {
Sheet sheet = workbook.getSheetAt(0);
@@ -49,15 +49,22 @@ public class TestVocabularyBankInsert {
}
// String word = row.getCell(0).getStringCellValue();
// String pronunciation = row.getCell(1) != null ? row.getCell(1).getStringCellValue() : "";
// String pos = row.getCell(2) != null ? row.getCell(2).getStringCellValue() : "";
// String meaning = row.getCell(3) != null ? row.getCell(3).getStringCellValue() : "";
// String gradeUnit = row.getCell(4) != null ? row.getCell(4).getStringCellValue() : "";
String word = row.getCell(0).getStringCellValue();
String meaning = row.getCell(1) != null ? row.getCell(1).getStringCellValue() : "";
String gradeUnit = row.getCell(2) != null ? row.getCell(2).getStringCellValue() : "";
String pronunciation = "";
String pos = "";
if (word.contains("Unit")) {
continue;
}
int gradeUnitId = 0;
int gradeUnitId;
if (map.containsKey(gradeUnit)) {
gradeUnitId = map.get(gradeUnit);
} else {
@@ -80,7 +87,8 @@ public class TestVocabularyBankInsert {
VocabularyBankDO vocabularyBankDO = VocabularyBankDO.builder()
.word(word)
.definition(meaning)
.pronunciation("")
.pronunciation(pronunciation)
.pos(pos)
.unitId(gradeUnitId)
.build();
vocabularyBankMapper.insertSelective(vocabularyBankDO);