Forráskód Böngészése

update syncExamData...

deason 1 éve
szülő
commit
093dd54425

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

@@ -157,6 +157,10 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         // 是否开启人脸验证
         boolean isFaceEnable = FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId);
 
+        // 是否开启审核全通过
+        ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examId, ExamProperties.AUDIT_ALL_PASS.name());
+        boolean isAuditAllPass = examProperty != null && StringUtil.isTrue(examProperty.getValue());
+
         //先更新考生的考试次数
         updateExamStudent(examStudentId);
 
@@ -213,22 +217,24 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
             examAuditService.saveExceedMaxSwitchScreenCount(realExamRecordDataId);
         }
 
-        if (null == req.getExamSyncCapture()) {
-            //开启摄像头
-            if (isFaceEnable) {
+        //若开启人脸验证
+        if (isFaceEnable) {
+            if (req.getExamSyncCapture() == null) {
+                //无“开考人脸识别验证”结果
                 examAuditService.saveHeaderWarnAudit(realExamRecordDataId);
             }
-        }
 
-        //如果开启了活检
-        if (isFaceEnable) {
-            //计算违纪自动审核结果(无人脸或活检失败)
-            boolean isNoPhotoAndIllegality = (null == req.getExamCaptures() || req.getExamCaptures().isEmpty());//是否无照片
+            //无“人脸抓拍比对”结果
+            boolean isNoPhotoAndIllegality = CollectionUtils.isEmpty(req.getExamCaptures());
+
+            //计算违纪自动审核结果(无人脸抓拍比对 或 活检失败)
             saveAutoAudit(tempExamRecordData, isNoPhotoAndIllegality, realExamRecordDataId);
         }
 
         //若开启审核全通过
-        auditPassExamRecordData(examId, realExamRecordDataId);
+        if (isAuditAllPass) {
+            auditPassExamRecordData(realExamRecordDataId);
+        }
 
         //计算最终分数(这个步骤必须放在所有改变“违纪、警告、审核状态”的操作之后)
         if (ExamType.ONLINE.name().equals(examType) || ExamType.ONLINE_HOMEWORK.name().equals(examType)
@@ -254,23 +260,20 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         return new SyncExamDataResp();
     }
 
-    private void auditPassExamRecordData(Long examId, Long realExamRecordDataId) {
+    private void auditPassExamRecordData(Long realExamRecordDataId) {
         //开启审核全通过
-        ExamPropertyCacheBean ep = CacheHelper.getExamProperty(examId, ExamProperties.AUDIT_ALL_PASS.name());
-        if (ep != null && StringUtil.isTrue(ep.getValue())) {
-            Optional<ExamRecordDataEntity> optional = examRecordDataRepo.findById(realExamRecordDataId);
-            if (optional.isPresent()) {
-                // 修改考试记录为已审
-                ExamRecordDataEntity entity = optional.get();
-                entity.setIsWarn(false);
-                entity.setIsIllegality(false);
-                if (examAuditService.updateExamAuditByAllPass(realExamRecordDataId)) {
-                    entity.setIsAudit(true);
-                } else {
-                    entity.setIsAudit(false);
-                }
-                examRecordDataRepo.save(entity);
+        Optional<ExamRecordDataEntity> optional = examRecordDataRepo.findById(realExamRecordDataId);
+        if (optional.isPresent()) {
+            // 修改考试记录为已审
+            ExamRecordDataEntity entity = optional.get();
+            entity.setIsWarn(false);
+            entity.setIsIllegality(false);
+            if (examAuditService.updateExamAuditByAllPass(realExamRecordDataId)) {
+                entity.setIsAudit(true);
+            } else {
+                entity.setIsAudit(false);
             }
+            examRecordDataRepo.save(entity);
         }
     }