|
@@ -60,20 +60,38 @@ public class QuartzLogicServiceImpl implements QuartzLogicService {
|
|
TEExamActivity teExamActivity = teExamActivityService.getOne(teExamActivityQueryWrapper);
|
|
TEExamActivity teExamActivity = teExamActivityService.getOne(teExamActivityQueryWrapper);
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamActivity.getExamId());
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamActivity.getExamId());
|
|
if (Objects.nonNull(examCacheBean) && examCacheBean.getEnable() == 1 && Objects.nonNull(teExamActivity) && teExamActivity.getEnable() == 1) {
|
|
if (Objects.nonNull(examCacheBean) && examCacheBean.getEnable() == 1 && Objects.nonNull(teExamActivity) && teExamActivity.getEnable() == 1) {
|
|
|
|
+ Integer forceFinish = examCacheBean.getForceFinish();
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examActivityRecordCacheKey(teExamActivity.getId()));
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examActivityRecordCacheKey(teExamActivity.getId()));
|
|
- if (Objects.nonNull(objectMap) && objectMap.size() > 0) {
|
|
|
|
- objectMap.forEach((k, v) -> {
|
|
|
|
- ExamRecordStatusEnum examRecordStatusEnum = (ExamRecordStatusEnum) v;
|
|
|
|
- //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
- if (Objects.nonNull(examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)) {
|
|
|
|
- Long recordId = Long.parseLong(k);
|
|
|
|
- Integer durationSeconds = ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
|
- Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
- //交卷
|
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), Long.parseLong(k), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ if (Objects.nonNull(forceFinish) && forceFinish.intValue() == 1) {//强制收卷
|
|
|
|
+ if (Objects.nonNull(objectMap) && objectMap.size() > 0) {
|
|
|
|
+ objectMap.forEach((k, v) -> {
|
|
|
|
+ ExamRecordStatusEnum examRecordStatusEnum = (ExamRecordStatusEnum) v;
|
|
|
|
+ //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)) {
|
|
|
|
+ Long recordId = Long.parseLong(k);
|
|
|
|
+ Integer durationSeconds = ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
|
+ Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
+ //交卷
|
|
|
|
+ teExamService.finish(examStudentCacheBean.getStudentId(), Long.parseLong(k), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (Objects.nonNull(objectMap) && objectMap.size() > 0) {
|
|
|
|
+ objectMap.forEach((k, v) -> {
|
|
|
|
+ ExamRecordStatusEnum examRecordStatusEnum = (ExamRecordStatusEnum) v;
|
|
|
|
+ //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.ANSWERING, examRecordStatusEnum)) {
|
|
|
|
+ Long recordId = Long.parseLong(k);
|
|
|
|
+ Integer durationSeconds = ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
|
+ Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
+ //交卷
|
|
|
|
+ teExamService.finish(examStudentCacheBean.getStudentId(), Long.parseLong(k), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|