|
@@ -8,9 +8,11 @@ import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
import com.qmth.themis.business.enums.FinishTypeEnum;
|
|
|
import com.qmth.themis.business.enums.MqEnum;
|
|
|
import com.qmth.themis.business.service.TEExamActivityService;
|
|
|
+import com.qmth.themis.business.service.TEExamService;
|
|
|
import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
|
+import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.mq.dto.MqDto;
|
|
|
import com.qmth.themis.mq.enums.MqTagEnum;
|
|
|
import com.qmth.themis.mq.enums.MqTopicEnum;
|
|
@@ -47,8 +49,11 @@ public class QuartzLogicServiceImpl implements QuartzLogicService {
|
|
|
@Resource
|
|
|
TOeExamRecordService tOeExamRecordService;
|
|
|
|
|
|
+// @Resource
|
|
|
+// MqDtoService mqDtoService;
|
|
|
+
|
|
|
@Resource
|
|
|
- MqDtoService mqDtoService;
|
|
|
+ TEExamService teExamService;
|
|
|
|
|
|
/**
|
|
|
* 考试场次quartz逻辑
|
|
@@ -77,32 +82,33 @@ public class QuartzLogicServiceImpl implements QuartzLogicService {
|
|
|
tOeExamRecordList.forEach(s -> {
|
|
|
s.setStatus(ExamRecordStatusEnum.FINISHED);
|
|
|
s.setFinishTime(new Date());
|
|
|
- s.setFinishType(FinishTypeEnum.INTERRUPT);
|
|
|
+ s.setFinishType(FinishTypeEnum.AUTO);
|
|
|
finalExamStudentIdList.add(s.getExamStudentId());
|
|
|
+ //加入交卷逻辑
|
|
|
+ teExamService.finish(s.getExamStudentId(), s.getId(), FinishTypeEnum.AUTO.name(), s.getDurationSeconds() + 60);
|
|
|
});
|
|
|
tOeExamRecordService.updateBatchById(tOeExamRecordList);
|
|
|
|
|
|
- if (Objects.nonNull(examStudentIdList) && examStudentIdList.size() > 0) {
|
|
|
- //获取该考试批次下所有考生,考试次数减1
|
|
|
- QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
- teExamStudentQueryWrapper.lambda().in(TEExamStudent::getId, examStudentIdList);
|
|
|
- List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
- examStudentIdentityList = new ArrayList<>();
|
|
|
- List<String> finalExamStudentIdentityList = examStudentIdentityList;
|
|
|
- teExamStudentList.forEach(s -> {
|
|
|
- int count = Objects.isNull(s.getLeftExamCount()) ? 0 : s.getLeftExamCount();
|
|
|
- count--;
|
|
|
- s.setLeftExamCount(count < 0 ? 0 : count);
|
|
|
- finalExamStudentIdentityList.add(s.getIdentity());
|
|
|
- });
|
|
|
- //加入踢下线mq
|
|
|
- teExamStudentService.updateBatchById(teExamStudentList);
|
|
|
- MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.oe.name(), JacksonUtil.parseJson(finalExamStudentIdentityList), MqEnum.WEBSOCKET_OFFLINE_LOG, String.valueOf(teExamActivity.getId()), teExamActivity.getCode());
|
|
|
- //发送强行离线mq start
|
|
|
- mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
- //发送强行离线mq end
|
|
|
- }
|
|
|
- //todo 未完待续,需要加入交卷逻辑
|
|
|
+// if (Objects.nonNull(examStudentIdList) && examStudentIdList.size() > 0) {
|
|
|
+// //获取该考试批次下所有考生,考试次数减1
|
|
|
+// QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
+// teExamStudentQueryWrapper.lambda().in(TEExamStudent::getId, examStudentIdList);
|
|
|
+// List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
+// examStudentIdentityList = new ArrayList<>();
|
|
|
+// List<String> finalExamStudentIdentityList = examStudentIdentityList;
|
|
|
+// teExamStudentList.forEach(s -> {
|
|
|
+// int count = Objects.isNull(s.getLeftExamCount()) ? 0 : s.getLeftExamCount();
|
|
|
+// count--;
|
|
|
+// s.setLeftExamCount(count < 0 ? 0 : count);
|
|
|
+// finalExamStudentIdentityList.add(s.getIdentity());
|
|
|
+// });
|
|
|
+// //加入踢下线mq
|
|
|
+// teExamStudentService.updateBatchById(teExamStudentList);
|
|
|
+// MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.oe.name(), JacksonUtil.parseJson(finalExamStudentIdentityList), MqEnum.WEBSOCKET_OFFLINE_LOG, String.valueOf(teExamActivity.getId()), teExamActivity.getCode());
|
|
|
+// //发送强行离线mq start
|
|
|
+// mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
+// //发送强行离线mq end
|
|
|
+// }
|
|
|
} else {
|
|
|
log.info("考试场次:{}已删除", key);
|
|
|
}
|