Эх сурвалжийг харах

同步考试相关数据到管理端

lideyin 5 жил өмнө
parent
commit
d93cb0d58d

+ 1 - 1
examcloud-core-oe-admin-api-provider/pom.xml

@@ -14,6 +14,6 @@
 			<artifactId>examcloud-core-oe-admin-service</artifactId>
 			<version>${examcloud.version}</version>
 		</dependency>
-	</dependencies>
+    </dependencies>
 
 </project>

+ 422 - 25
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java

@@ -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()) {

+ 23 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamRecordDataSyncRepo.java

@@ -0,0 +1,23 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao;
+
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataSyncEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Description 同步
+ * @Author lideyin
+ * @Date 2019/12/23 18:25
+ * @Version 1.0
+ */
+@Repository
+public interface ExamRecordDataSyncRepo extends JpaRepository<ExamRecordDataSyncEntity, Long>, JpaSpecificationExecutor<ExamRecordDataSyncEntity> {
+
+}

+ 17 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamSyncCaptureRepo.java

@@ -0,0 +1,17 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao;
+
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamSyncCaptureEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Description 同步抓拍照片
+ * @Author lideyin
+ * @Date 2019/12/10 14:05
+ * @Version 1.0
+ */
+@Repository
+public interface ExamSyncCaptureRepo extends JpaRepository<ExamSyncCaptureEntity, Long>, JpaSpecificationExecutor<ExamSyncCaptureEntity> {
+    ExamSyncCaptureEntity findByExamRecordDataId(Long examRecordId);
+}

+ 57 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/entity/ExamRecordDataSyncEntity.java

@@ -0,0 +1,57 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao.entity;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+import org.hibernate.annotations.DynamicInsert;
+
+import javax.persistence.*;
+
+/**
+ * @Description 考试记录同步表
+ * @Author lideyin
+ * @Date 2019/12/23 18:20
+ * @Version 1.0
+ */
+@Entity
+@Table(name = "ec_oe_exam_record_data_sync", indexes = {
+        @Index(name = "IDX_E_O_E_R_D_S_001", columnList = "cacheId", unique = true)
+})
+@DynamicInsert
+public class ExamRecordDataSyncEntity extends JpaEntity {
+
+    private static final long serialVersionUID = -1226407876493433911L;
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+    /**
+     * 缓存中的id
+     */
+    private Long cacheId;
+    /**
+     * 数据库中的id
+     */
+    private Long dbId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getCacheId() {
+        return cacheId;
+    }
+
+    public void setCacheId(Long cacheId) {
+        this.cacheId = cacheId;
+    }
+
+    public Long getDbId() {
+        return dbId;
+    }
+
+    public void setDbId(Long dbId) {
+        this.dbId = dbId;
+    }
+}

+ 218 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/entity/ExamSyncCaptureEntity.java

@@ -0,0 +1,218 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao.entity;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+import org.hibernate.annotations.DynamicInsert;
+
+import javax.persistence.*;
+
+/**
+ * @Description 网考同步抓拍表
+ * @Author lideyin
+ * @Date 2019/12/6 16:07
+ * @Version 1.0
+ */
+@Entity
+@Table(name = "ec_oe_exam_sync_capture", indexes = {
+        @Index(name = "IDX_E_O_E_C_001", columnList = "examRecordDataId, fileName", unique = true),
+        @Index(name = "IDX_E_O_E_C_002", columnList = "examRecordDataId")
+})
+@DynamicInsert
+public class ExamSyncCaptureEntity extends JpaEntity {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = -6162329876793785782L;
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+    /**
+     * ec_oe_exam_record_data  ID
+     */
+    private Long examRecordDataId;
+    /**
+     * 文件URL
+     */
+    private String fileUrl;
+
+    private String fileName;
+
+    /**
+     * 比较是否通过
+     */
+    @Column(name = "is_pass")
+    private Boolean isPass;
+
+    /**
+     * 人脸比较返回信息
+     */
+    @Column(name = "face_compare_result", length = 2000)
+    private String faceCompareResult;
+
+    /**
+     * 是否有陌生人
+     * 就是摄像头拍到不止考生一人
+     */
+    @Column(name = "is_stranger")
+    private Boolean isStranger;
+    /**
+     * 百度人脸关键点坐标结果
+     */
+    @Column(name = "landmark", length = 4000)
+    private String landmark;
+    /**
+     * 百度在线活体检测结果
+     */
+    @Column(name = "faceliveness_result", length = 2000)
+    private String facelivenessResult;
+
+    /**
+     * 从进入队列到处理完成的时间
+     */
+    private Long usedTime;
+
+    /**
+     * 从开始处理到处理完成的时间
+     */
+    private Long processTime;
+
+
+    /**
+     * 是否存在虚拟摄像头
+     */
+    @Column(name = "has_virtual_camera")
+    private Boolean hasVirtualCamera;
+
+    /**
+     * 摄像头信息
+     */
+    @Column(name = "camera_infos", length = 800)
+    private String cameraInfos;
+
+    /**
+     * 其他信息
+     */
+    @Column(name = "ext_msg", length = 800)
+    private String extMsg;
+
+    public ExamSyncCaptureEntity() {
+    }
+
+    public ExamSyncCaptureEntity(ExamCaptureQueueEntity examCaptureQueueEntity) {
+        this.examRecordDataId = examCaptureQueueEntity.getExamRecordDataId();
+        this.fileUrl = examCaptureQueueEntity.getFileUrl();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getExamRecordDataId() {
+        return examRecordDataId;
+    }
+
+    public void setExamRecordDataId(Long examRecordDataId) {
+        this.examRecordDataId = examRecordDataId;
+    }
+
+    public String getFileUrl() {
+        return fileUrl;
+    }
+
+    public void setFileUrl(String fileUrl) {
+        this.fileUrl = fileUrl;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public String getFaceCompareResult() {
+        return faceCompareResult;
+    }
+
+    public void setFaceCompareResult(String faceCompareResult) {
+        this.faceCompareResult = faceCompareResult;
+    }
+
+    public Boolean getIsPass() {
+        return isPass;
+    }
+
+    public void setIsPass(Boolean isPass) {
+        this.isPass = isPass;
+    }
+
+    public Boolean getIsStranger() {
+        return isStranger;
+    }
+
+    public void setIsStranger(Boolean isStranger) {
+        this.isStranger = isStranger;
+    }
+
+    public String getLandmark() {
+        return landmark;
+    }
+
+    public void setLandmark(String landmark) {
+        this.landmark = landmark;
+    }
+
+    public Long getUsedTime() {
+        return usedTime;
+    }
+
+    public void setUsedTime(Long usedTime) {
+        this.usedTime = usedTime;
+    }
+
+    public String getFacelivenessResult() {
+        return facelivenessResult;
+    }
+
+    public void setFacelivenessResult(String facelivenessResult) {
+        this.facelivenessResult = facelivenessResult;
+    }
+
+    public Long getProcessTime() {
+        return processTime;
+    }
+
+    public void setProcessTime(Long processTime) {
+        this.processTime = processTime;
+    }
+
+    public Boolean getHasVirtualCamera() {
+        return hasVirtualCamera;
+    }
+
+    public void setHasVirtualCamera(Boolean hasVirtualCamera) {
+        this.hasVirtualCamera = hasVirtualCamera;
+    }
+
+    public String getCameraInfos() {
+        return cameraInfos;
+    }
+
+    public void setCameraInfos(String cameraInfos) {
+        this.cameraInfos = cameraInfos;
+    }
+
+    public String getExtMsg() {
+        return extMsg;
+    }
+
+    public void setExtMsg(String extMsg) {
+        this.extMsg = extMsg;
+    }
+
+}

+ 15 - 3
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/enums/FaceVerifyResult.java

@@ -1,5 +1,7 @@
 package cn.com.qmth.examcloud.core.oe.admin.dao.enums;
 
+import org.apache.commons.lang3.StringUtils;
+
 /**
  * @author  	chenken
  * @date    	2018年2月5日 上午8:38:04
@@ -42,8 +44,18 @@ public enum FaceVerifyResult {
 	public void setDesc(String desc) {
 		this.desc = desc;
 	}
-	public static void main(String[] args) {
-		
+
+	public static FaceVerifyResult strToEnum(String name){
+		if(StringUtils.isBlank(name)){
+			return null;
+		}
+		for(FaceVerifyResult fr:FaceVerifyResult.values()){
+			if(name.equals(fr.name())){
+				return fr;
+			}
+		}
+
+		return null;
 	}
-}	
+}
 

+ 17 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamAuditService.java

@@ -42,14 +42,12 @@ public interface ExamAuditService {
      * @return
      */
     ExamAuditEntity getExamAuditByExamRecordDataId(Long examRecordDataId);
-    
+
     /**
      * 监考待审-批量审核
-     *
-     * @param examRecordIds
+     * @param examRecordDataIds
      * @param isPass
-     * @param disciplineDetail
-     * @param userId
+     * @param user
      */
     void batchAudit(List<Long> examRecordDataIds, Boolean isPass,User user);
 
@@ -67,6 +65,19 @@ public interface ExamAuditService {
 	 * @param redoAuditInfo
 	 * @param user
 	 */
-	public void redoAudit(RedoAuditInfo redoAuditInfo,User user);
+    void redoAudit(RedoAuditInfo redoAuditInfo, User user);
+
+    /**
+     * 活体检测失败,系统审核
+     * @param examRecordDataId
+     * @param rootOrgId
+     */
+    void saveExamAuditByFaceVerifyFailed(Long examRecordDataId, Long rootOrgId);
+
+    /**
+     * 抓拍照片为0,系统审核
+     * @param examRecordDataId
+     */
+    void saveExamAuditByNoPhoto(Long examRecordDataId);
 
 }

+ 152 - 56
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamAuditServiceImpl.java

@@ -7,62 +7,45 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper.EXAM_RECORD_DATA_ID;
-
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.commons.lang3.StringUtils;
-import org.hibernate.query.NativeQuery;
-import org.hibernate.transform.Transformers;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.google.common.collect.Lists;
-
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.Searcher;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamAuditRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamAuditEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordForMarkingEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.AuditStatus;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.DisciplineType;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.SelectType;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamAuditService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordQuestionsService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreObtainQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.admin.service.LocalCacheService;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditEntityConvert;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditQuery;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.RedoAuditInfo;
+import cn.com.qmth.examcloud.core.oe.admin.base.utils.CommonUtil;
+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.core.oe.admin.service.bean.examaudit.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.others.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
 import cn.com.qmth.examcloud.marking.api.MarkWorkCloudService;
 import cn.com.qmth.examcloud.marking.api.request.AppendMarkWorkPaperReq;
 import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
+import cn.com.qmth.examcloud.support.enums.FaceBiopsyScheme;
+import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.hibernate.query.NativeQuery;
+import org.hibernate.transform.Transformers;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.List;
+
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper.EXAM_RECORD_DATA_ID;
 
 /**
  * 考试记录审核相关接口
@@ -92,9 +75,27 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     @Autowired
     private ExamScoreObtainQueueService examScoreObtainQueueService;
     @Autowired
-    private LocalCacheService localCacheService;
-    @Autowired
     MarkWorkCloudService markWorkCloudService;
+    @Autowired
+    private ExamFaceLivenessVerifyRepo examFaceLivenessVerifyRepo;
+
+    @Autowired
+    private FaceBiopsyItemRepo faceBiopsyItemRepo;
+
+    /**
+     * 活体检测失败自动审核
+     */
+    private static final String FACE_LIVENESS_VERIFY_AUTO_AUDIT = "FACE_LIVENESS_VERIFY_AUTO_AUDIT";
+
+    /**
+     * 无照片自动审核
+     */
+    private static final String NOPHOTO_VERIFY_AUTO_AUDIT = "NOPHOTO_VERIFY_AUTO_AUDIT";
+
+    /**
+     * 系统审核
+     */
+    private static final String AUDIT_USER_NAME = "SYSTEM";
     @Override
     public Page<ExamAuditInfo> getExamAuditList(ExamAuditQuery query) {
         Check.isNull(query, "查询参数不能为空!");
@@ -269,7 +270,103 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 		}
 	}
 
-	/**
+    /**
+     * 活体检测失败,系统审核
+     *
+     * @param examRecordDataId
+     * @param rootOrgId
+     */
+    @Override
+    public void saveExamAuditByFaceVerifyFailed(Long examRecordDataId, Long rootOrgId) {
+        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(examRecordDataId);
+        if (examAudit != null) {
+            return;
+        }
+        ExamAuditEntity examAuditEntity = new ExamAuditEntity();
+        examAuditEntity.setExamRecordDataId(examRecordDataId);
+        examAuditEntity.setDisciplineType(DisciplineType.ACTION_FAILURE);
+        examAuditEntity.setUserId(FACE_LIVENESS_VERIFY_AUTO_AUDIT);//活体检测自动审核
+        examAuditEntity.setAuditUserName(AUDIT_USER_NAME);
+        examAuditEntity.setDisciplineDetail(getFaceVerifyDisciplineDetail(examRecordDataId, rootOrgId));//计算违纪描述
+        examAuditEntity.setStatus(AuditStatus.UN_PASS);
+        examAuditRepo.save(examAuditEntity);
+    }
+
+    /**
+     * 抓拍照片为0,系统审核
+     *
+     * @param examRecordDataId
+     */
+    @Override
+    public void saveExamAuditByNoPhoto(Long examRecordDataId) {
+        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(examRecordDataId);
+        if (examAudit != null) {
+            return;
+        }
+        ExamAuditEntity examAuditEntity = new ExamAuditEntity();
+        examAuditEntity.setExamRecordDataId(examRecordDataId);
+        examAuditEntity.setDisciplineType(DisciplineType.OTHER);
+        examAuditEntity.setDisciplineDetail("抓拍照片数量为0");
+        examAuditEntity.setUserId(NOPHOTO_VERIFY_AUTO_AUDIT);//抓拍照片为0自动审核
+        examAuditEntity.setAuditUserName(AUDIT_USER_NAME);
+        examAuditEntity.setStatus(AuditStatus.UN_PASS);
+        examAuditRepo.save(examAuditEntity);
+    }
+
+    //获取活检违纪详情
+    private String getFaceVerifyDisciplineDetail(Long examRecordDataId, Long rootOrgId) {
+        FaceBiopsyScheme faceBiopsyScheme = FaceBiopsyHelper.getFaceBiopsyScheme(rootOrgId);
+
+        //新活体检测方案从新表中取相关数据
+        if (faceBiopsyScheme == FaceBiopsyScheme.NEW) {
+            List<FaceBiopsyItemEntity> faceBiopsyItems = faceBiopsyItemRepo.findByExamRecordDataIdOrderByIdAsc(examRecordDataId);
+            //从未调过人脸检测接口,或者只调过接口但是未保存过结果(即未完成活检),则提示未进行人脸活体检测
+            if (faceBiopsyItems == null ||
+                    (faceBiopsyItems.size() == 1 && !faceBiopsyItems.get(0).getCompleted())) {
+                return "未进行人脸活体检测";
+            }
+
+            StringBuffer sbBuffer = new StringBuffer("");
+            for (FaceBiopsyItemEntity item : faceBiopsyItems) {
+                String startTime = CommonUtil.getDateStrWithSecond(item.getCreationTime());
+                String resultMsg = "";
+                if (null != item.getCompleted() && !item.getCompleted()) {
+                    resultMsg = "活检未完成";
+                } else {
+                    if (null != item.getResult() && item.getResult()) {
+                        resultMsg = "活检成功";
+                    } else {
+                        resultMsg = item.getErrorMsg() == null ? "" : item.getErrorMsg();
+                    }
+                }
+                sbBuffer.append(startTime + ":" + resultMsg);
+                sbBuffer.append("&&");
+            }
+            return sbBuffer.toString();
+        }
+        //旧活体检测方案从旧表中取相关数据
+        else {
+            List<ExamFaceLivenessVerifyEntity> faceVerifies =
+                    examFaceLivenessVerifyRepo.findByExamRecordDataIdOrderById(examRecordDataId);
+            if (faceVerifies == null || faceVerifies.size() == 0) {
+                return "未进行人脸动作检测";
+            } else {
+                StringBuffer sbBuffer = new StringBuffer("");
+                for (ExamFaceLivenessVerifyEntity faceVerify : faceVerifies) {
+                    String startTime = CommonUtil.getDateStrWithSecond(faceVerify.getStartTime());
+                    sbBuffer.append(startTime + ":" + FaceVerifyResult.getDescByName(faceVerify.getVerifyResult()));
+                    sbBuffer.append("&&");
+                }
+                String disciplineDetail = sbBuffer.toString();
+                if (disciplineDetail.length() > 500) {
+                    disciplineDetail = disciplineDetail.substring(0, 500);
+                }
+                return disciplineDetail;
+            }
+        }
+    }
+
+    /**
 	 * 重审后置处理
 	 * @param isPass
 	 * @param examRecordData
@@ -290,18 +387,17 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     	//审核通过且为非全客观题卷,保存阅卷需要数据
     	saveExamRecordForMarkingWithAudit(examRecordData);
     	//保存推送分数队列
-        examScorePushQueueService.saveScoreDataInfoToQueue(examRecordData, examRecordData.getId());
+        examScorePushQueueService.saveScoreDataInfoToQueue(examRecordData.getId());
         //保存获取分数队列
-        examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData);
+        examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData.getId());
         //发送通知
         examScoreObtainQueueService.sendObtainScoreNotify(examRecordData.getRootOrgId());
 	}
-	
-	/**
-	 * 审核通过且为非全客观题卷,保存阅卷需要数据
-	 * @param examRecordData
-	 * @param examScore
-	 */
+
+    /**
+     * 审核通过且为非全客观题卷,保存阅卷需要数据
+     * @param examRecordData
+     */
 	private void saveExamRecordForMarkingWithAudit(ExamRecordDataEntity examRecordData){
     	if(examRecordData.getIsAllObjectivePaper() != null && !examRecordData.getIsAllObjectivePaper()){
             ExamRecordForMarkingEntity examRecordForMarkingExists =
@@ -340,7 +436,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 			examRecordForMarkingRepo.delete(examRecordForMarking);
 		}
 		//保存获取分数队列
-        examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData);
+        examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData.getId());
         //发送通知
         examScoreObtainQueueService.sendObtainScoreNotify(examRecordData.getRootOrgId());
 	}