|
@@ -6,10 +6,12 @@ import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
import com.qmth.themis.business.bean.exam.ExamActivityUnFinishBean;
|
|
|
import com.qmth.themis.business.bean.exam.ExamUnFinishBean;
|
|
|
-import com.qmth.themis.business.cache.ExamActivityRecordCacheUtil;
|
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
import com.qmth.themis.business.cache.ExamingDataCacheUtil;
|
|
|
-import com.qmth.themis.business.cache.bean.*;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
@@ -252,52 +254,20 @@ public class TEStudentController {
|
|
|
Integer leftBreakResumeCount = ec.getBreakResumeCount() - alreadyBreakCount;
|
|
|
//如果断点时间大于整体断点时间,则强制交卷
|
|
|
if (Objects.equals(status, ExamRecordStatusEnum.ANSWERING) || Objects.equals(status, ExamRecordStatusEnum.BREAK_OFF) || Objects.equals(status, ExamRecordStatusEnum.RESUME_PREPARE)) {
|
|
|
- if (Objects.nonNull(lastBreakTime) && (System.currentTimeMillis() - lastBreakTime) / 1000 > breakExpireSeconds) {
|
|
|
- teExamService.finish(teStudentCacheDto.getId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
- List<TEExamDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, orgId);
|
|
|
- if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
- map.put("waiting", list);
|
|
|
- }
|
|
|
+ Boolean finished = tOeExamRecordService.sendExamBreakMsg(recordId, false);
|
|
|
+ if (finished) {
|
|
|
+ map = this.getWaitList(teStudent.getId(), examId, orgId, map);
|
|
|
} else {
|
|
|
- //如果断点次数小于0,也强制交卷
|
|
|
- if (leftBreakResumeCount <= 0) {
|
|
|
- teExamService.finish(teStudentCacheDto.getId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
- List<TEExamDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, orgId);
|
|
|
- if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
- map.put("waiting", list);
|
|
|
- }
|
|
|
- } else {
|
|
|
- //只有ANSWERING状态才生成断点
|
|
|
- if (Objects.equals(status, ExamRecordStatusEnum.ANSWERING)) {
|
|
|
- alreadyBreakCount++;
|
|
|
- Long breakId = Constants.idGen.next();
|
|
|
- ExamRecordCacheUtil.setLastBreakId(recordId, breakId, false);
|
|
|
- ExamRecordCacheUtil.setStatus(recordId, ExamRecordStatusEnum.BREAK_OFF, false);
|
|
|
- Long lastBreakTimeNow = System.currentTimeMillis();
|
|
|
- ExamRecordCacheUtil.setLastBreakTime(recordId, lastBreakTimeNow, false);
|
|
|
- ExamRecordCacheUtil.setAlreadyBreakCount(recordId, alreadyBreakCount, false);
|
|
|
- Long lastStartTime = System.currentTimeMillis();
|
|
|
- ExamRecordCacheUtil.setLastStartTime(recordId, lastStartTime, false);
|
|
|
- String[] columns = new String[]{ExamRecordFieldEnum.last_break_id.name(), ExamRecordFieldEnum.status.name(), ExamRecordFieldEnum.last_break_time.name(), ExamRecordFieldEnum.already_break_count.name(), ExamRecordFieldEnum.last_start_time.name()};
|
|
|
- Object[] values = new Object[]{breakId, ExamRecordStatusEnum.BREAK_OFF, lastBreakTimeNow, alreadyBreakCount, lastStartTime};
|
|
|
- tOeExamRecordService.dataUpdatesMq(recordId, columns, values);
|
|
|
- ExamConstant.sendExamStopMsg(recordId, true);
|
|
|
- //考试断点异常原因 发送mq start
|
|
|
- MqDto mqDtoBreak = new MqDto(MqTopicEnum.THEMIS_TOPIC.getCode(), MqTagEnum.EXAM_BREAK.name(), ExceptionEnum.NET_TIME_OUT, MqTagEnum.EXAM_BREAK, String.valueOf(recordId), String.valueOf(recordId));
|
|
|
- mqDtoService.assembleSendOneWayMsg(mqDtoBreak);
|
|
|
- //考试断点异常原因 发送mq end
|
|
|
- //更新场次-考试记录缓存
|
|
|
- ExamActivityRecordCacheUtil.setExamRecordStatus(examActivityId, recordId, new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId), ExamRecordCacheUtil.getStatus(recordId)));
|
|
|
- }
|
|
|
- ExamUnFinishBean examUnFinishBean = this.unFinishCommon(recordId, ec, examStudentCacheBean, examActivityCacheBean, examStudentId);
|
|
|
- map.put("unFinished", examUnFinishBean);
|
|
|
+ //只有ANSWERING状态才生成断点
|
|
|
+ if (Objects.equals(status, ExamRecordStatusEnum.ANSWERING)) {
|
|
|
+ ExamConstant.sendExamStopMsg(recordId, true);
|
|
|
+ tOeExamRecordService.setExamBreak(alreadyBreakCount, recordId, examActivityId);
|
|
|
}
|
|
|
+ ExamUnFinishBean examUnFinishBean = this.unFinishCommon(recordId, ec, examStudentCacheBean, examActivityCacheBean, examStudentId);
|
|
|
+ map.put("unFinished", examUnFinishBean);
|
|
|
}
|
|
|
} else {
|
|
|
- List<TEExamDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, orgId);
|
|
|
- if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
- map.put("waiting", list);
|
|
|
- }
|
|
|
+ map = this.getWaitList(teStudent.getId(), examId, orgId, map);
|
|
|
}
|
|
|
}
|
|
|
//获取全局考试配置
|
|
@@ -365,4 +335,21 @@ public class TEStudentController {
|
|
|
examActivityUnFinishBean.setRecordId(recordId);
|
|
|
return new ExamUnFinishBean(ec.getId(), ec.getName(), ec.getPreNotice(), ec.getPreNoticeStaySeconds(), ec.getPostNotice(), examActivityUnFinishBean);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取待考列表
|
|
|
+ *
|
|
|
+ * @param studentId
|
|
|
+ * @param examId
|
|
|
+ * @param orgId
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String, Object> getWaitList(Long studentId, Long examId, Long orgId, Map<String, Object> map) {
|
|
|
+ List<TEExamDto> list = teExamService.getWaitingExam(studentId, examId, orgId);
|
|
|
+ if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
+ map.put("waiting", list);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|