fix(api): 修正接口路径并优化定时任务逻辑

- 将上传考试单词图片接口路径由 /exam/words/genexam 修改为 /exam/words/submit
- AutoJudgeExamWordsTask 中注入 ExamWordsJudgeService 服务
- 定时任务中调用 examWordsJudgeService.judgeExamWords 方法实现自动判卷
- 注释掉 PngUtil 中调试用的图像保存代码,避免生成多余文件
This commit is contained in:
lbw
2025-12-15 11:45:49 +08:00
parent e5a1ef1423
commit 89df9af8c6
4 changed files with 8 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -1,7 +1,7 @@
import axios from "@/axios";
export function uploadExamWordsPng(data) {
return axios.post('/exam/words/genexam', data)
return axios.post('/exam/words/submit', data)
}
export function getExamWordsResult(page, size) {