lideyin 5 лет назад
Родитель
Сommit
47b1e8b737

+ 27 - 22
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/impl/ExamRecordDataServiceImpl.java

@@ -15,6 +15,7 @@ import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.support.enums.HandInExamType;
 import cn.com.qmth.examcloud.support.enums.IsSuccess;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
+import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -89,28 +90,32 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
     public ExamRecordData processAfterHandInExam(Long examRecordDataId) {
         ExamRecordData examRecordData = getExamRecordDataCache(examRecordDataId);
 
-        // 判断是否存在未处理的图片
-        boolean existUnhandledExamCaptureQueue = (examCaptureQueueRepo
-                .existsUnhandledByExamRecordDataId(examRecordDataId) != null);
-        if (existUnhandledExamCaptureQueue) {
-            throw new StatusException(Constants.CAPTURE_PROCESSING_STATUS_CODE, "PROCESSING");
-        }
-
-        // 计算人脸检测结果
-        CalculateFaceCheckResultInfo faceCheckResult = examCaptureService.calculateFaceCheckResult(examRecordDataId);
-        modifyExamRecordDataByFaceCheckResult(examRecordData, faceCheckResult);
-
-        // 计算活体检测结果
-        CalcFaceBiopsyResultReq req = new CalcFaceBiopsyResultReq();
-        req.setExamRecordDataId(examRecordDataId);
-        CalcFaceBiopsyResultResp calcFaceBiopsyResultResp = examRecordDataCloudService.calcFaceBiopsyResult(req);
-        modifyExamRecordDataByFaceBiopsyResult(examRecordData, calcFaceBiopsyResultResp);
-
-        // 违纪自动审核
-        Boolean isAudit = this.calcAutoAuditResult(faceCheckResult.getNoPhotoAndIllegality(),
-                calcFaceBiopsyResultResp.getFaceVerifyResult(), calcFaceBiopsyResultResp.getIllegality());
-        if (null != isAudit) {
-            examRecordData.setIsAudit(isAudit);
+        //只有开启的人脸的才会进行如下处理
+        if (FaceBiopsyHelper.isFaceEnable(examRecordData.getRootOrgId(),
+                examRecordData.getExamId(), examRecordData.getStudentId())) {
+            // 判断是否存在未处理的图片
+            boolean existUnhandledExamCaptureQueue = (examCaptureQueueRepo
+                    .existsUnhandledByExamRecordDataId(examRecordDataId) != null);
+            if (existUnhandledExamCaptureQueue) {
+                throw new StatusException(Constants.CAPTURE_PROCESSING_STATUS_CODE, "PROCESSING");
+            }
+
+            // 计算人脸检测结果
+            CalculateFaceCheckResultInfo faceCheckResult = examCaptureService.calculateFaceCheckResult(examRecordDataId);
+            modifyExamRecordDataByFaceCheckResult(examRecordData, faceCheckResult);
+
+            // 计算活体检测结果
+            CalcFaceBiopsyResultReq req = new CalcFaceBiopsyResultReq();
+            req.setExamRecordDataId(examRecordDataId);
+            CalcFaceBiopsyResultResp calcFaceBiopsyResultResp = examRecordDataCloudService.calcFaceBiopsyResult(req);
+            modifyExamRecordDataByFaceBiopsyResult(examRecordData, calcFaceBiopsyResultResp);
+
+            // 违纪自动审核
+            Boolean isAudit = this.calcAutoAuditResult(faceCheckResult.getNoPhotoAndIllegality(),
+                    calcFaceBiopsyResultResp.getFaceVerifyResult(), calcFaceBiopsyResultResp.getIllegality());
+            if (null != isAudit) {
+                examRecordData.setIsAudit(isAudit);
+            }
         }
 
         //自动计算客观分

+ 1 - 1
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/pipeline/SyncExamDataExecutor.java

@@ -104,7 +104,7 @@ public class SyncExamDataExecutor implements NodeExecuter<Long, ExamRecordData,
                     ExamRecordStatus.EXAM_AUTO_HAND_IN == examRecordData.getExamRecordStatus()) {
                 this.debugLog("prepare to execute last node's hand in data...", examRecordDataId);
 
-                examRecordDataService.processAfterHandInExam(examRecordDataId);
+                examRecordData = examRecordDataService.processAfterHandInExam(examRecordDataId);
 
                 this.debugLog("execute last node's hand in data success...", examRecordDataId);
             }