deason 2 lat temu
rodzic
commit
f25f86b757

+ 11 - 10
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/job/FaceVerifyJobHandler.java

@@ -8,7 +8,6 @@ import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamCaptureQueueEntity;
 import cn.com.qmth.examcloud.core.oe.student.dao.enums.ExamCaptureQueueStatus;
 import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
 import cn.com.qmth.examcloud.starters.face.verify.common.CommonUtils;
-import cn.com.qmth.examcloud.starters.face.verify.common.FaceVerifyException;
 import cn.com.qmth.examcloud.starters.face.verify.model.FaceResult;
 import cn.com.qmth.examcloud.starters.face.verify.model.param.ImageBase64Parm;
 import cn.com.qmth.examcloud.starters.face.verify.model.param.ImageParm;
@@ -130,9 +129,9 @@ public class FaceVerifyJobHandler {
                         faceCompareResult = faceVerifyService.faceCompareByFacePlus(basePhoto, capturePhoto);
                     }
 
-                    if (!faceCompareResult.isApiSuccess()) {
-                        throw new FaceVerifyException(faceCompareResult.getError());
-                    }
+                    // if (!faceCompareResult.needReTry()) {
+                    //     throw new FaceVerifyException(faceCompareResult.getError());
+                    // }
 
                     queue.setIsPass(faceCompareResult.isPass());
                     queue.setFaceCompareResult(faceCompareResult.getJsonResult());
@@ -156,6 +155,8 @@ public class FaceVerifyJobHandler {
                     if (!faceCompareResult.isPass()) {
                         queue.setExtMsg(faceCompareResult.getError());
                     }
+
+                    examCaptureQueueRepo.save(queue);
                 }
             } catch (Exception e) {
                 int errorNum = queue.getErrorNum() != null ? queue.getErrorNum() : 0;
@@ -166,13 +167,13 @@ public class FaceVerifyJobHandler {
                 log.error("人脸比对错误!examRecordDataId:{} queueId:{} errorNum:{} error:{}", queue.getExamRecordDataId(),
                         queue.getId(), queue.getErrorNum(), e.getMessage());
                 examCaptureQueueRepo.save(queue);
-                return;
+                continue;
             }
 
             if (errFaceNum) {
                 // 没有检测到正常人脸,直接保存人脸检测最终结果并删除该队列记录
                 this.saveExamCaptureAndDeleteQueue(queue);
-                return;
+                continue;
             }
 
             try {
@@ -180,9 +181,9 @@ public class FaceVerifyJobHandler {
                 FaceResult faceLivenessResult = faceVerifyService.faceVerifyByBaidu(capturePhoto);
                 queue.setFacelivenessResult(faceLivenessResult.getJsonResult());
 
-                if (!faceLivenessResult.isApiSuccess()) {
-                    throw new FaceVerifyException(faceLivenessResult.getError());
-                }
+                // if (!faceLivenessResult.needReTry()) {
+                //     throw new FaceVerifyException(faceLivenessResult.getError());
+                // }
 
                 if (!faceLivenessResult.isPass()) {
                     queue.setExtMsg(faceLivenessResult.getError());
@@ -196,7 +197,7 @@ public class FaceVerifyJobHandler {
                 log.error("人脸活体检测错误!examRecordDataId:{} queueId:{} errorNum:{} error:{}", queue.getExamRecordDataId(),
                         queue.getId(), queue.getErrorNum(), e.getMessage());
                 examCaptureQueueRepo.save(queue);
-                return;
+                continue;
             }
 
             // 保存人脸检测最终结果并删除该队列记录