refactor(pngutil): 优化试卷id识别为学生和试卷组合对象
- 将分析试卷id方法返回类型改为StudentExamId,包含学生id和试卷id - 修改正则匹配逻辑,从单个id提取改为依次提取试卷id和学生id - 增加StudentExamId类,封装学生id和试卷id字段 - 试卷生成与接口数据构建均添加学生相关信息,完善数据结构 - 相关测试调用修改为使用StudentExamId类型并打印对象信息
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.yinlihupo.enlish.service.omr;
|
||||
|
||||
import com.yinlihupo.enlish.service.model.bo.CoordinatesXY;
|
||||
import com.yinlihupo.enlish.service.model.bo.StudentExamId;
|
||||
import com.yinlihupo.enlish.service.utils.PngUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -41,7 +42,7 @@ public class TestOmr {
|
||||
public void testInteger(){
|
||||
String filePath = "C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\main\\resources\\templates\\p3.png";
|
||||
List<CoordinatesXY> coordinatesXIES = PngUtil.analysisXY(filePath);
|
||||
Integer examWordsId = PngUtil.analyzeExamWordsId(filePath, tessdataPath, coordinatesXIES);
|
||||
log.info("examWordsId:{}", examWordsId);
|
||||
StudentExamId studentExamId = PngUtil.analyzeExamWordsId(filePath, tessdataPath, coordinatesXIES);
|
||||
log.info("studentExamId:{}",studentExamId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,12 @@ public class ExamTest {
|
||||
.build();
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("id", examWordsDO.getId());
|
||||
data.put("examId", examWordsDO.getId());
|
||||
data.put("studentId", 1);
|
||||
data.put("studentStr","小明三班一年级");
|
||||
data.put("examStr", examWordsDO.getTitle());
|
||||
data.put("words", assessmentWords);
|
||||
data.put("answer", assessmentWords);
|
||||
|
||||
// 4. 渲染并输出
|
||||
try (XWPFTemplate template = XWPFTemplate.compile("C:\\project\\java\\enlish_edu\\enlish\\enlish-service\\src\\main\\resources\\templates\\assessment_v5.docx", config)) {
|
||||
|
||||
Reference in New Issue
Block a user