From 86d96a162f19fcc4727da5e00dfc93f86b80b0fc Mon Sep 17 00:00:00 2001 From: huababa1 <2037205722@qq.com> Date: Mon, 18 Aug 2025 11:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E7=AE=A1=E7=90=86=E5=A2=9E=E5=8A=A0=E4=B8=B4=E6=97=B6?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/monitor/vo/StuMonitorPaperEndVo.java | 1 + .../exam/service/monitor/MonitorServiceImpl.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) 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()); // 保留旧成绩