|
@@ -1,110 +1,110 @@
|
|
|
-package com.qmth.themis.task.quartz;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
-import com.qmth.themis.business.constant.SystemConstant;
|
|
|
-import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
|
|
|
-import com.qmth.themis.business.entity.TEExamStudent;
|
|
|
-import com.qmth.themis.business.entity.TOeExamRecord;
|
|
|
-import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
-import com.qmth.themis.business.service.CacheService;
|
|
|
-import com.qmth.themis.business.service.CommonService;
|
|
|
-import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
-import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
-import org.quartz.JobExecutionContext;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.scheduling.quartz.QuartzJobBean;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description: repair job
|
|
|
- * @Param:
|
|
|
- * @return:
|
|
|
- * @Author: wangliang
|
|
|
- * @Date: 2022/11/1
|
|
|
- */
|
|
|
-public class RepairJob extends QuartzJobBean {
|
|
|
- private final static Logger log = LoggerFactory.getLogger(RepairJob.class);
|
|
|
-
|
|
|
- @Resource
|
|
|
- TOeExamRecordService tOeExamRecordService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TEExamStudentService teExamStudentService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- CommonService commonService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- CacheService cacheService;
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void executeInternal(JobExecutionContext context) {
|
|
|
- log.info("repairJob进来了,context:{}", context);
|
|
|
- this.persistedJob();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 持久化补救
|
|
|
- */
|
|
|
- public void persistedJob() {
|
|
|
- log.info("persistedJob进来了");
|
|
|
- QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
|
- tOeExamRecordQueryWrapper.lambda().isNotNull(TOeExamRecord::getFirstStartTime)
|
|
|
- .isNotNull(TOeExamRecord::getFinishTime)
|
|
|
- .eq(TOeExamRecord::getStatus, ExamRecordStatusEnum.FINISHED);
|
|
|
- List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
|
- if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
|
- for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
- if ((System.currentTimeMillis() - t.getFinishTime().longValue()) / 1000 / 60 >= 30) {//超过30分钟则改状态
|
|
|
- try {
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(t.getExamStudentId());
|
|
|
- TEStudentCacheDto teStudent = cacheService.addStudentAccountCache(examStudentCacheBean.getStudentId());
|
|
|
- commonService.persisted(t.getId(), teStudent.getId());
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- this.answerJob();
|
|
|
- this.examStudentExamCountJob();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 答案补救
|
|
|
- */
|
|
|
- public void answerJob() {
|
|
|
- log.info("answerJob进来了");
|
|
|
- List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.persistedAnswerBatch(null, null, null);
|
|
|
- if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
|
- for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
- try {
|
|
|
- if ((System.currentTimeMillis() - t.getFinishTime().longValue()) / 1000 / 60 >= 30) {//超过30分钟则改状态
|
|
|
- tOeExamRecordService.saveDataByCachePersistedAnswer(t.getId());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新考生缓存
|
|
|
- */
|
|
|
- public void examStudentExamCountJob() {
|
|
|
- log.info("examStudentExamCountJob进来了");
|
|
|
- List<TEExamStudent> teExamStudentList = teExamStudentService.findAlreadyExamCountZero(null, null, null, null);
|
|
|
- if (!CollectionUtils.isEmpty(teExamStudentList)) {
|
|
|
- for (TEExamStudent t : teExamStudentList) {
|
|
|
- try {
|
|
|
- teExamStudentService.updateExamStudentByCache(t.getId());
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+//package com.qmth.themis.task.quartz;
|
|
|
+//
|
|
|
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+//import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
+//import com.qmth.themis.business.constant.SystemConstant;
|
|
|
+//import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
|
|
|
+//import com.qmth.themis.business.entity.TEExamStudent;
|
|
|
+//import com.qmth.themis.business.entity.TOeExamRecord;
|
|
|
+//import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
+//import com.qmth.themis.business.service.CacheService;
|
|
|
+//import com.qmth.themis.business.service.CommonService;
|
|
|
+//import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
+//import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
+//import org.quartz.JobExecutionContext;
|
|
|
+//import org.slf4j.Logger;
|
|
|
+//import org.slf4j.LoggerFactory;
|
|
|
+//import org.springframework.scheduling.quartz.QuartzJobBean;
|
|
|
+//import org.springframework.util.CollectionUtils;
|
|
|
+//
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//import java.util.List;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * @Description: repair job
|
|
|
+// * @Param:
|
|
|
+// * @return:
|
|
|
+// * @Author: wangliang
|
|
|
+// * @Date: 2022/11/1
|
|
|
+// */
|
|
|
+//public class RepairJob extends QuartzJobBean {
|
|
|
+// private final static Logger log = LoggerFactory.getLogger(RepairJob.class);
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// TOeExamRecordService tOeExamRecordService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// TEExamStudentService teExamStudentService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// CommonService commonService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// CacheService cacheService;
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// protected void executeInternal(JobExecutionContext context) {
|
|
|
+// log.info("repairJob进来了,context:{}", context);
|
|
|
+// this.persistedJob();
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 持久化补救
|
|
|
+// */
|
|
|
+// public void persistedJob() {
|
|
|
+// log.info("persistedJob进来了");
|
|
|
+// QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
|
+// tOeExamRecordQueryWrapper.lambda().isNotNull(TOeExamRecord::getFirstStartTime)
|
|
|
+// .isNotNull(TOeExamRecord::getFinishTime)
|
|
|
+// .eq(TOeExamRecord::getStatus, ExamRecordStatusEnum.FINISHED);
|
|
|
+// List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
|
+// if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
|
+// for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
+// if ((System.currentTimeMillis() - t.getFinishTime().longValue()) / 1000 / 60 >= 30) {//超过30分钟则改状态
|
|
|
+// try {
|
|
|
+// ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(t.getExamStudentId());
|
|
|
+// TEStudentCacheDto teStudent = cacheService.addStudentAccountCache(examStudentCacheBean.getStudentId());
|
|
|
+// commonService.persisted(t.getId(), teStudent.getId());
|
|
|
+// } catch (Exception e) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// this.answerJob();
|
|
|
+// this.examStudentExamCountJob();
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 答案补救
|
|
|
+// */
|
|
|
+// public void answerJob() {
|
|
|
+// log.info("answerJob进来了");
|
|
|
+// List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.persistedAnswerBatch(null, null, null);
|
|
|
+// if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
|
+// for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
+// try {
|
|
|
+// if ((System.currentTimeMillis() - t.getFinishTime().longValue()) / 1000 / 60 >= 30) {//超过30分钟则改状态
|
|
|
+// tOeExamRecordService.saveDataByCachePersistedAnswer(t.getId());
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 更新考生缓存
|
|
|
+// */
|
|
|
+// public void examStudentExamCountJob() {
|
|
|
+// log.info("examStudentExamCountJob进来了");
|
|
|
+// List<TEExamStudent> teExamStudentList = teExamStudentService.findAlreadyExamCountZero(null, null, null, null);
|
|
|
+// if (!CollectionUtils.isEmpty(teExamStudentList)) {
|
|
|
+// for (TEExamStudent t : teExamStudentList) {
|
|
|
+// try {
|
|
|
+// teExamStudentService.updateExamStudentByCache(t.getId());
|
|
|
+// } catch (Exception e) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|