|
@@ -3,19 +3,22 @@ package cn.com.qmth.examcloud.core.oe.task.service.pipeline;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.helpers.ObjectHolder;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
|
import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
|
|
import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
|
|
|
|
+import cn.com.qmth.examcloud.commons.helpers.ObjectHolder;
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.NodeExecuter;
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.NodeExecuter;
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
|
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordDataIdsReq;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordDataIdsReq;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.request.UpdateExamRecordDataBatchNumReq;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.request.UpdateExamRecordDataBatchNumReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.UpdateExamRecordStatusReq;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordDataIdsResp;
|
|
import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordDataIdsResp;
|
|
import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
|
|
import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
|
|
|
|
+import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
|
|
import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -27,6 +30,8 @@ import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
@Component
|
|
@Component
|
|
public class DataGainExamExecutor implements NodeExecuter<Long, ExamRecordData, Long, ExamRecordData> {
|
|
public class DataGainExamExecutor implements NodeExecuter<Long, ExamRecordData, Long, ExamRecordData> {
|
|
|
|
|
|
|
|
+ private static final ExamCloudLog LOG = ExamCloudLogFactory.getLog(DataGainExamExecutor.class);
|
|
|
|
+
|
|
private final static Integer batchSize = 200;
|
|
private final static Integer batchSize = 200;
|
|
|
|
|
|
private final static Long batchNum = new Date().getTime();
|
|
private final static Long batchNum = new Date().getTime();
|
|
@@ -39,7 +44,7 @@ public class DataGainExamExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void execute(Long key, ExamRecordData value, List<KeyValuePair<Long, ExamRecordData>> outList,
|
|
public void execute(Long key, ExamRecordData value, List<KeyValuePair<Long, ExamRecordData>> outList,
|
|
- ObjectHolder<Boolean> removable, TaskContext context) throws Exception {
|
|
|
|
|
|
+ ObjectHolder<Boolean> removable, TaskContext context) throws Exception {
|
|
// 获取考试信息id
|
|
// 获取考试信息id
|
|
Long startId = 0l;
|
|
Long startId = 0l;
|
|
GetExamRecordDataIdsReq req = new GetExamRecordDataIdsReq();
|
|
GetExamRecordDataIdsReq req = new GetExamRecordDataIdsReq();
|
|
@@ -56,9 +61,11 @@ public class DataGainExamExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
// 根据id获取考试信息缓存
|
|
// 根据id获取考试信息缓存
|
|
ExamRecordData erd = examRecordDataService.getExamRecordDataCache(id);
|
|
ExamRecordData erd = examRecordDataService.getExamRecordDataCache(id);
|
|
if (erd == null) {
|
|
if (erd == null) {
|
|
- throw new StatusException("1001", "获取Redis中考试信息为空");
|
|
|
|
|
|
+ LOG.error("获取Redis中考试信息为空 examRecordDataId:"+id);
|
|
|
|
+ updateExamRecordStatusError(id);
|
|
|
|
+ }else {
|
|
|
|
+ outList.add(new KeyValuePair<Long, ExamRecordData>(id, erd));
|
|
}
|
|
}
|
|
- outList.add(new KeyValuePair<Long, ExamRecordData>(id, erd));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// 修改已获取过的考试信息batchNum
|
|
// 修改已获取过的考试信息batchNum
|
|
@@ -70,4 +77,14 @@ public class DataGainExamExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void updateExamRecordStatusError(Long id) {
|
|
|
|
+ try {
|
|
|
|
+ UpdateExamRecordStatusReq ureq = new UpdateExamRecordStatusReq();
|
|
|
|
+ ureq.setExamRecordStatus(ExamRecordStatus.EXAM_ERROR.name());
|
|
|
|
+ ureq.setId(id);
|
|
|
|
+ examRecordDataCloudService.updateExamRecordStatus(ureq);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ LOG.error("修改考试记录状态失败 examRecordDataId:"+id);;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|