增加支付宝订单关闭时间
parent
23e2c14d28
commit
847f492fab
|
|
@ -1,10 +1,7 @@
|
|||
package com.ruoyi.common.constant;
|
||||
|
||||
import com.ruoyi.common.enums.AdType;
|
||||
import io.jsonwebtoken.Claims;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -228,5 +225,9 @@ public class Constants
|
|||
* 最受欢迎的8个推广位
|
||||
*/
|
||||
public static final String ADVERT_POPULAR = "ADVERT_POPULAR";
|
||||
/**
|
||||
* 支付超时最大时间
|
||||
*/
|
||||
public static final Integer PAY_EXPIRE_MAX_HOURS = 24 * 7;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,4 +38,9 @@ public class AlipayReqDTO {
|
|||
*/
|
||||
@JsonProperty("product_code")
|
||||
private String productCode;
|
||||
/**
|
||||
* 绝对超时时间,格式为yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonProperty("time_expire")
|
||||
private String timeExpire;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.ruoyi.xkt.enums.EPayChannel;
|
|||
import com.ruoyi.xkt.enums.EPayPage;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
|
|
@ -26,9 +27,10 @@ public interface PaymentManager {
|
|||
* @param amount
|
||||
* @param subject
|
||||
* @param payPage
|
||||
* @param expireTime
|
||||
* @return 跳转页面数据/签名字符串/支付跳转链接/预支付交易会话标识(根据支付渠道&支付来源确定)
|
||||
*/
|
||||
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage);
|
||||
String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime);
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.xkt.manager.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
|
@ -13,6 +15,7 @@ import com.alipay.api.domain.AlipayTradeRefundModel;
|
|||
import com.alipay.api.domain.Participant;
|
||||
import com.alipay.api.request.*;
|
||||
import com.alipay.api.response.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.xkt.domain.StoreOrderDetail;
|
||||
import com.ruoyi.xkt.dto.finance.AlipayReqDTO;
|
||||
|
|
@ -28,6 +31,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
|
|
@ -89,7 +93,7 @@ public class AliPaymentMangerImpl implements PaymentManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage) {
|
||||
public String pay(String tradeNo, BigDecimal amount, String subject, EPayPage payPage, Date expireTime) {
|
||||
Assert.notEmpty(tradeNo);
|
||||
Assert.notNull(amount);
|
||||
Assert.notEmpty(subject);
|
||||
|
|
@ -98,6 +102,7 @@ public class AliPaymentMangerImpl implements PaymentManager {
|
|||
reqDTO.setOutTradeNo(tradeNo);
|
||||
reqDTO.setTotalAmount(amount.toPlainString());
|
||||
reqDTO.setSubject(subject);
|
||||
reqDTO.setTimeExpire(DateUtil.formatDateTime(expireTime));
|
||||
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(gatewayUrl, appId, privateKey, DEFAULT_FORMAT, charset,
|
||||
alipayPublicKey, signType);
|
||||
|
|
@ -112,7 +117,7 @@ public class AliPaymentMangerImpl implements PaymentManager {
|
|||
AlipayTradePagePayResponse webResp = alipayClient.pageExecute(webReq);
|
||||
if (webResp.isSuccess()) {
|
||||
return webResp.getBody();
|
||||
}else {
|
||||
} else {
|
||||
String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(webResp);
|
||||
log.error("支付发起失败: {}", diagnosisUrl);
|
||||
}
|
||||
|
|
@ -130,7 +135,7 @@ public class AliPaymentMangerImpl implements PaymentManager {
|
|||
AlipayTradeWapPayResponse wapResp = alipayClient.pageExecute(wapReq);
|
||||
if (wapResp.isSuccess()) {
|
||||
return wapResp.getBody();
|
||||
}else {
|
||||
} else {
|
||||
String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(wapResp);
|
||||
log.error("支付发起失败: {}", diagnosisUrl);
|
||||
}
|
||||
|
|
@ -170,7 +175,8 @@ public class AliPaymentMangerImpl implements PaymentManager {
|
|||
throw new ServiceException("订单[" + orderExt.getOrder().getOrderNo() + "]支付状态异常");
|
||||
}
|
||||
return pay(orderExt.getOrder().getOrderNo(), orderExt.getOrder().getTotalAmount(),
|
||||
"代发订单" + orderExt.getOrder().getOrderNo(), payPage);
|
||||
"代发订单" + orderExt.getOrder().getOrderNo(), payPage,
|
||||
DateUtil.offset(orderExt.getOrder().getCreateTime(), DateField.HOUR, Constants.PAY_EXPIRE_MAX_HOURS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
|
@ -200,7 +202,9 @@ public class AssetServiceImpl implements IAssetService {
|
|||
rechargeAddDTO.getAmount(), rechargeAddDTO.getPayChannel());
|
||||
PaymentManager paymentManager = getPaymentManager(rechargeAddDTO.getPayChannel());
|
||||
String payRtnStr = paymentManager.pay(financeBillExt.getFinanceBill().getBillNo(), rechargeAddDTO.getAmount(),
|
||||
"档口充值", rechargeAddDTO.getPayPage());
|
||||
"档口充值", rechargeAddDTO.getPayPage(),
|
||||
DateUtil.offset(financeBillExt.getFinanceBill().getCreateTime(), DateField.HOUR,
|
||||
Constants.PAY_EXPIRE_MAX_HOURS));
|
||||
return new RechargeAddResult(financeBillExt, payRtnStr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue