From 9bef9b0cc3afa38ecc585071179de534936876f1 Mon Sep 17 00:00:00 2001 From: tangqian Date: Fri, 2 Jun 2023 16:03:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8F=90=E6=88=90=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/shop/support/pay/WxPayStrategy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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));