lideyin 5 年之前
父節點
當前提交
263e607dc9

+ 12 - 2
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/FaceBiopsyServiceImpl.java

@@ -113,7 +113,7 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
             }
 
             //如果第二次活检也失败,再次调用,则抛出异常
-            if (!secondFaceBiopsyItem.getResult()){
+            if (!secondFaceBiopsyItem.getResult()) {
                 throw new StatusException("201008", "非法请求,无活体检测机会");
             }
 
@@ -240,6 +240,7 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
         if (!verifySteps.stream().anyMatch(p -> null != p.getResult())) {
             throw new StatusException("201005", "检测结果不允许为空");
         }
+
         for (FaceBiopsyStepInfo stepInfo : verifySteps) {
             //如果检测结果为空,则直接跳过
             if (stepInfo.getResult() == null) {
@@ -310,8 +311,17 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
                     }
                     break;
             }
+        }
 
+        //如果当前为第二次活检,且第一次活检已经失败,本次活检也失败,则直接结束考试
+        if (verifyTimes == 2) {
+            FaceBiopsyItemEntity firstFaceBiopsyItem =
+                    faceBiopsyItemRepo.findFirstByExamRecordDataIdOrderByIdAsc(req.getExamRecordDataId());
+            if (!firstFaceBiopsyItem.getResult() && !finalIsSuccess) {
+                isEndExam = true;
+            }
         }
+
         //构建业务实体
         SaveFaceBiopsyResultResp resp = new SaveFaceBiopsyResultResp();
         resp.setEndExam(isEndExam);
@@ -821,6 +831,6 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
 
         //如果未开启人脸活体检测,则返回null
         return FaceBiopsyHelper.isFaceVerify(examRecordData.getRootOrgId(),
-                examRecordData.getExamId(),  examRecordData.getStudentId());
+                examRecordData.getExamId(), examRecordData.getStudentId());
     }
 }