Accept Merge Request #149: (hyc -> master)
Merge Request: 【修改】监控管理增加临时id Created By: @华允传 Accepted By: @华允传 URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/149?initial=true
This commit is contained in:
@@ -8,4 +8,5 @@ import lombok.Data;
|
|||||||
public class StuMonitorPaperEndVo {
|
public class StuMonitorPaperEndVo {
|
||||||
private String stuId;
|
private String stuId;
|
||||||
private String paperId;
|
private String paperId;
|
||||||
|
private String temporaryId;
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@ import jakarta.annotation.Resource;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
import java.time.LocalDateTime;
|
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.paper.*;
|
||||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
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.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.exam.service.monitor.vo.*;
|
||||||
//import pc.exam.pp.module.infra.service.file.FileService;
|
//import pc.exam.pp.module.infra.service.file.FileService;
|
||||||
|
|
||||||
@@ -70,7 +73,8 @@ public class MonitorServiceImpl implements MonitorService {
|
|||||||
private EducationPaperSchemeMapper educationPaperSchemeMapper;
|
private EducationPaperSchemeMapper educationPaperSchemeMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ExamSpecialtyMapper examSpecialtyMapper;
|
private ExamSpecialtyMapper examSpecialtyMapper;
|
||||||
|
@Resource
|
||||||
|
private StuPaperScoreMapper stuPaperScoreMapper;
|
||||||
|
|
||||||
// @Resource
|
// @Resource
|
||||||
// private FileService fileService;
|
// private FileService fileService;
|
||||||
@@ -357,7 +361,12 @@ public class MonitorServiceImpl implements MonitorService {
|
|||||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperEndVo.getPaperId());
|
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperEndVo.getPaperId());
|
||||||
String taskId = educationPaper.getTaskId();
|
String taskId = educationPaper.getTaskId();
|
||||||
String key = "userCache:" + taskId + ":" + stuMonitorPaperEndVo.getStuId();
|
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);
|
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key), MonitorDO.class);
|
||||||
info.setRemainingTime(0L);
|
info.setRemainingTime(0L);
|
||||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
||||||
@@ -370,7 +379,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|||||||
if (StringUtils.isNotBlank(monitorDO.getScore())) {
|
if (StringUtils.isNotBlank(monitorDO.getScore())) {
|
||||||
try {
|
try {
|
||||||
double oldScore = Double.parseDouble(monitorDO.getScore());
|
double oldScore = Double.parseDouble(monitorDO.getScore());
|
||||||
if (score > oldScore) {
|
if (score.doubleValue()> oldScore) {
|
||||||
info.setScore(String.valueOf(score));
|
info.setScore(String.valueOf(score));
|
||||||
} else {
|
} else {
|
||||||
info.setScore(monitorDO.getScore()); // 保留旧成绩
|
info.setScore(monitorDO.getScore()); // 保留旧成绩
|
||||||
|
Reference in New Issue
Block a user