瀏覽代碼

Merge remote-tracking branch 'origin/FaceScenic_V2_baiduface' into FaceScenic_V2_baiduface

xwh 1 月之前
父節點
當前提交
c24b32851f

+ 24 - 1
app/src/main/java/com/hanghui/senic/baiduface/BaiduFacePreviewActivity.java

@@ -150,6 +150,16 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
     private ImageView iv_please_scanface;
     Handler faceFailedHandler = new Handler(Looper.getMainLooper());//刷脸连续未通过后使用handler延时一定时间后,显示失败结果页
     String mDeviceModel = DeviceUtils.getDeviceModel();
+    volatile String userIdUniqueId = "";
+    /**
+     * 清除同人脸间隔判断保存的userID
+     */
+    private Runnable userIdUniqueIdRunnable = new Runnable() {
+        @Override
+        public void run() {
+            userIdUniqueId = "";
+        }
+    };
 
     private Handler mHandler = new Handler(Looper.getMainLooper()) {
         @Override
@@ -798,6 +808,10 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         if (user == null) {
             return;
         }
+        //同人脸判断是否在规定时间内
+        if (userIdUniqueId.equals(StringIsNull.ReturnString(user.getUserId()))){
+            return;
+        }
         invoke_StopVerify();
         TaskStatus.setStatus(TaskStatus.TASK_STATUS_FACE);
         TaskStatus.setCurrentTask(TaskStatus.CURRENT_TASSK_LOCAL_FACE);
@@ -831,6 +845,15 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
             return;
         }
 
+        //判断1:N刷脸 同人脸间隔
+        if(ConfigManager.getAuthenticationBeanListBean().getSameFaceInterval() > 0){
+            userIdUniqueId = StringIsNull.ReturnString(user.getUserId());
+            //销毁延时器,重新计时
+            AppHandler.getHandler().removeCallbacks(userIdUniqueIdRunnable);
+            AppHandler.getHandler().postDelayed(userIdUniqueIdRunnable,
+                    ConfigManager.getAuthenticationBeanListBean().getSameFaceInterval() * 1000);
+        }
+
         AppLogUtils.i(true, TAG, "doScanFaceResult_Success(), 请求结果页");
 
         Constants.IDCARD_TYPE = 0;
@@ -880,7 +903,7 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         long curTime = System.currentTimeMillis();
 
         //已过期
-        if (curTime < startTime || curTime > endTime) {
+        if (curTime <= startTime || curTime >= endTime) {
 
             FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", "不在有效期", 500, "不在有效期");
             BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);

+ 12 - 2
app/src/main/java/com/hanghui/senic/bean/AuthenticationBean.java

@@ -488,6 +488,18 @@ public class AuthenticationBean {
         private String transitPushEncryptPrivateKey;//进出记录推送数据是否加解密PrivateKey
         @SerializedName("validTimeSwitch")
         private Boolean validTimeSwitch;//是否启用有效时间 默认-false
+        @SerializedName("sameFaceInterval")
+        private Integer sameFaceInterval;//1:N 同人脸间隔时间
+        @SerializedName("serverTime")
+        private long serverTime;//服务器时间
+
+        public Integer getSameFaceInterval() {
+            return sameFaceInterval;
+        }
+
+        public void setSameFaceInterval(Integer sameFaceInterval) {
+            this.sameFaceInterval = sameFaceInterval;
+        }
 
         public Boolean getValidTimeSwitch() {
             return validTimeSwitch;
@@ -496,8 +508,6 @@ public class AuthenticationBean {
         public void setValidTimeSwitch(Boolean validTimeSwitch) {
             this.validTimeSwitch = validTimeSwitch;
         }
-        @SerializedName("serverTime")
-        private long serverTime;//服务器时间
 
         public Boolean getTransitPushSwitch() {
             return transitPushSwitch;

+ 3 - 0
app/src/main/java/com/hanghui/senic/common/gson/CompleteDataUtil.java

@@ -475,6 +475,9 @@ public class CompleteDataUtil {
 
     //补全在线配置数据类型为int、boolean类型的字段
     public static void completeData(AuthenticationBean authenticationBean) {
+        if (authenticationBean.getData().get(0).getSameFaceInterval() == null){
+            authenticationBean.getData().get(0).setSameFaceInterval(0);
+        }
         if (authenticationBean.getData().get(0).getValidTimeSwitch() == null){
             authenticationBean.getData().get(0).setValidTimeSwitch(false);
         }