|
@@ -9,13 +9,13 @@ import com.qmth.themis.business.enums.FinishExamTypeEnum;
|
|
import com.qmth.themis.business.service.TEExamActivityService;
|
|
import com.qmth.themis.business.service.TEExamActivityService;
|
|
import com.qmth.themis.business.service.TEExamStudentService;
|
|
import com.qmth.themis.business.service.TEExamStudentService;
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
-import com.qmth.themis.business.util.JacksonUtil;
|
|
|
|
-import org.quartz.*;
|
|
|
|
|
|
+import org.quartz.JobDetail;
|
|
|
|
+import org.quartz.JobExecutionContext;
|
|
|
|
+import org.quartz.JobExecutionException;
|
|
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.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
-import sun.net.idn.StringPrep;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -53,34 +53,38 @@ public class ExamActivityJob extends QuartzJobBean {
|
|
QueryWrapper<TEExamActivity> teExamActivityQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TEExamActivity> teExamActivityQueryWrapper = new QueryWrapper<>();
|
|
teExamActivityQueryWrapper.lambda().eq(TEExamActivity::getCode, strings[1]);
|
|
teExamActivityQueryWrapper.lambda().eq(TEExamActivity::getCode, strings[1]);
|
|
TEExamActivity teExamActivity = teExamActivityService.getOne(teExamActivityQueryWrapper);
|
|
TEExamActivity teExamActivity = teExamActivityService.getOne(teExamActivityQueryWrapper);
|
|
- log.info("key:{}", key);
|
|
|
|
|
|
+ if (Objects.nonNull(teExamActivity)) {
|
|
|
|
+ log.info("key:{}", key);
|
|
|
|
|
|
- //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
- QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
|
|
- tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamActivityId, teExamActivity.getId()).eq(TOeExamRecord::getStatus, ExamRecordStatusEnum.finished.ordinal());
|
|
|
|
- List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
|
|
- List<Long> examStudentIdList = new ArrayList<>();
|
|
|
|
- tOeExamRecordList.forEach(s -> {
|
|
|
|
- s.setStatus(ExamRecordStatusEnum.finished.ordinal());
|
|
|
|
- s.setFinishTime(new Date());
|
|
|
|
- s.setFinishType(FinishExamTypeEnum.must_finish.ordinal());
|
|
|
|
- examStudentIdList.add(s.getExamStudentId());
|
|
|
|
- });
|
|
|
|
- tOeExamRecordService.updateBatchById(tOeExamRecordList);
|
|
|
|
-
|
|
|
|
- if (examStudentIdList.size() > 0) {
|
|
|
|
- //获取该考试批次下所有考生,考试次数减1
|
|
|
|
- QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
|
- teExamStudentQueryWrapper.lambda().in(TEExamStudent::getId, examStudentIdList);
|
|
|
|
- List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
|
- teExamStudentList.forEach(s -> {
|
|
|
|
- int count = s.getLeftExamCount();
|
|
|
|
- count--;
|
|
|
|
- s.setLeftExamCount(count < 0 ? 0 : count);
|
|
|
|
|
|
+ //获取该考试批次下所有未交卷的考生的考试记录
|
|
|
|
+ QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamActivityId, teExamActivity.getId()).eq(TOeExamRecord::getStatus, ExamRecordStatusEnum.finished.ordinal());
|
|
|
|
+ List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
|
|
+ List<Long> examStudentIdList = new ArrayList<>();
|
|
|
|
+ tOeExamRecordList.forEach(s -> {
|
|
|
|
+ s.setStatus(ExamRecordStatusEnum.finished.ordinal());
|
|
|
|
+ s.setFinishTime(new Date());
|
|
|
|
+ s.setFinishType(FinishExamTypeEnum.must_finish.ordinal());
|
|
|
|
+ examStudentIdList.add(s.getExamStudentId());
|
|
});
|
|
});
|
|
- teExamStudentService.updateBatchById(teExamStudentList);
|
|
|
|
|
|
+ tOeExamRecordService.updateBatchById(tOeExamRecordList);
|
|
|
|
+
|
|
|
|
+ if (examStudentIdList.size() > 0) {
|
|
|
|
+ //获取该考试批次下所有考生,考试次数减1
|
|
|
|
+ QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ teExamStudentQueryWrapper.lambda().in(TEExamStudent::getId, examStudentIdList);
|
|
|
|
+ List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
|
+ teExamStudentList.forEach(s -> {
|
|
|
|
+ int count = s.getLeftExamCount();
|
|
|
|
+ count--;
|
|
|
|
+ s.setLeftExamCount(count < 0 ? 0 : count);
|
|
|
|
+ });
|
|
|
|
+ teExamStudentService.updateBatchById(teExamStudentList);
|
|
|
|
+ }
|
|
|
|
+ //todo 未完待续,需要加入交卷逻辑
|
|
|
|
+ } else {
|
|
|
|
+ log.info("考试场次:{}已删除", key);
|
|
}
|
|
}
|
|
- //todo 未完待续,需要加入交卷逻辑
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|