소스 검색

重构考试记录和考试记录属性的相关引用代码

lideyin 5 년 전
부모
커밋
fa9ab155ab

+ 8 - 4
examcloud-core-oe-face-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/face/service/impl/ExamCaptureServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.core.oe.student.face.service.impl;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.helpers.JsonHttpResponseHolder;
 import cn.com.qmth.examcloud.core.oe.common.base.Constants;
+import cn.com.qmth.examcloud.core.oe.common.base.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamCaptureEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamCaptureQueueStatus;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamProperties;
@@ -198,7 +199,8 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
                 //face++的结果检测到人脸,才执行百度活体检测
                 if (faceCompareResult.containsKey("confidence")) {
                     examCaptureQueue.setPass(calculateFaceCompareIsPass(faceCompareResult));
-                    examCaptureQueue.setStranger(calculateFaceCompareIsStranger(examCaptureQueue.getExamRecordDataId(), faceCompareResult));
+                    examCaptureQueue.setStranger(calculateFaceCompareIsStranger(examCaptureQueue.getExamRecordDataId(),
+                            examCaptureQueue.getStudentId(),faceCompareResult));
                     //更新队列状态为face++比对完成
                     examCaptureQueue.setStatus(ExamCaptureQueueStatus.PROCESS_FACE_COMPARE_COMPLETE);
                     disposeFaceCompareSuccessful(examCaptureQueue);
@@ -535,15 +537,17 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
      * @return
      * @throws JSONException
      */
-    private boolean calculateFaceCompareIsStranger(Long examRecordDataId, JSONObject jsonObject) {
+    private boolean calculateFaceCompareIsStranger(Long examRecordDataId,Long studentId, JSONObject jsonObject) {
         JSONArray face2Array = jsonObject.getJSONArray("faces2");
         //添加是否有陌生人开关功能
         ExamRecordPropertyCacheBean examRecordPropertyCache = CacheHelper.getExamRecordProperty(examRecordDataId);
         //默认开启了陌生人检测
         String isStrangerEnableStr = "true";
         if (examRecordPropertyCache != null) {
-            isStrangerEnableStr = CacheHelper.getExamOrgProperty(examRecordPropertyCache.getExamId(),
-                    examRecordPropertyCache.getOrgId(), ExamProperties.IS_STRANGER_ENABLE.name()).getValue();
+            isStrangerEnableStr = ExamCacheTransferHelper.getCachedExamProperty(examRecordPropertyCache.getExamId(),
+                    examRecordPropertyCache.getOrgId(),
+                    studentId,
+                    ExamProperties.IS_STRANGER_ENABLE.name()).getValue();
         }
         boolean isStranger;
         // 如果开启了陌生人检测才记录陌生人数据,否则认为没有陌生人