|
@@ -0,0 +1,69 @@
|
|
|
+package cn.com.qmth.examcloud.task.service.job;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.OeStudentExamRecordCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.bean.HandInExamRecordBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.CleanHandInExamRecordReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetHandInExamRecordReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetHandInExamRecordResp;
|
|
|
+import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
|
+import cn.com.qmth.examcloud.web.task.AbstractTask;
|
|
|
+import cn.com.qmth.examcloud.web.task.ScheduleJob;
|
|
|
+import cn.com.qmth.examcloud.web.task.TaskTracker;
|
|
|
+import org.apache.commons.logging.Log;
|
|
|
+import org.apache.commons.logging.LogFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 处理已经交卷的数据
|
|
|
+ */
|
|
|
+@Component("oeCleanHandInExamRecordTask")
|
|
|
+public class OeCleanHandInExamRecordTask extends AbstractTask {
|
|
|
+
|
|
|
+ private static final Log log = LogFactory.getLog(OeCleanHandInExamRecordTask.class);
|
|
|
+ @Autowired
|
|
|
+ TaskTracker taskTracker;
|
|
|
+ @Autowired
|
|
|
+ private OeStudentExamRecordCloudService oeStudentExamRecordCloudService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run(ScheduleJob scheduleJob) throws Exception {
|
|
|
+ Long startId = 0L;
|
|
|
+ int limit = PropertyHolder.getInt("oe.cleanHandInExamRecord.limit", 100);
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ GetHandInExamRecordReq req = new GetHandInExamRecordReq();
|
|
|
+ req.setLimit(limit);
|
|
|
+ req.setStartId(startId);
|
|
|
+ GetHandInExamRecordResp resp = oeStudentExamRecordCloudService.getHandInExamRecords(req);
|
|
|
+
|
|
|
+ if (startId.equals(resp.getNextId())) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ //因为有可能手动交卷处理掉,所以找不到数据时,不抛错,继续执行下一批数据
|
|
|
+ if (null == resp.getList() || resp.getList().isEmpty()) {
|
|
|
+ startId = resp.getNextId();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (HandInExamRecordBean handInExam : resp.getList()) {
|
|
|
+ try {
|
|
|
+ CleanHandInExamRecordReq cleanHandInExamRecordReq = new CleanHandInExamRecordReq();
|
|
|
+ cleanHandInExamRecordReq.setExamRecordDataId(handInExam.getExamRecordDataId());
|
|
|
+ cleanHandInExamRecordReq.setId(handInExam.getId());
|
|
|
+ cleanHandInExamRecordReq.setStudentId(handInExam.getStudentId());
|
|
|
+ oeStudentExamRecordCloudService.cleanHandInExamRecord(cleanHandInExamRecordReq);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("[oeCleanHandInExamRecordTask_"+handInExam.getExamRecordDataId()+"]交卷后续动作自动服务处理失败",e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ startId = resp.getNextId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TaskTracker getTaskTracker() {
|
|
|
+ return taskTracker;
|
|
|
+ }
|
|
|
+}
|