feat:云音箱

This commit is contained in:
dzc committed 2026-04-28 15:39:58 +08:00
1 parent 810038864d
commit e68298d177
1 file changed
+27 -23
@@ -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<HardManagerEntity> yyxList = hardManagerMapper.selectList(new LambdaQueryWrapper<HardManagerEntity>().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<HardManagerEntity> yyxList = hardManagerMapper.selectList(new LambdaQueryWrapper<HardManagerEntity>().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) {