瀏覽代碼

交卷后续处理,代码重构及bug fix

lideyin 5 年之前
父節點
當前提交
d60591ddf9

+ 12 - 1
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamScoreDataCloudServiceProvider.java

@@ -3,6 +3,9 @@ package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 import java.util.ArrayList;
 import java.util.List;
 
+import cn.com.qmth.examcloud.support.Constants;
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
+import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -258,7 +261,15 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
                     JSONObject resultJson = jsonObject.getJSONObject("result");
                     if (resultJson.has("face_liveness")) {
                         double faceLivenessVal = resultJson.getDouble("face_liveness");
-                        double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
+
+                        Double baiduFacelivenessThreshold;
+                        SysPropertyCacheBean baiduFacelivenessThresholdProperty = CacheHelper.getSysProperty("$baidu.faceliveness.threshold");
+                        if (!baiduFacelivenessThresholdProperty.getHasValue()) {
+                            baiduFacelivenessThreshold = Constants.DEFAULT_BAIDU_FACELIVENESS_THRESHOLD;
+                        } else {
+                            baiduFacelivenessThreshold = Double.valueOf(baiduFacelivenessThresholdProperty.getValue().toString());
+                        }
+
                         if (faceLivenessVal > baiduFacelivenessThreshold) {
                             return true;
                         }

+ 12 - 1
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java

@@ -20,6 +20,9 @@ import cn.com.qmth.examcloud.core.oe.admin.service.ExamCaptureService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examcapture.ExamCaptureAuditInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examcapture.ExamCaptureInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.others.ExamCacheTransferHelper;
+import cn.com.qmth.examcloud.support.Constants;
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
+import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
 import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import com.google.common.collect.Lists;
@@ -202,7 +205,15 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
 					JSONObject resultJson = jsonObject.getJSONObject("result");
 					if(resultJson.has("face_liveness")){
 						double faceLivenessVal = resultJson.getDouble("face_liveness");
-						double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
+
+                        Double baiduFacelivenessThreshold;
+                        SysPropertyCacheBean baiduFacelivenessThresholdProperty = CacheHelper.getSysProperty("$baidu.faceliveness.threshold");
+                        if (!baiduFacelivenessThresholdProperty.getHasValue()) {
+                            baiduFacelivenessThreshold = Constants.DEFAULT_BAIDU_FACELIVENESS_THRESHOLD;
+                        } else {
+                            baiduFacelivenessThreshold = Double.valueOf(baiduFacelivenessThresholdProperty.getValue().toString());
+                        }
+
 						if(faceLivenessVal > baiduFacelivenessThreshold){
 							return true;
 						}