|
@@ -1,23 +1,40 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.api.provider;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.SyncExamDataCloudService;
|
|
|
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.admin.api.response.SyncExamDataResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.*;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
|
|
|
+import cn.com.qmth.examcloud.support.Constants;
|
|
|
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.enums.SyncStatus;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamBoss;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
+import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
|
+import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
|
|
|
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
+import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Example;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @Description 同步考试相关数据接口
|
|
|
* @Author lideyin
|
|
@@ -40,7 +57,32 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
@Autowired
|
|
|
private ExamBossService examBossService;
|
|
|
@Autowired
|
|
|
- ExamRecordDataCacheService examRecordDataCacheService;
|
|
|
+ private ExamRecordDataCacheService examRecordDataCacheService;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataRepo examRecordDataRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentRepo examStudentRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamSyncCaptureRepo examSyncCaptureRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamCaptureRepo examCaptureRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamFaceLivenessVerifyRepo examFaceLivenessVerifyRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordPaperStructRepo examRecordPaperStructRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyRepo faceBiopsyRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyItemRepo faceBiopsyItemRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyItemStepRepo faceBiopsyItemStepRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamAuditService examAuditService;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataSyncRepo examRecordDataSyncRepo;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 同步考试记录数据
|
|
@@ -50,58 +92,412 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
*/
|
|
|
@ApiOperation(value = "同步考试记录相关数据")
|
|
|
@PostMapping("/syncExamData")
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public SyncExamDataResp syncExamData(@RequestBody SyncExamDataReq req) {
|
|
|
+ String sequenceLockKey = Constants.EXAM_SYNC_CONTROL_LOCK_PREFIX + req.getExamRecordData().getStudentId();
|
|
|
+
|
|
|
+ //添加考试同步控制全局锁,自动解锁
|
|
|
+ SequenceLockHelper.getLock(sequenceLockKey);
|
|
|
+
|
|
|
+ //校验考试记录是否已同步,如果已同步,则直接返回
|
|
|
+ if (hasSynced(req.getExamRecordData().getId())) {
|
|
|
+ return new SyncExamDataResp();
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步考试记录
|
|
|
+ ExamRecordDataBean examRecordData = req.getExamRecordData();
|
|
|
+ Long examRecordDataId = syncExamRecordData(examRecordData);
|
|
|
|
|
|
- //同步考试记录
|
|
|
- ExamRecordDataEntity examRecordData= syncExamRecordData(req.getExamRecordData());
|
|
|
+ //添加同步记录
|
|
|
+ addExamRecordDataSync(examRecordData.getId(), examRecordDataId);
|
|
|
|
|
|
- Long examRecordDataId= examRecordData.getId();
|
|
|
+ //同步抓拍照片结果(同步抓拍的数据)
|
|
|
+ syncExamSyncCapture(req.getExamSyncCapture(), examRecordDataId);
|
|
|
|
|
|
- //同步抓拍照片结果(包括同步抓拍和异步抓拍的数据)
|
|
|
- syncExamCapture(req.getExamCapture(),examRecordDataId);
|
|
|
+ //同步抓拍照片结果(异步抓拍的数据)
|
|
|
+ syncExamCapture(req.getExamCaptures(), examRecordDataId);
|
|
|
|
|
|
- //同步face id活体检测数据
|
|
|
- syncExamFaceLivenessVerify(req.getExamFaceLivenessVerify(),examRecordDataId);
|
|
|
+ //同步face id活体检测数据
|
|
|
+ syncExamFaceLivenessVerify(req.getExamFaceLivenessVerifies(), examRecordDataId);
|
|
|
|
|
|
//同步新活检
|
|
|
- syncFaceBiopsy(req.getFaceBiopsy(),examRecordDataId);
|
|
|
+ syncFaceBiopsy(req.getFaceBiopsy(), examRecordDataId);
|
|
|
|
|
|
//同步考试记录对应的试卷结构
|
|
|
- syncExamRecordPaperStruct(req.getExamRecordPaperStruct(),examRecordDataId);
|
|
|
+ syncExamRecordPaperStruct(req.getExamRecordPaperStruct(), examRecordDataId);
|
|
|
|
|
|
//同步作答记录
|
|
|
- syncExamRecordQuestions(req.getExamRecordQuestions(),examRecordDataId);
|
|
|
+ syncExamRecordQuestions(req.getExamRecordQuestions(), examRecordDataId);
|
|
|
|
|
|
//计算违纪自动审核结果(无人脸或活检失败)
|
|
|
- saveAutoAudit(examRecordDataId);
|
|
|
+ boolean isNoPhotoAndIllegality = (null == req.getExamCaptures() || req.getExamCaptures().isEmpty());//是否无照片
|
|
|
+ saveAutoAudit(examRecordData, isNoPhotoAndIllegality);
|
|
|
|
|
|
//同步后续处理
|
|
|
processAfterSyncExamData(examRecordDataId, examRecordData.getExamId());
|
|
|
- return null;
|
|
|
+
|
|
|
+ return new SyncExamDataResp();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加考试记录的同步记录
|
|
|
+ *
|
|
|
+ * @param cacheId
|
|
|
+ * @param dbId
|
|
|
+ */
|
|
|
+ private void addExamRecordDataSync(Long cacheId, Long dbId) {
|
|
|
+ ExamRecordDataSyncEntity entity = new ExamRecordDataSyncEntity();
|
|
|
+ entity.setCacheId(cacheId);
|
|
|
+ entity.setDbId(dbId);
|
|
|
+
|
|
|
+ examRecordDataSyncRepo.save(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考试记录表是否已同步
|
|
|
+ *
|
|
|
+ * @param cacheExamRecordDataId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean hasSynced(Long cacheExamRecordDataId) {
|
|
|
+ ExamRecordDataSyncEntity query = new ExamRecordDataSyncEntity();
|
|
|
+ query.setCacheId(cacheExamRecordDataId);
|
|
|
+ Example<ExamRecordDataSyncEntity> example = Example.of(query);
|
|
|
+ return examRecordDataSyncRepo.exists(example);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long syncExamRecordData(ExamRecordDataBean examRecordData) {
|
|
|
+
|
|
|
+
|
|
|
+ ExamRecordDataEntity examRecordDataEntity = copyExamRecordDataEntityFrom(examRecordData);
|
|
|
+
|
|
|
+ examRecordDataRepo.save(examRecordDataEntity);
|
|
|
+
|
|
|
+ return examRecordDataEntity.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordDataEntity copyExamRecordDataEntityFrom(ExamRecordDataBean examRecordData) {
|
|
|
+ ExamRecordDataEntity result = new ExamRecordDataEntity();
|
|
|
+ Long examId = examRecordData.getExamId();
|
|
|
+ result.setExamId(examId);
|
|
|
+ result.setExamType(ExamType.valueOf(examRecordData.getExamType()));
|
|
|
+ result.setExamStudentId(examRecordData.getExamStudentId());
|
|
|
+ Long studentId = examRecordData.getStudentId();
|
|
|
+ result.setStudentId(studentId);
|
|
|
+
|
|
|
+ ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
|
|
|
+ if (null == examStudentEntity) {
|
|
|
+ throw new StatusException("100101", "考生id不正确");
|
|
|
+ }
|
|
|
+ result.setStudentCode(examStudentEntity.getStudentCode());
|
|
|
+ result.setStudentName(examStudentEntity.getStudentName());
|
|
|
+ result.setIdentityNumber(examStudentEntity.getIdentityNumber());
|
|
|
+
|
|
|
+ result.setCourseId(examRecordData.getCourseId());
|
|
|
+ result.setOrgId(examRecordData.getOrgId());
|
|
|
+ result.setRootOrgId(examRecordData.getRootOrgId());
|
|
|
+ result.setBasePaperId(examRecordData.getBasePaperId());
|
|
|
+
|
|
|
+// result.setPaperStructId(examRecordData.getPaperStructId());
|
|
|
+ result.setPaperType(examRecordData.getPaperType());
|
|
|
+
|
|
|
+ CourseCacheBean course = CacheHelper.getCourse(examRecordData.getCourseId());
|
|
|
+ result.setCourseLevel(course.getLevel());
|
|
|
+
|
|
|
+ result.setInfoCollector(examRecordData.getInfoCollector());
|
|
|
+ result.setStartTime(examRecordData.getStartTime());
|
|
|
+ result.setEndTime(examRecordData.getEndTime());
|
|
|
+ result.setCleanTime(examRecordData.getCleanTime());
|
|
|
+ result.setIsWarn(examRecordData.getWarn());
|
|
|
+ result.setIsAudit(examRecordData.getAudit());
|
|
|
+ result.setIsIllegality(examRecordData.getIllegality());
|
|
|
+ result.setExamRecordStatus(ExamRecordStatus.getByName(examRecordData.getExamRecordStatus()));
|
|
|
+ result.setUsedExamTime(examRecordData.getUsedExamTime());
|
|
|
+
|
|
|
+ Integer usedNum = examStudentEntity.getUsedNum();
|
|
|
+ result.setExamOrder(getExamOrder(examId, studentId, usedNum));//考试次数
|
|
|
+ result.setIsReexamine(isReexamine(examId, studentId, usedNum));//是否重考
|
|
|
+
|
|
|
+ result.setIsContinued(examRecordData.getContinued());
|
|
|
+ result.setContinuedCount(examRecordData.getContinuedCount());
|
|
|
+ result.setFaceSuccessCount(examRecordData.getFaceSuccessCount());
|
|
|
+ result.setFaceFailedCount(examRecordData.getFaceFailedCount());
|
|
|
+ result.setFaceStrangerCount(examRecordData.getFaceStrangerCount());
|
|
|
+ result.setFaceTotalCount(examRecordData.getFaceTotalCount());
|
|
|
+ result.setFaceSuccessPercent(examRecordData.getFaceSuccessPercent());
|
|
|
+ result.setFaceVerifyResult(IsSuccess.valueOf(examRecordData.getFaceVerifyResult()));
|
|
|
+ result.setFaceLandmarkVal(examRecordData.getFaceLandmarkVal());
|
|
|
+ result.setIsAllObjectivePaper(examRecordData.getAllObjectivePaper());
|
|
|
+ result.setBaiduFaceLivenessSuccessPercent(examRecordData.getBaiduFaceLivenessSuccessPercent());
|
|
|
+ result.setIsExceed(examRecordData.getExceed());
|
|
|
+// result.setExamRecordQuestionsId(examRecordData.getExamRecordQuestionsId());
|
|
|
+ result.setTotalScore(examRecordData.getTotalScore());
|
|
|
+ result.setObjectiveScore(examRecordData.getObjectiveScore());
|
|
|
+ result.setObjectiveAccuracy(examRecordData.getObjectiveAccuracy());
|
|
|
+ result.setSubjectiveScore(examRecordData.getSubjectiveScore());
|
|
|
+ result.setSuccPercent(examRecordData.getSuccPercent());
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算考试次数
|
|
|
+ *
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param studentId 学生id
|
|
|
+ * @param usedExamNum 已考次数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Integer getExamOrder(Long examId, Long studentId, Integer usedExamNum) {
|
|
|
+ ExamSettingsCacheBean cachedExam = ExamCacheTransferHelper.getCachedExam(examId, studentId);
|
|
|
+ Integer canExamTimes = cachedExam.getExamTimes() == null ? 0 : cachedExam.getExamTimes().intValue();//可考次数
|
|
|
+
|
|
|
+ //超过或等于可考次数,始终为可考次数+1
|
|
|
+ if (usedExamNum >= canExamTimes) {
|
|
|
+ return canExamTimes + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return usedExamNum + 1;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private ExamRecordDataEntity syncExamRecordData(ExamRecordDataBean examRecordData) {
|
|
|
- return null;
|
|
|
+ /**
|
|
|
+ * 计算是否为重考
|
|
|
+ *
|
|
|
+ * @param examId 考试id
|
|
|
+ * @param studentId 学生id
|
|
|
+ * @param usedExamNum 已考次数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean isReexamine(Long examId, Long studentId, Integer usedExamNum) {
|
|
|
+ ExamSettingsCacheBean cachedExam = ExamCacheTransferHelper.getCachedExam(examId, studentId);
|
|
|
+ Integer canExamTimes = cachedExam.getExamTimes() == null ? 0 : cachedExam.getExamTimes().intValue();//可考次数
|
|
|
+
|
|
|
+ //超过或等于可考次数,始终为可考次数+1
|
|
|
+ if (usedExamNum >= canExamTimes) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private void saveAutoAudit(Long examRecordDataId) {
|
|
|
+ private void saveAutoAudit(ExamRecordDataBean examRecordData, boolean isNoPhotoAndIllegality) {
|
|
|
+ //无照片违纪自动审核
|
|
|
+ if (isNoPhotoAndIllegality) {
|
|
|
+ examAuditService.saveExamAuditByNoPhoto(examRecordData.getId());
|
|
|
+ } else {
|
|
|
+ //活体检测失败违纪自动审核
|
|
|
+ if (null != examRecordData.getFaceVerifyResult()
|
|
|
+ && IsSuccess.FAILED.name().equals(examRecordData.getFaceVerifyResult())
|
|
|
+ && examRecordData.getIllegality()) {
|
|
|
+ examAuditService.saveExamAuditByFaceVerifyFailed(examRecordData.getId(), examRecordData.getRootOrgId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void syncExamRecordQuestions(ExamRecordQuestionsBean examRecordQuestions, Long examRecordDataId) {
|
|
|
+ ExamRecordQuestionsEntity entity = copyExamRecordQuestionsFrom(examRecordQuestions, examRecordDataId);
|
|
|
+ examRecordQuestionsRepo.save(entity);
|
|
|
+
|
|
|
+ //更新考试记录表中的作答记录id
|
|
|
+ ExamRecordDataEntity examRecordData =
|
|
|
+ GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
+ examRecordData.setExamRecordQuestionsId(entity.getId());
|
|
|
+ examRecordDataRepo.save(examRecordData);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordQuestionsEntity copyExamRecordQuestionsFrom(ExamRecordQuestionsBean bean, Long examRecordDataId) {
|
|
|
+ ExamRecordQuestionsEntity entity = new ExamRecordQuestionsEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+
|
|
|
+ List<ExamQuestionEntity> examQuestionEntityList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (ExamQuestionBean questionBean : bean.getExamQuestionBeans()) {
|
|
|
+ ExamQuestionEntity questionEntity = new ExamQuestionEntity();
|
|
|
+
|
|
|
+ questionEntity.setExamRecordDataId(questionBean.getExamRecordDataId());
|
|
|
+ questionEntity.setMainNumber(questionBean.getMainNumber());
|
|
|
+ questionEntity.setQuestionId(questionBean.getQuestionId());
|
|
|
+ questionEntity.setOrder(questionBean.getOrder());
|
|
|
+ questionEntity.setStudentAnswer(questionBean.getStudentAnswer());
|
|
|
+ questionEntity.setStudentScore(questionBean.getStudentScore());
|
|
|
+ questionEntity.setQuestionScore(questionBean.getQuestionScore());
|
|
|
+ questionEntity.setQuestionType(questionBean.getQuestionType());
|
|
|
+ questionEntity.setIsAnswer(questionBean.getAnswer());
|
|
|
+ questionEntity.setIsSign(questionBean.getSign());
|
|
|
+ questionEntity.setCorrectAnswer(questionBean.getCorrectAnswer());
|
|
|
+ questionEntity.setOptionPermutation(questionBean.getOptionPermutation());
|
|
|
+ questionEntity.setAudioPlayTimes(questionBean.getAudioPlayTimes());
|
|
|
+ questionEntity.setAnswerType(AnswerType.valueOf(questionBean.getAnswerType()));
|
|
|
+
|
|
|
+ examQuestionEntityList.add(questionEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ entity.setExamQuestionEntities(examQuestionEntityList);
|
|
|
+
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
private void syncExamRecordPaperStruct(ExamRecordPaperStructBean examRecordPaperStruct, Long examRecordDataId) {
|
|
|
+ ExamRecordPaperStructEntity entity = copyExamRecordPaperStructFrom(examRecordPaperStruct, examRecordDataId);
|
|
|
+ examRecordPaperStructRepo.save(entity);
|
|
|
+
|
|
|
+ //更新考试记录表中的试卷结构id
|
|
|
+ ExamRecordDataEntity examRecordData =
|
|
|
+ GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
+ examRecordData.setPaperStructId(entity.getId());
|
|
|
+ examRecordDataRepo.save(examRecordData);
|
|
|
}
|
|
|
|
|
|
- private void syncFaceBiopsy(FaceBiopsyBean faceBiopsy, Long examRecordDataId) {
|
|
|
+ private ExamRecordPaperStructEntity copyExamRecordPaperStructFrom(ExamRecordPaperStructBean examRecordPaperStruct, Long examRecordDataId) {
|
|
|
+ ExamRecordPaperStructEntity entity = new ExamRecordPaperStructEntity();
|
|
|
+ entity.setId(examRecordPaperStruct.getId());
|
|
|
+ entity.setDefaultPaper(examRecordPaperStruct.getDefaultPaper());
|
|
|
+
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
- private void syncExamFaceLivenessVerify(ExamFaceLivenessVerifyBean examFaceLivenessVerify, Long examRecordDataId) {
|
|
|
+ //TODO 事务待确认
|
|
|
+ @Transactional
|
|
|
+ public void syncFaceBiopsy(FaceBiopsyBean faceBiopsy, Long examRecordDataId) {
|
|
|
+ FaceBiopsyEntity faceBiopsyEntity = copyFaceBiopsyFrom(faceBiopsy, examRecordDataId);
|
|
|
+ faceBiopsyRepo.save(faceBiopsyEntity);
|
|
|
+
|
|
|
+ FaceBiopsyItemEntity faceBiopsyItemEntity = copyFaceBiopsyItemFrom(
|
|
|
+ faceBiopsy.getFaceBiopsyItem(), faceBiopsyEntity.getId(), examRecordDataId);
|
|
|
+ faceBiopsyItemRepo.save(faceBiopsyItemEntity);
|
|
|
+
|
|
|
+ List<FaceBiopsyItemStepEntity> faceBiopsyItemStepEntityList = copyFaceBiopsyItemStepFrom(
|
|
|
+ faceBiopsy.getFaceBiopsyItem().getFaceBiopsyItemSteps(), faceBiopsyItemEntity.getId(), examRecordDataId);
|
|
|
+ faceBiopsyItemStepRepo.saveAll(faceBiopsyItemStepEntityList);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private void syncExamCapture(ExamCaptureBean examCapture, Long examRecordDataId) {
|
|
|
+ private FaceBiopsyEntity copyFaceBiopsyFrom(FaceBiopsyBean bean, Long examRecordDataId) {
|
|
|
+ FaceBiopsyEntity entity = new FaceBiopsyEntity();
|
|
|
+ entity.setRootOrgId(bean.getRootOrgId());
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setResult(bean.getResult());
|
|
|
+ entity.setErrorMsg(bean.getErrorMsg());
|
|
|
+ entity.setVerifiedTimes(bean.getVerifiedTimes());
|
|
|
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private FaceBiopsyItemEntity copyFaceBiopsyItemFrom(FaceBiopsyItemBean bean, Long faceByiopsyId, Long examRecordDataId) {
|
|
|
+ FaceBiopsyItemEntity entity = new FaceBiopsyItemEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setFaceBiopsyId(faceByiopsyId);
|
|
|
+ entity.setFaceBiopsyType(FaceBiopsyType.valueOf(bean.getFaceBiopsyType()));
|
|
|
+ entity.setCompleted(bean.getCompleted());
|
|
|
+ entity.setResult(bean.getResult());
|
|
|
+ entity.setErrorMsg(bean.getErrorMsg());
|
|
|
+ entity.setInFreezeTime(bean.getInFreezeTime());
|
|
|
+
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<FaceBiopsyItemStepEntity> copyFaceBiopsyItemStepFrom(List<FaceBiopsyItemStepBean> faceBiopsyItemSteps,
|
|
|
+ Long faceBiopsyItemId, Long examRecordDataId) {
|
|
|
+ List<FaceBiopsyItemStepEntity> faceBiopsyItemStepEntityList = new ArrayList<>();
|
|
|
+ for (FaceBiopsyItemStepBean bean : faceBiopsyItemSteps) {
|
|
|
+ FaceBiopsyItemStepEntity entity = new FaceBiopsyItemStepEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setFaceBiopsyItemId(faceBiopsyItemId);
|
|
|
+ entity.setAction(FaceBiopsyAction.valueOf(bean.getAction()));
|
|
|
+ entity.setResourceRelativePath(bean.getResourceRelativePath());
|
|
|
+ entity.setResourceType(ResourceType.valueOf(bean.getResourceType()));
|
|
|
+ entity.setActionStay(bean.getActionStay());
|
|
|
+ entity.setResult(bean.getResult());
|
|
|
+ entity.setErrorMsg(bean.getErrorMsg());
|
|
|
+ entity.setExt1(bean.getExt1());
|
|
|
+ entity.setExt2(bean.getExt2());
|
|
|
+ entity.setExt3(bean.getExt3());
|
|
|
+ entity.setExt4(bean.getExt4());
|
|
|
+ entity.setExt5(bean.getExt5());
|
|
|
+
|
|
|
+ faceBiopsyItemStepEntityList.add(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ return faceBiopsyItemStepEntityList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void syncExamFaceLivenessVerify(List<ExamFaceLivenessVerifyBean> examFaceLivenessVerifies, Long examRecordDataId) {
|
|
|
+ for (ExamFaceLivenessVerifyBean bean : examFaceLivenessVerifies) {
|
|
|
+ ExamFaceLivenessVerifyEntity entity = copyExamFaceLivenessVerifyFrom(bean, examRecordDataId);
|
|
|
+
|
|
|
+ examFaceLivenessVerifyRepo.save(entity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamFaceLivenessVerifyEntity copyExamFaceLivenessVerifyFrom(ExamFaceLivenessVerifyBean bean,
|
|
|
+ Long examRecordDataId) {
|
|
|
+ ExamFaceLivenessVerifyEntity entity = new ExamFaceLivenessVerifyEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setError(bean.getError());
|
|
|
+ entity.setStartTime(bean.getStartTime());
|
|
|
+ entity.setUsedTime(bean.getUsedTime());
|
|
|
+ entity.setResultJson(bean.getResultJson());
|
|
|
+ entity.setVerifyResult(FaceVerifyResult.valueOf(bean.getVerifyResult()));
|
|
|
+ entity.setBizId(bean.getBizId());
|
|
|
+ entity.setIsError(bean.getError());
|
|
|
+ entity.setErrorMsg(bean.getErrorMsg());
|
|
|
+ entity.setOperateNum(bean.getOperateNum());
|
|
|
+
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void syncExamSyncCapture(ExamSyncCaptureBean examSyncCapture, Long examRecordDataId) {
|
|
|
+ ExamSyncCaptureEntity examSyncCaptureEntity = copyExamSyncCaptureFrom(examSyncCapture, examRecordDataId);
|
|
|
+
|
|
|
+ examSyncCaptureRepo.save(examSyncCaptureEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamSyncCaptureEntity copyExamSyncCaptureFrom(ExamSyncCaptureBean examSyncCapture, Long examRecordDataId) {
|
|
|
+ ExamSyncCaptureEntity entity = new ExamSyncCaptureEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setFileUrl(examSyncCapture.getFileUrl());
|
|
|
+ entity.setFileName(examSyncCapture.getFileName());
|
|
|
+ entity.setFaceCompareResult(examSyncCapture.getFaceCompareResult());
|
|
|
+ entity.setIsPass(examSyncCapture.getPass());
|
|
|
+ entity.setIsStranger(examSyncCapture.getStranger());
|
|
|
+ entity.setLandmark(examSyncCapture.getLandmark());
|
|
|
+ entity.setUsedTime(examSyncCapture.getUsedTime());
|
|
|
+ entity.setFacelivenessResult(examSyncCapture.getFacelivenessResult());
|
|
|
+ entity.setProcessTime(examSyncCapture.getProcessTime());
|
|
|
+ entity.setHasVirtualCamera(examSyncCapture.getHasVirtualCamera());
|
|
|
+ entity.setCameraInfos(examSyncCapture.getCameraInfos());
|
|
|
+ entity.setExtMsg(examSyncCapture.getExtMsg());
|
|
|
+
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void syncExamCapture(List<ExamCaptureBean> examCaptures, Long examRecordDataId) {
|
|
|
+ for (ExamCaptureBean bean : examCaptures) {
|
|
|
+ ExamCaptureEntity examCaptureEntity = copyExamCaptureFrom(bean, examRecordDataId);
|
|
|
+ examCaptureRepo.save(examCaptureEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamCaptureEntity copyExamCaptureFrom(ExamCaptureBean examCapture, Long examRecordDataId) {
|
|
|
+ ExamCaptureEntity entity = new ExamCaptureEntity();
|
|
|
+ entity.setExamRecordDataId(examCapture.getExamRecordDataId());
|
|
|
+ entity.setFileUrl(examCapture.getFileUrl());
|
|
|
+ entity.setFileName(examCapture.getFileName());
|
|
|
+ entity.setFaceCompareResult(examCapture.getFaceCompareResult());
|
|
|
+ entity.setIsPass(examCapture.getPass());
|
|
|
+ entity.setIsStranger(examCapture.getStranger());
|
|
|
+ entity.setLandmark(examCapture.getLandmark());
|
|
|
+ entity.setUsedTime(examCapture.getUsedTime());
|
|
|
+ entity.setFacelivenessResult(examCapture.getFacelivenessResult());
|
|
|
+ entity.setProcessTime(examCapture.getProcessTime());
|
|
|
+ entity.setHasVirtualCamera(examCapture.getHasVirtualCamera());
|
|
|
+ entity.setCameraInfos(examCapture.getCameraInfos());
|
|
|
+ entity.setExtMsg(examCapture.getExtMsg());
|
|
|
+
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -149,11 +545,12 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 设置考试记录的同步状态
|
|
|
- * @param examRecordDataId
|
|
|
- */
|
|
|
- private void setAndSaveExamRecordDataSyncStatus(Long examRecordDataId) {
|
|
|
+ /**
|
|
|
+ * 设置考试记录的同步状态
|
|
|
+ *
|
|
|
+ * @param examRecordDataId
|
|
|
+ */
|
|
|
+ private void setAndSaveExamRecordDataSyncStatus(Long examRecordDataId) {
|
|
|
ExamRecordData examRecordData = examRecordDataCacheService.getExamRecordDataCache(examRecordDataId);
|
|
|
|
|
|
if (SyncStatus.SYNCED == examRecordData.getSyncStatus()) {
|