pull/1121/head
梁宇奇 2025-09-04 14:29:34 +08:00
parent 544a24d19e
commit f05bab008b
8 changed files with 27 additions and 9 deletions

View File

@ -179,6 +179,7 @@ public class AssetController extends XktBaseController {
rechargeAddDTO.setAmount(vo.getAmount());
rechargeAddDTO.setPayChannel(EPayChannel.of(vo.getPayChannel()));
rechargeAddDTO.setPayPage(EPayPage.of(vo.getPayPage()));
rechargeAddDTO.setReturnUrl(vo.getReturnUrl());
RechargeAddResult result = assetService.rechargeByStore(rechargeAddDTO);
return success(new StoreRechargeRespVO(result.getBillNo(), result.getPayRtnStr()));
}

View File

@ -24,4 +24,7 @@ public class StoreRechargeReqVO {
@NotNull(message = "支付来源不能为空")
@ApiModelProperty(value = "支付来源[1:电脑网站 2:手机网站 3:APP]", required = true)
private Integer payPage;
@ApiModelProperty(value = "支付完成后跳转url")
private String returnUrl;
}

View File

@ -274,7 +274,8 @@ alipay:
rootCertPath: C:/alipay/test/alipayRootCert.crt
alipayPublicCertPath: C:/alipay/test/alipayPublicCert.crt
notifyUrl: http://101.34.251.164:9310/rest/v1/alipay-callback/notify
returnUrl:
defaultReturnUrl: http://121.40.214.172/index.html
orderReturnUrl: http://121.40.214.172/index.html
signType: RSA2
charset: UTF-8
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do

View File

@ -274,7 +274,8 @@ alipay:
rootCertPath: /alipay/test/alipayRootCert.crt
alipayPublicCertPath: /alipay/test/alipayPublicCert.crt
notifyUrl: http://121.40.117.244:9310/rest/v1/alipay-callback/notify
returnUrl:
defaultReturnUrl: http://121.40.214.172/index.html
orderReturnUrl: http://121.40.214.172/index.html
signType: RSA2
charset: UTF-8
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do

View File

@ -28,4 +28,8 @@ public class RechargeAddDTO {
*
*/
private EPayPage payPage;
/**
* url
*/
private String returnUrl;
}

View File

@ -29,9 +29,10 @@ public interface PaymentManager {
* @param subject
* @param payPage
* @param expireTime
* @param returnUrl
* @return ///&
*/
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime);
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime, String returnUrl);
/**
*

View File

@ -3,6 +3,7 @@ package com.ruoyi.xkt.manager.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
@ -61,8 +62,11 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
@Value("${alipay.notifyUrl:}")
private String notifyUrl;
@Value("${alipay.returnUrl:}")
private String returnUrl;
@Value("${alipay.defaultReturnUrl:}")
private String defaultReturnUrl;
@Value("${alipay.orderReturnUrl:}")
private String orderReturnUrl;
@Value("${alipay.signType:}")
private String signType;
@ -109,7 +113,8 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
}
@Override
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime) {
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime,
String returnUrl) {
Assert.notEmpty(tradeNo);
Assert.notNull(amount);
Assert.notEmpty(subject);
@ -120,7 +125,9 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
reqDTO.setSubject(subject);
reqDTO.setEnablePayChannels("balance,moneyFund,bankPay,debitCardExpress");
reqDTO.setTimeExpire(DateUtil.formatDateTime(expireTime));
if (StrUtil.isBlank(returnUrl)) {
returnUrl = defaultReturnUrl;
}
switch (payPage) {
case WEB:
reqDTO.setProductCode("FAST_INSTANT_TRADE_PAY");
@ -195,7 +202,7 @@ public class AliPaymentMangerImpl implements PaymentManager, InitializingBean {
throw new ServiceException("订单[" + orderExt.getOrder().getOrderNo() + "]支付状态异常");
}
return pay(orderExt.getOrder().getOrderNo(), orderExt.getOrder().getTotalAmount(),
"代发订单" + orderExt.getOrder().getOrderNo(), payPage, null);
"代发订单" + orderExt.getOrder().getOrderNo(), payPage, null, orderReturnUrl);
}
@Override

View File

@ -245,7 +245,7 @@ public class AssetServiceImpl implements IAssetService {
7, TimeUnit.DAYS);
PaymentManager paymentManager = getPaymentManager(rechargeAddDTO.getPayChannel());
String payRtnStr = paymentManager.pay(billNo, rechargeAddDTO.getAmount(),
"档口充值", rechargeAddDTO.getPayPage(), null);
"档口充值", rechargeAddDTO.getPayPage(), null, rechargeAddDTO.getReturnUrl());
return new RechargeAddResult(billNo, payRtnStr);
}