【修改】监控管理增加临时id

This commit is contained in:
huababa1
2025-08-18 11:11:05 +08:00
parent 015e5ab084
commit 86d96a162f
2 changed files with 13 additions and 3 deletions

View File

@@ -8,4 +8,5 @@ import lombok.Data;
public class StuMonitorPaperEndVo {
private String stuId;
private String paperId;
private String temporaryId;
}

View File

@@ -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<StuScoreVo> 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()); // 保留旧成绩