fix: 修改相关提成单位

pull/16/head
tangqian 2023-06-02 16:03:47 +08:00
parent 0e26bdbf4b
commit 9bef9b0cc3
1 changed files with 8 additions and 1 deletions

View File

@ -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));