lideyin 5 anos atrás
pai
commit
c3d8e88a9c

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

@@ -346,24 +346,25 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
                 case FACE_COMPARE:
                     //如果第一步检测部分失败(照片非本人或检测中多人脸),需要结束考试
                     Map faceCompareResult = JsonUtil.fromJson(stepInfo.getResultJson(), Map.class);
+                    if (null != faceCompareResult) {
+                        if (null == faceCompareResult.get("isStranger") || null == faceCompareResult.get("isPass") ||
+                                null == faceCompareResult.get("existsSystemError")) {
+                            throw new StatusException("201007", "活体检测第一步检测结果的json串格式不正确");
+                        }
 
-                    if (null == faceCompareResult.get("isStranger") || null == faceCompareResult.get("isPass") ||
-                            null == faceCompareResult.get("existsSystemError")) {
-                        throw new StatusException("201007", "活体检测第一步检测结果的json串格式不正确");
-                    }
-
-                    Boolean isStranger = Boolean.valueOf(faceCompareResult.get("isStranger").toString());
-                    Boolean isPass = Boolean.valueOf(faceCompareResult.get("isPass").toString());
-                    Boolean existsSystemError = Boolean.valueOf(faceCompareResult.get("existsSystemError").toString());
-                    //case1.1.有陌生人(即多人脸),不管是否比对成功,直接结束考试
-                    if (isStranger) {
-                        return true;
-                    }
-                    //case1.2.无陌生人且检测失败且不是系统错误(即照片非本人或无人脸),也直接结束考试
-                    else {
-                        if (!isPass && !existsSystemError) {
+                        Boolean isStranger = Boolean.valueOf(faceCompareResult.get("isStranger").toString());
+                        Boolean isPass = Boolean.valueOf(faceCompareResult.get("isPass").toString());
+                        Boolean existsSystemError = Boolean.valueOf(faceCompareResult.get("existsSystemError").toString());
+                        //case1.1.有陌生人(即多人脸),不管是否比对成功,直接结束考试
+                        if (isStranger) {
                             return true;
                         }
+                        //case1.2.无陌生人且检测失败且不是系统错误(即照片非本人或无人脸),也直接结束考试
+                        else {
+                            if (!isPass && !existsSystemError) {
+                                return true;
+                            }
+                        }
                     }
                     break;
                 case HAPPY:
@@ -414,8 +415,12 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
 
         int verifyTimes = getVerifyTimes(examRecordDataId);
         //如果是第一次活检,且成功,且开启追加活检,则允许继续活检
-        if (verifyTimes == 1 && finalIsSuccess && isAddFaceVerifyOutFreezeTime(examRecordDataId)) {
-            return true;
+        //或者是第一次活检,且失败,则允许继续活检
+        if (verifyTimes == 1) {
+            if ((finalIsSuccess && isAddFaceVerifyOutFreezeTime(examRecordDataId)) ||
+                    !finalIsSuccess) {
+                return true;
+            }
         }
 
         //如果是第二次活检,且成功,且第一次活检失败,且开启追加活检,则允许继续活检