feat: 订单催促

This commit is contained in:
huchuansai
2025-09-24 10:49:50 +08:00
parent e391058b30
commit e777adf6b0
3 changed files with 63 additions and 4 deletions

View File

@@ -76,6 +76,20 @@ public class WxCustomMpService {
wxMpService.addConfigStorage(entity.getAppId(), config);
return wxMpService.switchoverTo(entity.getAppId());
}
public WxMpService proxyWxMpService(String tenantId) {
if (StrUtil.isBlankIfStr(tenantId)) {
throw new CustomException("系统错误,租户ID不能为空");
}
SysTenantEntity entity = tenantService.selectSysTenantByTenantId(tenantId);
if (entity == null) {
throw new CustomException("系统错误,租户ID不能为空");
}
WxMpMapConfigImpl config = new WxMpMapConfigImpl();
config.setAppId(entity.getAppId());
config.setSecret(entity.getSecret());
wxMpService.addConfigStorage(entity.getAppId(), config);
return wxMpService.switchoverTo(entity.getAppId());
}
public WxPayService getWxPay() {
String tenantId = SecurityUtils.getTenantId();
@@ -161,7 +175,7 @@ public class WxCustomMpService {
data.add(new WxMpTemplateData("amount8", money));
templateMessage.setData(data);
try {
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
proxyWxMpService(tenantId).getTemplateMsgService().sendTemplateMsg(templateMessage);
} catch (WxErrorException e) {
log.error("接单成功发送消息异常", e);
}
@@ -324,7 +338,7 @@ public class WxCustomMpService {
data.add(new WxMpTemplateData("thing13", order.getCommodityName()));
templateMessage.setData(data);
try {
proxyWxMpService().getTemplateMsgService().sendTemplateMsg(templateMessage);
proxyWxMpService(tenant.getTenantId()).getTemplateMsgService().sendTemplateMsg(templateMessage);
} catch (WxErrorException e) {
log.error("订单完成发送消息异常", e);
}