diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index e4d2fdb30..951285261 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -66,7 +66,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { private ProductSkuApi productSkuApi; @Resource - @Lazy + @Lazy // 延迟加载,避免循环依赖 private TradeOrderApi tradeOrderApi; // TODO @芋艿:在详细预览下; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java index cd6b6a13c..df3d2db60 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java @@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronization; @@ -56,6 +57,7 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*; public class AfterSaleServiceImpl implements AfterSaleService { @Resource + @Lazy // 延迟加载,避免循环依赖 private TradeOrderUpdateService tradeOrderUpdateService; @Resource private TradeOrderQueryService tradeOrderQueryService; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index a6b206798..504c55e78 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -83,8 +83,6 @@ import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.DELIV @Slf4j public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { - public static final String ORDER_DETAIL_PATH = "pages/order/detail"; // 订单详情页 - @Resource private TradeOrderMapper tradeOrderMapper; @Resource @@ -373,6 +371,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { MapUtil.builder().put("expressName", express != null ? express.getName() : "") .put("logisticsNo", express != null ? deliveryReqVO.getLogisticsNo() : "").build()); + // TODO @puhui999:可以改成 4.1 4.2。因为都算通知哈; // 4. 发送站内信 tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO() .setOrderId(order.getId()).setUserId(order.getUserId()).setMessage(null)); @@ -384,8 +383,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { public void sendDeliveryOrderMessage(TradeOrderDO order, TradeOrderDeliveryReqVO deliveryReqVO) { // 构建并发送模版消息 Long orderId = order.getId(); - socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO().setPage(ORDER_DETAIL_PATH + "?id=" + orderId) - .setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()).setTemplateTitle(DELIVERY_ORDER) + socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO() + .setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()) + .setTemplateTitle(DELIVERY_ORDER) + .setPage("pages/order/detail?id=" + orderId) // 订单详情页 .addMessage("character_string3", String.valueOf(orderId)) // 订单编号 .addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态 .addMessage("date4", LocalDateTimeUtil.formatNormal(LocalDateTime.now()))// 发货时间 diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index e3892dcd5..9216258db 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import jakarta.annotation.Resource; @@ -28,11 +29,13 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_DELIV public class TradeCombinationOrderHandler implements TradeOrderHandler { @Resource + @Lazy // 延迟加载,避免循环依赖 private TradeOrderUpdateService orderUpdateService; @Resource private TradeOrderQueryService orderQueryService; @Resource + @Lazy // 延迟加载,避免循环依赖 private CombinationRecordApi combinationRecordApi; @Override diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/MessageTemplateConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/MessageTemplateConstants.java index 7031f1d42..5f2cf8965 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/MessageTemplateConstants.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/MessageTemplateConstants.java @@ -10,6 +10,7 @@ public interface MessageTemplateConstants { //======================= 小程序订阅消息 ======================= String WALLET_RECHARGER_PAID = "充值成功通知"; + // TODO @puhui999:这个放在售后那。aftersale String WALLET_RECHARGE_REFUNDED = "退款申请通知"; } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java index a5d1cec3d..4414c8881 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java @@ -59,8 +59,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { private static final String WALLET_RECHARGE_ORDER_SUBJECT = "钱包余额充值"; - public static final String WALLET_MONEY_PATH = "pages/user/wallet/money"; // 钱包详情页 - @Resource private PayWalletRechargeMapper walletRechargeMapper; @Resource @@ -148,8 +146,10 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { // 1. 获得会员钱包信息 PayWalletDO wallet = payWalletService.getWallet(walletRecharge.getWalletId()); // 2. 构建并发送模版消息 - socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO().setPage(WALLET_MONEY_PATH) - .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()).setTemplateTitle(WALLET_RECHARGER_PAID) + socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO() + .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()) + .setTemplateTitle(WALLET_RECHARGER_PAID) + .setPage("pages/user/wallet/money") // 钱包详情界面 .addMessage("character_string1", String.valueOf(payOrderId)) // 支付单编号 .addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额 .addMessage("time3", LocalDateTimeUtil.formatNormal(walletRecharge.getCreateTime())) // 充值时间 @@ -229,8 +229,10 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { PayWalletDO wallet = payWalletService.getWallet(walletId); // 2. 构建并发送模版消息 String thing8 = PayRefundStatusEnum.isSuccess(payRefund.getStatus()) ? SUCCESS.getName() : FAILURE.getName(); - socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO().setPage(WALLET_MONEY_PATH) - .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()).setTemplateTitle(WALLET_RECHARGE_REFUNDED) + socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO() + .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()) + .setTemplateTitle(WALLET_RECHARGE_REFUNDED) + .setPage("pages/user/wallet/money") // 钱包详情界面 .addMessage("character_string1", String.valueOf(payRefund.getId())) // 退款订单编号 .addMessage("time7", LocalDateTimeUtil.formatNormal(payRefund.getCreateTime())) // 申请时间 .addMessage("amount3", fenToYuanStr(payRefund.getRefundPrice())) // 退款金额 diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 269e20e83..9c0e5f57d 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -195,10 +195,12 @@ wx: miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档 # appid: wx62056c0d5e8db250 # 测试号(牛希尧提供的) # secret: 333ae72f41552af1e998fe1f54e1584a - appid: wx63c280fe3248a3e7 # wenhualian的接口测试号 - secret: 6f270509224a7ae1296bbf1c8cb97aed +# appid: wx63c280fe3248a3e7 # wenhualian的接口测试号 +# secret: 6f270509224a7ae1296bbf1c8cb97aed # appid: wxc4598c446f8a9cb3 # 测试号(Kongdy 提供的) # secret: 4a1a04e07f6a4a0751b39c3064a92c8b + appid: wx66186af0759f47c9 # 测试号(puhui 提供的) + secret: 3218bcbd112cbc614c7264ceb20144ac config-storage: type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 key-prefix: wa # Redis Key 的前缀