|
@@ -163,6 +163,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
public List<TEExamDto> getWaitingExam(Long studentId, Long examId, Long orgId) {
|
|
public List<TEExamDto> getWaitingExam(Long studentId, Long examId, Long orgId) {
|
|
List<TEExamDto> list = teExamMapper.getWaitingExam(studentId, examId, orgId);
|
|
List<TEExamDto> list = teExamMapper.getWaitingExam(studentId, examId, orgId);
|
|
if (Objects.nonNull(list) && list.size() > 0) {
|
|
if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
|
+ ExamCacheBean examCache=getExamCacheBean(examId);
|
|
list.forEach(s -> {
|
|
list.forEach(s -> {
|
|
List<TEExamActivityDto> teExamActivityList = teExamActivityService.getWaitingExam(studentId, s.getId(), s.getExamActivityId(), s.getMode());
|
|
List<TEExamActivityDto> teExamActivityList = teExamActivityService.getWaitingExam(studentId, s.getId(), s.getExamActivityId(), s.getMode());
|
|
teExamActivityList.forEach(v -> {
|
|
teExamActivityList.forEach(v -> {
|
|
@@ -203,7 +204,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
v.setMonitorVideoSource(null);
|
|
v.setMonitorVideoSource(null);
|
|
}
|
|
}
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(v.getExamStudentId());
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(v.getExamStudentId());
|
|
- v.setLeftExamCount(examStudentCacheBean.getLeftExamCount());
|
|
|
|
|
|
+ v.setLeftExamCount(examCache.getExamCount()-examStudentCacheBean.getAlreadyExamCount());
|
|
});
|
|
});
|
|
s.setActivities(teExamActivityList);
|
|
s.setActivities(teExamActivityList);
|
|
});
|
|
});
|
|
@@ -226,6 +227,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考生Id和当前登录用户不一致");
|
|
throw new BusinessException("考生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
|
|
+ ExamCacheBean examCache=getExamCacheBean(es.getExamId());
|
|
TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) redisUtil.getStudent(es.getStudentId());
|
|
TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) redisUtil.getStudent(es.getStudentId());
|
|
if (teStudentCacheDto.getUnFinishedRecordId() != null) {
|
|
if (teStudentCacheDto.getUnFinishedRecordId() != null) {
|
|
Long recordId = teStudentCacheDto.getUnFinishedRecordId();
|
|
Long recordId = teStudentCacheDto.getUnFinishedRecordId();
|
|
@@ -250,7 +252,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
return prepare;
|
|
return prepare;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (es.getLeftExamCount() == 0) {
|
|
|
|
|
|
+ if (examCache.getExamCount().intValue()<=es.getAlreadyExamCount().intValue()) {
|
|
throw new BusinessException("没有剩余考试次数");
|
|
throw new BusinessException("没有剩余考试次数");
|
|
}
|
|
}
|
|
ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
ExamCacheBean exam = getExamCacheBean(es.getExamId());
|
|
@@ -310,8 +312,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
Long recordId = toeExamRecordService.saveByPrepare(es.getExamId(), es.getExamActivityId(), examStudentId,
|
|
Long recordId = toeExamRecordService.saveByPrepare(es.getExamId(), es.getExamActivityId(), examStudentId,
|
|
paperId, es.getCurrentSerialNumber());
|
|
paperId, es.getCurrentSerialNumber());
|
|
|
|
|
|
- Integer leftExamCount = es.getLeftExamCount();
|
|
|
|
- es.setLeftExamCount(leftExamCount - 1);
|
|
|
|
|
|
+ Integer alreadyExamCount = es.getAlreadyExamCount();
|
|
|
|
+ es.setAlreadyExamCount(alreadyExamCount + 1);
|
|
|
|
|
|
es.setCurrentRecordId(recordId);
|
|
es.setCurrentRecordId(recordId);
|
|
|
|
|
|
@@ -332,14 +334,12 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
|
|
prepare.setMonitorUserSig(tencentYunUtil.getSign(prepare.getMonitorUserId(), SystemConstant.TENCENT_EXPIRE_TIME));
|
|
|
|
|
|
|
|
|
|
- Integer breakResumeCount = exam.getBreakResumeCount();
|
|
|
|
// 更新考生缓存
|
|
// 更新考生缓存
|
|
redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
|
|
redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
|
|
//更新场次-考试记录缓存
|
|
//更新场次-考试记录缓存
|
|
ExamActivityRecordCacheUtil.setExamRecordStatus(activityId, recordId, ExamRecordCacheUtil.getStatus(recordId));
|
|
ExamActivityRecordCacheUtil.setExamRecordStatus(activityId, recordId, ExamRecordCacheUtil.getStatus(recordId));
|
|
teStudentCacheDto.setUnFinishedRecordId(recordId);
|
|
teStudentCacheDto.setUnFinishedRecordId(recordId);
|
|
redisUtil.setStudent(studentId, teStudentCacheDto);
|
|
redisUtil.setStudent(studentId, teStudentCacheDto);
|
|
- ExamRecordCacheUtil.setLeftBreakResumeCount(recordId, breakResumeCount);
|
|
|
|
//mq发送消息start
|
|
//mq发送消息start
|
|
MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.STUDENT.name(), SystemOperationEnum.PREPARE, MqTagEnum.STUDENT, String.valueOf(teStudentCacheDto.getId()), teStudentCacheDto.getIdentity());
|
|
MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.STUDENT.name(), SystemOperationEnum.PREPARE, MqTagEnum.STUDENT, String.valueOf(teStudentCacheDto.getId()), teStudentCacheDto.getIdentity());
|
|
this.sendOeLogMessage(SystemOperationEnum.PREPARE, examStudentId, recordId, mqDto);
|
|
this.sendOeLogMessage(SystemOperationEnum.PREPARE, examStudentId, recordId, mqDto);
|