From cd6ec9e759ec218cef72f109007a54ad2aa038e1 Mon Sep 17 00:00:00 2001 From: jjLv <1981429112@qq.com> Date: Wed, 4 Jun 2025 11:24:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8C=E5=B1=8F=E6=9C=BA=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9-?= =?UTF-8?q?=E5=8E=BB=E9=99=A4nacos=E4=B8=AD=E7=9A=84APP=5FID=E5=92=8CAPP?= =?UTF-8?q?=5FKEY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceServiceImpl.java | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/DeviceServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/DeviceServiceImpl.java index 650dcc1..d6d2a09 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/DeviceServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/DeviceServiceImpl.java @@ -31,10 +31,11 @@ public class DeviceServiceImpl implements DeviceService { private static final Logger logger = LoggerFactory.getLogger(DeviceServiceImpl.class); - @Value("${face.android.appId}") - private String appId; - @Value("${face.android.sdkKey}") - private String appKey; + /** + * Android 人脸识别 默认 应用ID和应用密钥 + */ + private static final String DEFAULT_APP_ID = "52XE2dQBtdmMsfDMvyKmPCCPyFsc4jvo8TKvAdaYfr28"; + private static final String DEFAULT_APP_KEY = "9YFPa6eiuNQAFnzJUadn4LaR8w1bcw3a5ZWYZB6FB57Y"; @Override public AjaxResult getDeviceInfo(AppDTO dto) { @@ -43,8 +44,30 @@ public class DeviceServiceImpl implements DeviceService { if (deviceInfoVo == null) { return AjaxResult.error("设备不存在"); } - deviceInfoVo.setAppId(appId); - deviceInfoVo.setAppKey(appKey); + List list = mapper.getParamInfo(); + if (list != null && !list.isEmpty()) { + for (ParamVO vo : list) { + String key = vo.getParamKey(); + String value = vo.getParamValue(); + if (key == null) { + continue; + } + switch (vo.getParamKey()) { + case "app_id": + deviceInfoVo.setAppId(value); + break; + case "app_key": + deviceInfoVo.setAppKey(value); + break; + default: + break; + } + } + }else{ + // 如果没有参数信息,设置默认值 + deviceInfoVo.setAppId(DEFAULT_APP_ID); + deviceInfoVo.setAppKey(DEFAULT_APP_KEY); + } deviceInfoVo.setTenantId(String.valueOf(GlobalConstants.TENANT_ID)); return AjaxResult.success(deviceInfoVo); }