|
@@ -4,8 +4,22 @@ import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
|
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.NodeExecuter;
|
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.SyncExamDataCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.SyncExamDataReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.bean.StuExamQuestionBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamFaceLivenessVerifiesReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordPaperStructReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordQuestionsReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetFaceBiopsyReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamFaceLivenessVerifiesResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordPaperStructResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordQuestionsResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetFaceBiopsyResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.task.dao.ExamCaptureRepo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.task.dao.ExamSyncCaptureRepo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.task.dao.entity.ExamCaptureEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.task.dao.entity.ExamSyncCaptureEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
|
|
|
import cn.com.qmth.examcloud.support.Constants;
|
|
|
import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
|
|
@@ -30,6 +44,12 @@ public class SyncExamDataExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
|
private SyncExamDataCloudService syncExamDataCloudService;
|
|
|
@Autowired
|
|
|
private ExamRecordDataService examRecordDataService;
|
|
|
+ @Autowired
|
|
|
+ private ExamCaptureRepo examCaptureRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamSyncCaptureRepo examSyncCaptureRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataCloudService examRecordDataCloudService;
|
|
|
|
|
|
@Override
|
|
|
public List<KeyValuePair<Long, ExamRecordData>> execute(Long key, ExamRecordData examRecordData, TaskContext context) throws Exception {
|
|
@@ -40,14 +60,21 @@ public class SyncExamDataExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
|
SequenceLockHelper.getLock(sequenceLockKey);
|
|
|
|
|
|
//处理上一节点中,指定时间内仍未处理完成的数据
|
|
|
+ Long examRecordDataId = examRecordData.getId();
|
|
|
if (examRecordData.getExamRecordStatus() == ExamRecordStatus.EXAM_HAND_IN ||
|
|
|
examRecordData.getExamRecordStatus() == ExamRecordStatus.EXAM_AUTO_HAND_IN) {
|
|
|
- examRecordDataService.processAfterHandInExam(examRecordData.getId());
|
|
|
+ examRecordDataService.processAfterHandInExam(examRecordDataId);
|
|
|
}
|
|
|
|
|
|
//同步数据
|
|
|
SyncExamDataReq syncReq = new SyncExamDataReq();
|
|
|
syncReq.setExamRecordData(copyExamRecordDataFrom(examRecordData));
|
|
|
+ syncReq.setExamCaptures(getExamCaptures(examRecordDataId));
|
|
|
+ syncReq.setExamFaceLivenessVerifies(getExamFaceLivenessVerifies(examRecordDataId));
|
|
|
+ syncReq.setExamRecordPaperStruct(getExamRecordPaperStruct(examRecordDataId));
|
|
|
+ syncReq.setExamRecordQuestions(getExamRecordQuestions(examRecordDataId));
|
|
|
+ syncReq.setExamSyncCapture(getExamSyncCapture(examRecordDataId));
|
|
|
+ syncReq.setFaceBiopsy(getFaceBiopsy(examRecordDataId));
|
|
|
syncExamDataCloudService.syncExamData(syncReq);
|
|
|
|
|
|
return null;
|
|
@@ -56,6 +83,194 @@ public class SyncExamDataExecutor implements NodeExecuter<Long, ExamRecordData,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private FaceBiopsyBean getFaceBiopsy(Long examRecordDataId) {
|
|
|
+ GetFaceBiopsyReq req = new GetFaceBiopsyReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+
|
|
|
+ GetFaceBiopsyResp resp = examRecordDataCloudService.getFaceBiopsy(req);
|
|
|
+
|
|
|
+ cn.com.qmth.examcloud.core.oe.student.api.bean.FaceBiopsyBean faceBiopsyBean = resp.getFaceBiopsyBean();
|
|
|
+
|
|
|
+ FaceBiopsyBean bean = new FaceBiopsyBean();
|
|
|
+ bean.setErrorMsg(faceBiopsyBean.getErrorMsg());
|
|
|
+ bean.setExamRecordDataId(faceBiopsyBean.getExamRecordDataId());
|
|
|
+ bean.setResult(faceBiopsyBean.getResult());
|
|
|
+ bean.setRootOrgId(faceBiopsyBean.getRootOrgId());
|
|
|
+ bean.setVerifiedTimes(faceBiopsyBean.getVerifiedTimes());
|
|
|
+
|
|
|
+ List<FaceBiopsyItemBean> faceBiopsyItemList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (cn.com.qmth.examcloud.core.oe.student.api.bean.FaceBiopsyItemBean faceBiopsyItemBean : faceBiopsyBean.getFaceBiopsyItems()) {
|
|
|
+ FaceBiopsyItemBean itemBean = new FaceBiopsyItemBean();
|
|
|
+
|
|
|
+ itemBean.setCompleted(faceBiopsyItemBean.getCompleted());
|
|
|
+ itemBean.setErrorMsg(faceBiopsyItemBean.getErrorMsg());
|
|
|
+ itemBean.setExamRecordDataId(faceBiopsyItemBean.getExamRecordDataId());
|
|
|
+ itemBean.setFaceBiopsyId(faceBiopsyItemBean.getFaceBiopsyId());
|
|
|
+ itemBean.setFaceBiopsyType(faceBiopsyItemBean.getFaceBiopsyType());
|
|
|
+ itemBean.setInFreezeTime(faceBiopsyItemBean.getInFreezeTime());
|
|
|
+ itemBean.setResult(faceBiopsyItemBean.getResult());
|
|
|
+
|
|
|
+ List<FaceBiopsyItemStepBean> itemStepList = new ArrayList<>();
|
|
|
+ for (cn.com.qmth.examcloud.core.oe.student.api.bean.FaceBiopsyItemStepBean faceBiopsyItemStepBean : faceBiopsyItemBean.getFaceBiopsyItemSteps()) {
|
|
|
+ FaceBiopsyItemStepBean itemStepBean = new FaceBiopsyItemStepBean();
|
|
|
+ itemStepBean.setAction(faceBiopsyItemStepBean.getAction());
|
|
|
+ itemStepBean.setActionStay(faceBiopsyItemStepBean.getActionStay());
|
|
|
+ itemStepBean.setErrorMsg(faceBiopsyItemStepBean.getErrorMsg());
|
|
|
+ itemStepBean.setExamRecordDataId(faceBiopsyItemStepBean.getExamRecordDataId());
|
|
|
+ itemStepBean.setFaceBiopsyItemId(faceBiopsyItemStepBean.getFaceBiopsyItemId());
|
|
|
+ itemStepBean.setResourceRelativePath(faceBiopsyItemStepBean.getResourceRelativePath());
|
|
|
+ itemStepBean.setResourceType(faceBiopsyItemStepBean.getResourceType());
|
|
|
+ itemStepBean.setResult(faceBiopsyItemStepBean.getResult());
|
|
|
+
|
|
|
+ itemStepList.add(itemStepBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ itemBean.setFaceBiopsyItemSteps(itemStepList);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setFaceBiopsyItems(faceBiopsyItemList);
|
|
|
+
|
|
|
+ return bean;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamSyncCaptureBean getExamSyncCapture(Long examRecordDataId) {
|
|
|
+ ExamSyncCaptureEntity entity = examSyncCaptureRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
+ if (null == entity) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamSyncCaptureBean bean = new ExamSyncCaptureBean();
|
|
|
+ bean.setId(entity.getId());
|
|
|
+ bean.setExamRecordDataId(entity.getExamRecordDataId());
|
|
|
+ bean.setFileUrl(entity.getFileUrl());
|
|
|
+ bean.setFileName(entity.getFileName());
|
|
|
+ bean.setPass(entity.getIsPass());
|
|
|
+ bean.setFaceCompareResult(entity.getFaceCompareResult());
|
|
|
+ bean.setStranger(entity.getIsStranger());
|
|
|
+ bean.setLandmark(entity.getLandmark());
|
|
|
+ bean.setFacelivenessResult(entity.getFacelivenessResult());
|
|
|
+ bean.setUsedTime(entity.getUsedTime());
|
|
|
+ bean.setProcessTime(entity.getProcessTime());
|
|
|
+ bean.setHasVirtualCamera(entity.getHasVirtualCamera());
|
|
|
+ bean.setCameraInfos(entity.getCameraInfos());
|
|
|
+ bean.setExtMsg(entity.getExtMsg());
|
|
|
+
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordQuestionsBean getExamRecordQuestions(Long examRecordDataId) {
|
|
|
+ GetExamRecordQuestionsReq req = new GetExamRecordQuestionsReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+ GetExamRecordQuestionsResp resp = examRecordDataCloudService.getExamRecordQuestions(req);
|
|
|
+
|
|
|
+ ExamRecordQuestionsBean bean = new ExamRecordQuestionsBean();
|
|
|
+ bean.setCreationTime(resp.getCreationTime());
|
|
|
+ bean.setExamRecordDataId(resp.getExamRecordDataId());
|
|
|
+
|
|
|
+ List<ExamQuestionBean> examQuestionBeanList = new ArrayList<>();
|
|
|
+ for (StuExamQuestionBean stuExamQuestionBean : resp.getExamQuestions()) {
|
|
|
+ ExamQuestionBean examQuestionBean = new ExamQuestionBean();
|
|
|
+ examQuestionBean.setExamRecordDataId(stuExamQuestionBean.getExamRecordDataId());
|
|
|
+ examQuestionBean.setMainNumber(stuExamQuestionBean.getMainNumber());
|
|
|
+ examQuestionBean.setQuestionId(stuExamQuestionBean.getQuestionId());
|
|
|
+ examQuestionBean.setOrder(stuExamQuestionBean.getOrder());
|
|
|
+ examQuestionBean.setQuestionScore(stuExamQuestionBean.getQuestionScore());
|
|
|
+ examQuestionBean.setQuestionType(stuExamQuestionBean.getQuestionType());
|
|
|
+ examQuestionBean.setCorrectAnswer(stuExamQuestionBean.getCorrectAnswer());
|
|
|
+ examQuestionBean.setStudentAnswer(stuExamQuestionBean.getStudentAnswer());
|
|
|
+ examQuestionBean.setStudentScore(stuExamQuestionBean.getStudentScore());
|
|
|
+ examQuestionBean.setAnswer(stuExamQuestionBean.getAnswer());
|
|
|
+ examQuestionBean.setSign(stuExamQuestionBean.getSign());
|
|
|
+ examQuestionBean.setOptionPermutation(stuExamQuestionBean.getOptionPermutation());
|
|
|
+ examQuestionBean.setAudioPlayTimes(stuExamQuestionBean.getAudioPlayTimes());
|
|
|
+
|
|
|
+ if (null != stuExamQuestionBean.getAnswerType()) {
|
|
|
+ examQuestionBean.setAnswerType(stuExamQuestionBean.getAnswerType().name());
|
|
|
+ }
|
|
|
+
|
|
|
+ examQuestionBeanList.add(examQuestionBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setExamQuestionBeans(examQuestionBeanList);
|
|
|
+
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordPaperStructBean getExamRecordPaperStruct(Long examRecordDataId) {
|
|
|
+ GetExamRecordPaperStructReq req = new GetExamRecordPaperStructReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+ GetExamRecordPaperStructResp resp = examRecordDataCloudService.getExamRecordPaperStruct(req);
|
|
|
+
|
|
|
+ ExamRecordPaperStructBean bean = new ExamRecordPaperStructBean();
|
|
|
+ bean.setId(resp.getId());
|
|
|
+ bean.setDefaultPaper(resp.getDefaultPaper());
|
|
|
+
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ExamFaceLivenessVerifyBean> getExamFaceLivenessVerifies(Long examRecordDataId) {
|
|
|
+ GetExamFaceLivenessVerifiesReq req = new GetExamFaceLivenessVerifiesReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+
|
|
|
+ GetExamFaceLivenessVerifiesResp resp = examRecordDataCloudService.getExamFaceLivenessVerifies(req);
|
|
|
+ if (null == resp.getExamFaceLivenessVerifis() || resp.getExamFaceLivenessVerifis().isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ExamFaceLivenessVerifyBean> resultList = new ArrayList<>();
|
|
|
+ for (cn.com.qmth.examcloud.core.oe.student.api.bean.ExamFaceLivenessVerifyBean eflvb : resp.getExamFaceLivenessVerifis()) {
|
|
|
+ ExamFaceLivenessVerifyBean bean = new ExamFaceLivenessVerifyBean();
|
|
|
+ bean.setId(eflvb.getId());
|
|
|
+ bean.setExamRecordDataId(eflvb.getExamRecordDataId());
|
|
|
+ bean.setStartTime(eflvb.getStartTime());
|
|
|
+ bean.setUsedTime(eflvb.getUsedTime());
|
|
|
+ bean.setResultJson(eflvb.getResultJson());
|
|
|
+ bean.setVerifyResult(eflvb.getVerifyResult());
|
|
|
+ bean.setBizId(eflvb.getBizId());
|
|
|
+ bean.setError(eflvb.getError());
|
|
|
+ bean.setErrorMsg(eflvb.getErrorMsg());
|
|
|
+ bean.setOperateNum(eflvb.getOperateNum());
|
|
|
+
|
|
|
+ resultList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ExamCaptureBean> getExamCaptures(Long examRecordDataId) {
|
|
|
+ List<ExamCaptureEntity> entityList = examCaptureRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
+ if (null == entityList || entityList.isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ExamCaptureBean> resultList = new ArrayList<>();
|
|
|
+ for (ExamCaptureEntity entity : entityList) {
|
|
|
+ ExamCaptureBean bean = new ExamCaptureBean();
|
|
|
+
|
|
|
+ bean.setId(entity.getId());
|
|
|
+ bean.setExamRecordDataId(entity.getExamRecordDataId());
|
|
|
+ bean.setFileUrl(entity.getFileUrl());
|
|
|
+ bean.setFileName(entity.getFileName());
|
|
|
+ bean.setPass(entity.getIsPass());
|
|
|
+ bean.setFaceCompareResult(entity.getFaceCompareResult());
|
|
|
+ bean.setStranger(entity.getIsStranger());
|
|
|
+ bean.setLandmark(entity.getLandmark());
|
|
|
+ bean.setFacelivenessResult(entity.getFacelivenessResult());
|
|
|
+ bean.setUsedTime(entity.getUsedTime());
|
|
|
+ bean.setProcessTime(entity.getProcessTime());
|
|
|
+ bean.setHasVirtualCamera(entity.getHasVirtualCamera());
|
|
|
+ bean.setCameraInfos(entity.getCameraInfos());
|
|
|
+ bean.setExtMsg(entity.getExtMsg());
|
|
|
+
|
|
|
+ resultList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
private ExamRecordDataBean copyExamRecordDataFrom(ExamRecordData examRecordData) {
|
|
|
ExamRecordDataBean data = new ExamRecordDataBean();
|
|
|
data.setId(examRecordData.getId());
|