Commit a8a3720ecdfe84c232d84d2082ca21c52837a348

Authored by YunaiV
1 parent d8436659

!1359 fix(mall):用户余额充值(虚拟物品)订单上传发货信息到微信小程序订单

yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet;
2 2
3 import cn.hutool.core.date.LocalDateTimeUtil; 3 import cn.hutool.core.date.LocalDateTimeUtil;
4 import cn.hutool.core.lang.Assert; 4 import cn.hutool.core.lang.Assert;
  5 +import cn.hutool.core.util.ObjUtil;
5 import cn.hutool.core.util.ObjectUtil; 6 import cn.hutool.core.util.ObjectUtil;
6 import cn.hutool.extra.spring.SpringUtil; 7 import cn.hutool.extra.spring.SpringUtil;
7 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 8 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
@@ -17,6 +18,7 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; @@ -17,6 +18,7 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
17 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; 18 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
18 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; 19 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
19 import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargeMapper; 20 import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargeMapper;
  21 +import cn.iocoder.yudao.module.pay.enums.PayChannelEnum;
20 import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; 22 import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
21 import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; 23 import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
22 import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; 24 import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
@@ -158,9 +160,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { @@ -158,9 +160,8 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
158 160
159 @Async 161 @Async
160 public void sendWalletRechargerPaidMessage(Long payOrderId, PayWalletRechargeDO walletRecharge) { 162 public void sendWalletRechargerPaidMessage(Long payOrderId, PayWalletRechargeDO walletRecharge) {
161 - // 1. 获得会员钱包信息 163 + // 1. 构建并发送模版消息
162 PayWalletDO wallet = payWalletService.getWallet(walletRecharge.getWalletId()); 164 PayWalletDO wallet = payWalletService.getWallet(walletRecharge.getWalletId());
163 - // 2. 构建并发送模版消息  
164 socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO() 165 socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
165 .setUserId(wallet.getUserId()).setUserType(wallet.getUserType()) 166 .setUserId(wallet.getUserId()).setUserType(wallet.getUserType())
166 .setTemplateTitle(WXA_WALLET_RECHARGER_PAID) 167 .setTemplateTitle(WXA_WALLET_RECHARGER_PAID)
@@ -169,8 +170,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { @@ -169,8 +170,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
169 .addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额 170 .addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额
170 .addMessage("time3", LocalDateTimeUtil.formatNormal(walletRecharge.getCreateTime())) // 充值时间 171 .addMessage("time3", LocalDateTimeUtil.formatNormal(walletRecharge.getCreateTime())) // 充值时间
171 .addMessage("phrase4", "充值成功")); // 充值状态 172 .addMessage("phrase4", "充值成功")); // 充值状态
172 - // 3. 调用接口上传虚拟物品发货信息 173 +
  174 + // 2. 调用接口上传虚拟物品发货信息
  175 + // 注意:只有微信小程序支付的订单,才需要同步
173 PayOrderDO payOrder = payOrderService.getOrder(payOrderId); 176 PayOrderDO payOrder = payOrderService.getOrder(payOrderId);
  177 + if (ObjUtil.notEqual(payOrder.getChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
  178 + return;
  179 + }
174 SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO() 180 SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO()
175 .setTransactionId(payOrder.getChannelOrderNo()) 181 .setTransactionId(payOrder.getChannelOrderNo())
176 .setOpenid(payOrder.getChannelUserId()) 182 .setOpenid(payOrder.getChannelUserId())