diff --git a/README.md b/README.md
index 7a16995bb..2582e5f07 100644
--- a/README.md
+++ b/README.md
@@ -219,85 +219,230 @@ public class SimplePayOrderTest {
Apache License Version 2.0
## 📚 Dromara 成员项目
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/result/PayOrderResult.java b/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/result/PayOrderResult.java
index 3d1ea0132..da3196512 100644
--- a/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/result/PayOrderResult.java
+++ b/daxpay-single-demo/src/main/java/cn/bootx/platform/daxpay/demo/result/PayOrderResult.java
@@ -14,21 +14,11 @@ import lombok.Setter;
@Setter
public class PayOrderResult {
- /** 支付ID */
- private Long paymentId;
+ /** 商户订单号 */
+ private String bizOrderNo;
- /** 是否是异步支付 */
- private boolean asyncPay;
-
- /**
- * 异步支付通道
- * @see PayChannelEnum
- */
- private String asyncChannel;
-
-
- /** 支付参数体(通常用于发起异步支付的参数) */
- private String payBody;
+ /** 订单号 */
+ private String orderNo;
/**
* 支付状态
@@ -36,4 +26,7 @@ public class PayOrderResult {
*/
private String status;
+ /** 支付参数体(通常用于发起支付的参数) */
+ private String payBody;
+
}
diff --git a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/PayNoticeModel.java b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/PayNoticeModel.java
index 3704cb18e..f2f4ad8ea 100644
--- a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/PayNoticeModel.java
+++ b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/PayNoticeModel.java
@@ -6,6 +6,8 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import java.time.LocalDateTime;
+
/**
* 支付异步通知类
* @author xxm
@@ -16,20 +18,23 @@ import lombok.ToString;
@ToString
public class PayNoticeModel {
- /** 支付ID */
- private Long paymentId;
+ /** 订单号 */
+ private String orderNo;
- /** 业务号 */
- private String businessNo;
+ /** 商户订单号 */
+ private String bizOrderNo;
- /** 是否是异步支付 */
- private boolean asyncPay;
+ /** 标题 */
+ private String title;
/**
- * 异步支付通道
+ * 支付通道
* @see PayChannelEnum
*/
- private String asyncChannel;
+ private String channel;
+
+ /** 支付方式 */
+ private String method;
/** 支付金额 */
private Integer amount;
@@ -40,15 +45,15 @@ public class PayNoticeModel {
*/
private String status;
- /** 支付创建时间 */
- private Long createTime;
-
/** 支付成功时间 */
private Long payTime;
/** 支付关闭时间 */
private Long closeTime;
+ /** 支付创建时间 */
+ private Long createTime;
+
/** 商户扩展参数,回调时会原样返回 */
private String attach;
diff --git a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/RefundNoticeModel.java b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/RefundNoticeModel.java
index 74cd0b64f..67ecf13c5 100644
--- a/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/RefundNoticeModel.java
+++ b/daxpay-single-sdk/src/main/java/cn/bootx/platform/daxpay/sdk/model/notice/RefundNoticeModel.java
@@ -6,6 +6,8 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+import java.time.LocalDateTime;
+
/**
* 退款通知消息
* @author xxm
@@ -16,20 +18,17 @@ import lombok.ToString;
@ToString
public class RefundNoticeModel {
- /** 退款ID */
- private Long refundId;
-
/** 退款号 */
private String refundNo;
- /** 是否含有异步通道 */
- private boolean asyncPay;
+ /** 商户退款号 */
+ private String bizRefundNo;
/**
- * 异步通道
+ * 支付通道
* @see PayChannelEnum
*/
- private String asyncChannel;
+ private String channel;
/** 退款金额 */
private Integer amount;
@@ -41,7 +40,7 @@ public class RefundNoticeModel {
private String status;
/** 退款成功时间 */
- private Long refundTime;
+ private Long finishTime;
/** 退款创建时间 */
private Long createTime;
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/allocation/AllocationReceiverController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/allocation/AllocationReceiverController.java
index 65831cd6f..12b117f7d 100644
--- a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/allocation/AllocationReceiverController.java
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/allocation/AllocationReceiverController.java
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
- * 对账接收方控制器
+ * 分账接收方控制器
* @author xxm
* @since 2024/3/28
*/
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/PayOrderController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/PayOrderController.java
index 099586cfd..671ed4a1c 100644
--- a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/PayOrderController.java
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/PayOrderController.java
@@ -59,6 +59,7 @@ public class PayOrderController {
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
return Res.ok(order);
}
+
@Operation(summary = "查询订单详情")
@GetMapping("/findByOrderNo")
public ResResult findByOrderNo(String orderNo){
@@ -67,14 +68,14 @@ public class PayOrderController {
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
PayOrderDetailDto detailDto=new PayOrderDetailDto();
detailDto.setPayOrder(order);
- detailDto.setPayOrderExtra(payOrderExtraService.findById(order.getId()).toDto());
+ detailDto.setPayOrderExtra(payOrderExtraService.findById(order.getId()));
return Res.ok(detailDto);
}
@Operation(summary = "查询支付订单扩展信息")
@GetMapping("/getExtraById")
public ResResult getExtraById(Long id){
- return Res.ok(payOrderExtraService.findById(id).toDto());
+ return Res.ok(payOrderExtraService.findById(id));
}
@Operation(summary = "同步支付状态")
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/RefundOrderController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/RefundOrderController.java
index 1723e4293..e11d5fcb8 100644
--- a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/RefundOrderController.java
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/order/RefundOrderController.java
@@ -9,6 +9,7 @@ import cn.bootx.platform.daxpay.result.pay.SyncResult;
import cn.bootx.platform.daxpay.service.core.order.refund.service.RefundOrderQueryService;
import cn.bootx.platform.daxpay.service.core.order.refund.service.RefundOrderService;
import cn.bootx.platform.daxpay.service.core.payment.sync.service.RefundSyncService;
+import cn.bootx.platform.daxpay.service.dto.order.refund.RefundOrderDetailDto;
import cn.bootx.platform.daxpay.service.dto.order.refund.RefundOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.refund.RefundOrderExtraDto;
import cn.bootx.platform.daxpay.service.param.order.PayOrderRefundParam;
@@ -38,12 +39,23 @@ public class RefundOrderController {
return Res.ok(refundOrderQueryService.page(pageParam, query));
}
+
+ @Operation(summary = "查询退款订单详情")
+ @GetMapping("/findByOrderNo")
+ public ResResult findByRefundNo(String refundNo){
+ RefundOrderDto order = refundOrderQueryService.findByRefundNo(refundNo);
+ RefundOrderDetailDto detailDto = new RefundOrderDetailDto();
+ detailDto.setRefundOrder(order);
+ detailDto.setRefundOrderExtra(refundOrderQueryService.findExtraById(order.getId()));
+ return Res.ok(detailDto);
+ }
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult findById(Long id){
return Res.ok(refundOrderQueryService.findById(id));
}
+
@Operation(summary = "查询扩展信息")
@GetMapping("/findExtraById")
public ResResult findExtraById(Long id){
@@ -57,6 +69,13 @@ public class RefundOrderController {
return Res.ok();
}
+ @Operation(summary = "重新发起退款")
+ @PostMapping("/resetRefund")
+ public ResResult resetRefund(Long id){
+ refundOrderService.resetRefund(id);
+ return Res.ok();
+ }
+
@Operation(summary = "退款同步")
@PostMapping("/syncByRefundNo")
public ResResult syncByRefundNo(String refundNo){
diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/bootx/platform/daxpay/result/order/RefundOrderResult.java b/daxpay-single/daxpay-single-core/src/main/java/cn/bootx/platform/daxpay/result/order/RefundOrderResult.java
index ec885be44..1a080577f 100644
--- a/daxpay-single/daxpay-single-core/src/main/java/cn/bootx/platform/daxpay/result/order/RefundOrderResult.java
+++ b/daxpay-single/daxpay-single-core/src/main/java/cn/bootx/platform/daxpay/result/order/RefundOrderResult.java
@@ -32,11 +32,6 @@ public class RefundOrderResult {
@Schema(description = "退款金额")
private BigDecimal amount;
- /** 退款发起时间 */
- @Schema(description = "退款发起时间")
- @JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
- private LocalDateTime refundTime;
-
@Schema(description = "退款完成时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
private LocalDateTime finishTime;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayAllocationService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayAllocationService.java
index 48f3c9c9a..d248c88bb 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayAllocationService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayAllocationService.java
@@ -46,7 +46,7 @@ public class AliPayAllocationService {
public void allocation(AllocationOrder allocationOrder, List orderDetails){
// 分账主体参数
AlipayTradeOrderSettleModel model = new AlipayTradeOrderSettleModel();
- model.setOutRequestNo(String.valueOf(allocationOrder.getOrderNo()));
+ model.setOutRequestNo(allocationOrder.getOrderNo());
model.setTradeNo(allocationOrder.getOutOrderNo());
model.setRoyaltyMode(AliPayCode.ALLOC_ASYNC);
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRefundService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRefundService.java
index 95fabc715..3a792c458 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRefundService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRefundService.java
@@ -32,8 +32,8 @@ public class AliPayRefundService {
public void refund(RefundOrder refundOrder) {
RefundLocal refundInfo = PaymentContextLocal.get().getRefundInfo();
AlipayTradeRefundModel refundModel = new AlipayTradeRefundModel();
- refundModel.setOutTradeNo(String.valueOf(refundOrder.getOrderNo()));
- refundModel.setOutRequestNo(String.valueOf(refundOrder.getRefundNo()));
+ refundModel.setOutTradeNo(refundOrder.getOrderNo());
+ refundModel.setOutRequestNo(refundOrder.getRefundNo());
// 金额转换
String refundAmount = String.valueOf(refundOrder.getAmount()*0.01);
refundModel.setRefundAmount(refundAmount);
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPaySyncService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPaySyncService.java
index 2c3ad88d3..01e65e27c 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPaySyncService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPaySyncService.java
@@ -119,7 +119,7 @@ public class AliPaySyncService {
// 成功
if (Objects.equals(tradeStatus, AliPayCode.REFUND_SUCCESS)){
LocalDateTime localDateTime = LocalDateTimeUtil.of(response.getGmtRefundPay());
- return syncResult.setRefundTime(localDateTime).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
+ return syncResult.setFinishTime(localDateTime).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
} else {
return syncResult.setSyncStatus(RefundSyncStatusEnum.FAIL).setErrorMsg("支付宝网关退款未成功");
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayCallbackService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayCallbackService.java
index cfeb662e0..cf0e1c245 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayCallbackService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayCallbackService.java
@@ -62,7 +62,7 @@ public class UnionPayCallbackService {
// 判断并保存回调类型
PaymentTypeEnum callbackType = this.getCallbackType();
callbackInfo.setCallbackType(callbackType)
- .setChannel(PayChannelEnum.ALI.getCode());
+ .setChannel(PayChannelEnum.UNION_PAY.getCode());
// 验证消息
if (!this.verifyNotify()) {
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayRefundService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayRefundService.java
index 07d8cd04d..3bb0e5dcc 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayRefundService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPayRefundService.java
@@ -28,22 +28,22 @@ public class UnionPayRefundService {
/**
* 退款方法
*/
- public void refund(RefundOrder refundOrder, PayOrder payOrder,UnionPayKit unionPayKit) {
+ public void refund(RefundOrder refundOrder, UnionPayKit unionPayKit) {
// 金额转换
BigDecimal refundAmount = BigDecimal.valueOf(refundOrder.getAmount() * 0.01);
- BigDecimal orderAmount = BigDecimal.valueOf(payOrder.getAmount() * 0.01);
+ BigDecimal orderAmount = BigDecimal.valueOf(refundOrder.getOrderAmount() * 0.01);
UnionRefundOrder unionRefundOrder = new UnionRefundOrder();
unionRefundOrder.setRefundNo(refundOrder.getRefundNo());
- unionRefundOrder.setTradeNo(String.valueOf(payOrder.getOrderNo()));
+ unionRefundOrder.setTradeNo(refundOrder.getOutOrderNo());
unionRefundOrder.setRefundAmount(refundAmount);
unionRefundOrder.setTotalAmount(orderAmount);
UnionRefundResult refund = unionPayKit.refund(unionRefundOrder);
- String gatewayNo = (String) refund.getAttr(UnionPayCode.QUERY_ID);
+ String outRefundNo = (String) refund.getAttr(UnionPayCode.QUERY_ID);
// 云闪付退款是否成功需要查询状态, 所以设置为退款中状态
RefundLocal refundInfo = PaymentContextLocal.get().getRefundInfo();
- refundInfo.setStatus(RefundStatusEnum.PROGRESS).setOutRefundNo(gatewayNo);
+ refundInfo.setStatus(RefundStatusEnum.PROGRESS).setOutRefundNo(outRefundNo);
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPaySyncService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPaySyncService.java
index a802c71e9..a2a327e1f 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPaySyncService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/union/service/UnionPaySyncService.java
@@ -43,7 +43,7 @@ public class UnionPaySyncService {
PaySyncResult syncResult = new PaySyncResult().setSyncStatus(PaySyncStatusEnum.FAIL);
AssistOrder query = new AssistOrder();
- query.setOutTradeNo(String.valueOf(order.getId()));
+ query.setOutTradeNo(order.getOrderNo());
Map result = unionPayKit.query(query);
syncResult.setSyncInfo(JSONUtil.toJsonStr(result));
@@ -132,7 +132,7 @@ public class UnionPaySyncService {
String queryId = MapUtil.getStr(result, QUERY_ID);
String timeEnd = MapUtil.getStr(result, TXN_TIME);
LocalDateTime time = LocalDateTimeUtil.parse(timeEnd, DatePattern.PURE_DATETIME_PATTERN);
- return syncResult.setOutRefundNo(queryId).setRefundTime(time).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
+ return syncResult.setOutRefundNo(queryId).setFinishTime(time).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
}
// 退款中
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPaySyncService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPaySyncService.java
index 434bbaa59..492e0d622 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPaySyncService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPaySyncService.java
@@ -47,7 +47,7 @@ public class WeChatPaySyncService {
.appid(weChatPayConfig.getWxAppId())
.mch_id(weChatPayConfig.getWxMchId())
.nonce_str(WxPayKit.generateStr())
- .out_trade_no(String.valueOf(order.getOrderNo()))
+ .out_trade_no(order.getOrderNo())
.build()
.createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256);
try {
@@ -110,7 +110,7 @@ public class WeChatPaySyncService {
.mch_id(weChatPayConfig.getWxMchId())
.nonce_str(WxPayKit.generateStr())
// 使用退款单号查询, 只返回当前这条, 如果使用支付订单号查询,返回所有相关的
- .out_refund_no(String.valueOf(refundOrder.getRefundNo()))
+ .out_refund_no(refundOrder.getRefundNo())
.build()
.createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256);
@@ -127,7 +127,7 @@ public class WeChatPaySyncService {
if (Objects.equals(tradeStatus, WeChatPayCode.REFUND_SUCCESS)) {
String timeEnd = result.get(WeChatPayCode.REFUND_SUCCESS_TIME);
LocalDateTime time = LocalDateTimeUtil.parse(timeEnd, DatePattern.NORM_DATETIME_PATTERN);
- return syncResult.setRefundTime(time).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
+ return syncResult.setFinishTime(time).setSyncStatus(RefundSyncStatusEnum.SUCCESS);
}
// 退款中
if (Objects.equals(tradeStatus, WeChatPayCode.REFUND_PROCESSING)) {
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/pay/service/PayOrderExtraService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/pay/service/PayOrderExtraService.java
index cd5f96f05..702f7ae97 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/pay/service/PayOrderExtraService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/pay/service/PayOrderExtraService.java
@@ -3,6 +3,7 @@ package cn.bootx.platform.daxpay.service.core.order.pay.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
+import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderExtraDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -23,8 +24,9 @@ public class PayOrderExtraService {
/**
* 查询详情
*/
- public PayOrderExtra findById(Long id){
- return payOrderExtraManager.findById(id).orElseThrow(()->new DataNotExistException("支付订单扩展信息不存在"));
+ public PayOrderExtraDto findById(Long id){
+ return payOrderExtraManager.findById(id).map(PayOrderExtra::toDto)
+ .orElseThrow(()->new DataNotExistException("支付订单扩展信息不存在"));
}
/**
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/entity/RefundOrder.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/entity/RefundOrder.java
index bf60b1198..7878751df 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/entity/RefundOrder.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/entity/RefundOrder.java
@@ -39,6 +39,10 @@ public class RefundOrder extends MpBaseEntity implements EntityBaseFunction new DataNotExistException("退款订单扩展信息不存在"));
}
+ /**
+ * 根据退款号查询
+ */
+ public RefundOrderDto findByRefundNo(String refundNo){
+ return refundOrderManager.findByRefundNo(refundNo).map(RefundOrder::toDto)
+ .orElseThrow(() -> new DataNotExistException("退款订单扩展信息不存在"));
+
+ }
+
/**
* 根据退款号和商户退款号查询
*/
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/service/RefundOrderService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/service/RefundOrderService.java
index 1aa7dbb69..7c5005fa7 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/service/RefundOrderService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/order/refund/service/RefundOrderService.java
@@ -4,12 +4,17 @@ import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.spring.util.WebServletUtil;
import cn.bootx.platform.daxpay.code.PaymentApiCode;
import cn.bootx.platform.daxpay.param.payment.refund.RefundParam;
+import cn.bootx.platform.daxpay.service.core.order.refund.dao.RefundOrderExtraManager;
+import cn.bootx.platform.daxpay.service.core.order.refund.dao.RefundOrderManager;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.RefundOrder;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.RefundOrderExtra;
import cn.bootx.platform.daxpay.service.core.payment.common.service.PaymentAssistService;
import cn.bootx.platform.daxpay.service.core.payment.refund.service.RefundService;
import cn.bootx.platform.daxpay.service.core.system.config.dao.PayApiConfigManager;
import cn.bootx.platform.daxpay.service.core.system.config.entity.PayApiConfig;
import cn.bootx.platform.daxpay.service.core.system.config.service.PayApiConfigService;
import cn.bootx.platform.daxpay.service.param.order.PayOrderRefundParam;
+import cn.bootx.platform.daxpay.util.OrderNoGenerateUtil;
import cn.hutool.extra.servlet.ServletUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -33,6 +38,10 @@ public class RefundOrderService {
private final PayApiConfigService apiConfigService;
private final PaymentAssistService paymentAssistService;
+ private final RefundOrderExtraManager refundOrderExtraManager;
+
+ private final RefundOrderManager refundOrderManager;
+
private final PayApiConfigManager apiConfigManager;
/**
@@ -47,7 +56,7 @@ public class RefundOrderService {
RefundParam refundParam = new RefundParam();
refundParam.setOrderNo(param.getOrderNo());
- refundParam.setBizRefundNo(param.getOrderNo()+"R");
+ refundParam.setBizRefundNo(OrderNoGenerateUtil.refund());
refundParam.setAmount(param.getAmount());
refundParam.setReason(param.getReason());
refundParam.setReqTime(LocalDateTime.now());
@@ -61,4 +70,39 @@ public class RefundOrderService {
// 调用统一退款接口
refundService.refund(refundParam);
}
+
+ /**
+ * 重新退款
+ */
+ public void resetRefund(Long id){
+
+ // 查询扩展信息
+ RefundOrderExtra refundOrderExtra = refundOrderExtraManager.findById(id)
+ .orElseThrow(() -> new DataNotExistException("未找到退款订单"));
+
+ // 查询扩展信息
+ RefundOrder refundOrder = refundOrderManager.findById(id)
+ .orElseThrow(() -> new DataNotExistException("未找到退款订单"));
+
+ String ip = Optional.ofNullable(WebServletUtil.getRequest())
+ .map(ServletUtil::getClientIP)
+ .orElse("未知");
+
+ RefundParam refundParam = new RefundParam();
+ refundParam.setBizRefundNo(refundOrder.getBizRefundNo());
+ // 回调通知
+ refundParam.setNotifyUrl(refundOrderExtra.getNotifyUrl());
+ refundParam.setAttach(refundOrderExtra.getAttach());
+ refundParam.setReqTime(LocalDateTime.now());
+ refundParam.setClientIp(ip);
+
+ // 手动初始化上下文
+ paymentAssistService.initContext(refundParam);
+ // 初始化接口信息为统一退款
+ PayApiConfig api = apiConfigManager.findByCode(PaymentApiCode.REFUND).orElseThrow(() -> new DataNotExistException("未找到统一退款接口信息"));
+ // 设置接口信息
+ apiConfigService.initApiInfo(api);
+ // 调用统一退款接口
+ refundService.refund(refundParam);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/dao/AllocationGroupManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/dao/AllocationGroupManager.java
index 62e401d48..1692d5d7c 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/dao/AllocationGroupManager.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/dao/AllocationGroupManager.java
@@ -43,7 +43,7 @@ public class AllocationGroupManager extends BaseManager findDefaultGroup(String asyncChannel) {
- return findByField(AllocationGroup::getChannel,asyncChannel);
+ public Optional findDefaultGroup(String channel) {
+ return findByField(AllocationGroup::getChannel,channel);
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/service/AllocationService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/service/AllocationService.java
index f7df2d53e..f74654757 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/service/AllocationService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/allocation/service/AllocationService.java
@@ -93,6 +93,7 @@ public class AllocationService {
order.setStatus(AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
.setErrorMsg(null);
} catch (Exception e) {
+ log.error("分账出现错误:", e);
// 失败
order.setStatus(AllocationOrderStatusEnum.ALLOCATION_FAILED.getCode())
.setErrorMsg(e.getMessage());
@@ -144,6 +145,7 @@ public class AllocationService {
.setErrorMsg(null);
} catch (Exception e) {
+ log.error("重新分账出现错误:", e);
// 失败
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_FAILED.getCode())
.setErrorMsg(e.getMessage());
@@ -182,6 +184,7 @@ public class AllocationService {
allocationOrder.setStatus(AllocationOrderStatusEnum.FINISH.getCode())
.setErrorMsg(null);
} catch (Exception e) {
+ log.error("分账完结错误:", e);
// 失败
allocationOrder.setStatus(AllocationOrderStatusEnum.FINISH_FAILED.getCode())
.setErrorMsg(e.getMessage());
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/close/service/PayCloseService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/close/service/PayCloseService.java
index cc0aaddf0..467c429a9 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/close/service/PayCloseService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/close/service/PayCloseService.java
@@ -80,6 +80,8 @@ public class PayCloseService {
// 返回结果
return result;
} catch (Exception e) {
+ log.error("关闭订单失败, id: {}:", payOrder.getId());
+ log.error("关闭订单失败:", e);
// 记录关闭失败的记录
this.saveRecord(payOrder, false, e.getMessage());
result.setCode("1").setMsg(e.getMessage());
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/PayNoticeResult.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/PayNoticeResult.java
index c7563be3c..c92a723dc 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/PayNoticeResult.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/PayNoticeResult.java
@@ -20,51 +20,60 @@ import java.time.LocalDateTime;
@Schema(title = "支付异步通知类")
public class PayNoticeResult {
+ /** 订单号 */
@Schema(description = "订单号")
private String orderNo;
+ /** 商户订单号 */
@Schema(description = "商户订单号")
private String bizOrderNo;
+ /** 标题 */
@Schema(description = "标题")
private String title;
/**
+ * 支付通道
* @see PayChannelEnum
*/
@Schema(description = "支付通道")
private String channel;
- /**
- * 支付方式
- */
+ /** 支付方式 */
@Schema(description = "支付方式")
private String method;
+ /** 支付金额 */
@Schema(description = "支付金额")
private Integer amount;
/**
+ * 支付状态
* @see PayStatusEnum
*/
@Schema(description = "支付状态")
private String status;
+ /** 支付成功时间 */
@Schema(description = "支付成功时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
private LocalDateTime payTime;
+ /** 支付关闭时间 */
@Schema(description = "支付关闭时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
private LocalDateTime closeTime;
+ /** 支付创建时间 */
@Schema(description = "支付创建时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
private LocalDateTime createTime;
+ /** 商户扩展参数,回调时会原样返回 */
@Schema(description = "商户扩展参数,回调时会原样返回")
private String attach;
+ /** 签名 */
@Schema(description = "签名")
private String sign;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/RefundNoticeResult.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/RefundNoticeResult.java
index ff6fc1b31..dbd127c5f 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/RefundNoticeResult.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/result/RefundNoticeResult.java
@@ -20,38 +20,47 @@ import java.time.LocalDateTime;
@Schema(title = "退款通知消息")
public class RefundNoticeResult {
+ /** 退款号 */
@Schema(description = "退款号")
private String refundNo;
+ /** 商户退款号 */
@Schema(description = "商户退款号")
private String bizRefundNo;
/**
+ * 支付通道
* @see PayChannelEnum
*/
- @Schema(description = "异步通道")
+ @Schema(description = "支付通道")
private String channel;
+ /** 退款金额 */
@Schema(description = "退款金额")
private Integer amount;
/**
+ * 退款状态
* @see RefundStatusEnum
*/
@Schema(description = "退款状态")
private String status;
+ /** 退款成功时间 */
@Schema(description = "退款成功时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
- private LocalDateTime refundTime;
+ private LocalDateTime finishTime;
+ /** 退款创建时间 */
@Schema(description = "退款创建时间")
@JsonSerialize(using = LocalDateTimeToTimestampSerializer.class)
private LocalDateTime createTime;
+ /** 商户扩展参数,回调时会原样返回 */
@Schema(description = "商户扩展参数,回调时会原样返回")
private String attach;
+ /** 签名 */
@Schema(description = "签名")
private String sign;
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeAssistService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeAssistService.java
index 81ea454ac..6aab7ae48 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeAssistService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeAssistService.java
@@ -77,7 +77,7 @@ public class ClientNoticeAssistService {
.setRefundNo(order.getRefundNo())
.setChannel(order.getChannel())
.setAmount(order.getAmount())
- .setRefundTime(order.getFinishTime())
+ .setFinishTime(order.getFinishTime())
.setCreateTime(order.getCreateTime())
.setStatus(order.getStatus())
.setAttach(orderExtra.getAttach());
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeService.java
index 555da505f..68eb75329 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/notice/service/ClientNoticeService.java
@@ -108,6 +108,7 @@ public class ClientNoticeService {
taskManager.save(task);
} catch (Exception e) {
log.error("注册支付消息通知任务失败,数据错误,订单ID:{}",order.getId());
+ log.error("错误内容",e);
throw new RuntimeException(e);
}
// 同时触发一次通知, 如果成功发送, 任务结束
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayExpiredTimeService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayExpiredTimeService.java
index 899582b9e..0bc51ac91 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayExpiredTimeService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayExpiredTimeService.java
@@ -41,7 +41,7 @@ public class PayExpiredTimeService {
repository.store(payOrder.getId(), expiredTime);
}
catch (Exception e) {
- log.error("注册支付单超时关闭失败");
+ log.error("注册支付单超时关闭失败",e);
throw new RetryableException();
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayService.java
index 65ea1926c..f57d6fa88 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/service/PayService.java
@@ -155,7 +155,7 @@ public class PayService {
// 支付操作
payStrategy.doPayHandler();
} catch (Exception e) {
- // 记录错误原因
+ // 记录错误原因, 此处没有事务, 所以可以正常更新
payOrder.setErrorMsg(e.getMessage());
payOrderService.updateById(payOrder);
throw e;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/service/ReconcileService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/service/ReconcileService.java
index 68f060979..15cc36f8e 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/service/ReconcileService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/service/ReconcileService.java
@@ -19,6 +19,7 @@ import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralRec
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.ReconcileDiff;
import cn.bootx.platform.daxpay.service.core.payment.reconcile.factory.ReconcileStrategyFactory;
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
+import cn.bootx.platform.daxpay.util.OrderNoGenerateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -55,15 +56,8 @@ public class ReconcileService {
*/
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public ReconcileOrder create(LocalDate date, String channel) {
-
- // 构建对账策略
- AbsReconcileStrategy reconcileStrategy = ReconcileStrategyFactory.create(channel);
-
- // 生成批次号
- String seqNo = reconcileStrategy.generateSequence(date);
-
ReconcileOrder order = new ReconcileOrder()
- .setBatchNo(seqNo)
+ .setBatchNo(OrderNoGenerateUtil.reconciliation())
.setChannel(channel)
.setDate(date);
reconcileOrderManager.save(order);
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/AlipayReconcileStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/AlipayReconcileStrategy.java
index a18c001d8..2e3279fc1 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/AlipayReconcileStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/AlipayReconcileStrategy.java
@@ -1,14 +1,12 @@
package cn.bootx.platform.daxpay.service.core.payment.reconcile.strategy;
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
-import cn.bootx.platform.common.sequence.func.Sequence;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayReconcileService;
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralReconcileRecord;
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
-import cn.bootx.platform.daxpay.service.handler.sequence.DaxPaySequenceHandler;
import cn.hutool.core.date.DatePattern;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@@ -17,7 +15,6 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
-import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@@ -38,9 +35,6 @@ public class AlipayReconcileStrategy extends AbsReconcileStrategy {
private final AliPayConfigService configService;
- private final DaxPaySequenceHandler daxPaySequenceHandler;
-
-
/**
* 策略标识
*
@@ -51,21 +45,6 @@ public class AlipayReconcileStrategy extends AbsReconcileStrategy {
return PayChannelEnum.ALI;
}
- /**
- * 生成对账序列号
- * 规则:通道简称 + yyyyMMdd + 两位流水号
- * 例子:wx2024012001、ali2024012002
- */
- @Override
- public String generateSequence(LocalDate date) {
-
- String prefix = getChannel().getReconcilePrefix();
- String dateStr = LocalDateTimeUtil.format(date, DatePattern.PURE_DATE_PATTERN);
- Sequence sequence = daxPaySequenceHandler.alipayReconcileSequence(dateStr);
- String key = String.format("%02d", sequence.next());
- return prefix + dateStr + key;
- }
-
/**
* 对账前处理, 主要是初始化支付SDK配置
*/
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/UnionPayReconcileStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/UnionPayReconcileStrategy.java
index 120ffdee7..a044c7b49 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/UnionPayReconcileStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/UnionPayReconcileStrategy.java
@@ -1,16 +1,13 @@
package cn.bootx.platform.daxpay.service.core.payment.reconcile.strategy;
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
-import cn.bootx.platform.common.sequence.func.Sequence;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.union.entity.UnionPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.union.service.UnionPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.union.service.UnionPayReconcileService;
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralReconcileRecord;
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
-import cn.bootx.platform.daxpay.service.handler.sequence.DaxPaySequenceHandler;
import cn.bootx.platform.daxpay.service.sdk.union.api.UnionPayKit;
-import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
-import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@@ -41,22 +37,8 @@ public class UnionPayReconcileStrategy extends AbsReconcileStrategy {
private final UnionPayReconcileService reconcileService;
- private final DaxPaySequenceHandler daxPaySequenceHandler;
-
private UnionPayKit unionPayKit;
- /**
- * 生成对账序列号
- */
- @Override
- public String generateSequence(LocalDate date) {
- String prefix = getChannel().getReconcilePrefix();
- String dateStr = LocalDateTimeUtil.format(date, DatePattern.PURE_DATE_PATTERN);
- Sequence sequence = daxPaySequenceHandler.unionPayReconcileSequence(dateStr);
- String key = String.format("%02d", sequence.next());
- return prefix + dateStr + key;
- }
-
/**
* 对账前处理, 主要是初始化支付SDK配置
*/
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/WechatPayReconcileStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/WechatPayReconcileStrategy.java
index d7d5fb4cc..082dc6f08 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/WechatPayReconcileStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/reconcile/strategy/WechatPayReconcileStrategy.java
@@ -1,17 +1,12 @@
package cn.bootx.platform.daxpay.service.core.payment.reconcile.strategy;
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
-import cn.bootx.platform.common.sequence.func.Sequence;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
-import cn.bootx.platform.daxpay.service.core.channel.wechat.convert.WeChatConvert;
-import cn.bootx.platform.daxpay.service.core.channel.wechat.dao.WeChatPayRecordManager;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
-import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayRecord;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WechatPayReconcileService;
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralReconcileRecord;
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
-import cn.bootx.platform.daxpay.service.handler.sequence.DaxPaySequenceHandler;
import cn.hutool.core.date.DatePattern;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@@ -20,10 +15,8 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
-import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
-import java.util.stream.Collectors;
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
@@ -42,8 +35,6 @@ public class WechatPayReconcileStrategy extends AbsReconcileStrategy {
private final WeChatPayConfigService weChatPayConfigService;
- private final DaxPaySequenceHandler daxPaySequenceHandler;
-
private WeChatPayConfig config;
/**
@@ -56,21 +47,6 @@ public class WechatPayReconcileStrategy extends AbsReconcileStrategy {
return PayChannelEnum.WECHAT;
}
- /**
- * 生成对账序列号
- * 生成批次号
- * 规则:通道简称 + yyyyMMdd + 两位流水号
- * 例子:wx2024012001、ali2024012002
- */
- @Override
- public String generateSequence(LocalDate date) {
- String prefix = getChannel().getReconcilePrefix();
- String dateStr = LocalDateTimeUtil.format(date, DatePattern.PURE_DATE_PATTERN);
- Sequence sequence = daxPaySequenceHandler.wechatReconcileSequence(dateStr);
- String key = String.format("%02d", sequence.next());
- return prefix + dateStr + key;
- }
-
/**
* 对账前处理, 主要是初始化支付SDK配置
*/
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundAssistService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundAssistService.java
index 09a44e930..df42453d1 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundAssistService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundAssistService.java
@@ -108,6 +108,7 @@ public class RefundAssistService {
.setOrderId(payOrder.getId())
.setOrderNo(payOrder.getOrderNo())
.setBizOrderNo(payOrder.getBizOrderNo())
+ .setOutOrderNo(payOrder.getOutOrderNo())
.setRefundNo(OrderNoGenerateUtil.refund())
.setBizRefundNo(refundParam.getBizRefundNo())
.setChannel(payOrder.getChannel())
@@ -137,7 +138,7 @@ public class RefundAssistService {
public void updateOrder(RefundOrder refundOrder){
RefundLocal asyncRefundInfo = PaymentContextLocal.get().getRefundInfo();
refundOrder.setStatus(asyncRefundInfo.getStatus().getCode())
- .setRefundNo(asyncRefundInfo.getOutRefundNo());
+ .setOutRefundNo(asyncRefundInfo.getOutRefundNo());
// 退款成功更新退款时间
if (Objects.equals(refundOrder.getStatus(), SUCCESS.getCode())){
// TODO 读取网关返回的退款时间和完成时间
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundService.java
index 3697ac54b..776580546 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/service/RefundService.java
@@ -100,8 +100,6 @@ public class RefundService {
refundAssistService.checkAndParam(param, payOrder);
// 通过退款参数获取退款策略
AbsRefundStrategy refundStrategy = RefundStrategyFactory.create(payOrder.getChannel());
- // 设置支付订单数据
- refundStrategy.setPayOrder(payOrder);
// 进行退款前预处理
refundStrategy.doBeforeRefundHandler();
// 退款操作的预处理, 对支付订单进行预扣款, 返回创建成功的退款订单, 成功后才可以进行下一阶段的操作
@@ -110,8 +108,8 @@ public class RefundService {
try {
// 执行退款策略
refundStrategy.doRefundHandler();
- }
- catch (Exception e) {
+ } catch (Exception e) {
+ log.error("退款出现错误", e);
// 记录处理失败状态
PaymentContextLocal.get().getRefundInfo().setStatus(RefundStatusEnum.FAIL);
// 更新退款失败的记录
@@ -153,7 +151,7 @@ public class RefundService {
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
RefundOrderExtra refundOrderExtra = refundOrderExtraManager.findById(refundOrder.getId())
.orElseThrow(() -> new DataNotExistException("退款订单扩展信息不存在"));
- AbsRefundStrategy refundStrategy = RefundStrategyFactory.create(refundOrder.getRefundNo());
+ AbsRefundStrategy refundStrategy = RefundStrategyFactory.create(refundOrder.getChannel());
// 设置退款订单对象
refundStrategy.setRefundOrder(refundOrder);
// 退款前准备操作
@@ -165,6 +163,7 @@ public class RefundService {
refundStrategy.doRefundHandler();
}
catch (Exception e) {
+ log.error("重新退款失败:", e);
// 记录处理失败状态
PaymentContextLocal.get().getRefundInfo().setStatus(RefundStatusEnum.FAIL);
// 记录退款失败的记录
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/UnionRefundStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/UnionRefundStrategy.java
index 1c8b6ef7a..bb61bd73b 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/UnionRefundStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/UnionRefundStrategy.java
@@ -53,6 +53,6 @@ public class UnionRefundStrategy extends AbsRefundStrategy {
@Override
public void doRefundHandler() {
UnionPayKit unionPayKit = unionPayConfigService.initPayService(unionPayConfig);
- unionPayRefundService.refund(this.getRefundOrder(), this.getPayOrder(), unionPayKit);
+ unionPayRefundService.refund(this.getRefundOrder(), unionPayKit);
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/service/RefundRepairService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/service/RefundRepairService.java
index 17352c8da..b7a2da455 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/service/RefundRepairService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/service/RefundRepairService.java
@@ -63,7 +63,7 @@ public class RefundRepairService {
}
try {
// 获取关联支付单
- PayOrder payOrder = payOrderQueryService.findById(refundOrder.getId())
+ PayOrder payOrder = payOrderQueryService.findById(refundOrder.getOrderId())
.orElseThrow(() -> new RuntimeException("支付单不存在"));
// 根据不同的类型执行对应的修复逻辑
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/result/RefundSyncResult.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/result/RefundSyncResult.java
index 766392db4..0e0f99b24 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/result/RefundSyncResult.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/result/RefundSyncResult.java
@@ -32,7 +32,7 @@ public class RefundSyncResult {
private String outRefundNo;
/** 退款完成时间(通常用于接收网关返回的时间) */
- private LocalDateTime refundTime;
+ private LocalDateTime finishTime;
/** 错误提示码 */
private String errorCode;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/service/RefundSyncService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/service/RefundSyncService.java
index 181007535..013dab6ea 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/service/RefundSyncService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/sync/service/RefundSyncService.java
@@ -107,7 +107,7 @@ public class RefundSyncService {
if (Objects.isNull(repairInfo.getSource())){
repairInfo.setSource(PayRepairSourceEnum.SYNC);
}
- repairInfo.setFinishTime(syncResult.getRefundTime());
+ repairInfo.setFinishTime(syncResult.getFinishTime());
repairResult = this.repairHandler(syncResult, refundOrder);
}
} catch (PayFailureException e) {
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/close/entity/PayCloseRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/close/entity/PayCloseRecord.java
index 6ca150c72..8ec6dc39f 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/close/entity/PayCloseRecord.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/close/entity/PayCloseRecord.java
@@ -45,9 +45,11 @@ public class PayCloseRecord extends MpCreateEntity implements EntityBaseFunction
@DbColumn(comment = "是否关闭成功")
private boolean closed;
+ /** 错误码 */
@DbColumn(comment = "错误码")
private String code;
+ /** 错误消息 */
@DbColumn(comment = "错误消息")
private String errorMsg;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/sync/entity/PaySyncRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/sync/entity/PaySyncRecord.java
index 2ce617a5d..8fbd66650 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/sync/entity/PaySyncRecord.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/record/sync/entity/PaySyncRecord.java
@@ -76,12 +76,15 @@ public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction<
@DbColumn(comment = "是否进行修复")
private boolean repair;
+ /** 修复单号 */
@DbColumn(comment = "修复单号")
private String repairNo;
+ /** 错误码 */
@DbColumn(comment = "错误码")
private String errorCode;
+ /** 错误消息 */
@DbColumn(comment = "错误消息")
private String errorMsg;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDetailDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDetailDto.java
new file mode 100644
index 000000000..24d49595b
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDetailDto.java
@@ -0,0 +1,20 @@
+package cn.bootx.platform.daxpay.service.dto.order.refund;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 退款订单信息
+ * @author xxm
+ * @since 2024/4/28
+ */
+@Data
+@Accessors(chain = true)
+@Schema(title = "退款订单信息")
+public class RefundOrderDetailDto {
+ @Schema(description = "退款订单")
+ RefundOrderDto refundOrder;
+ @Schema(description = "退款订单扩展信息")
+ RefundOrderExtraDto refundOrderExtra;
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDto.java
index 8f85619d0..9cc5a06aa 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDto.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/order/refund/RefundOrderDto.java
@@ -68,10 +68,6 @@ public class RefundOrderDto extends BaseDto {
@Schema(description = "退款原因")
private String reason;
- /** 退款发起时间 */
- @Schema(description = "退款发起时间")
- private LocalDateTime refundTime;
-
@Schema(description = "退款结束时间")
private LocalDateTime finishTime;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/close/PayCloseRecordDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/close/PayCloseRecordDto.java
index 13fa861df..d10360c81 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/close/PayCloseRecordDto.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/close/PayCloseRecordDto.java
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.dto.record.close;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
+import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -18,36 +19,36 @@ import lombok.experimental.Accessors;
@Schema(title = "支付关闭记录")
public class PayCloseRecordDto extends BaseDto {
- /** 支付记录id */
- @Schema(description = "支付记录id")
- private Long paymentId;
+ /** 订单号 */
+ @DbColumn(comment = "订单号")
+ private String orderNo;
- /** 业务号 */
- @Schema(description = "业务号")
- private String businessNo;
+ /** 商户订单号 */
+ @DbColumn(comment = "商户订单号")
+ private String bizOrderNo;
/**
- * 关闭的异步支付通道, 可以为空
- * @see PayChannelEnum#getCode()
+ * 关闭的支付通道
+ * @see PayChannelEnum
*/
- @Schema(description = "关闭的异步支付通道")
- private String asyncChannel;
+ @DbColumn(comment = "关闭的异步支付通道")
+ private String channel;
/**
* 是否关闭成功
*/
- @Schema(description = "是否关闭成功")
+ @DbColumn(comment = "是否关闭成功")
private boolean closed;
+ /** 错误码 */
+ @DbColumn(comment = "错误码")
+ private String code;
+
/** 错误消息 */
- @Schema(description = "错误消息")
+ @DbColumn(comment = "错误消息")
private String errorMsg;
/** 客户端IP */
- @Schema(description = "客户端IP")
+ @DbColumn(comment = "客户端IP")
private String clientIp;
-
- /** 请求链路ID */
- @Schema(description = "请求链路ID")
- private String reqId;
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/repair/PayRepairRecordDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/repair/PayRepairRecordDto.java
index 35ead2d08..ef815a4a0 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/repair/PayRepairRecordDto.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/repair/PayRepairRecordDto.java
@@ -4,7 +4,9 @@ import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.code.PayRepairSourceEnum;
import cn.bootx.platform.daxpay.service.code.PayRepairWayEnum;
+import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
import cn.bootx.platform.daxpay.service.code.RefundRepairWayEnum;
+import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -23,21 +25,25 @@ public class PayRepairRecordDto extends BaseDto {
/**
* 修复号
- * 如果一次修复产生的修复记录只有一条, 则该字段为与ID一致
- * 如果一次修复产生的修复记录有多个, 则使用这个ID作为关联
+ * 如果一次修复产生的修复记录有多个记录, 使用这个作为关联
*/
@Schema(description = "修复号")
private String repairNo;
/** 支付ID/退款ID */
- @Schema(description = "业务ID")
- private Long orderId;
+ @Schema(description = "本地订单ID")
+ private Long tradeId;
- /** 支付业务号/退款号 业务号 */
- @Schema(description = "业务号")
- private String orderNo;
+ /**
+ * 本地交易号, 支付号/退款号
+ */
+ @Schema(description = "本地业务号")
+ private String tradeNo;
- /** 类型 支付修复/退款修复 */
+ /**
+ * 修复类型 支付修复/退款修复
+ * @see PaymentTypeEnum
+ */
@Schema(description = "修复类型")
private String repairType;
@@ -49,32 +55,28 @@ public class PayRepairRecordDto extends BaseDto {
private String repairSource;
/**
- * 修复类型
+ * 修复方式
* @see PayRepairWayEnum
* @see RefundRepairWayEnum
*/
- @Schema(description = "修复类型")
+ @Schema(description = "修复方式")
private String repairWay;
/** 修复的异步通道 */
@Schema(description = "修复的异步通道")
- private String asyncChannel;
+ private String channel;
/**
* 修复前状态
* @see PayStatusEnum
*/
- @Schema(description = "修复前订单状态")
+ @Schema(description = "修复前状态")
private String beforeStatus;
/**
* 修复后状态
* @see PayStatusEnum
*/
- @Schema(description = "修复后订单状态")
+ @Schema(description = "修复后状态")
private String afterStatus;
-
- /** 金额变动 */
- @Schema(description = "金额变动")
- private Integer amount;
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/sync/PaySyncRecordDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/sync/PaySyncRecordDto.java
index 4f19359b6..becb3fb73 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/sync/PaySyncRecordDto.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/record/sync/PaySyncRecordDto.java
@@ -4,6 +4,8 @@ import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.RefundSyncStatusEnum;
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
+import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
+import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -22,19 +24,32 @@ import lombok.experimental.Accessors;
@Schema(title = "支付同步订单")
public class PaySyncRecordDto extends BaseDto {
- /** 本地订单ID */
+ /** 本地交易号 */
@Schema(description = "本地订单ID")
- private String orderId;
+ private String tradeNo;
- /** 本地业务号 */
- @Schema(description = "本地业务号")
- private String orderNo;
+ /** 商户交易号 */
+ @Schema(description = "商户交易号")
+ private String bizTradeNo;
- /** 网关订单号 */
- @Schema(description = "网关订单号")
- private String gatewayOrderNo;
+ /** 三方交易号 */
+ @Schema(description = "三方交易号")
+ private String outTradeNo;
- /** 同步类型 */
+
+ /**
+ * 三方支付返回状态
+ * @see PaySyncStatusEnum
+ * @see RefundSyncStatusEnum
+ */
+ @Schema(description = "网关返回状态")
+ private String outTradeStatus;
+
+
+ /**
+ * 同步类型 支付/退款
+ * @see PaymentTypeEnum
+ */
@Schema(description = "同步类型")
private String syncType;
@@ -43,38 +58,32 @@ public class PaySyncRecordDto extends BaseDto {
* @see PayChannelEnum#getCode()
*/
@Schema(description = "同步的异步通道")
- private String asyncChannel;
+ private String channel;
- /** 通知消息 */
+ /** 网关返回的同步消息 */
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
- @Schema(description = "通知消息")
+ @Schema(description = "同步消息")
private String syncInfo;
- /**
- * 网关返回状态
- * @see PaySyncStatusEnum
- * @see RefundSyncStatusEnum
- */
- @Schema(description = "网关返回状态")
- private String gatewayStatus;
-
/**
* 支付单如果状态不一致, 是否进行修复
*/
@Schema(description = "是否进行修复")
- private boolean repairOrder;
+ private boolean repair;
+ /** 修复单号 */
@Schema(description = "修复单号")
- private String repairOrderNo;
+ private String repairNo;
+ /** 错误码 */
+ @Schema(description = "错误码")
+ private String errorCode;
+
+ /** 错误消息 */
@Schema(description = "错误消息")
private String errorMsg;
/** 客户端IP */
@Schema(description = "客户端IP")
private String clientIp;
-
- /** 请求链路ID */
- @Schema(description = "请求链路ID")
- private String reqId;
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsReconcileStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsReconcileStrategy.java
index 735bd3e39..e6053d8a2 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsReconcileStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsReconcileStrategy.java
@@ -25,12 +25,6 @@ public abstract class AbsReconcileStrategy implements PayStrategy {
/** 对账订单明细 */
private List reconcileDetails;
-
- /**
- * 生成对账序列号
- */
- public abstract String generateSequence(LocalDate date);
-
/**
* 对账前处理, 主要是初始化支付SDK配置
*/
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsRefundStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsRefundStrategy.java
index f44f9bee6..8de3a9bc8 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsRefundStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsRefundStrategy.java
@@ -15,9 +15,6 @@ import lombok.Setter;
@Setter
public abstract class AbsRefundStrategy implements PayStrategy{
- /** 支付订单 */
- private PayOrder payOrder = null;
-
/** 退款订单 */
private RefundOrder refundOrder = null;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/handler/sequence/DaxPaySequenceHandler.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/handler/sequence/DaxPaySequenceHandler.java
deleted file mode 100644
index 5b646337d..000000000
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/handler/sequence/DaxPaySequenceHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package cn.bootx.platform.daxpay.service.handler.sequence;
-
-import cn.bootx.platform.common.sequence.func.Sequence;
-import cn.bootx.platform.common.sequence.util.SequenceUtil;
-import lombok.RequiredArgsConstructor;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * 序列生成器配置类
- * @author xxm
- * @since 2024/2/28
- */
-@Configuration
-@RequiredArgsConstructor
-public class DaxPaySequenceHandler {
-
- /**
- * 支付宝对账单序列生成器
- */
- public Sequence alipayReconcileSequence(String date) {
- return SequenceUtil.create(1,1,1,"AlipayReconcileSequence"+date);
- }
-
- /**
- * 微信对账单序列生成器
- */
- public Sequence wechatReconcileSequence(String date) {
- return SequenceUtil.create(1,1,1,"WechatReconcileSequence"+date);
- }
-
- /**
- * 云闪付对账单序列生成器
- */
- public Sequence unionPayReconcileSequence(String date) {
- return SequenceUtil.create(1,1,1,"UnionPayReconcileSequence"+date);
- }
-}