|
@@ -121,10 +121,17 @@ public class DoubleVerifyActivityHelp {
|
|
|
boolean isAdmin = Boolean.TRUE.equals(userValidation.getSafeUser()) || Boolean.TRUE.equals(userValidation.getAdminUser()) || Boolean.TRUE.equals(userValidation.getCabinetAdmin());
|
|
|
Triple<Boolean, Boolean, Long> first = activity.doubleVerifyList.get(0);
|
|
|
Triple<Boolean, Boolean, Long> second = activity.doubleVerifyList.get(1);
|
|
|
+ // 第一个人必须是登录人
|
|
|
+ if (!first.getFirst()) {
|
|
|
+ if (!userValidation.getUserId().equals(ChemicalApp.userData.getUserId())) {
|
|
|
+ PopTip.show("请登录人验证!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
// 第一个人是否已认证通过 第二个人未通过
|
|
|
if (!first.getFirst() && !second.getFirst()) {
|
|
|
- binding.hint1IV.setText("第一位验证已通过");
|
|
|
- PopTip.show("第一位验证已通过!");
|
|
|
+ binding.hint1IV.setText("登录人验证已通过");
|
|
|
+ PopTip.show("登录人验证已通过!");
|
|
|
userValidation1 = userValidation;
|
|
|
activity.doubleVerifyList.set(0, new Triple<>(true, isAdmin, Long.valueOf(userValidation.getUserId())));
|
|
|
// 切换到第二位验证人 默认人脸方式
|
|
@@ -178,7 +185,7 @@ public class DoubleVerifyActivityHelp {
|
|
|
// 是否第一位
|
|
|
if (isFirst) {
|
|
|
if (first.getFirst()) {
|
|
|
- PopTip.show("第一位验证已通过!");
|
|
|
+ PopTip.show("登录人验证已通过!");
|
|
|
return;
|
|
|
}
|
|
|
binding.include1LL.removeAllViewsInLayout();
|
|
@@ -192,8 +199,8 @@ public class DoubleVerifyActivityHelp {
|
|
|
ImageView imageView = new ImageView(activity);
|
|
|
imageView.setImageBitmap(faceBitmap);
|
|
|
binding.include1LL.addView(imageView);
|
|
|
- binding.hint1IV.setText("第一位验证已通过");
|
|
|
- PopTip.show("第一位验证已通过!");
|
|
|
+ binding.hint1IV.setText("登录人验证已通过");
|
|
|
+ PopTip.show("登录人验证已通过!");
|
|
|
userValidation1 = userValidationBean;
|
|
|
switchShowDetect(DetectType.FACE_DETECT, false, true);
|
|
|
}
|
|
@@ -242,7 +249,7 @@ public class DoubleVerifyActivityHelp {
|
|
|
}
|
|
|
} else {
|
|
|
if (!first.getFirst()) {
|
|
|
- PopTip.show("第一位验证未通过!");
|
|
|
+ PopTip.show("登录人验证未通过!");
|
|
|
return;
|
|
|
}
|
|
|
binding.include2LL.removeAllViewsInLayout();
|
|
@@ -310,63 +317,66 @@ public class DoubleVerifyActivityHelp {
|
|
|
switchDetectUi(faceDetect, isFirst);
|
|
|
}
|
|
|
|
|
|
- private CountDownTimer qrTimer = new CountDownTimer(1000, 1000) {
|
|
|
- @Override
|
|
|
- public void onTick(long millisUntilFinished) {
|
|
|
+ private CountDownTimer qrTimer;
|
|
|
|
|
|
- }
|
|
|
+ private void startQrTimer() {
|
|
|
+ if (null != qrTimer) {
|
|
|
+ qrTimer.cancel();
|
|
|
+ qrTimer.start();
|
|
|
+ } else {
|
|
|
+ qrTimer = new CountDownTimer(3000, 1000) {
|
|
|
+ @Override
|
|
|
+ public void onTick(long millisUntilFinished) {
|
|
|
|
|
|
- @Override
|
|
|
- public void onFinish() {
|
|
|
- if (activity.detectType != DetectType.SCAN_DETECT) {
|
|
|
- qrTimer.cancel();
|
|
|
- qrTimer = null;
|
|
|
- } else {
|
|
|
- ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<UserValidationBean>() {
|
|
|
- @Override
|
|
|
- public UserValidationBean doInBackground() throws Throwable {
|
|
|
- List<HxpCabinetDoorVo> planAddDataDoorList = activity.planAddData.getDoorList();
|
|
|
- List<String> doorIdList = new ArrayList<>();
|
|
|
- if (null != planAddDataDoorList && !planAddDataDoorList.isEmpty()) {
|
|
|
- for (int i = 0; i < planAddDataDoorList.size(); i++) {
|
|
|
- doorIdList.add(String.valueOf(planAddDataDoorList.get(i).getDoorId()));
|
|
|
- }
|
|
|
- }
|
|
|
- Response response = HttpTool.aioScanLogin1(qrScanTime, ChemicalApp.subjectId, doorIdList);
|
|
|
- LogUtils.json(response);
|
|
|
- LogUtils.d(response.body().string());
|
|
|
- if (response.isSuccessful()) {
|
|
|
- String json = response.body().string();
|
|
|
- JSONObject jsonObject = new JSONObject(json);
|
|
|
- int code = jsonObject.getInt("code");
|
|
|
- if (200 == code) {
|
|
|
- return GsonUtils.fromJson(jsonObject.getJSONObject("data").toString(), UserValidationBean.class);
|
|
|
- } else {
|
|
|
- PopTip.show(jsonObject.getString("message"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFinish() {
|
|
|
+ if (activity.detectType != DetectType.SCAN_DETECT) {
|
|
|
+ qrTimer.cancel();
|
|
|
+ qrTimer = null;
|
|
|
+ } else {
|
|
|
+ ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<UserValidationBean>() {
|
|
|
+ @Override
|
|
|
+ public UserValidationBean doInBackground() throws Throwable {
|
|
|
+ List<HxpCabinetDoorVo> planAddDataDoorList = activity.planAddData.getDoorList();
|
|
|
+ List<String> doorIdList = new ArrayList<>();
|
|
|
+ if (null != planAddDataDoorList && !planAddDataDoorList.isEmpty()) {
|
|
|
+ for (int i = 0; i < planAddDataDoorList.size(); i++) {
|
|
|
+ doorIdList.add(String.valueOf(planAddDataDoorList.get(i).getDoorId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Response response = HttpTool.aioScanLogin1(qrScanTime, ChemicalApp.subjectId, doorIdList);
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ String json = response.body().string();
|
|
|
+ JSONObject jsonObject = new JSONObject(json);
|
|
|
+ int code = jsonObject.getInt("code");
|
|
|
+ if (200 == code) {
|
|
|
+ return GsonUtils.fromJson(jsonObject.getJSONObject("data").toString(), UserValidationBean.class);
|
|
|
+ } else {
|
|
|
+ PopTip.show(jsonObject.getString("message"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PopTip.show(response.message());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
- } else {
|
|
|
- PopTip.show(response.message());
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
- @Override
|
|
|
- public void onSuccess(UserValidationBean result) {
|
|
|
- if (null != result) {
|
|
|
- qrTimer.cancel();
|
|
|
- qrTimer = null;
|
|
|
- verifyProcess(result);
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public void onSuccess(UserValidationBean result) {
|
|
|
+ if (null != result) {
|
|
|
+ qrTimer.cancel();
|
|
|
+ qrTimer = null;
|
|
|
+ verifyProcess(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ qrTimer.start();
|
|
|
}
|
|
|
- });
|
|
|
- qrTimer.start();
|
|
|
- }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ qrTimer.start();
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
- private void startQrTimer() {
|
|
|
- qrTimer.cancel();
|
|
|
- qrTimer.start();
|
|
|
}
|
|
|
|
|
|
private void switchDetectUi(DetectType detectType, boolean isFirst) {
|
|
@@ -376,21 +386,21 @@ public class DoubleVerifyActivityHelp {
|
|
|
binding.face1IB.setVisibility(View.GONE);
|
|
|
binding.scan1IB.setVisibility(View.VISIBLE);
|
|
|
binding.card1IB.setVisibility(View.VISIBLE);
|
|
|
- binding.hint1IV.setText("请第一位人脸验证");
|
|
|
+ binding.hint1IV.setText("请登录人人脸验证");
|
|
|
binding.hintBottom1IV.setText("请正对屏幕并使脸位于取景框内");
|
|
|
break;
|
|
|
case CARD_DETECT:
|
|
|
binding.face1IB.setVisibility(View.VISIBLE);
|
|
|
binding.scan1IB.setVisibility(View.VISIBLE);
|
|
|
binding.card1IB.setVisibility(View.GONE);
|
|
|
- binding.hint1IV.setText("请第一位刷卡验证");
|
|
|
+ binding.hint1IV.setText("请登录人刷卡验证");
|
|
|
binding.hintBottom1IV.setText("请在刷卡区域进行刷卡验证");
|
|
|
break;
|
|
|
case SCAN_DETECT:
|
|
|
binding.face1IB.setVisibility(View.VISIBLE);
|
|
|
binding.scan1IB.setVisibility(View.GONE);
|
|
|
binding.card1IB.setVisibility(View.VISIBLE);
|
|
|
- binding.hint1IV.setText("请第一位扫码验证");
|
|
|
+ binding.hint1IV.setText("请登录人扫码验证");
|
|
|
binding.hintBottom1IV.setText("请打开微信扫描屏幕二维码");
|
|
|
break;
|
|
|
}
|