deason 1 jaar geleden
bovenliggende
commit
5f6ba9ae08

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

@@ -166,27 +166,27 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         // 是否开启人脸验证
         boolean isFaceEnable = FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId);
 
-        // 是否开启考中人脸活体检测
-        boolean isFaceVerify = FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, studentId);
+        boolean skipFace = false, isFaceVerify = false, isFaceVerifyForceExit = false, isVirtualCameraAuditEnabled = false;
+        if (isFaceEnable) {
+            // 检查当前考生是否跳过人脸识别
+            skipFace = this.checkExamSkipFace(examId, examStudentId);
+
+            // 是否开启考中人脸活体检测
+            isFaceVerify = FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, studentId);
 
-        // 是否考中活体不通过强制退出
-        ExamPropertyCacheBean faceVerifyForceExitProperty = CacheHelper.getExamProperty(examId, ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
-        boolean isFaceVerifyForceExit = faceVerifyForceExitProperty != null && StringUtil.isTrue(faceVerifyForceExitProperty.getValue());
+            // 是否考中活体不通过强制退出
+            ExamPropertyCacheBean faceVerifyForceExitProperty = CacheHelper.getExamProperty(examId, ExamProperties.FACE_VERIFY_FORCE_EXIT.name());
+            isFaceVerifyForceExit = faceVerifyForceExitProperty != null && StringUtil.isTrue(faceVerifyForceExitProperty.getValue());
 
-        // 是否开启虚拟摄像头进入待审核
-        ExamPropertyCacheBean virtualCameraAuditEnabledProperty = CacheHelper.getExamProperty(examId, ExamProperties.VIRTUAL_CAMERA_AUDIT_ENABLED.name());
-        boolean isVirtualCameraAuditEnabled = virtualCameraAuditEnabledProperty != null && StringUtil.isTrue(virtualCameraAuditEnabledProperty.getValue());
+            // 是否开启虚拟摄像头进入待审核
+            ExamPropertyCacheBean virtualCameraAuditEnabledProperty = CacheHelper.getExamProperty(examId, ExamProperties.VIRTUAL_CAMERA_AUDIT_ENABLED.name());
+            isVirtualCameraAuditEnabled = virtualCameraAuditEnabledProperty != null && StringUtil.isTrue(virtualCameraAuditEnabledProperty.getValue());
+        }
 
         // 是否开启审核全通过
         ExamPropertyCacheBean auditAllPassProperty = CacheHelper.getExamProperty(examId, ExamProperties.AUDIT_ALL_PASS.name());
         boolean isAuditAllPass = auditAllPassProperty != null && StringUtil.isTrue(auditAllPassProperty.getValue());
 
-        // 检查当前考生是否跳过人脸识别
-        boolean skipFace = false;
-        if (isFaceEnable) {
-            skipFace = this.checkExamSkipFace(examId, examStudentId);
-        }
-
         //先更新考生的考试次数
         updateExamStudent(examStudentId);
 
@@ -226,6 +226,8 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         //同步活检结果: FACE_CLIENT("S3", "C端活体检测方案")
         syncFaceLiveVerifyRecords(req.getFaceLiveVerifyRecords(), realExamRecordDataId);
 
+        // ******************** 处理违纪、异常、审核等场景 start ********************
+
         //【违纪】非法考生端应用
         String illegalReason = redisClient.get(CacheConstants.CACHE_OE_DISCIPLINE_ILLEGAL_CLIENT + tempExamRecordDataId, String.class);
         if (StringUtils.isNotEmpty(illegalReason)) {
@@ -307,6 +309,8 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
             LOG.warn("{}_{}_{} AuditAllPass...", studentId, tempExamRecordDataId, realExamRecordDataId);
         }
 
+        // ******************** 处理违纪、异常、审核等场景 end ********************
+
         //计算最终分数(这个步骤必须放在所有改变“违纪、警告、审核状态”的操作之后)
         if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)
                 || ExamType.OFFLINE.name().equals(examType)) {
@@ -335,11 +339,12 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         //开启审核全通过
         Optional<ExamRecordDataEntity> optional = examRecordDataRepo.findById(realExamRecordDataId);
         if (optional.isPresent()) {
+            boolean isPass = examAuditService.updateExamAuditByAllPass(realExamRecordDataId);
             // 修改考试记录为已审
             ExamRecordDataEntity entity = optional.get();
             entity.setIsWarn(false);
             entity.setIsIllegality(false);
-            if (examAuditService.updateExamAuditByAllPass(realExamRecordDataId)) {
+            if (isPass) {
                 entity.setIsAudit(true);
             } else {
                 entity.setIsAudit(false);

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

@@ -528,8 +528,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
      */
     @Override
     public void saveExamAuditByFaceVerifyFailed(Long examRecordDataId, Long rootOrgId) {
-        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(examRecordDataId);
-        if (examAudit != null) {
+        boolean exist = examAuditRepo.existsByExamRecordDataId(examRecordDataId);
+        if (exist) {
             return;
         }
         ExamAuditEntity examAuditEntity = new ExamAuditEntity();
@@ -549,8 +549,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
      */
     @Override
     public void saveExamAuditByNoPhoto(Long examRecordDataId) {
-        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(examRecordDataId);
-        if (examAudit != null) {
+        boolean exist = examAuditRepo.existsByExamRecordDataId(examRecordDataId);
+        if (exist) {
             return;
         }
         ExamAuditEntity examAuditEntity = new ExamAuditEntity();
@@ -588,8 +588,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 
     @Override
     public void saveHeaderWarnAudit(Long realExamRecordDataId) {
-        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(realExamRecordDataId);
-        if (examAudit != null) {
+        boolean exist = examAuditRepo.existsByExamRecordDataId(realExamRecordDataId);
+        if (exist) {
             return;
         }
         ExamAuditEntity examAuditEntity = new ExamAuditEntity();
@@ -775,8 +775,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 
     @Override
     public void saveExceedMaxSwitchScreenCount(Long realExamRecordDataId) {
-        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(realExamRecordDataId);
-        if (examAudit != null) {
+        boolean exist = examAuditRepo.existsByExamRecordDataId(realExamRecordDataId);
+        if (exist) {
             return;
         }
         ExamAuditEntity examAuditEntity = new ExamAuditEntity();