浏览代码

考试次数在开考加一

xiatian 4 年之前
父节点
当前提交
3ccb36a982

+ 10 - 8
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -364,13 +364,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
 //            throw new BusinessException("试卷答案未上传:" + paperId);
 //            throw new BusinessException("试卷答案未上传:" + paperId);
 //        }
 //        }
 
 
-        // 写入次数
-        Integer alreadyExamCount = es.getAlreadyExamCount() + 1;
-
         Long recordId = toeExamRecordService.saveByPrepare(es.getExamId(), es.getExamActivityId(), examStudentId,
         Long recordId = toeExamRecordService.saveByPrepare(es.getExamId(), es.getExamActivityId(), examStudentId,
-                paperId, alreadyExamCount);
-
-        es.setAlreadyExamCount(alreadyExamCount);
+                paperId, es.getAlreadyExamCount()+1);
 
 
         es.setCurrentRecordId(recordId);
         es.setCurrentRecordId(recordId);
 
 
@@ -399,7 +394,6 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) redisUtil.getStudent(studentId);
         TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) redisUtil.getStudent(studentId);
 //        MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.STUDENT.name(), SystemOperationEnum.FIRST_PREPARE, MqTagEnum.STUDENT, String.valueOf(teStudentCacheDto.getId()), teStudentCacheDto.getIdentity());
 //        MqDto mqDto = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.STUDENT.name(), SystemOperationEnum.FIRST_PREPARE, MqTagEnum.STUDENT, String.valueOf(teStudentCacheDto.getId()), teStudentCacheDto.getIdentity());
 //        this.sendOeLogMessage(SystemOperationEnum.FIRST_PREPARE, examStudentId, recordId, mqDto);
 //        this.sendOeLogMessage(SystemOperationEnum.FIRST_PREPARE, examStudentId, recordId, mqDto);
-        updateExamStudent(examStudentId, alreadyExamCount, recordId);
         //mq发送消息end
         //mq发送消息end
         return prepare;
         return prepare;
     }
     }
@@ -541,10 +535,18 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                 finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
                 finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
             }
             }
         }
         }
+
         ret = new ExamStartBean();
         ret = new ExamStartBean();
         ret.setPaperDecryptSecret(ep.getDecryptSecret());
         ret.setPaperDecryptSecret(ep.getDecryptSecret());
         ret.setPaperDecryptVector(ep.getDecryptVector());
         ret.setPaperDecryptVector(ep.getDecryptVector());
 
 
+        if (!ExamRecordStatusEnum.RESUME_PREPARE.equals(sta)) {//非断点进入的
+	        // 写入次数
+	        es.setAlreadyExamCount(es.getAlreadyExamCount()+1);
+	        // 更新考生缓存
+	        redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
+	        updateExamStudent(examStudentId, es.getAlreadyExamCount(), recordId);
+        }
         // 更新考试记录缓存
         // 更新考试记录缓存
         Long firstStartTime = System.currentTimeMillis();
         Long firstStartTime = System.currentTimeMillis();
         ExamRecordCacheUtil.setFirstStartTime(recordId, firstStartTime, false);
         ExamRecordCacheUtil.setFirstStartTime(recordId, firstStartTime, false);
@@ -556,7 +558,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         toeExamRecordService.dataUpdatesMq(recordId, columns, values);
         toeExamRecordService.dataUpdatesMq(recordId, columns, values);
         //更新场次-考试记录缓存
         //更新场次-考试记录缓存
         ExamActivityRecordCacheUtil.setExamRecordStatus(activityId, recordId, new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId), ExamRecordCacheUtil.getStatus(recordId)));
         ExamActivityRecordCacheUtil.setExamRecordStatus(activityId, recordId, new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId), ExamRecordCacheUtil.getStatus(recordId)));
-
+        
         //非强制交卷,换算最终交卷时间并生成一次性延时任务
         //非强制交卷,换算最终交卷时间并生成一次性延时任务
         if (Objects.nonNull(exam.getForceFinish()) && exam.getForceFinish().intValue() == 0) {
         if (Objects.nonNull(exam.getForceFinish()) && exam.getForceFinish().intValue() == 0) {
             Long date = ExamRecordCacheUtil.getExamFinalFinishTime(recordId);
             Long date = ExamRecordCacheUtil.getExamFinalFinishTime(recordId);