|
@@ -12,6 +12,7 @@ import org.quartz.JobExecutionContext;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -72,44 +73,48 @@ public class MqActivityJob extends QuartzJobBean {
|
|
List<TOeExamRecord> examRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
List<TOeExamRecord> examRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
Integer forceFinish = exam.getForceFinish();
|
|
Integer forceFinish = exam.getForceFinish();
|
|
if (Objects.nonNull(forceFinish) && forceFinish.intValue() == 1) {//强制收卷
|
|
if (Objects.nonNull(forceFinish) && forceFinish.intValue() == 1) {//强制收卷
|
|
- examRecordList.forEach(s -> {
|
|
|
|
- ExamRecordStatusEnum examRecordStatusEnum = s.getStatus();
|
|
|
|
- //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
- if (Objects.nonNull(examRecordStatusEnum)
|
|
|
|
- && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)
|
|
|
|
- && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)) {
|
|
|
|
- Integer durationSeconds = s.getDurationSeconds();
|
|
|
|
- Long examStudentId = s.getExamStudentId();
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
- //候考阶段且没有进入考试则不交卷
|
|
|
|
- if (examRecordStatusEnum == ExamRecordStatusEnum.FIRST_PREPARE && Objects.isNull(s.getFirstStartTime())) {
|
|
|
|
- commonService.deleteExamStudentCache(s.getId(), examStudentCacheBean.getStudentId());
|
|
|
|
- commonService.DismissRoomByStrRoomId(s.getId());
|
|
|
|
- } else {//交卷
|
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), s.getId(), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(examRecordList)) {
|
|
|
|
+ examRecordList.forEach(s -> {
|
|
|
|
+ ExamRecordStatusEnum examRecordStatusEnum = s.getStatus();
|
|
|
|
+ //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum)
|
|
|
|
+ && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)
|
|
|
|
+ && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)) {
|
|
|
|
+ Integer durationSeconds = s.getDurationSeconds();
|
|
|
|
+ Long examStudentId = s.getExamStudentId();
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
+ //候考阶段且没有进入考试则不交卷
|
|
|
|
+ if (examRecordStatusEnum == ExamRecordStatusEnum.FIRST_PREPARE && Objects.isNull(s.getFirstStartTime())) {
|
|
|
|
+ commonService.deleteExamStudentCache(s.getId(), examStudentCacheBean.getStudentId());
|
|
|
|
+ commonService.DismissRoomByStrRoomId(s.getId());
|
|
|
|
+ } else {//交卷
|
|
|
|
+ teExamService.finish(examStudentCacheBean.getStudentId(), s.getId(), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- examRecordList.forEach(s -> {
|
|
|
|
- ExamRecordStatusEnum examRecordStatusEnum = s.getStatus();
|
|
|
|
- //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
- if (Objects.nonNull(examRecordStatusEnum)
|
|
|
|
- && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)
|
|
|
|
- && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)
|
|
|
|
- && !Objects.equals(ExamRecordStatusEnum.ANSWERING, examRecordStatusEnum)) {
|
|
|
|
- Integer durationSeconds = s.getDurationSeconds();
|
|
|
|
- Long examStudentId = s.getExamStudentId();
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
- //候考阶段且没有进入考试则不交卷
|
|
|
|
- if (examRecordStatusEnum == ExamRecordStatusEnum.FIRST_PREPARE && Objects.isNull(s.getFirstStartTime())) {
|
|
|
|
- commonService.deleteExamStudentCache(s.getId(), examStudentCacheBean.getStudentId());
|
|
|
|
- commonService.DismissRoomByStrRoomId(s.getId());
|
|
|
|
- } else {//交卷
|
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), s.getId(), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(examRecordList)) {
|
|
|
|
+ examRecordList.forEach(s -> {
|
|
|
|
+ ExamRecordStatusEnum examRecordStatusEnum = s.getStatus();
|
|
|
|
+ //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum)
|
|
|
|
+ && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum)
|
|
|
|
+ && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)
|
|
|
|
+ && !Objects.equals(ExamRecordStatusEnum.ANSWERING, examRecordStatusEnum)) {
|
|
|
|
+ Integer durationSeconds = s.getDurationSeconds();
|
|
|
|
+ Long examStudentId = s.getExamStudentId();
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
|
+ //候考阶段且没有进入考试则不交卷
|
|
|
|
+ if (examRecordStatusEnum == ExamRecordStatusEnum.FIRST_PREPARE && Objects.isNull(s.getFirstStartTime())) {
|
|
|
|
+ commonService.deleteExamStudentCache(s.getId(), examStudentCacheBean.getStudentId());
|
|
|
|
+ commonService.DismissRoomByStrRoomId(s.getId());
|
|
|
|
+ } else {//交卷
|
|
|
|
+ teExamService.finish(examStudentCacheBean.getStudentId(), s.getId(), FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
exam.setScanTime(finishTime);
|
|
exam.setScanTime(finishTime);
|