diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java index 93b012935..a5f91de06 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java @@ -4,9 +4,12 @@ import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration; import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse; import cn.iocoder.yudao.module.shop.utils.OrderUtil; +import cn.iocoder.yudao.module.system.api.tenant.TenantApi; +import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO; import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request; import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result; @@ -36,16 +39,20 @@ public class WxPayStrategy implements IPayStrategy{ private WxPayOneAutoConfiguration wxPayOneAutoConfiguration; @Autowired private WxPayProperties payProperties; + @Autowired + private TenantApi tenantApi; @Override public InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest,String openid) { + Long requiredTenantId = TenantContextHolder.getRequiredTenantId(); + TenantDTO tenant = tenantApi.getTenant(requiredTenantId); InitOrderResponse response = new InitOrderResponse(); WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService(); Assert.notNull(wxPayService, "获取微信支付配置失败!"); WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request(); int sum = orderDO.getPayPrice().multiply(new BigDecimal("100")).intValue(); wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum)); - wxPayRequest.setDescription("会员充值"); + wxPayRequest.setDescription(tenant.getName()); wxPayRequest.setOutTradeNo(orderDO.getOrderId()); wxPayRequest.setNotifyUrl(payProperties.getNotifyUrl()); wxPayRequest.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(openid));