diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorPaperEndVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorPaperEndVo.java index 3cc45dd4..b7d98c3f 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorPaperEndVo.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorPaperEndVo.java @@ -8,4 +8,5 @@ import lombok.Data; public class StuMonitorPaperEndVo { private String stuId; private String paperId; + private String temporaryId; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java index 7adacb11..881de2ec 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java @@ -11,6 +11,7 @@ import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import java.io.IOException; +import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.sql.Time; import java.time.LocalDateTime; @@ -34,6 +35,8 @@ import pc.exam.pp.module.exam.dal.mysql.monitor.MonitorMapper; import pc.exam.pp.module.exam.dal.mysql.paper.*; import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper; import pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper; +import pc.exam.pp.module.exam.dal.mysql.student.StuPaperScoreMapper; +import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo; import pc.exam.pp.module.exam.service.monitor.vo.*; //import pc.exam.pp.module.infra.service.file.FileService; @@ -70,7 +73,8 @@ public class MonitorServiceImpl implements MonitorService { private EducationPaperSchemeMapper educationPaperSchemeMapper; @Resource private ExamSpecialtyMapper examSpecialtyMapper; - + @Resource + private StuPaperScoreMapper stuPaperScoreMapper; // @Resource // private FileService fileService; @@ -357,7 +361,12 @@ public class MonitorServiceImpl implements MonitorService { EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperEndVo.getPaperId()); String taskId = educationPaper.getTaskId(); String key = "userCache:" + taskId + ":" + stuMonitorPaperEndVo.getStuId(); - double score = educationPaperMapper.selctStuScoreByStuIdAndPaperId(stuMonitorPaperEndVo.getStuId(), stuMonitorPaperEndVo.getPaperId()); +// double score = educationPaperMapper.selctStuScoreByStuIdAndPaperId(stuMonitorPaperEndVo.getStuId(), stuMonitorPaperEndVo.getPaperId()); + BigDecimal score = new BigDecimal(0); + List stuScoreVos = stuPaperScoreMapper.getStuScore(Long.valueOf(stuMonitorPaperEndVo.getStuId()), stuMonitorPaperEndVo.getPaperId(), stuMonitorPaperEndVo.getTemporaryId()); + for (StuScoreVo scoreVo : stuScoreVos) { + score = score.add(scoreVo.getScore()); + } MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key), MonitorDO.class); info.setRemainingTime(0L); EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId); @@ -370,7 +379,7 @@ public class MonitorServiceImpl implements MonitorService { if (StringUtils.isNotBlank(monitorDO.getScore())) { try { double oldScore = Double.parseDouble(monitorDO.getScore()); - if (score > oldScore) { + if (score.doubleValue()> oldScore) { info.setScore(String.valueOf(score)); } else { info.setScore(monitorDO.getScore()); // 保留旧成绩