|
@ -2,15 +2,15 @@ |
|
|
|
|
|
|
|
|
## 需求描述 |
|
|
## 需求描述 |
|
|
|
|
|
|
|
|
用户需求:"进行离场核销时, 如果pad_config中gate_enter_open_enable为true, 不进行网络核销, 直接执行开门" |
|
|
|
|
|
|
|
|
用户需求:"进行离场核销时, 如果pad_config中gate_open_enable为true, 不进行网络核销, 直接执行开门" |
|
|
|
|
|
|
|
|
## 实现方案 |
|
|
## 实现方案 |
|
|
|
|
|
|
|
|
### 1. 配置项位置 |
|
|
### 1. 配置项位置 |
|
|
|
|
|
|
|
|
配置项 `gate_enter_open_enable` 位于: |
|
|
|
|
|
|
|
|
配置项 `gate_open_enable` 位于: |
|
|
``` |
|
|
``` |
|
|
pad_config -> extension -> pad_setting -> gate_enter_open_enable |
|
|
|
|
|
|
|
|
pad_config -> extension -> pad_setting -> gate_open_enable |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
### 2. 配置获取方法 |
|
|
### 2. 配置获取方法 |
|
@ -18,7 +18,7 @@ pad_config -> extension -> pad_setting -> gate_enter_open_enable |
|
|
使用现有的 `VenueSceneUtils.getGateConfig()` 方法获取配置: |
|
|
使用现有的 `VenueSceneUtils.getGateConfig()` 方法获取配置: |
|
|
```java |
|
|
```java |
|
|
VenueSceneUtils.GateConfig gateConfig = VenueSceneUtils.getGateConfig(context); |
|
|
VenueSceneUtils.GateConfig gateConfig = VenueSceneUtils.getGateConfig(context); |
|
|
boolean gateEnterOpenEnable = gateConfig != null && gateConfig.gateEnterOpenEnable; |
|
|
|
|
|
|
|
|
boolean gateOpenEnable = gateConfig != null && gateConfig.gateOpenEnable; |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
### 3. 修改的文件 |
|
|
### 3. 修改的文件 |
|
@ -33,28 +33,30 @@ boolean gateEnterOpenEnable = gateConfig != null && gateConfig.gateEnterOpenEnab |
|
|
```java |
|
|
```java |
|
|
// 判断是进场还是离场场景 |
|
|
// 判断是进场还是离场场景 |
|
|
if (VenueSceneUtils.isLeaveScene(OXFaceOnlineActivity.this)) { |
|
|
if (VenueSceneUtils.isLeaveScene(OXFaceOnlineActivity.this)) { |
|
|
// 离场场景:检查gate_enter_open_enable配置 |
|
|
|
|
|
|
|
|
// 离场场景:检查gate_open_enable配置 |
|
|
VenueSceneUtils.GateConfig gateConfig = VenueSceneUtils.getGateConfig(OXFaceOnlineActivity.this); |
|
|
VenueSceneUtils.GateConfig gateConfig = VenueSceneUtils.getGateConfig(OXFaceOnlineActivity.this); |
|
|
if (gateConfig != null && gateConfig.gateEnterOpenEnable) { |
|
|
|
|
|
// 如果gate_enter_open_enable为true,直接开门不进行网络核销 |
|
|
|
|
|
LogManager.logInfo(TAG, "检测到离场场景,gate_enter_open_enable为true,直接开启B门"); |
|
|
|
|
|
showLoadingStatus("离场验证成功"); |
|
|
|
|
|
|
|
|
if (gateConfig != null && gateConfig.gateOpenEnable) { |
|
|
|
|
|
// 如果gate_open_enable为true,直接开门不进行网络核销 |
|
|
|
|
|
LogManager.logInfo(TAG, "检测到离场场景,gate_open_enable为true,直接开启B门"); |
|
|
|
|
|
showLoadingStatus("门已打开,请直接离场"); |
|
|
|
|
|
|
|
|
// 2秒后隐藏提示并开门 |
|
|
|
|
|
|
|
|
// 直接开启B门 |
|
|
|
|
|
if (gateABController != null) { |
|
|
|
|
|
LogManager.logInfo(TAG, "gate_open_enable为true,直接开启B门"); |
|
|
|
|
|
gateABController.handleFaceRecognitionSuccess(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pauseCamera(); |
|
|
|
|
|
// 5秒后隐藏提示并恢复摄像头 |
|
|
new Handler().postDelayed(new Runnable() { |
|
|
new Handler().postDelayed(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
public void run() { |
|
|
public void run() { |
|
|
hideLoadingStatus(); |
|
|
hideLoadingStatus(); |
|
|
|
|
|
|
|
|
// 直接开启B门 |
|
|
|
|
|
if (isUDPInitialized && udpExample != null) { |
|
|
|
|
|
LogManager.logInfo(TAG, "gate_enter_open_enable为true,直接开启B门"); |
|
|
|
|
|
udpExample.handleFaceRecognitionSuccess(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
resumeCamera(); |
|
|
} |
|
|
} |
|
|
}, 2000); |
|
|
|
|
|
|
|
|
}, 5000); |
|
|
} else { |
|
|
} else { |
|
|
// gate_enter_open_enable为false或配置不存在,按正常流程进行网络校验 |
|
|
|
|
|
|
|
|
// gate_open_enable为false或配置不存在,按正常流程进行网络校验 |
|
|
if (isNetworkAvailable()) { |
|
|
if (isNetworkAvailable()) { |
|
|
LogManager.logInfo(TAG, "检测到离场场景,网络可用,执行离场校验"); |
|
|
LogManager.logInfo(TAG, "检测到离场场景,网络可用,执行离场校验"); |
|
|
performLeaveVerification(base64img); |
|
|
performLeaveVerification(base64img); |
|
@ -69,19 +71,19 @@ if (VenueSceneUtils.isLeaveScene(OXFaceOnlineActivity.this)) { |
|
|
|
|
|
|
|
|
### 配置为 true 时的流程 |
|
|
### 配置为 true 时的流程 |
|
|
``` |
|
|
``` |
|
|
人脸识别成功 → 获取base64图像 → 检查配置 → gate_enter_open_enable=true → 直接开启B门 |
|
|
|
|
|
|
|
|
人脸识别成功 → 获取base64图像 → 检查配置 → gate_open_enable=true → 直接开启B门 |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
### 配置为 false 时的流程 |
|
|
### 配置为 false 时的流程 |
|
|
``` |
|
|
``` |
|
|
人脸识别成功 → 获取base64图像 → 检查配置 → gate_enter_open_enable=false → 网络校验 → 校验成功 → 开启B门 |
|
|
|
|
|
|
|
|
人脸识别成功 → 获取base64图像 → 检查配置 → gate_open_enable=false → 网络校验 → 校验成功 → 开启B门 |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
## 用户体验优化 |
|
|
## 用户体验优化 |
|
|
|
|
|
|
|
|
1. **配置为true时**: |
|
|
1. **配置为true时**: |
|
|
- 显示 "离场验证成功" 提示 |
|
|
|
|
|
- 2秒后自动开门 |
|
|
|
|
|
|
|
|
- 显示 "门已打开,请直接离场" 提示 |
|
|
|
|
|
- 5秒后自动开门并恢复摄像头 |
|
|
- 无需等待网络请求,提升通行速度 |
|
|
- 无需等待网络请求,提升通行速度 |
|
|
|
|
|
|
|
|
2. **配置为false时**: |
|
|
2. **配置为false时**: |
|
@ -90,7 +92,7 @@ if (VenueSceneUtils.isLeaveScene(OXFaceOnlineActivity.this)) { |
|
|
|
|
|
|
|
|
## 配置项说明 |
|
|
## 配置项说明 |
|
|
|
|
|
|
|
|
- **gate_enter_open_enable**: 门禁进入开启使能 |
|
|
|
|
|
|
|
|
- **gate_open_enable**: 门禁开启使能 |
|
|
- **类型**: boolean |
|
|
- **类型**: boolean |
|
|
- **默认值**: false |
|
|
- **默认值**: false |
|
|
- **作用**: 控制离场时是否跳过网络验证直接开门 |
|
|
- **作用**: 控制离场时是否跳过网络验证直接开门 |
|
@ -99,8 +101,8 @@ if (VenueSceneUtils.isLeaveScene(OXFaceOnlineActivity.this)) { |
|
|
|
|
|
|
|
|
### 配置为true时的日志 |
|
|
### 配置为true时的日志 |
|
|
``` |
|
|
``` |
|
|
检测到离场场景,gate_enter_open_enable为true,直接开启B门 |
|
|
|
|
|
gate_enter_open_enable为true,直接开启B门 |
|
|
|
|
|
|
|
|
检测到离场场景,gate_open_enable为true,直接开启B门 |
|
|
|
|
|
gate_open_enable为true,直接开启B门 |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
### 配置为false时的日志 |
|
|
### 配置为false时的日志 |
|
@ -118,13 +120,13 @@ gate_enter_open_enable为true,直接开启B门 |
|
|
## 测试建议 |
|
|
## 测试建议 |
|
|
|
|
|
|
|
|
### 测试场景1:配置为true |
|
|
### 测试场景1:配置为true |
|
|
1. 设置 `gate_enter_open_enable = true` |
|
|
|
|
|
|
|
|
1. 设置 `gate_open_enable = true` |
|
|
2. 进入离场场景 |
|
|
2. 进入离场场景 |
|
|
3. 进行人脸识别 |
|
|
3. 进行人脸识别 |
|
|
4. 验证:应直接开门,不进行网络请求 |
|
|
4. 验证:应直接开门,不进行网络请求 |
|
|
|
|
|
|
|
|
### 测试场景2:配置为false |
|
|
### 测试场景2:配置为false |
|
|
1. 设置 `gate_enter_open_enable = false` |
|
|
|
|
|
|
|
|
1. 设置 `gate_open_enable = false` |
|
|
2. 进入离场场景 |
|
|
2. 进入离场场景 |
|
|
3. 进行人脸识别 |
|
|
3. 进行人脸识别 |
|
|
4. 验证:应进行网络校验,校验成功后开门 |
|
|
4. 验证:应进行网络校验,校验成功后开门 |
|
@ -143,7 +145,7 @@ gate_enter_open_enable为true,直接开启B门 |
|
|
|
|
|
|
|
|
## 总结 |
|
|
## 总结 |
|
|
|
|
|
|
|
|
此次修改实现了根据配置项 `gate_enter_open_enable` 来控制离场时是否跳过网络验证的功能: |
|
|
|
|
|
|
|
|
此次修改实现了根据配置项 `gate_open_enable` 来控制离场时是否跳过网络验证的功能: |
|
|
- 配置为 `true`:离场时直接开门,提升用户通行体验 |
|
|
- 配置为 `true`:离场时直接开门,提升用户通行体验 |
|
|
- 配置为 `false` 或不存在:保持原有的网络校验流程,确保业务安全 |
|
|
- 配置为 `false` 或不存在:保持原有的网络校验流程,确保业务安全 |
|
|
|
|
|
|