feat(exam): 优化考试判卷逻辑并完善相关接口
- 新增获取未完成判卷数量接口 getExamUnfinishedCount - 修改定时任务 autoJudgeExamWords 使用未完成判卷数量判断 - Mapper 添加 selectUnfinishedCount 方法,SQL查询未完成记录数 - 优化文件上传判卷时日志输出,增加“上传文件成功”日志 - 修正判卷时未识别学生和考试的提示信息 - 移除学生查询页面中班级和年级ID显示,仅保留名称显示 - 测试类中添加判卷方法调用测试逻辑 - 配置文件增加 Sa-Token 相关日志调试配置
This commit is contained in:
@@ -19,6 +19,8 @@ public interface ExamWordsJudgeResultDOMapper {
|
||||
|
||||
Integer selectCount();
|
||||
|
||||
Integer selectUnfinishedCount();
|
||||
|
||||
ExamWordsJudgeResultDO selectDetailById(@Param("id") Integer id);
|
||||
|
||||
List<ExamWordsJudgeResultDO> selectByStudentId(@Param("studentId") Integer studentId);
|
||||
|
||||
@@ -13,6 +13,8 @@ public interface ExamWordsJudgeService {
|
||||
|
||||
Integer getExamWordsJudgeResultCount();
|
||||
|
||||
Integer getExamUnfinishedCount();
|
||||
|
||||
ExamWordsJudgeResultDO getExamWordsJudgeResultDOById(Integer id);
|
||||
|
||||
List<ExamWordsJudgeResultDO> getStudentExamWordsResultList(Integer studentId);
|
||||
|
||||
@@ -178,8 +178,9 @@ public class ExamWordsServiceImpl implements ExamWordsService {
|
||||
|
||||
File dest = new File(path);
|
||||
file.transferTo(dest);
|
||||
|
||||
return examWordsJudgeResultDOMapper.insert(path);
|
||||
int insert = examWordsJudgeResultDOMapper.insert(path);
|
||||
log.info("上传文件成功");
|
||||
return insert;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("上传失败", e);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
private String tessdataPath;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void judgeExamWords(int count) {
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResultDOS = examWordsJudgeResultDOMapper.selectUnfinishedExamWordsJudgeResultDOList(count);
|
||||
for (ExamWordsJudgeResultDO examWordsJudgeResultDO : examWordsJudgeResultDOS) {
|
||||
@@ -62,7 +61,7 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
Integer examWordsJudgeResultDOId = examWordsJudgeResultDO.getId();
|
||||
if (studentExamId == null) {
|
||||
log.info("未找到学生 id 和考试 id");
|
||||
examWordsJudgeResultDOMapper.updateMsg(examWordsJudgeResultDOId, "未识别学生 id 和考试 id");
|
||||
examWordsJudgeResultDOMapper.updateMsg(examWordsJudgeResultDOId, "未识别学生和考试");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -351,6 +350,11 @@ public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
return examWordsJudgeResultDOMapper.selectCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getExamUnfinishedCount() {
|
||||
return examWordsJudgeResultDOMapper.selectUnfinishedCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamWordsJudgeResultDO getExamWordsJudgeResultDOById(Integer id) {
|
||||
return examWordsJudgeResultDOMapper.selectDetailById(id);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class AutoJudgeExamWordsTask {
|
||||
|
||||
@Scheduled(fixedRate = 5000)
|
||||
public void autoJudgeExamWords() {
|
||||
if (examWordsJudgeService.getExamWordsJudgeResultCount() != 0) {
|
||||
if (examWordsJudgeService.getExamUnfinishedCount() != 0) {
|
||||
log.info("有试卷待检测,开始检测");
|
||||
examWordsJudgeService.judgeExamWords(5);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ mybatis:
|
||||
# MyBatis xml 配置文件路径
|
||||
mapper-locations: classpath:/mapper/**/*.xml
|
||||
|
||||
|
||||
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
@@ -27,3 +28,6 @@ sa-token:
|
||||
is-share: true
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
logging:
|
||||
level:
|
||||
com.yinlihupo.enlish.service.domain.mapper: debug
|
||||
@@ -61,7 +61,6 @@
|
||||
<select id="selectCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from exam_words_judge_result
|
||||
where is_finished = 0
|
||||
</select>
|
||||
|
||||
<select id="selectDetailById" resultMap="ResultMapWithBLOBs">
|
||||
@@ -95,4 +94,10 @@
|
||||
limit #{startIndex}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectUnfinishedCount" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from exam_words_judge_result
|
||||
where is_finished = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -5,6 +5,7 @@ import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsDO;
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO;
|
||||
import com.yinlihupo.enlish.service.domain.mapper.ExamWordsJudgeResultDOMapper;
|
||||
import com.yinlihupo.enlish.service.model.bo.Word;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsService;
|
||||
import com.yinlihupo.enlish.service.service.VocabularyService;
|
||||
@@ -24,6 +25,8 @@ public class ExamTest {
|
||||
private ExamWordsService examWordsService;
|
||||
@Resource
|
||||
private VocabularyService vocabularyService;
|
||||
@Resource
|
||||
private ExamWordsJudgeResultDOMapper examWordsJudgeResultDOMapper;
|
||||
@Test
|
||||
public void test() {
|
||||
// ExamWordsDO examWordsDO = examWordsService.generateExamWords(5, 0);
|
||||
|
||||
@@ -54,6 +54,11 @@ public class ExamWordsJudgeServiceTest {
|
||||
// }
|
||||
}
|
||||
|
||||
@Test
|
||||
public void judege() {
|
||||
examWordsJudgeService.judgeExamWords(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectExamWordsJudgeResult() {
|
||||
// List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(1, 10);
|
||||
|
||||
@@ -43,10 +43,8 @@
|
||||
<div class="text-lg font-semibold mb-4">学生查询</div>
|
||||
<div class="flex flex-wrap items-center gap-3 mb-4">
|
||||
<el-input v-model="studentName" placeholder="按姓名查询" clearable style="max-width: 220px" />
|
||||
<el-tag v-if="selectedClassId" effect="plain">班级:{{ selectedClassTitle }} (ID: {{
|
||||
selectedClassId }})</el-tag>
|
||||
<el-tag v-if="selectedGradeId" effect="plain">年级:{{ selectedGradeTitle }} (ID: {{
|
||||
selectedGradeId }})</el-tag>
|
||||
<el-tag v-if="selectedClassId" effect="plain">班级:{{ selectedClassTitle }}</el-tag>
|
||||
<el-tag v-if="selectedGradeId" effect="plain">年级:{{ selectedGradeTitle }}</el-tag>
|
||||
<el-button type="primary" @click="fetchStudents">查询</el-button>
|
||||
<el-button @click="resetStudentFilters">重置</el-button>
|
||||
<el-button type="success" :disabled="selectedStudentIds.length !== 1"
|
||||
|
||||
Reference in New Issue
Block a user