2 次代码提交 1e7b7f6c91 ... 6f68f776b4

作者 SHA1 备注 提交日期
  xwh 6f68f776b4 Merge remote-tracking branch 'origin/FaceScenic_V2_baiduface' into FaceScenic_V2_baiduface 2 周之前
  xwh 952e09c481 feat:悬浮(无核验)类型样式 2 周之前

+ 2 - 2
app/build.gradle

@@ -16,8 +16,8 @@ android {
         applicationId "com.hanghui.senic"
         minSdkVersion 22
         targetSdkVersion 22
-        versionCode 146
-        versionName "1.3.2.241220"
+        versionCode 147
+        versionName "1.3.2.241226"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         ndk {
             abiFilters "armeabi-v7a"   //armeabi-v7a 'arm64-v8a'

+ 42 - 0
app/src/main/java/com/hanghui/senic/ShowBaiDuFaceResultEvent.java

@@ -0,0 +1,42 @@
+package com.hanghui.senic;
+
+/**
+ * Description: $
+ *
+ * @author xwh
+ * time 2024/12/25
+ **/
+public class ShowBaiDuFaceResultEvent {
+    String msgStrString ,voiceStr;
+    boolean isSuucess;
+
+    public ShowBaiDuFaceResultEvent(String msgStrString, String voiceStr, boolean isSuucess) {
+        this.msgStrString = msgStrString;
+        this.voiceStr = voiceStr;
+        this.isSuucess = isSuucess;
+    }
+
+    public String getMsgStrString() {
+        return msgStrString;
+    }
+
+    public void setMsgStrString(String msgStrString) {
+        this.msgStrString = msgStrString;
+    }
+
+    public String getVoiceStr() {
+        return voiceStr;
+    }
+
+    public void setVoiceStr(String voiceStr) {
+        this.voiceStr = voiceStr;
+    }
+
+    public boolean isSuucess() {
+        return isSuucess;
+    }
+
+    public void setSuucess(boolean suucess) {
+        isSuucess = suucess;
+    }
+}

+ 14 - 0
app/src/main/java/com/hanghui/senic/baiduface/BaiDuFaceResultPageListener.java

@@ -0,0 +1,14 @@
+package com.hanghui.senic.baiduface;
+
+import com.hanghui.senic.bean.FederatedPlatformsResponseBean;
+
+/**
+ * Description: $
+ *
+ * @author xwh
+ * time 2024/12/25
+ **/
+public interface BaiDuFaceResultPageListener {
+
+    public void showUI(String msgStr,String voiceStr);
+}

+ 12 - 1
app/src/main/java/com/hanghui/senic/baiduface/BaiduFaceController.java

@@ -3,6 +3,7 @@ package com.hanghui.senic.baiduface;
 
 import android.app.Activity;
 
+import com.hanghui.senic.ShowBaiDuFaceResultEvent;
 import com.hanghui.senic.activity.view.BaiDuFaceView;
 import com.hanghui.senic.bean.FederatedPlatformsResponseBean;
 import com.hanghui.senic.common.DataManager;
@@ -11,6 +12,8 @@ import com.hanghui.senic.controller.BaseController;
 import com.hanghui.senic.service.usbserialdemo.utile.ConfigManager;
 import com.hanghui.senic.service.usbserialdemo.utile.loacat.AppLogUtils;
 
+import org.greenrobot.eventbus.EventBus;
+
 
 /**
  * 百度刷脸
@@ -96,7 +99,15 @@ public class BaiduFaceController extends BaseController {
                     ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneTips(),
                     BaiDuFaceView.PAGE_TYPE_PERSON_CARD_HINT,
                     ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneVoice());
-            BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+
+            if(ConfigManager.getAuthenticationBeanListBean().getLocalBaiduFace()){
+                EventBus.getDefault().post(new ShowBaiDuFaceResultEvent(
+                        ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneTips()
+                ,ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneVoice(),true));
+            }else{
+                BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+            }
+
         }
 
 

+ 58 - 5
app/src/main/java/com/hanghui/senic/baiduface/BaiduFacePreviewActivity.java

@@ -24,6 +24,7 @@ import com.baidu.idl.main.facesdk.model.BDFaceSDKCommon;
 import com.baidu.idl.main.facesdk.model.SingleBaseConfig;
 import com.baidu.idl.main.facesdk.utils.FaceUtils;
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
 import com.bumptech.glide.request.RequestOptions;
 import com.example.datalibrary.callback.CameraDataCallback;
 import com.example.datalibrary.callback.FaceDetectCallBack;
@@ -42,9 +43,12 @@ import com.example.datalibrary.utils.ToastUtils;
 import com.google.gson.Gson;
 import com.hanghui.senic.MyAppliction;
 import com.hanghui.senic.R;
+import com.hanghui.senic.ShowBaiDuFaceResultEvent;
 import com.hanghui.senic.activity.view.BaiDuFaceView;
 import com.hanghui.senic.activity.view.ClickButtonFloatView;
 import com.hanghui.senic.baiduface.view.BaiduPreviewTexture;
+import com.hanghui.senic.baiduface.view.BaiduResultView;
+import com.hanghui.senic.bean.AuthenticationBean;
 import com.hanghui.senic.bean.FederatedPlatformsRequestBean;
 import com.hanghui.senic.bean.FederatedPlatformsResponseBean;
 import com.hanghui.senic.bean.PADQREvent;
@@ -55,6 +59,7 @@ import com.hanghui.senic.common.Constants;
 import com.hanghui.senic.common.DataManager;
 import com.hanghui.senic.common.DataReturns;
 import com.hanghui.senic.common.DeviceExpireManager;
+import com.hanghui.senic.common.MTTSManager;
 import com.hanghui.senic.common.TaskStatus;
 import com.hanghui.senic.common.ThreadPoolManager;
 import com.hanghui.senic.common.UserInfoManager;
@@ -65,6 +70,7 @@ import com.hanghui.senic.network.HttpRequest;
 import com.hanghui.senic.service.usbserialdemo.utile.ConfigManager;
 import com.hanghui.senic.service.usbserialdemo.utile.StringIsNull;
 import com.hanghui.senic.service.usbserialdemo.utile.StringUtils;
+import com.hanghui.senic.service.usbserialdemo.utile.X1.RelaysAndLedUtile;
 import com.hanghui.senic.service.usbserialdemo.utile.devicesUI.BaseDeviceUI;
 import com.hanghui.senic.service.usbserialdemo.utile.devicesUI.DeviceUtils;
 import com.hanghui.senic.service.usbserialdemo.utile.loacat.AppLogUtils;
@@ -99,7 +105,7 @@ import java.util.List;
  * <p>
  * 本地5w条人脸时1:n比对要多少秒
  */
-public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
+public class BaiduFacePreviewActivity extends BaiduFaceMainActivity implements BaiduResultView.BaiduFaceResultCallback {
 
     private static final String TAG = "BaiduFaceActivity";
 
@@ -118,7 +124,7 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
     private static final int PERFER_HEIGH = SingleBaseConfig.getBaseConfig().getRgbAndNirHeight();
 
 
-    private User mUser;//上一次识别到的人
+    private volatile User mUser;//上一次识别到的人
 
 
     private int MODE_SCANFACE = 3;//纯刷脸
@@ -151,6 +157,10 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
     Handler faceFailedHandler = new Handler(Looper.getMainLooper());//刷脸连续未通过后使用handler延时一定时间后,显示失败结果页
     String mDeviceModel = DeviceUtils.getDeviceModel();
     volatile String userIdUniqueId = "";
+
+
+    private BaiduResultView baiduResultView;
+
     /**
      * 清除同人脸间隔判断保存的userID
      */
@@ -439,9 +449,12 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         RequestOptions options = new RequestOptions().placeholder(R.mipmap.please_scanface).error(R.mipmap.please_scanface)
                 .diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true);
         ImageLoaderUtils.loadImage(ConfigManager.getAuthenticationBeanListBean().getPreviewPageUrl(), iv_please_scanface, options);
-
+        baiduResultView=findViewById(R.id.result_view);
+        baiduResultView.setBaiduFaceResultCallback(this);
+        baiduResultView.setVisibility(View.INVISIBLE);
     }
 
+
     private void showResultPage() {
         baiDuView_FloatingResultPageFrame.setVisibility(View.GONE);
         baiDuView_GeneralResultPageFrame.setVisibility(View.GONE);
@@ -590,6 +603,11 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
 
                         if (isNeedVerify) {
 
+
+                            if(ConfigManager.getAuthenticationBeanListBean().getLocalBaiduFace()){
+                                baiduResultView.result(livenessModel,bdFaceCheckConfig.getFeatureCheckMode());
+                                return;
+                            }
      /*                               AppHandler.getHandler().post(new Runnable() {
                                         @Override
                                         public void run() {
@@ -654,7 +672,7 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         if (glMantleSurfacView == null) {
             return;
         }
-        glMantleSurfacView.onGlDraw(livenessModel.getTrackFaceInfo(),
+        glMantleSurfacView.onGlDraw(livenessModel.getFaceInfo(),
                 livenessModel.getBdFaceImageInstance(),
                 FaceOnDrawTexturViewUtil.drawFaceColor(mUser, livenessModel), ConfigManager.getAuthenticationBeanListBean().getFaceFollowBoxSwitch());
 
@@ -713,7 +731,6 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
     private void invoke_ScanFace() {
 
         isNeedVerify = true;
-
         bdFaceCheckConfig = FaceUtils.getInstance().getBDFaceCheckConfig();
 
     }
@@ -1205,6 +1222,12 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", msg, 500, openVoiceMsg, true);
         isCreatedRunnable = false;
         startTime = 0L;
+
+        if (baiduResultView != null && ConfigManager.getAuthenticationBeanListBean().getLocalBaiduFace()) {
+            baiduResultView.showResultPageUI(false, msg, openVoiceMsg);
+            return;
+        }
+
         if (ConfigManager.isPreCheck()) {
             AppLogUtils.i(false, TAG, "doPersonCardResult_fail(), 预检查");
             DataReturns.getInstance().doDataReturns(federatedPlatformsResponseBean, DataReturns.FACE_DATA_VIRTUAL);
@@ -1237,5 +1260,35 @@ public class BaiduFacePreviewActivity extends BaiduFaceMainActivity {
         }
 
     }
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    public void showBaiDuFaceResultEvent(ShowBaiDuFaceResultEvent event) {
+        if (event == null || baiduResultView == null) {
+            return;
+        }
+        baiduResultView.showResultPageUI(event.isSuucess(),event.getMsgStrString(),event.getVoiceStr());
+
+    }
+
+
+
+    @Override
+    public void personCardinvokeStopVerify() {
+        AppHandler.getHandler().removeCallbacks(mPersonCardTimeoutRunnable);
+        invoke_StopVerify();
+    }
+
+    @Override
+    public void invokeStopVerify() {
+        invoke_StopVerify();
+    }
 
+    @Override
+    public void invokeResume() {
+        isNeedVerify = true;
+        if(bdFaceCheckConfig==null){
+            bdFaceCheckConfig=FaceUtils.getInstance().getBDFaceCheckConfig();
+        }
+        bdFaceCheckConfig.setFeatureCheckMode(3);
+       // invoke_Resume();
+    }
 }

+ 949 - 0
app/src/main/java/com/hanghui/senic/baiduface/view/BaiduResultView.java

@@ -0,0 +1,949 @@
+package com.hanghui.senic.baiduface.view;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.os.Looper;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+import androidx.core.content.ContextCompat;
+
+import com.baidu.idl.main.facesdk.model.BDFaceImageInstance;
+import com.baidu.idl.main.facesdk.model.SingleBaseConfig;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.bumptech.glide.request.RequestOptions;
+import com.example.datalibrary.model.LivenessModel;
+import com.example.datalibrary.model.User;
+import com.example.datalibrary.utils.BitmapUtils;
+import com.hanghui.senic.R;
+import com.hanghui.senic.activity.view.BaiDuFaceView;
+import com.hanghui.senic.activity.view.ClickButtonFloatView;
+import com.hanghui.senic.baiduface.BaiDuFaceResultPageListener;
+import com.hanghui.senic.baiduface.BaiduFaceUtil;
+import com.hanghui.senic.bean.AuthenticationBean;
+import com.hanghui.senic.bean.FederatedPlatformsRequestBean;
+import com.hanghui.senic.bean.FederatedPlatformsResponseBean;
+import com.hanghui.senic.common.AppHandler;
+import com.hanghui.senic.common.CommonUtil;
+import com.hanghui.senic.common.Constants;
+import com.hanghui.senic.common.DataManager;
+import com.hanghui.senic.common.DataReturns;
+import com.hanghui.senic.common.DeviceExpireManager;
+import com.hanghui.senic.common.MTTSManager;
+import com.hanghui.senic.common.TaskStatus;
+import com.hanghui.senic.common.ThreadPoolManager;
+import com.hanghui.senic.common.UserInfoManager;
+import com.hanghui.senic.controller.BlacklistManager;
+import com.hanghui.senic.network.HttpRequest;
+import com.hanghui.senic.service.usbserialdemo.utile.ConfigManager;
+import com.hanghui.senic.service.usbserialdemo.utile.StringIsNull;
+import com.hanghui.senic.service.usbserialdemo.utile.StringUtils;
+import com.hanghui.senic.service.usbserialdemo.utile.X1.RelaysAndLedUtile;
+import com.hanghui.senic.service.usbserialdemo.utile.loacat.AppLogUtils;
+import com.hanghui.senic.utils.DoubClickUtils;
+import com.hanghui.senic.utils.ImageLoaderUtils;
+
+import java.util.concurrent.Future;
+
+/**
+ * Description: $
+ *
+ * @author xwh
+ * time 2024/12/24
+ **/
+public class BaiduResultView  extends LinearLayout {
+
+    private ImageView ivPhoto,iv_through,iv_top_bg;
+    private TextView tv_name,tv_card,tv_phone,tv_through;
+    private LinearLayout ll_outcome_masked;
+    private FrameLayout fl_user_info;
+    private Future future; //开门线程
+
+    private LinearLayout ll_count_down;
+    private TextView tv_count_down;
+    /**
+     * 清除同人脸间隔判断保存的userID
+     */
+    private Runnable userIdUniqueIdRunnable = new Runnable() {
+        @Override
+        public void run() {
+            userIdUniqueId = "";
+        }
+    };
+
+    public BaiduResultView(Context context) {
+        super(context);
+        init(context);
+    }
+
+    public BaiduResultView(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+        init(context);
+    }
+
+    public BaiduResultView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        init(context);
+    }
+
+    public BaiduResultView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        init(context);
+    }
+
+    private void init(Context context){
+        LayoutInflater.from(context).inflate(R.layout.layout_baidu_result_view, this);
+        ivPhoto=findViewById(R.id.iv_photo);
+        tv_name=findViewById(R.id.tv_name);
+        tv_card=findViewById(R.id.tv_card);
+        tv_phone=findViewById(R.id.tv_phone);
+        iv_through=findViewById(R.id.iv_through);
+        iv_top_bg=findViewById(R.id.iv_top_bg);
+        tv_through=findViewById(R.id.tv_through);
+        fl_user_info=findViewById(R.id.fl_user_info);
+        ll_outcome_masked=findViewById(R.id.ll_outcome_masked);
+        tv_count_down=findViewById(R.id.tv_count_down);
+        ll_count_down = findViewById(R.id.ll_count_down);
+        ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
+        ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
+        ll_count_down.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if(DoubClickUtils.onDoubClick()){
+                    return;
+                }
+                closePage();
+            }
+        });
+    }
+
+    public void result(LivenessModel livenessModel,int featureCheckMode){
+
+        // 设备已过期,不做任何处理
+        if (DeviceExpireManager.getInstance().isDeviceExpire()) {
+            return;
+        }
+        if (featureCheckMode == 3 && ConfigManager.getAuthenticationBeanListBean().getOpenOneToN()) {
+            User user = livenessModel.getUser();
+            if (user == null) {
+                stranger(livenessModel);
+            }else{
+                startTime=0L;
+                if(future!=null&&!future.isDone()){
+                    return;
+                }
+                future= ThreadPoolManager.getInstance().submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        doScanFaceResult_Success(livenessModel);
+                    }
+                });
+
+            }
+        } else if (featureCheckMode == 4) {
+            doPersonCardResult(livenessModel);
+        }
+
+
+
+    }
+    long currentTime = System.currentTimeMillis();//检测到刷脸数据返回后,记录当前事件
+   volatile long startTime = 0L;//将刷脸返回时的当前时间保存,用于下次比较
+    //陌生人
+    private void stranger(LivenessModel livenessModel){
+        if (ConfigManager.getAuthenticationBeanListBean().getOneToNFailShowTip()) {
+            currentTime = System.currentTimeMillis();
+            if (startTime == 0 || ((currentTime - startTime) > (ConfigManager.getAuthenticationBeanListBean().getOneToNContinueFailTime() * 1000) + 500)) {
+                startTime = currentTime;
+
+            }
+
+            if ((currentTime - startTime) > (ConfigManager.getAuthenticationBeanListBean().getOneToNContinueFailTime() * 1000)) {
+
+                TaskStatus.setStatus(TaskStatus.TASK_STATUS_FACE);
+                TaskStatus.setCurrentTask(TaskStatus.CURRENT_TASSK_LOCAL_FACE);
+                if(callback!=null){
+                    callback.invokeStopVerify();
+                }
+                //判断失败进出记录是否开启,且类型包含1:N刷脸失败类型
+                sendPushFailed(3,livenessModel.getBdFaceImageInstance());
+                String failText = "";
+                if (!StringIsNull.IsStringNull(ConfigManager.getAuthenticationBeanListBean().getFailText())) {
+                    failText = ConfigManager.getAuthenticationBeanListBean().getFailText();
+                }
+                doPersonCardResult_fail(failText, ConfigManager.getAuthenticationBeanListBean().getFailVoice());
+            }
+        }
+    }
+
+
+    volatile String userIdUniqueId = "";
+
+    /**
+     * 纯刷脸成功后执行
+     *
+     * @param livenessModel
+     */
+    private void doScanFaceResult_Success(LivenessModel livenessModel) {
+        User user = livenessModel.getUser();
+        if (user == null) {
+            return;
+        }
+        //同人脸判断是否在规定时间内
+        if (userIdUniqueId.equals(StringIsNull.ReturnString(user.getUserId()))){
+            return;
+        }
+        if(callback!=null){
+            callback.invokeStopVerify();
+        }
+        TaskStatus.setStatus(TaskStatus.TASK_STATUS_FACE);
+        TaskStatus.setCurrentTask(TaskStatus.CURRENT_TASSK_LOCAL_FACE);
+
+        String faceRequestParams = BaiduFaceUtil.getScanFaceRequestParams(user);
+
+        //setAuthCodeOrVid(jsonObject,extInfoJsonObject);
+        //重置现场照片、姓名、身份证号等用户信息
+        setUserInfoToUserInfoManager(livenessModel);
+
+        DataReturns.getInstance().clearData();
+        //判断用户是否在有效期内
+        if (ConfigManager.getAuthenticationBeanListBean().getValidTimeSwitch() && isUserExpire(user)) {
+            return;
+        }
+        //判断黑名单中是否存在该用户
+        if (BlacklistManager.getInstance().isInBlacklist(user.getIdNumber(), user.getPhone(), new BaiDuFaceResultPageListener() {
+            @Override
+            public void showUI(String msgStr,String voiceStr) {
+                showErrorUI(msgStr,voiceStr);
+            }})) {
+            return;
+        }
+
+        //判断年龄限制是否打开
+        if (ConfigManager.isAgeLimitOpen(user.getIdNumber(), user.getUserId(), new BaiDuFaceResultPageListener() {
+            @Override
+            public void showUI(String msgStr, String voiceStr) {
+                showErrorUI(msgStr,voiceStr);
+            }})) {
+            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);
+        }
+
+        Constants.IDCARD_TYPE = 0;
+
+        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(),dataDTO.getSignalNo());
+        ThreadPoolManager.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                String speak=   ConfigManager.getAuthenticationBeanListBean().getSucVoice();
+                if(TextUtils.isEmpty(speak)){
+                    speak ="请通行";
+                }
+                MTTSManager.getInstance().speak(speak);
+            }
+        });
+
+        BDFaceImageInstance rgbImage = livenessModel.getBdFaceImageInstance();
+        if (rgbImage != null) {
+           final Bitmap bitmap = BitmapUtils.getInstaceBmp(rgbImage);
+            HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
+                    UserInfoManager.getInstance().getUserInformationBean().getName(),
+                    UserInfoManager.getInstance().getUserInformationBean().getIdNumber(),
+                    UserInfoManager.getInstance().getUserInformationBean().getIdPhoto(), "",
+                    UserInfoManager.getInstance().getUserInformationBean().getMobile(), true,
+                    0,
+                    UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(),
+                    UserInfoManager.getInstance().getUserInformationBean().getUserId(),bitmap);
+            RequestOptions options = new RequestOptions().bitmapTransform(new RoundedCorners(30));
+            options.diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true);
+
+            String name = UserInfoManager.getInstance().getUserInformationBean().getName();
+            String idCard = UserInfoManager.getInstance().getUserInformationBean().getIdNumber();
+            String phone = UserInfoManager.getInstance().getUserInformationBean().getMobile();
+            //姓名脱敏
+            if (!StringUtils.isEmpty(name) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "姓名")) {
+                name = StringUtils.getString(name);
+                name = StringUtils.chineseName(name);
+            }
+            //身份证脱敏
+            if (!StringUtils.isEmpty(idCard) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "身份证号")) {
+                idCard = StringUtils.getString(idCard);
+                idCard = StringUtils.getDesensitization(idCard);
+            }
+            //手机号脱敏
+            if (!StringUtils.isEmpty(phone) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "手机号")) {
+                phone = StringUtils.getString(phone);
+                phone = StringUtils.mobilePhone(phone);
+            }
+            if (StringIsNull.IsStringNull(name)) {
+                name = "";
+            }
+            if (StringIsNull.IsStringNull(idCard)) {
+                idCard = "";
+            }
+            if (StringIsNull.IsStringNull(phone)) {
+                phone = "";
+            }
+            if (!phone.contains("*")) {
+                phone = StringUtils.defaultDesensitization(phone);
+            }
+            if (!idCard.contains("*")) {
+                idCard = StringUtils.defaultDesensitization(idCard);
+            }
+            if (!name.contains("*")) {
+                name = StringUtils.defaultDesensitization(name);
+            }
+            final String finalName = name ;
+            final String finalidCard=idCard;
+            final String finalPhone=phone;
+            AppHandler.getHandler().post(new Runnable() {
+                @Override
+                public void run() {
+                    setVisibility(View.VISIBLE);
+                    fl_user_info.setVisibility(VISIBLE);
+                    String sucText=   ConfigManager.getAuthenticationBeanListBean().getSucText();
+                    if(TextUtils.isEmpty(sucText)){
+                        sucText="请通行";
+                    }
+
+                    ImageLoaderUtils.loadImage(bitmap,ivPhoto,options);
+                    iv_through.setVisibility(VISIBLE);
+                    ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
+                    ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
+                    ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_blues);
+                    tv_name.setText(finalName);
+                    tv_card.setText(finalidCard);
+                    tv_phone.setText(finalPhone);
+                    tv_through.setText(sucText);
+                    tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.f1677FF));
+                }
+            });
+
+        }
+        int delay=dataDTO.getSuccessPageTime();
+        reset(delay);
+
+
+    }
+
+    Handler mHandler =new Handler(Looper.getMainLooper());
+
+    public Handler getmHandler() {
+        if(mHandler==null){
+            synchronized (BaiduResultView.class){
+                if(mHandler==null){
+                    mHandler=new android.os.Handler(Looper.getMainLooper());
+                }
+            }
+        }
+        return mHandler;
+    }
+
+    private volatile CountDownTimer oneToOneCountDownTimer;
+    private void startOneToOneCountDownTimer(int delay){
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                try {
+
+                    ll_count_down.setVisibility(VISIBLE);
+                    tv_count_down.setText(delay + "s");
+                    oneToOneCountDownTimer = new CountDownTimer(delay * 1000, 1000) {
+                        public void onTick(long millisUntilFinished) {
+                            // 每次间隔,这里更新UI,显示剩余时间
+                            tv_count_down.setText(" "+(millisUntilFinished / 1000) + "s");
+                        }
+
+                        public void onFinish() {
+                            // 倒计时结束时的操作
+                        }
+                    };
+                    // 开始倒计时
+                    oneToOneCountDownTimer.start();
+                } catch (Exception e) {
+                    stopOneToOneCountDownTimer();
+                }
+            }
+        });
+
+    }
+    private void stopOneToOneCountDownTimer(){
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                if (oneToOneCountDownTimer != null) {
+                    oneToOneCountDownTimer.cancel();
+                    oneToOneCountDownTimer=null;
+                }
+            }
+        });
+
+    }
+
+
+
+    private volatile CountDownTimer closeResultPageCountDownTimer;
+    private volatile boolean isCountDowning=false;
+
+    private void startCountDownTimer(int delay){
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    if (isCountDowning) {
+                        return;
+                    }
+                    isCountDowning = true;
+                    ll_count_down.setVisibility(VISIBLE);
+                    tv_count_down.setText(delay + "s");
+                    closeResultPageCountDownTimer = new CountDownTimer(delay * 1000, 1000) {
+                        public void onTick(long millisUntilFinished) {
+                            // 每次间隔,这里更新UI,显示剩余时间
+                            tv_count_down.setText(" "+(millisUntilFinished / 1000) + "s");
+                        }
+
+                        public void onFinish() {
+                            // 倒计时结束时的操作
+                            closePage();
+                        }
+                    };
+                    // 开始倒计时
+                    closeResultPageCountDownTimer.start();
+                } catch (Exception e) {
+                    isCountDowning=false;
+                    stopCountDownTimer();
+                }
+            }
+        });
+
+    }
+
+
+    private void closePage(){
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                isCountDowning = false;
+                ll_count_down.setVisibility(INVISIBLE);
+                ivPhoto.setImageResource(0);
+                ll_outcome_masked.setBackgroundResource(0);
+                tv_name.setText("");
+                tv_card.setText("");
+                tv_phone.setText("");
+                tv_through.setText("");
+                setVisibility(View.INVISIBLE);
+                fl_user_info.setVisibility(INVISIBLE);
+                iv_through.setVisibility(VISIBLE);
+                getmHandler().removeCallbacksAndMessages(null);
+                isCreatedRunnable = false;
+                isCountDowning=false;
+                startTime=0L;
+                TaskStatus.setInitState();
+                if (callback != null) {
+                    callback.invokeResume();
+                }
+            }
+        });
+    }
+    /**
+     *
+     * @author xwh
+     * Time 2024/9/3
+     * Description: 停止倒计时
+     *
+     **/
+    private void stopCountDownTimer(){
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                if (closeResultPageCountDownTimer != null) {
+                    closeResultPageCountDownTimer.cancel();
+                    closeResultPageCountDownTimer=null;
+                }
+            }
+        });
+
+    }
+
+    private void reset(int delay){
+        startCountDownTimer(delay);
+
+    }
+
+
+
+    private void showErrorUI(String msgStr,String voiceStr){
+        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+        ThreadPoolManager.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                String voice=  voiceStr;
+                if(TextUtils.isEmpty(voiceStr)){
+                    voice=ConfigManager.getAuthenticationBeanListBean().getFailVoice();
+                }
+                if(TextUtils.isEmpty(voice)){
+                   return;
+                }
+                MTTSManager.getInstance().speak(voice);
+            }
+        });
+        AppHandler.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                setVisibility(View.VISIBLE);
+                fl_user_info.setVisibility(INVISIBLE);
+                String sucText=  msgStr;
+                if(TextUtils.isEmpty(msgStr)){
+                    sucText=ConfigManager.getAuthenticationBeanListBean().getFailText();
+                }
+                iv_through.setVisibility(VISIBLE);
+                ImageLoaderUtils.loadRes(R.mipmap.mainactivity_erroe,iv_through);
+                ImageLoaderUtils.loadRes(R.mipmap.red_background_gradient,iv_top_bg);
+                ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_reds);
+                tv_through.setText(sucText);
+                tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.fEE4523));
+            }
+        });
+        int delay=dataDTO.getFailPageTime();
+        reset(delay);
+
+
+    }
+
+    public void showResultPageUI(boolean isSuccess,String msgStr,String voiceStr){
+        if(callback!=null){
+            callback.invokeStopVerify();
+        }
+        stopOneToOneCountDownTimer();
+        if(!isSuccess){
+
+            AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+            ThreadPoolManager.getInstance().execute(new Runnable() {
+                @Override
+                public void run() {
+                    String voice=  voiceStr;
+                    if(TextUtils.isEmpty(voiceStr)){
+                        voice=ConfigManager.getAuthenticationBeanListBean().getFailVoice();
+                    }
+                    if(TextUtils.isEmpty(voice)){
+                        return;
+                    }
+                    MTTSManager.getInstance().speak(voice);
+                }
+            });
+            AppHandler.getHandler().post(new Runnable() {
+                @Override
+                public void run() {
+                    getmHandler().removeCallbacksAndMessages(null);
+                    setVisibility(View.VISIBLE);
+                    fl_user_info.setVisibility(INVISIBLE);
+                    String sucText=  msgStr;
+                    if(TextUtils.isEmpty(msgStr)){
+                        sucText=ConfigManager.getAuthenticationBeanListBean().getFailText();
+                    }
+                    iv_through.setVisibility(VISIBLE);
+                    ImageLoaderUtils.loadRes(R.mipmap.mainactivity_erroe,iv_through);
+                    ImageLoaderUtils.loadRes(R.mipmap.red_background_gradient,iv_top_bg);
+                    ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_reds);
+                    tv_through.setText(sucText);
+                    tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.fEE4523));
+                }
+            });
+            int delay=dataDTO.getFailPageTime();
+            reset(delay);
+
+
+        }else{
+
+            ThreadPoolManager.getInstance().execute(new Runnable() {
+                @Override
+                public void run() {
+                    String voice=  voiceStr;
+                    if(TextUtils.isEmpty(voiceStr)){
+                        voice=ConfigManager.getAuthenticationBeanListBean().getOneToOneVoice();
+                    }
+                    if(TextUtils.isEmpty(voice)){
+                        return;
+                    }
+                    MTTSManager.getInstance().speak(voice);
+                }
+            });
+            AppHandler.getHandler().post(new Runnable() {
+                @Override
+                public void run() {
+                    setVisibility(View.VISIBLE);
+                    fl_user_info.setVisibility(INVISIBLE);
+                    String sucText=  msgStr;
+                    if(TextUtils.isEmpty(msgStr)){
+                        sucText=ConfigManager.getAuthenticationBeanListBean().getOneToOneTips();
+                    }
+                    iv_through.setVisibility(GONE);
+                    ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
+                    ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
+                    ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_blues);
+                    tv_through.setText(sucText);
+                    tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.f1677FF));
+                }
+            });
+            int delay=ConfigManager.getAuthenticationBean().getData().get(0).getOneToOneTimeout() ;
+            startOneToOneCountDownTimer(delay);
+        }
+
+
+
+    }
+
+
+
+
+    /**
+     * 判断用户是否过期
+     *
+     * @param user 用户
+     * @return 是否过期
+     */
+    private boolean isUserExpire(User user) {
+        if (user == null) {
+            return false;
+        }
+
+        long startTime = user.getStartTime();
+        long endTime = user.getEndTime();
+        long curTime = System.currentTimeMillis();
+        if (curTime <= startTime){
+            showErrorUI("未到有效时间","未到有效时间");
+            return true;
+        }
+        if (curTime >= endTime){
+            showErrorUI("已过期","已过期");
+            return true;
+        }
+//        //已过期
+//        if (curTime <= startTime || curTime >= endTime) {
+//
+//            FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", "不在有效期", 500, "不在有效期");
+//            BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+//
+//            return true;
+//        }
+        return false;
+    }
+    private void setUserInfoToUserInfoManager(LivenessModel livenessModel) {
+        if (livenessModel == null) {
+            return;
+        }
+        User user = livenessModel.getUser();
+
+        if (user == null) {
+            return;
+        }
+        String userName = user.getUserName();
+        String idNumber = user.getIdNumber();
+        String phone = user.getPhone();
+        String photo = user.getPhoto();
+        String cardIdEx = user.getCardIdEx();
+        String userId = user.getUserId();
+        String scenePhotoUrl = user.getPhoto();
+        UserInfoManager.getInstance().setUserInformationBean(userName, idNumber, "", photo, phone, cardIdEx, userId, livenessModel.getFeatureScore(), scenePhotoUrl);
+
+    }
+    //判断1:1人脸连续未通过的runnable是否启动
+   volatile boolean isCreatedRunnable = false;
+    /**
+     * 刷脸失败
+     * @param msg
+     * @param openVoiceMsg
+     */
+    private void doPersonCardResult_fail(String msg, String openVoiceMsg) {
+        if(callback!=null){
+            callback.personCardinvokeStopVerify();
+        }
+
+        if (StringIsNull.IsStringNull(openVoiceMsg)) {
+            openVoiceMsg = msg;
+        }
+        isCreatedRunnable = false;
+        startTime = 0L;
+        showErrorUI(msg,openVoiceMsg);
+    }
+
+    /**
+     * 1:N、1:1 刷脸失败进出记录推送
+     * @param type
+     */
+    private void sendPushFailed(int type, BDFaceImageInstance rgbImage) {
+        if (!ConfigManager.getAuthenticationBeanListBean().isPushFailedRecordSwitch()){
+            AppLogUtils.e(false,"刷脸失败记录推送","刷脸失败记录推送 - 检测到未开启失败记录推送,直接return");
+            return;
+        }
+        if (!ConfigManager.getAuthenticationBeanListBean().getPushFailedRecordType().contains(type)){
+            AppLogUtils.e(false,"刷脸失败记录推送","刷脸失败记录推送 - 检测到失败类型中不包含当前类型,直接return  type = "+type);
+            return;
+        }
+        Bitmap bitmap = null;
+        if (rgbImage != null) {
+             bitmap = BitmapUtils.getInstaceBmp(rgbImage);
+
+        }
+        HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
+                UserInfoManager.getInstance().getUserInformationBean().getName(),
+                UserInfoManager.getInstance().getUserInformationBean().getIdNumber(),
+                "", "", UserInfoManager.getInstance().getUserInformationBean().getMobile(),
+                false, type, UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(), "",bitmap);
+
+
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+    /**
+     * 人证比对结果处理
+     *
+     * @param livenessModel
+     */
+    private void doPersonCardResult(LivenessModel livenessModel) {
+
+        if (livenessModel == null) {
+            return;
+        }
+        // 人脸识别阈值判断
+        // 比对分值,相似度分数
+        float compareScore = livenessModel.getScore();
+        float idThreshold = SingleBaseConfig.getBaseConfig().getIdThreshold();
+
+        if (!ConfigManager.getAuthenticationBeanListBean().getLivingControl()) {  //活体检测未开启
+            doPersonCardComparison(compareScore, idThreshold, livenessModel);
+
+        } else {    //活体检测开启
+            //活体阈值判断显示
+            float rgbLivenessScore = livenessModel.getRgbLivenessScore();
+            float rgbLivenessThreshold = SingleBaseConfig.getBaseConfig().getRgbLiveScore();//rgb活体阈值
+
+
+            if (rgbLivenessScore >= rgbLivenessThreshold) {
+                doPersonCardComparison(compareScore, idThreshold, livenessModel);
+            } else {
+
+            }
+        }
+
+    }
+
+    private void doPersonCardComparison(float compareScore, float idThreshold, LivenessModel livenessModel) {
+        if (compareScore >= idThreshold) {
+            UserInfoManager.getInstance().updateUserInformationBean_VerifyScore(compareScore);
+            doPersonCardResult_Success(livenessModel);
+
+        } else {
+            if (!isCreatedRunnable) {
+                isCreatedRunnable = true;
+
+
+
+                getmHandler().removeCallbacksAndMessages(null);
+                getmHandler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                      ThreadPoolManager.getInstance().execute(new Runnable() {
+                          @Override
+                          public void run() {
+                              //判断失败进出记录是否开启,且类型包含1:1刷脸失败类型
+                              UserInfoManager.getInstance().updateUserInformationBean_VerifyScore(compareScore);
+                              sendPushFailed(4,livenessModel.getBdFaceImageInstance());
+                              String failText = "比对失败";
+                              doPersonCardResult_fail(failText, failText);
+                          }
+                      });
+
+
+                    }
+                }, ConfigManager.getAuthenticationBeanListBean().getOneToOneContinueFailTime() * 1000);
+            }
+        }
+    }
+
+    private void doPersonCardResult_Success(LivenessModel livenessModel) {
+
+        if(callback!=null){
+            callback.personCardinvokeStopVerify();
+        }
+        getmHandler().removeCallbacksAndMessages(null);
+        AuthenticationBean.DataDTO dataDTO= ConfigManager.getAuthenticationBean().getData().get(0);
+        RelaysAndLedUtile.getInstance().openDoor(dataDTO.getUseSerialPort(),dataDTO.getSignalNo());
+        ThreadPoolManager.getInstance().execute(new Runnable() {
+            @Override
+            public void run() {
+                String speak=   ConfigManager.getAuthenticationBeanListBean().getSucVoice();
+                if(TextUtils.isEmpty(speak)){
+                    speak ="请通行";
+                }
+                MTTSManager.getInstance().speak(speak);
+            }
+        });
+
+
+
+
+
+        BDFaceImageInstance rgbImage = livenessModel.getBdFaceImageInstance();
+        if (rgbImage != null) {
+            final Bitmap bitmap = BitmapUtils.getInstaceBmp(rgbImage);
+            HttpRequest.getInstance().setEventRecords(TaskStatus.currentTask,
+                    UserInfoManager.getInstance().getUserInformationBean().getName(),
+                    UserInfoManager.getInstance().getUserInformationBean().getIdNumber(),
+                    UserInfoManager.getInstance().getUserInformationBean().getIdPhoto(), "",
+                    UserInfoManager.getInstance().getUserInformationBean().getMobile(), true,
+                    0,
+                    UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(),
+                    UserInfoManager.getInstance().getUserInformationBean().getUserId(),bitmap);
+            RequestOptions options = new RequestOptions().bitmapTransform(new RoundedCorners(30));
+            options.diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true);
+
+            String name = UserInfoManager.getInstance().getUserInformationBean().getName();
+            String idCard = UserInfoManager.getInstance().getUserInformationBean().getIdNumber();
+            String phone = UserInfoManager.getInstance().getUserInformationBean().getMobile();
+            //姓名脱敏
+            if (!StringUtils.isEmpty(name) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "姓名")) {
+                name = StringUtils.getString(name);
+                name = StringUtils.chineseName(name);
+            }
+            //身份证脱敏
+            if (!StringUtils.isEmpty(idCard) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "身份证号")) {
+                idCard = StringUtils.getString(idCard);
+                idCard = StringUtils.getDesensitization(idCard);
+            }
+            //手机号脱敏
+            if (!StringUtils.isEmpty(phone) && StringUtils.isString(ConfigManager.getAuthenticationBean().getData()
+                    .get(0).getSucText(), "手机号")) {
+                phone = StringUtils.getString(phone);
+                phone = StringUtils.mobilePhone(phone);
+            }
+            if (StringIsNull.IsStringNull(name)) {
+                name = "";
+            }
+            if (StringIsNull.IsStringNull(idCard)) {
+                idCard = "";
+            }
+            if (StringIsNull.IsStringNull(phone)) {
+                phone = "";
+            }
+            if (!phone.contains("*")) {
+                phone = StringUtils.defaultDesensitization(phone);
+            }
+            if (!idCard.contains("*")) {
+                idCard = StringUtils.defaultDesensitization(idCard);
+            }
+            if (!name.contains("*")) {
+                name = StringUtils.defaultDesensitization(name);
+            }
+            final String finalName = name ;
+            final String finalidCard=idCard;
+            final String finalPhone=phone;
+            AppHandler.getHandler().post(new Runnable() {
+                @Override
+                public void run() {
+                    setVisibility(View.VISIBLE);
+                    fl_user_info.setVisibility(VISIBLE);
+                    String sucText=   ConfigManager.getAuthenticationBeanListBean().getSucText();
+                    if(TextUtils.isEmpty(sucText)){
+                        sucText="请通行";
+                    }
+                    ImageLoaderUtils.loadImage(bitmap,ivPhoto,options);
+
+                    ImageLoaderUtils.loadRes(R.mipmap.mainactivity_aicon,iv_through);
+                    ImageLoaderUtils.loadRes(R.mipmap.blue_background_gradient,iv_top_bg);
+                    ll_outcome_masked.setBackgroundResource(R.drawable.outcome_masked_blues);
+                    tv_name.setText(finalName);
+                    tv_card.setText(finalidCard);
+                    tv_phone.setText(finalPhone);
+                    tv_through.setText(sucText);
+                    tv_through.setTextColor(ContextCompat.getColor(getContext(),R.color.f1677FF));
+                }
+            });
+
+        }
+        int delay=dataDTO.getSuccessPageTime();
+        reset(delay);
+
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    BaiduFaceResultCallback callback;
+
+
+    public void setBaiduFaceResultCallback(BaiduFaceResultCallback callback) {
+        this.callback = callback;
+    }
+
+    public interface BaiduFaceResultCallback {
+
+        void personCardinvokeStopVerify();
+        void invokeStopVerify();
+
+        void invokeResume();
+
+
+    }
+
+}

+ 13 - 0
app/src/main/java/com/hanghui/senic/bean/AuthenticationBean.java

@@ -505,6 +505,19 @@ public class AuthenticationBean {
             this.successShowPersonalInfoList = successShowPersonalInfoList;
         }
 
+
+
+        @SerializedName("isLocalBaiduFace")
+        private Boolean isLocalBaiduFace =true;
+
+        public Boolean getLocalBaiduFace() {
+            return isLocalBaiduFace;
+        }
+
+        public void setLocalBaiduFace(Boolean localBaiduFace) {
+            isLocalBaiduFace = localBaiduFace;
+        }
+
         public Integer getSameFaceInterval() {
             return sameFaceInterval;
         }

+ 9 - 23
app/src/main/java/com/hanghui/senic/common/MTTSManager.java

@@ -7,6 +7,7 @@ import android.text.TextUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.google.gson.Gson;
 import com.hanghui.senic.MyAppliction;
+import com.hanghui.senic.lib_base.BaseApplication;
 import com.hanghui.senic.service.usbserialdemo.utile.MTTSDemo;
 import com.hanghui.senic.service.usbserialdemo.utile.StringIsNull;
 import com.hanghui.senic.service.usbserialdemo.utile.loacat.AppLogUtils;
@@ -73,22 +74,11 @@ public class MTTSManager implements TextToSpeech.OnInitListener {
             }
         }, "com.iflytek.speechcloud");//科大讯飞语音引擎*/
 
-        if (ismServiceConnectionUsable(mTTS)) {
-            if (mTTS == null) {
-                mTTS = new TextToSpeech(MyAppliction.getContext(), this);
-            }
-            speakContent = text;
-            //设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规
-            mTTS.setPitch(1.0f);
-            //设置语速
-            mTTS.setSpeechRate(1.0f);
-            //TextToSpeech.QUEUE_ADD添加到队列后面,依次将前面的读完轮序
-            //TextToSpeech.QUEUE_FLUSH刷新队列,将之前的队列取消阅读现在的文字
-            int mTTsState =  mTTS.speak(text, TextToSpeech.QUEUE_FLUSH, null,"HHLocal");
-            if(mTTsState != TextToSpeech.SUCCESS){
-                reset(text);
-            }
-        } else {//被回收了不可用状态
+
+
+        int mTTsState = TextToSpeech.ERROR;
+        mTTsState = mTTS.speak(text, TextToSpeech.QUEUE_FLUSH, null,"hhlocal");
+        if(mTTsState != TextToSpeech.SUCCESS){
             reset(text);
         }
     }
@@ -98,24 +88,20 @@ public class MTTSManager implements TextToSpeech.OnInitListener {
             mTTS.stop();
             mTTS.shutdown();
         }
-        mTTS = new TextToSpeech(MyAppliction.getContext(), status -> {
+        mTTS = new TextToSpeech(BaseApplication.getContext(), status -> {
             if (status == TextToSpeech.SUCCESS) {
                 int result = mTTS.setLanguage(Locale.CHINA);
                 if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE
                         && result != TextToSpeech.LANG_AVAILABLE) {
                     AppLogUtils.e(true, " TTS - onInit", "TTS语音播报 onInit: 不支持这种语言");
                 }
-                //设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规
-                mTTS.setPitch(1.0f);
-                //设置语速
-                mTTS.setSpeechRate(1.0f);
-                mTTS.speak(text, TextToSpeech.QUEUE_FLUSH, null,"HHLocal");
+
+                mTTS.speak(text, TextToSpeech.QUEUE_FLUSH, null,"hhlocal");
             } else {
                 AppLogUtils.e(true, " TTS - onInit", "TTS语音播报 onInit: TTS初始化失败");
             }
         }, "com.iflytek.speechcloud");//科大讯飞语音引擎
     }
-
     public void init() {
         //监听器就直接传入本类
         // mTTS = new TextToSpeech(MyAppliction.getContext(), this);

+ 23 - 4
app/src/main/java/com/hanghui/senic/controller/BlacklistManager.java

@@ -2,6 +2,7 @@ package com.hanghui.senic.controller;
 
 import com.hanghui.senic.MyAppliction;
 import com.hanghui.senic.activity.view.BaiDuFaceView;
+import com.hanghui.senic.baiduface.BaiDuFaceResultPageListener;
 import com.hanghui.senic.bean.BlacklistConfigBean;
 import com.hanghui.senic.bean.FederatedPlatformsResponseBean;
 import com.hanghui.senic.common.DataManager;
@@ -36,10 +37,14 @@ public class BlacklistManager {
         return instance;
     }
 
+
+    public boolean queryData(String data, String type){
+       return queryData(data,type,null);
+    }
     /**
      * 查询黑名单中是否存在该数据
      */
-    public boolean queryData(String data, String type) {
+    public boolean queryData(String data, String type, BaiDuFaceResultPageListener listener) {
         if (!ConfigManager.isOpenBlacklist()) {
             //黑名单未开启
             AppLogUtils.e(false, "黑名单查询", "检测到黑名单未开启,直接return 不做处理");
@@ -84,7 +89,13 @@ public class BlacklistManager {
         if (isBlacklistExistUser && ConfigManager.getAuthenticationBeanListBean().getForbidPassSwitch()) {
             FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B",
                     ConfigManager.getAuthenticationBeanListBean().getForbidPassText(), 500, ConfigManager.getAuthenticationBeanListBean().getForbidPassVoice());
-            BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+
+            if(listener!=null){
+                listener.showUI(ConfigManager.getAuthenticationBeanListBean().getForbidPassText()
+                        ,ConfigManager.getAuthenticationBeanListBean().getForbidPassVoice());
+            }else {
+                BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+            }
             BlacklistManager.getInstance().isBlacklistExistUser = false;
             return true;
         }
@@ -106,11 +117,16 @@ public class BlacklistManager {
 
 
     public boolean isInBlacklist(String idNumber ,String phone) {
+      return isInBlacklist(idNumber,phone,null);
+    }
+
+
+    public boolean isInBlacklist(String idNumber ,String phone,BaiDuFaceResultPageListener baiDuFaceResultPageListener) {
         //判断黑名单中是否存在该用户
-        if (!StringIsNull.IsStringNull(idNumber) && queryData(idNumber, "IDENTITY_CARD")) {
+        if (!StringIsNull.IsStringNull(idNumber) && queryData(idNumber, "IDENTITY_CARD",baiDuFaceResultPageListener)) {
             //展示了阻止通行结果页,直接return掉,不做后续逻辑处理
             return true;
-        } else if (!StringIsNull.IsStringNull(phone) && queryData(phone, "PHONE")) {
+        } else if (!StringIsNull.IsStringNull(phone) && queryData(phone, "PHONE",baiDuFaceResultPageListener)) {
             //展示了阻止通行结果页,直接return掉,不做后续逻辑处理
             return true;
         }
@@ -118,4 +134,7 @@ public class BlacklistManager {
 
     }
 
+
+
+
 }

+ 1 - 1
app/src/main/java/com/hanghui/senic/network/HttpRequest.java

@@ -1352,7 +1352,7 @@ public class HttpRequest {
         String finalOriginPhotoBase6 = originPhotoBase64;
         Float verifyScore = UserInfoManager.getInstance().getUserInformationBean().getVerifyScore();
         ThreadPoolManager.getInstance().submit(new Runnable() {
-            String compressPhoto = "";
+            volatile String compressPhoto = "";
             @Override
             public void run() {
                 /**

+ 34 - 6
app/src/main/java/com/hanghui/senic/service/usbserialdemo/utile/ConfigManager.java

@@ -31,6 +31,7 @@ import com.hanghui.senic.MyAppliction;
 import com.hanghui.senic.R;
 import com.hanghui.senic.activity.view.BaiDuFaceView;
 import com.hanghui.senic.activity.view.ClickButtonFloatView;
+import com.hanghui.senic.baiduface.BaiDuFaceResultPageListener;
 import com.hanghui.senic.bean.AuthenticationBean;
 import com.hanghui.senic.bean.CheckNumBean;
 import com.hanghui.senic.bean.FederatedPlatformsRequestBean;
@@ -1056,19 +1057,34 @@ public class ConfigManager {
      * <p>
      * return true -不做后续逻辑处理    false -进行联动平台请求
      */
-    public static boolean isAgeLimitOpen(String idNumber,String userId) {
+    public static boolean isAgeLimitOpen(String idNumber, String userId, BaiDuFaceResultPageListener listener) {
+
         if (ConfigManager.getAuthenticationBean().getData().get(0).isOpenAgeLimit()) {//是否开启年龄限制
             if (StringIsNull.IsStringNull(idNumber)) {
                 FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", "未获取有效身份证号码", 500, "未获取有效身份证号码");
-                BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                if(listener!=null){
+                    listener.showUI("未获取有效身份证号码","未获取有效身份证号码");
+                }else {
+                    BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                }
+
                 return true;
             }
             //判断年龄是否在限定区间内
-            int age = ConfigManager.getPersonAgeFromIdCard(UserInfoManager.getInstance().getUserInformationBean().getIdNumber());
+            int age = -1;
+            try {
+                age= ConfigManager.getPersonAgeFromIdCard(UserInfoManager.getInstance().getUserInformationBean().getIdNumber());
+            }catch (Exception e){
+                AppLogUtils.e(true, "年龄限制开启", "开启年龄限制,未获取有效身份证号"+e.toString());
+            }
             if (age == -1) {
                 AppLogUtils.e(true, "年龄限制开启", "开启年龄限制,未获取有效身份证号");
                 FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", "未获取有效身份证号码", 500, "未获取有效身份证号码");
-                BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                if(listener!=null){
+                    listener.showUI("未获取有效身份证号码","未获取有效身份证号码");
+                }else {
+                    BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                }
                 return true;
             }
             if (age >= ConfigManager.getAuthenticationBean().getData().get(0).getLimitSectionStart() &&
@@ -1092,9 +1108,17 @@ public class ConfigManager {
                             1,
                             UserInfoManager.getInstance().getUserInformationBean().getCardIdEx(),userId,null);
                 }
-                FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B", ConfigManager.getAuthenticationBean().getData().get(0).getAgeForbidText(),
+
+
+                FederatedPlatformsResponseBean federatedPlatformsResponseBean = DataManager.getInstance().getErrorOutcome("LocalError_B"
+                        , ConfigManager.getAuthenticationBean().getData().get(0).getAgeForbidText(),
                         500, ConfigManager.getAuthenticationBean().getData().get(0).getAgeForbidText());
-                BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                if(listener!=null){
+                    listener.showUI(ConfigManager.getAuthenticationBean().getData().get(0).getAgeForbidText(),ConfigManager.getAuthenticationBean().getData().get(0).getAgeForbidText());
+                }else {
+                    BaiDuFaceView.getInstance().getPlatformsCod(federatedPlatformsResponseBean);
+                }
+
 
                 return true;
             }
@@ -1102,6 +1126,10 @@ public class ConfigManager {
         return false;
     }
 
+    public static boolean isAgeLimitOpen(String idNumber,String userId) {
+        return isAgeLimitOpen(idNumber,userId,null);
+    }
+
     /**
      * 判断核验接口是否开启
      * <p>

+ 69 - 1
app/src/main/java/com/hanghui/senic/service/usbserialdemo/utile/X1/RelaysAndLedUtile.java

@@ -5,14 +5,21 @@ import android.content.Intent;
 import com.common.pos.api.util.PosUtil;
 import com.hanghui.senic.MyAppliction;
 import com.hanghui.senic.common.CommonUtil;
+import com.hanghui.senic.common.ThreadPoolManager;
+import com.hanghui.senic.controller.SerialController;
+import com.hanghui.senic.service.usbserialdemo.utile.ConfigManager;
 import com.hanghui.senic.service.usbserialdemo.utile.FaceScenicUtile;
+import com.hanghui.senic.service.usbserialdemo.utile.StringIsNull;
+import com.hanghui.senic.service.usbserialdemo.utile.StringUtils;
 import com.hanghui.senic.service.usbserialdemo.utile.devicesUI.Constants;
 import com.hanghui.senic.service.usbserialdemo.utile.devicesUI.DeviceUtils;
 import com.hanghui.senic.service.usbserialdemo.utile.loacat.AppLogUtils;
 
+import java.util.concurrent.Future;
+
 public class RelaysAndLedUtile {
     private static RelaysAndLedUtile instance;
-
+    private Future future; //开门线程
     private RelaysAndLedUtile() {
 
     }
@@ -96,4 +103,65 @@ public class RelaysAndLedUtile {
                 break;
         }
     }
+
+    /**
+     *
+     * @author xwh
+     * Time 2024/12/3
+     * Description: 开门
+     *
+     **/
+    public void openDoor(String UseSerialPort, String SignalNo) {
+        if (!StringIsNull.IsStringNull(UseSerialPort) && UseSerialPort.equals("RS232")) {
+            if (!StringUtils.isEmpty(SignalNo)) {
+                SerialController.getInstance().DoorSerialSendPortData(SignalNo);
+            }
+        }else if(ConfigManager.getAuthenticationBean().getData().get(0).getRelayOpenModel() == 2){
+            if(future!=null&&!future.isDone()){
+                future.cancel(true);
+            }
+            int GateTimeOut = 60;
+            if (ConfigManager.getAuthenticationBean().getData().get(0).getGateTimeOut() > 0) {
+                GateTimeOut = ConfigManager.getAuthenticationBean().getData().get(0).getGateTimeOut();
+            }
+            final int finalGateTimeOut = GateTimeOut;
+            future=  ThreadPoolManager.getInstance().submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        RelaysAndLedUtile.getInstance().isOpenRelays(1);
+                        Thread.sleep(finalGateTimeOut);
+                        RelaysAndLedUtile.getInstance().isOpenRelays(0);
+                    } catch (InterruptedException e) {
+
+                    }
+                }
+            });
+
+        }else {
+            if(future!=null&&!future.isDone()){
+                future.cancel(true);
+            }
+            int delay = 1000;
+            if (ConfigManager.getAuthenticationBean().getData().get(0).getOpenCloseInterval() > 0) {
+                delay = ConfigManager.getAuthenticationBean().getData().get(0).getOpenCloseInterval();
+            }
+
+            final int finalDelay = delay;
+            future=  ThreadPoolManager.getInstance().submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        RelaysAndLedUtile.getInstance().isOpenRelays(1);
+                        Thread.sleep(finalDelay);
+                        RelaysAndLedUtile.getInstance().isOpenRelays(0);
+                    } catch (InterruptedException e) {
+
+                    }
+                }
+            });
+
+        }
+    }
+
 }

+ 5 - 0
app/src/main/res/layout/activity_baiduface_preview.xml

@@ -33,6 +33,11 @@
         layout="@layout/window_outcome_floating_pages" />
     <include
         layout="@layout/window_outcome_general" />
+    <com.hanghui.senic.baiduface.view.BaiduResultView
+        android:id="@+id/result_view"
+        android:visibility="invisible"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
 
     <!-- debug按钮 -->
     <TextView

+ 279 - 0
app/src/main/res/layout/layout_baidu_result_view.xml

@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+
+    <RelativeLayout
+        android:id="@+id/rl_top"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/dp_400"
+        android:orientation="vertical"
+        android:visibility="visible">
+
+        <ImageView
+            android:id="@+id/iv_top_bg"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_300"
+            android:scaleType="fitXY" />
+
+        <LinearLayout
+            android:id="@+id/LoadingLocally_TopLinearLayout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/dp_20"
+            android:layout_marginTop="@dimen/dp_31"
+            android:layout_marginRight="@dimen/dp_20"
+            android:gravity="center_horizontal"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/iv_through"
+                android:layout_width="@dimen/dp_111"
+                android:layout_height="@dimen/dp_111"
+                android:layout_gravity="center"
+                android:layout_marginRight="@dimen/dp_30"
+                android:visibility="visible" />
+
+            <TextView
+                android:id="@+id/tv_through"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:ellipsize="end"
+                android:gravity="center"
+                android:maxEms="8"
+                android:maxLines="1"
+                android:text="请通行"
+                android:textColor="@color/f1677FF"
+                android:textSize="@dimen/dp_92"
+                android:textStyle="bold" />
+        </LinearLayout>
+        <!--倒计时-->
+        <LinearLayout
+            android:id="@+id/ll_count_down"
+            android:layout_width="@dimen/dp_97"
+            android:layout_height="@dimen/dp_50"
+            android:layout_alignParentRight="true"
+            android:layout_marginTop="@dimen/dp_20"
+            android:layout_marginRight="@dimen/dp_10"
+            android:layout_below="@+id/LoadingLocally_TopLinearLayout"
+            android:background="@drawable/activity_outcome_time2"
+            android:visibility="invisible"
+            android:gravity="center">
+
+            <TextView
+                android:id="@+id/tv_count_down"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text=""
+                android:layout_gravity="center_vertical"
+                android:layout_marginLeft="@dimen/dp_5"
+                android:textColor="@color/white"
+                android:textSize="@dimen/dp_28" />
+
+            <ImageView
+                android:layout_width="@dimen/dp_32"
+                android:layout_height="@dimen/dp_32"
+                android:layout_marginLeft="@dimen/dp_3"
+                android:layout_marginRight="@dimen/dp_5"
+                android:layout_gravity="center_vertical"
+                android:background="@mipmap/outcomeactivity_timexx" />
+        </LinearLayout>
+    </RelativeLayout>
+
+
+    <FrameLayout
+        android:id="@+id/fl_user_info"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true">
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_300"
+            android:layout_gravity="bottom"
+            android:orientation="vertical">
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/dp_100"
+                android:background="@drawable/outcome_masked_white2" />
+
+            <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/white" />
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:orientation="vertical"
+            android:paddingBottom="@dimen/dp_68"
+            android:visibility="visible">
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_42"
+                android:layout_marginRight="@dimen/dp_42"
+                android:layout_marginBottom="@dimen/dp_10"
+                android:background="@drawable/outcome_masked_white">
+
+                <LinearLayout
+                    android:id="@+id/ll_outcome_masked"
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/dp_300"
+                    android:orientation="vertical" />
+
+                <ImageView
+                    android:id="@+id/iv_photo"
+                    android:layout_width="@dimen/dp_180"
+                    android:layout_height="@dimen/dp_240"
+                    android:layout_alignParentRight="true"
+                    android:layout_gravity="center"
+                    android:layout_marginLeft="@dimen/dp_5"
+                    android:layout_marginTop="@dimen/dp_41"
+                    android:layout_marginRight="@dimen/dp_35"
+                    android:scaleType="centerCrop" />
+                <!-- 姓名身份证-->
+                <LinearLayout
+                    android:id="@+id/OutcomeActivity_NameOrIdNumber"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_35"
+                    android:layout_marginTop="@dimen/dp_41"
+                    android:layout_marginRight="@dimen/dp_30"
+                    android:layout_toLeftOf="@+id/iv_photo"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/tv_name"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="@dimen/dp_7"
+                        android:gravity="left"
+                        android:text=""
+                        android:textColor="@color/f324360"
+                        android:textSize="@dimen/idCardTextSize"
+                        android:textStyle="bold" />
+
+                    <TextView
+                        android:id="@+id/tv_card"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="@dimen/dp_3"
+                        android:gravity="left"
+                        android:text=""
+                        android:textColor="@color/f324360"
+                        android:textSize="@dimen/idCardTextSize"
+                        android:textStyle="bold" />
+
+                    <TextView
+                        android:id="@+id/tv_phone"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="@dimen/dp_3"
+                        android:gravity="left"
+                        android:text=""
+                        android:textColor="@color/f324360"
+                        android:textSize="@dimen/idCardTextSize"
+                        android:textStyle="bold" />
+                </LinearLayout>
+
+                <View
+                    android:id="@+id/OutcomeActivity_OutcomeButtonViewBg"
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/dp_50"
+                    android:layout_below="@+id/iv_photo"
+                    android:background="@color/white"
+                    android:visibility="gone" />
+
+                <LinearLayout
+                    android:id="@+id/OutcomeActivity_OutcomeButtonLinear"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@+id/iv_photo"
+                    android:layout_marginLeft="@dimen/dp_42"
+                    android:layout_marginTop="@dimen/dp_36"
+                    android:layout_marginBottom="@dimen/dp_24"
+                    android:orientation="horizontal"
+                    android:visibility="gone">
+
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/OutcomeActivity_OneLabel"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text=""
+                            android:textColor="@color/f1F3862CC"
+                            android:textSize="@dimen/dp_30" />
+
+                        <TextView
+                            android:id="@+id/OutcomeActivity_OneVaule"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/dp_5"
+                            android:text=""
+                            android:textColor="@color/f3B7EED"
+                            android:textSize="@dimen/dp_32" />
+
+                        <TextView
+                            android:id="@+id/OutcomeActivity_eTwoLabel"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/dp_16"
+                            android:text=""
+                            android:textColor="@color/f1F3862CC"
+                            android:textSize="@dimen/dp_30" />
+
+                        <TextView
+                            android:id="@+id/OutcomeActivity_TwoValue"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/dp_5"
+                            android:text=""
+                            android:textColor="@color/f3B7EED"
+                            android:textSize="@dimen/dp_32" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="@dimen/dp_70"
+                        android:layout_marginRight="@dimen/dp_30"
+                        android:layout_weight="1.5"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/LoadingLocally_ThrLabel"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="left"
+                            android:layout_marginLeft="@dimen/dp_5"
+                            android:text=""
+                            android:textColor="@color/f1F3862CC"
+                            android:textSize="@dimen/dp_30" />
+
+                        <ImageView
+                            android:id="@+id/LoadingLocally_ThrValue"
+                            android:layout_width="match_parent"
+                            android:layout_height="@dimen/dp_189"
+                            android:layout_gravity="center"
+                            android:layout_marginTop="@dimen/dp_5"
+                            android:scaleType="fitXY" />
+                    </LinearLayout>
+
+
+                </LinearLayout>
+            </RelativeLayout>
+        </RelativeLayout>
+    </FrameLayout>
+</RelativeLayout>

+ 5 - 5
datalibrary/src/main/java/com/example/datalibrary/gl/view/GlMantleSurfacView.java

@@ -83,7 +83,7 @@ public class GlMantleSurfacView extends RelativeLayout {
     }
 
     public void onGlDraw(FaceInfo[] faceInfos , BDFaceImageInstance image , FaceColor colors ) {
-        onGlDraw(faceInfos,image,colors,false);
+        onGlDraw(faceInfos[0],image,colors,false);
     }
     /**
      *
@@ -93,7 +93,7 @@ public class GlMantleSurfacView extends RelativeLayout {
      * @param isShowFaceFrame 是否显示人脸框
      *
     **/
-    public void onGlDraw(FaceInfo[] faceInfos , BDFaceImageInstance image , FaceColor colors,boolean isShowFaceFrame ) {
+    public void onGlDraw(FaceInfo faceInfos , BDFaceImageInstance image , FaceColor colors,boolean isShowFaceFrame ) {
 //        if (glFaceSurfaceView != null){
 //            glFaceSurfaceView.onGlDraw(faceInfos , image , colors.getColors() , rgbRevert , isDraw || mIsRegister);
 //        } else {
@@ -132,17 +132,17 @@ public class GlMantleSurfacView extends RelativeLayout {
             faceTexture.unlockCanvasAndPost(canvas);
             return;
         };
-        if (faceInfos == null || faceInfos.length == 0) {
+        if (faceInfos == null ) {
             // 清空canvas
             canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
             faceTexture.unlockCanvasAndPost(canvas);
             return;
         }
         canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
-        FaceInfo faceInfo = faceInfos[0];
+
 
         RectF rectF = new RectF();
-        rectF.set(FaceOnDrawTexturViewUtil.getFaceRectTwo(faceInfo));
+        rectF.set(FaceOnDrawTexturViewUtil.getFaceRectTwo(faceInfos));
         // 检测图片的坐标和显示的坐标不一样,需要转换。
         FaceOnDrawTexturViewUtil.mapFromOriginalRect(rectF,
                 faceTexture, image);