소스 검색

完善新活体代码

lideyin 5 년 전
부모
커밋
8b6f884eac

+ 7 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/FaceBiopsyService.java

@@ -29,4 +29,11 @@ public interface FaceBiopsyService {
      * @return
      */
     SaveFaceBiopsyResultResp saveFaceBiopsyResult(SaveFaceBiopsyResultReq req);
+
+    /**
+     * 获取人脸活体检测开始分钟数
+     * @param examRecordDataId 考试记录id
+     * @return Integer
+     */
+    Integer getFaceBiopsyStartMinute(Long examRecordDataId);
 }

+ 21 - 7
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -36,10 +36,7 @@ import cn.com.qmth.examcloud.reports.commons.bean.OnlineExamStudentReport;
 import cn.com.qmth.examcloud.reports.commons.bean.OnlineStudentReport;
 import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigDetailCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.*;
 import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
 import cn.com.qmth.examcloud.web.exception.SequenceLockException;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
@@ -140,6 +137,8 @@ public class ExamControlServiceImpl implements ExamControlService {
     private ExamCaptureQueueRepo examCaptureQueueRepo;
     @Autowired
     private ExamCaptureCloudService examCaptureCloudService;
+    @Autowired
+    FaceBiopsyService faceBiopsyService;
     @Value("${audio.app.url}")
     private String audioAppUrl;
     @Value("${$upyun.site.1.bucketName}")
@@ -155,6 +154,8 @@ public class ExamControlServiceImpl implements ExamControlService {
     @Value("${$upyun.site.1.domain}")
     private String upyunFileUrl;
 
+    private final String NEW_FACE_BIOPSY_SCHEME = "S2";
+
     @Transactional
     @Override
     public StartExamInfo startExam(Long examStudentId, User user) {
@@ -878,9 +879,22 @@ public class ExamControlServiceImpl implements ExamControlService {
             checkExamInProgressInfo.setInterruptNum(examingRecord.getContinuedCount());
 
             // 断点续考时重新计算活体检测的分钟数
-            checkExamInProgressInfo.setFaceVerifyMinute(examFaceLivenessVerifyService.getFaceLivenessVerifyMinute(
-                    examStudentEntity.getOrgId(), examStudentEntity.getExamId(),
-                    examingRecord.getExamRecordDataId(), examSessionInfo.getHeartbeat()));
+            Integer faceVerifyMinute = null;
+            OrgPropertyCacheBean orgProperty = CacheHelper.getOrgProperty(examStudentEntity.getRootOrgId(),
+                    Constants.IDENTIFICATION_OF_LIVING_BODY_SCHEME_KEY);
+
+            //如果是新活体检测方案,则使用新的计算方案计算活检开始时间
+            if (NEW_FACE_BIOPSY_SCHEME.equals(orgProperty.getValue())) {
+                faceVerifyMinute = examFaceLivenessVerifyService.getFaceLivenessVerifyMinute(
+                        examStudentEntity.getOrgId(), examStudentEntity.getExamId(),
+                        examingRecord.getExamRecordDataId(), examSessionInfo.getHeartbeat());
+            }
+            //非新活检,默认使用旧的活检计算方式
+            else {
+                faceVerifyMinute = faceBiopsyService.getFaceBiopsyStartMinute(examingRecord.getExamRecordDataId());
+            }
+
+            checkExamInProgressInfo.setFaceVerifyMinute(faceVerifyMinute);
             return checkExamInProgressInfo;
         }
     }

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

@@ -103,6 +103,20 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
         return resp;
     }
 
+    /**
+     * 获取人脸活体检测开始分钟数
+     * @param examRecordDataId 考试记录id
+     * @return Integer
+     */
+    @Override
+    public Integer getFaceBiopsyStartMinute(Long examRecordDataId) {
+        FaceBiopsyEntity faceBiopsyEntity = faceBiopsyRepo.findByExamRecordDataId(examRecordDataId);
+        if (faceBiopsyEntity == null) {
+            return null;
+        }
+        return calculateFaceBiopsyStartMinute(examRecordDataId, faceBiopsyEntity.getVerifiedTimes());
+    }
+
     /**
      * 构建保存人脸检测结果的业务实体
      *
@@ -411,7 +425,6 @@ public class FaceBiopsyServiceImpl implements FaceBiopsyService {
         return faceBiopsyEntity.getId();
     }
 
-
     /**
      * 计算人脸活体检测开始分钟数
      *