From e68298d177eaae12acf55e9230a8ad437dbe094a Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Tue, 28 Apr 2026 15:39:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BA=91=E9=9F=B3=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hard/service/impl/yyx/YyxServiceImpl.java | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/yyx/YyxServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/yyx/YyxServiceImpl.java index 8acda2799..b68a54bb5 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/yyx/YyxServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/yyx/YyxServiceImpl.java @@ -39,30 +39,34 @@ public class YyxServiceImpl implements YyxService { @Override public void send(Long mchId, Integer payPrice, String phone) { - if (!ObjectUtil.isAllNotEmpty(mchId, payPrice, phone)) { - return; + try { + if (!ObjectUtil.isAllNotEmpty(mchId, payPrice, phone)) { + return; + } + // 查询商户绑定的云音箱设备 + List yyxList = hardManagerMapper.selectList(new LambdaQueryWrapper().eq(HardManagerEntity::getMerchantId, mchId) + .eq(HardManagerEntity::getType, HardTypeEnum.YYX.getType()) + ); + if (ObjectUtil.isEmpty(yyxList)) { + return; + } + + String yuanPrice = fenToYuan(payPrice); + String lastPhone = phoneToLastPhone(phone); + + String template = yyxConf.getTemplate(); + + // 把`template`中的`${price}`替换为`yuanPrice` + template = template.replace("${price}", yuanPrice); + // 把`template`中的`${phone}`替换为`lastPhone` + template = template.replace("${phone-last}", lastPhone); + + + String finalTemplate = template; + yyxList.forEach(v -> httpSend(v.getUniqueCode(), finalTemplate)); + } catch (Exception e) { + log.error("|{}|发送失败,异常:{}", TAG, e.getMessage()); } - // 查询商户绑定的云音箱设备 - List yyxList = hardManagerMapper.selectList(new LambdaQueryWrapper().eq(HardManagerEntity::getMerchantId, mchId) - .eq(HardManagerEntity::getType, HardTypeEnum.YYX.getType()) - ); - if (ObjectUtil.isEmpty(yyxList)) { - return; - } - - String yuanPrice = fenToYuan(payPrice); - String lastPhone = phoneToLastPhone(phone); - - String template = yyxConf.getTemplate(); - - // 把`template`中的`${price}`替换为`yuanPrice` - template = template.replace("${price}", yuanPrice); - // 把`template`中的`${phone}`替换为`lastPhone` - template = template.replace("${phone-last}", lastPhone); - - - String finalTemplate = template; - yyxList.forEach(v -> httpSend(v.getUniqueCode(), finalTemplate)); } private boolean httpSend(String deviceId, String msg) {