fix(api): 修正接口路径并优化定时任务逻辑
- 将上传考试单词图片接口路径由 /exam/words/genexam 修改为 /exam/words/submit - AutoJudgeExamWordsTask 中注入 ExamWordsJudgeService 服务 - 定时任务中调用 examWordsJudgeService.judgeExamWords 方法实现自动判卷 - 注释掉 PngUtil 中调试用的图像保存代码,避免生成多余文件
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.yinlihupo.enlish.service.job;
|
||||
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudgeService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -8,8 +10,12 @@ import java.time.LocalDateTime;
|
||||
@Component
|
||||
public class AutoJudgeExamWordsTask {
|
||||
|
||||
@Resource
|
||||
private ExamWordsJudgeService examWordsJudgeService;
|
||||
|
||||
@Scheduled(fixedRate = 5000)
|
||||
public void autoJudgeExamWords() {
|
||||
System.out.println("【固定频率】开始自动判卷,时间:" + LocalDateTime.now());
|
||||
examWordsJudgeService.judgeExamWords(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class PngUtil {
|
||||
Imgproc.threshold(gray, binary, 0, 255, Imgproc.THRESH_BINARY | Imgproc.THRESH_OTSU);
|
||||
|
||||
// 可选:保存预处理后的图片查看效果
|
||||
Imgcodecs.imwrite("debug_roi.jpg", binary);
|
||||
// Imgcodecs.imwrite("debug_roi.jpg", binary);
|
||||
|
||||
// 4. 将 OpenCV Mat 转换为 BufferedImage (供 Tess4J 使用)
|
||||
BufferedImage processedImage = matToBufferedImage(binary);
|
||||
|
||||
Reference in New Issue
Block a user