From 91b2b3d9614190d8ebe1bef74b528e9ee229c7e8 Mon Sep 17 00:00:00 2001 From: bootx Date: Sat, 8 Jun 2024 23:22:46 +0800 Subject: [PATCH] =?UTF-8?q?ref=20=E5=88=86=E8=B4=A6=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=B8=BAAlloc,=20=E4=B8=8D=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=90=8D=E7=A7=B0,=20=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8B=86=E5=88=86=E9=80=80=E6=AC=BE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=BA=E5=8D=95=E7=8B=AC=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?,=20=E7=AD=96=E7=95=A5=E5=B7=A5=E5=8E=82=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E9=80=9A=E7=94=A8=E7=AD=96=E7=95=A5=E5=B7=A5=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _doc/Task.md | 4 +- .../single/sdk/code/PayChannelEnum.java | 14 ------- .../sdk/code/PayOrderRefundStatusEnum.java | 21 ++++++++++ .../sdk/model/allocation/AllocOrderModel.java | 6 +-- .../sdk/model/allocation/AllocationModel.java | 4 +- .../sdk/model/notice/AllocNoticeModel.java | 6 +-- .../sdk/model/notice/PayNoticeModel.java | 10 ++++- .../single/sdk/model/pay/PayOrderModel.java | 10 ++++- .../param/allocation/AllocFinishParam.java | 8 ++-- .../sdk/param/allocation/AllocSyncParam.java | 4 +- .../allocation/QueryAllocOrderParam.java | 4 +- .../single/sdk/allocation/AllocationTest.java | 4 +- .../single/sdk/query/QueryAllocOrderTest.java | 2 +- .../allocation/AllocationOrderController.java | 6 +-- .../payment/allocation/AllocFinishParam.java | 4 +- .../payment/allocation/AllocSyncParam.java | 4 +- .../allocation/QueryAllocOrderParam.java | 4 +- .../result/allocation/AllocationResult.java | 4 +- .../single/result/order/AllocOrderResult.java | 6 +-- .../single/result/order/PayOrderResult.java | 10 ++++- .../service/AliPayAllocationService.java | 6 +-- .../service/AliPayReconcileService.java | 3 +- .../service/UnionPayReconcileService.java | 3 +- .../service/WeChatPayAllocationService.java | 6 +-- .../service/WechatPayReconcileService.java | 3 +- .../dao/AllocationOrderManager.java | 4 +- .../allocation/entity/AllocationOrder.java | 6 +-- .../service/AllocationOrderService.java | 6 +-- .../core/order/pay/builder/PayBuilder.java | 2 +- .../core/order/pay/dao/PayOrderManager.java | 2 +- .../core/order/pay/entity/PayOrder.java | 2 +- .../allocation/factory/AllocationFactory.java | 39 ------------------- .../factory/AllocationReceiverFactory.java | 38 ------------------ .../service/AllocationCallbackService.java | 2 +- .../service/AllocationGroupService.java | 1 - .../service/AllocationReceiverService.java | 8 ++-- .../allocation/service/AllocationService.java | 38 +++++++++--------- .../service/AllocationSyncService.java | 16 ++++---- .../notice/result/AllocNoticeResult.java | 6 +-- .../notice/result/PayNoticeResult.java | 10 ++++- .../service/ClientNoticeAssistService.java | 2 +- .../payment/pay/service/PayAssistService.java | 2 +- .../reconcile/service/ReconcileService.java | 5 ++- .../transfer/factory/TransferFactory.java | 35 ----------------- .../transfer/service/TransferService.java | 5 +-- .../order/allocation/AllocationOrderDto.java | 6 +-- .../service/dto/order/pay/PayOrderDto.java | 10 ++++- .../handler/excel/PayChannelConvert.java | 1 + .../param/order/AllocationOrderQuery.java | 2 +- .../service/param/order/PayOrderQuery.java | 10 ++++- .../service/task/AllocationSyncTask.java | 2 +- 51 files changed, 177 insertions(+), 239 deletions(-) create mode 100644 daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayOrderRefundStatusEnum.java delete mode 100644 daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/factory/AllocationFactory.java delete mode 100644 daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/factory/AllocationReceiverFactory.java delete mode 100644 daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/factory/TransferFactory.java diff --git a/_doc/Task.md b/_doc/Task.md index a8363a129..5e085a915 100644 --- a/_doc/Task.md +++ b/_doc/Task.md @@ -7,13 +7,15 @@ - [ ] DEMO增加获取微信OpenID和支付宝OpenId功能 - [ ] 管理端界面支持扫码绑定对账接收方功能 - [ ] 支付通道两个独立的配置进行合并为一个 +- [ ] 平台配置和接口配置删除回调地址配置, 只保留接口参数设置 +- [ ] 接口配置删除验签配置, 放到平台配置进行统一处理 +- [x] 分账字段统一为Alloc, 不包括接口名称 - [x] 支付订单拆分退款状态为单独的字段 - [x] 策略工厂修改为通用策略工厂 - [x] 支付和退款达到终态不可以再回退回之前的状态 - [x] 修复支付关闭参数名称不正确问题 2.0.9: 消息通知改版和功能优化 - [ ] 增加类似支付宝应用通知的方式, 先支持http方式通信 -- [ ] 平台配置和接口配置删除回调地址配置, 只保留接口参数设置 - [ ] 增加支付宝和微信通知回调地址一键生成功能 2.1.x 版本内容 diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayChannelEnum.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayChannelEnum.java index 51e1f56c6..214e140d5 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayChannelEnum.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayChannelEnum.java @@ -3,9 +3,6 @@ package cn.daxpay.single.sdk.code; import lombok.Getter; import lombok.RequiredArgsConstructor; -import java.util.Arrays; -import java.util.Objects; - /** * 支付通道枚举 * @@ -26,15 +23,4 @@ public enum PayChannelEnum { /** 支付通道名称 */ private final String name; - - /** - * 根据编码获取枚举 - */ - public static PayChannelEnum findByCode(String code){ - return Arrays.stream(values()) - .filter(o -> Objects.equals(o.getCode(), code)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException("该枚举不存在")); - } - } diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayOrderRefundStatusEnum.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayOrderRefundStatusEnum.java new file mode 100644 index 000000000..b3edddb31 --- /dev/null +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/PayOrderRefundStatusEnum.java @@ -0,0 +1,21 @@ +package cn.daxpay.single.sdk.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 支付订单的退款状态 + * @author xxm + * @since 2024/6/7 + */ +@Getter +@AllArgsConstructor +public enum PayOrderRefundStatusEnum { + NO_REFUND("no_refund","未退款"), + REFUNDING("refunding","退款中"), + PARTIAL_REFUND("partial_refund","部分退款"), + REFUNDED("refunded","全部退款"), + ; + private final String code; + private final String name; +} diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocOrderModel.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocOrderModel.java index 36b0e4ba1..996aabf0a 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocOrderModel.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocOrderModel.java @@ -22,13 +22,13 @@ import java.util.List; public class AllocOrderModel extends DaxPayResponseModel { /** 分账单号 */ - private String allocationNo; + private String allocNo; /** 商户分账单号 */ - private String bizAllocationNo; + private String bizAllocNo; /** 通道分账号 */ - private String outAllocationNo; + private String outAllocNo; /** 支付订单号 */ private String orderNo; diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocationModel.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocationModel.java index 96ffbe808..ecd65e636 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocationModel.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/allocation/AllocationModel.java @@ -17,10 +17,10 @@ import lombok.ToString; public class AllocationModel extends DaxPayResponseModel { /** 分账订单号 */ - private String allocationNo; + private String allocNo; /** 分账订单号 */ - private String bizAllocationNo; + private String bizAllocNo; /** * 分账状态 diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/AllocNoticeModel.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/AllocNoticeModel.java index 0f0492a4a..7b289e0aa 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/AllocNoticeModel.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/AllocNoticeModel.java @@ -22,17 +22,17 @@ public class AllocNoticeModel extends DaxPayResponseModel { /** * 分账单号 */ - private String allocationNo; + private String allocNo; /** * 商户分账单号 */ - private String bizAllocationNo; + private String bizAllocNo; /** * 通道分账号 */ - private String outAllocationNo; + private String outAllocNo; /** * 支付订单号 diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/PayNoticeModel.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/PayNoticeModel.java index e17653e05..f01747ef9 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/PayNoticeModel.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/notice/PayNoticeModel.java @@ -2,6 +2,7 @@ package cn.daxpay.single.sdk.model.notice; import cn.daxpay.single.sdk.code.PayChannelEnum; import cn.daxpay.single.sdk.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.sdk.code.PayOrderRefundStatusEnum; import cn.daxpay.single.sdk.code.PayStatusEnum; import cn.daxpay.single.sdk.net.DaxPayResponseModel; import lombok.Getter; @@ -56,11 +57,18 @@ public class PayNoticeModel extends DaxPayResponseModel { */ private String status; + + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ - private String allocationStatus; + private String allocStatus; /** 支付成功时间 */ private Long payTime; diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/pay/PayOrderModel.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/pay/PayOrderModel.java index decf9c4ac..e035de888 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/pay/PayOrderModel.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/model/pay/PayOrderModel.java @@ -2,6 +2,7 @@ package cn.daxpay.single.sdk.model.pay; import cn.daxpay.single.sdk.code.PayChannelEnum; import cn.daxpay.single.sdk.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.sdk.code.PayOrderRefundStatusEnum; import cn.daxpay.single.sdk.code.PayStatusEnum; import cn.daxpay.single.sdk.net.DaxPayResponseModel; import lombok.Getter; @@ -18,7 +19,6 @@ import lombok.ToString; @ToString(callSuper = true) public class PayOrderModel extends DaxPayResponseModel { - /** 订单号 */ private String orderNo; @@ -63,11 +63,17 @@ public class PayOrderModel extends DaxPayResponseModel { */ private String status; + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ - private String allocationStatus; + private String allocStatus; /** 支付时间 */ diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocFinishParam.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocFinishParam.java index bb7e887c5..37253cf47 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocFinishParam.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocFinishParam.java @@ -17,11 +17,11 @@ import lombok.EqualsAndHashCode; @Data public class AllocFinishParam extends DaxPayRequest { - /** 商户分账单号 */ - private String bizAllocationNo; - /** 分账单号 */ - private String allocationNo; + private String allocNo; + + /** 商户分账单号 */ + private String bizAllocNo; /** * 方法请求路径 diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocSyncParam.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocSyncParam.java index efda2cb37..b61b37ab4 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocSyncParam.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/AllocSyncParam.java @@ -18,10 +18,10 @@ import lombok.Setter; public class AllocSyncParam extends DaxPayRequest { /** 分账号 */ - private String allocationNo; + private String allocNo; /** 商户分账号 */ - private String bizAllocationNo; + private String bizAllocNo; @Override public String path() { diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocOrderParam.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocOrderParam.java index ff482e8de..d8f3efddc 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocOrderParam.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocOrderParam.java @@ -18,10 +18,10 @@ import lombok.Setter; public class QueryAllocOrderParam extends DaxPayRequest { /** 分账单号 */ - private String allocationNo; + private String allocNo; /** 商户分账单号 */ - private String bizAllocationNo; + private String bizAllocNo; /** * 方法请求路径 diff --git a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/allocation/AllocationTest.java b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/allocation/AllocationTest.java index 4e9c6fdd3..d4ccfc36b 100644 --- a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/allocation/AllocationTest.java +++ b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/allocation/AllocationTest.java @@ -149,7 +149,7 @@ public class AllocationTest { public void allocationFinish() { // 分账完结参数 AllocFinishParam param = new AllocFinishParam(); - param.setAllocationNo("DEVA24060117191963000003"); + param.setAllocNo("DEVA24060117191963000003"); DaxPayResult execute = DaxPayKit.execute(param); System.out.println(JSONUtil.toJsonStr(execute)); @@ -162,7 +162,7 @@ public class AllocationTest { public void allocationSync() { // 分账同步参数 AllocSyncParam param = new AllocSyncParam(); - param.setAllocationNo("DEVA24060117191963000003"); + param.setAllocNo("DEVA24060117191963000003"); DaxPayResult execute = DaxPayKit.execute(param); System.out.println(JSONUtil.toJsonStr(execute)); diff --git a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/query/QueryAllocOrderTest.java b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/query/QueryAllocOrderTest.java index d7c98c2c9..3ce113a53 100644 --- a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/query/QueryAllocOrderTest.java +++ b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/query/QueryAllocOrderTest.java @@ -37,7 +37,7 @@ public class QueryAllocOrderTest { @Test public void queryAllocOrder() { QueryAllocOrderParam param = new QueryAllocOrderParam(); - param.setAllocationNo("DEVA240602000243630000101"); + param.setAllocNo("DEVA240602000243630000101"); param.setClientIp("127.0.0.1"); DaxPayResult execute = DaxPayKit.execute(param); System.out.println(JSONUtil.toJsonStr(execute)); diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationOrderController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationOrderController.java index 11aad17e9..11842d430 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationOrderController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationOrderController.java @@ -88,9 +88,9 @@ public class AllocationOrderController { @InitPaymentContext(PaymentApiCode.SYNC_ALLOCATION) @Operation(summary = "同步分账结果") @PostMapping("/sync") - public ResResult sync(String allocationNo){ + public ResResult sync(String allocNo){ AllocSyncParam param = new AllocSyncParam(); - param.setAllocationNo(allocationNo); + param.setAllocNo(allocNo); allocationSyncService.sync(param); return Res.ok(); } @@ -100,7 +100,7 @@ public class AllocationOrderController { @PostMapping("/finish") public ResResult finish(String allocationNo){ AllocFinishParam param = new AllocFinishParam(); - param.setAllocationNo(allocationNo); + param.setAllocNo(allocationNo); allocationService.finish(param); return Res.ok(); } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocFinishParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocFinishParam.java index 57b9bfe26..4ad4cd625 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocFinishParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocFinishParam.java @@ -16,8 +16,8 @@ import lombok.EqualsAndHashCode; public class AllocFinishParam extends PaymentCommonParam { @Schema(description = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; @Schema(description = "分账单号") - private String allocationNo; + private String allocNo; } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocSyncParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocSyncParam.java index b01508a00..9b863f4b0 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocSyncParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocSyncParam.java @@ -16,8 +16,8 @@ import lombok.EqualsAndHashCode; public class AllocSyncParam extends PaymentCommonParam { @Schema(description = "分账号") - private String allocationNo; + private String allocNo; @Schema(description = "商户分账号") - private String bizAllocationNo; + private String bizAllocNo; } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocOrderParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocOrderParam.java index 6ba1a7886..f43aa85c4 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocOrderParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocOrderParam.java @@ -16,8 +16,8 @@ import lombok.EqualsAndHashCode; public class QueryAllocOrderParam extends PaymentCommonParam { @Schema(description = "分账单号") - private String allocationNo; + private String allocNo; @Schema(description = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/allocation/AllocationResult.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/allocation/AllocationResult.java index ca0444cca..832e528e7 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/allocation/AllocationResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/allocation/AllocationResult.java @@ -20,11 +20,11 @@ public class AllocationResult extends PaymentCommonResult { /** 分账订单号 */ @Schema(description = "分账订单号") - private String allocationNo; + private String allocNo; /** 商户分账订单号 */ @Schema(description = "商户分账订单号") - private String bizAllocationNo; + private String bizAllocNo; /** * 分账状态 diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/AllocOrderResult.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/AllocOrderResult.java index 2ab85ea4b..a9b1014f9 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/AllocOrderResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/AllocOrderResult.java @@ -25,15 +25,15 @@ public class AllocOrderResult extends PaymentCommonResult { /** 分账单号 */ @Schema(description = "分账单号") - private String allocationNo; + private String allocNo; /** 商户分账单号 */ @Schema(description = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; /** 通道分账号 */ @Schema(description = "通道分账号") - private String outAllocationNo; + private String outAllocNo; /** * 支付订单号 diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/PayOrderResult.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/PayOrderResult.java index d7bdbb577..a73c460fb 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/PayOrderResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/result/order/PayOrderResult.java @@ -2,6 +2,7 @@ package cn.daxpay.single.result.order; import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.code.PayOrderRefundStatusEnum; import cn.daxpay.single.code.PayStatusEnum; import cn.daxpay.single.result.PaymentCommonResult; import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer; @@ -79,12 +80,19 @@ public class PayOrderResult extends PaymentCommonResult { @Schema(description = "支付状态") private String status; + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + @Schema(description = "退款状态") + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ @Schema(description = "分账状态") - private String allocationStatus; + private String allocStatus; /** 支付时间 */ @Schema(description = "支付时间") diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayAllocationService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayAllocationService.java index 314b22c63..dd2985a5c 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayAllocationService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayAllocationService.java @@ -49,7 +49,7 @@ public class AliPayAllocationService { public void allocation(AllocationOrder allocationOrder, List orderDetails){ // 分账主体参数 AlipayTradeOrderSettleModel model = new AlipayTradeOrderSettleModel(); - model.setOutRequestNo(allocationOrder.getAllocationNo()); + model.setOutRequestNo(allocationOrder.getAllocNo()); model.setTradeNo(allocationOrder.getOutOrderNo()); model.setRoyaltyMode(AliPayCode.ALLOC_ASYNC); @@ -79,7 +79,7 @@ public class AliPayAllocationService { public void finish(AllocationOrder allocationOrder, List orderDetails ){ // 分账主体参数 AlipayTradeOrderSettleModel model = new AlipayTradeOrderSettleModel(); - model.setOutRequestNo(String.valueOf(allocationOrder.getAllocationNo())); + model.setOutRequestNo(String.valueOf(allocationOrder.getAllocNo())); model.setTradeNo(allocationOrder.getOutOrderNo()); model.setRoyaltyMode(AliPayCode.ALLOC_ASYNC); // 分账完结参数 @@ -109,7 +109,7 @@ public class AliPayAllocationService { public AllocRemoteSyncResult sync(AllocationOrder allocationOrder, List allocationOrderDetails){ AlipayTradeOrderSettleQueryModel model = new AlipayTradeOrderSettleQueryModel(); model.setTradeNo(allocationOrder.getOutOrderNo()); - model.setOutRequestNo(allocationOrder.getAllocationNo()); + model.setOutRequestNo(allocationOrder.getAllocNo()); AlipayTradeOrderSettleQueryRequest request = new AlipayTradeOrderSettleQueryRequest(); request.setBizModel(model); AlipayTradeOrderSettleQueryResponse response = AliPayApi.execute(request); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayReconcileService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayReconcileService.java index 0d71396d0..aaeb7be97 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayReconcileService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/service/AliPayReconcileService.java @@ -239,10 +239,9 @@ public class AliPayReconcileService { */ private void saveOriginalFile(ReconcileOrder reconcileOrder, byte[] bytes) { // 将原始文件进行保存 - PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 - String fileName = StrUtil.format("交易对账单-{}-{}.csv", channelEnum.getName(),date); + String fileName = StrUtil.format("交易对账单-支付宝-{}.csv",date); UploadPretreatment uploadPretreatment = fileStorageService.of(bytes); if (StrUtil.isNotBlank(fileName)) { uploadPretreatment.setOriginalFilename(fileName); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/union/service/UnionPayReconcileService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/union/service/UnionPayReconcileService.java index 169c56af3..44722bc43 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/union/service/UnionPayReconcileService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/union/service/UnionPayReconcileService.java @@ -210,10 +210,9 @@ public class UnionPayReconcileService { * 保存下载的原始对账文件 */ private void saveOriginalFile(ReconcileOrder reconcileOrder, byte[] bytes) { - PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 - String fileName = StrUtil.format("交易对账单-{}-{}.txt", channelEnum.getName(),date); + String fileName = StrUtil.format("交易对账单-云闪付-{}.txt",date); UploadPretreatment uploadPretreatment = fileStorageService.of(bytes); if (StrUtil.isNotBlank(fileName)) { uploadPretreatment.setOriginalFilename(fileName); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WeChatPayAllocationService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WeChatPayAllocationService.java index ab0e47b6b..c27a9d2df 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WeChatPayAllocationService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WeChatPayAllocationService.java @@ -75,7 +75,7 @@ public class WeChatPayAllocationService { .appid(config.getWxAppId()) .nonce_str(WxPayKit.generateStr()) .transaction_id(allocationOrder.getOutOrderNo()) - .out_order_no(allocationOrder.getAllocationNo()) + .out_order_no(allocationOrder.getAllocNo()) .receivers(JSON.toJSONString(list)) .build() .createSign(config.getApiKeyV2(), SignType.HMACSHA256); @@ -97,7 +97,7 @@ public class WeChatPayAllocationService { .nonce_str(WxPayKit.generateStr()) .transaction_id(allocationOrder.getOutOrderNo()) // 分账要使用单独的的流水号, 不能与分账号相同 - .out_order_no(allocationOrder.getAllocationNo()+'F') + .out_order_no(allocationOrder.getAllocNo()+'F') .description("分账已完成") .build() .createSign(config.getApiKeyV2(), SignType.HMACSHA256); @@ -118,7 +118,7 @@ public class WeChatPayAllocationService { .mch_id(config.getWxMchId()) .nonce_str(WxPayKit.generateStr()) .transaction_id(allocationOrder.getOutOrderNo()) - .out_order_no(allocationOrder.getAllocationNo()) + .out_order_no(allocationOrder.getAllocNo()) .build() .createSign(config.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.profitSharingQuery(params); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WechatPayReconcileService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WechatPayReconcileService.java index 074ce4ddd..d29545968 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WechatPayReconcileService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/wechat/service/WechatPayReconcileService.java @@ -320,10 +320,9 @@ public class WechatPayReconcileService{ */ private void saveOriginalFile(ReconcileOrder reconcileOrder, String text) { // 微信接收结果转换为 byte[] - PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 - String fileName = StrUtil.format("交易对账单-{}-{}.txt", channelEnum.getName(),date); + String fileName = StrUtil.format("交易对账单-微信-{}.txt",date); byte[] bytes = StrUtil.bytes(text, CharsetUtil.CHARSET_UTF_8); UploadPretreatment uploadPretreatment = fileStorageService.of(bytes); if (StrUtil.isNotBlank(fileName)) { diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/dao/AllocationOrderManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/dao/AllocationOrderManager.java index 542ff8bc1..aa9cdf1a5 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/dao/AllocationOrderManager.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/dao/AllocationOrderManager.java @@ -31,14 +31,14 @@ public class AllocationOrderManager extends BaseManager findByAllocationNo(String allocationNo){ - return findByField(AllocationOrder::getAllocationNo, allocationNo); + return findByField(AllocationOrder::getAllocNo, allocationNo); } /** * 根据商户分账号查询 */ public Optional findByBizAllocationNo(String bizAllocationNo){ - return findByField(AllocationOrder::getBizAllocationNo, bizAllocationNo); + return findByField(AllocationOrder::getBizAllocNo, bizAllocationNo); } /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocationOrder.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocationOrder.java index e5b900b5f..879e6ae8c 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocationOrder.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocationOrder.java @@ -34,19 +34,19 @@ public class AllocationOrder extends MpBaseEntity implements EntityBaseFunction< * 分账单号 */ @DbColumn(comment = "分账单号") - private String allocationNo; + private String allocNo; /** * 商户分账单号 */ @DbColumn(comment = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; /** * 通道分账号 */ @DbColumn(comment = "通道分账号") - private String outAllocationNo; + private String outAllocNo; /** 支付订单ID */ @DbColumn(comment = "支付订单ID") diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/service/AllocationOrderService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/service/AllocationOrderService.java index c6cf4b27c..7692b5a95 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/service/AllocationOrderService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/service/AllocationOrderService.java @@ -164,8 +164,8 @@ public class AllocationOrderService { .setBizOrderNo(payOrder.getBizOrderNo()) .setOutOrderNo(payOrder.getOutOrderNo()) .setTitle(payOrder.getTitle()) - .setAllocationNo(OrderNoGenerateUtil.allocation()) - .setBizAllocationNo(param.getBizAllocationNo()) + .setAllocNo(OrderNoGenerateUtil.allocation()) + .setBizAllocNo(param.getBizAllocationNo()) .setChannel(payOrder.getChannel()) .setDescription(param.getDescription()) .setStatus(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode()) @@ -187,7 +187,7 @@ public class AllocationOrderService { extend.setId(allocId); // 更新支付订单分账状态 - payOrder.setAllocationStatus(PayOrderAllocStatusEnum.ALLOCATION.getCode()); + payOrder.setAllocStatus(PayOrderAllocStatusEnum.ALLOCATION.getCode()); payOrderManager.updateById(payOrder); allocationOrderDetailManager.saveAll(details); allocationOrderExtraManager.save(extend); diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/builder/PayBuilder.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/builder/PayBuilder.java index 85e6a34a1..2a1d37414 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/builder/PayBuilder.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/builder/PayBuilder.java @@ -48,7 +48,7 @@ public class PayBuilder { .setRefundableBalance(payParam.getAmount()); // 如果支持分账, 设置分账状态为代分账 if (payOrder.getAllocation()) { - payOrder.setAllocationStatus(PayOrderAllocStatusEnum.WAITING.getCode()); + payOrder.setAllocStatus(PayOrderAllocStatusEnum.WAITING.getCode()); } return payOrder; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/dao/PayOrderManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/dao/PayOrderManager.java index 6f6cae729..58d734c08 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/dao/PayOrderManager.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/dao/PayOrderManager.java @@ -71,7 +71,7 @@ public class PayOrderManager extends BaseManager { return this.lambdaQuery() .eq(PayOrder::getAllocation, true) .eq(PayOrder::getAutoAllocation, true) - .eq(PayOrder::getAllocationStatus, PayOrderAllocStatusEnum.WAITING.getCode()) + .eq(PayOrder::getAllocStatus, PayOrderAllocStatusEnum.WAITING.getCode()) .eq(PayOrder::getStatus, PayStatusEnum.SUCCESS.getCode()) .list(); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/entity/PayOrder.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/entity/PayOrder.java index df3fa2440..f4a99e2bb 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/entity/PayOrder.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/pay/entity/PayOrder.java @@ -106,7 +106,7 @@ public class PayOrder extends MpBaseEntity implements EntityBaseFunction details = this.getDetails(order.getId()); // 创建分账策略并初始化 - AbsAllocationStrategy allocationStrategy = AllocationFactory.create(order.getChannel()); + AbsAllocationStrategy allocationStrategy = PayStrategyFactory.create(order.getChannel(),AbsAllocationStrategy.class); allocationStrategy.initParam(order, details); // 分账预处理 allocationStrategy.doBeforeHandler(); @@ -191,8 +191,8 @@ public class AllocationService { } allocationOrderManager.updateById(order); return new AllocationResult() - .setAllocationNo(order.getAllocationNo()) - .setBizAllocationNo(order.getBizAllocationNo()) + .setAllocNo(order.getAllocNo()) + .setBizAllocNo(order.getBizAllocNo()) .setStatus(order.getStatus()); } finally { lockTemplate.releaseLock(lock); @@ -204,11 +204,11 @@ public class AllocationService { */ public AllocationResult finish(AllocFinishParam param) { AllocationOrder allocationOrder; - if (Objects.nonNull(param.getAllocationNo())){ - allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocationNo()) + if (Objects.nonNull(param.getAllocNo())){ + allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocNo()) .orElseThrow(() -> new DataNotExistException("未查询到分账单信息")); } else { - allocationOrder = allocationOrderManager.findByBizAllocationNo(param.getBizAllocationNo()) + allocationOrder = allocationOrderManager.findByBizAllocationNo(param.getBizAllocNo()) .orElseThrow(() -> new DataNotExistException("未查询到分账单信息")); } return this.finish(allocationOrder); @@ -225,7 +225,7 @@ public class AllocationService { List details = this.getDetails(allocationOrder.getId()); // 创建分账策略并初始化 - AbsAllocationStrategy allocationStrategy = AllocationFactory.create(allocationOrder.getChannel()); + AbsAllocationStrategy allocationStrategy = PayStrategyFactory.create(allocationOrder.getChannel(),AbsAllocationStrategy.class); allocationStrategy.initParam(allocationOrder, details); // 分账完结预处理 @@ -245,8 +245,8 @@ public class AllocationService { } allocationOrderManager.updateById(allocationOrder); return new AllocationResult() - .setAllocationNo(allocationOrder.getAllocationNo()) - .setBizAllocationNo(allocationOrder.getBizAllocationNo()) + .setAllocNo(allocationOrder.getAllocNo()) + .setBizAllocNo(allocationOrder.getBizAllocNo()) .setStatus(allocationOrder.getStatus()); } @@ -262,7 +262,7 @@ public class AllocationService { throw new PayFailureException("该订单不允许分账"); } // 判断分账状态 - if (Objects.equals(PayOrderAllocStatusEnum.ALLOCATION.getCode(), payOrder.getAllocationStatus())){ + if (Objects.equals(PayOrderAllocStatusEnum.ALLOCATION.getCode(), payOrder.getAllocStatus())){ throw new PayFailureException("该订单已分账完成"); } return payOrder; @@ -273,7 +273,7 @@ public class AllocationService { */ public AllocOrderResult queryAllocationOrder(QueryAllocOrderParam param) { // 查询分账单 - AllocationOrder allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocationNo()) + AllocationOrder allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocNo()) .orElseThrow(() -> new PayFailureException("分账单不存在")); AllocOrderResult result = AllocationConvert.CONVERT.toResult(allocationOrder); // 查询分账单明细 diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/service/AllocationSyncService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/service/AllocationSyncService.java index c4dd93084..1ac347f21 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/service/AllocationSyncService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/service/AllocationSyncService.java @@ -13,12 +13,12 @@ import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderDetailM import cn.daxpay.single.service.core.order.allocation.dao.AllocationOrderManager; import cn.daxpay.single.service.core.order.allocation.entity.AllocationOrder; import cn.daxpay.single.service.core.order.allocation.entity.AllocationOrderDetail; -import cn.daxpay.single.service.core.payment.allocation.factory.AllocationFactory; import cn.daxpay.single.service.core.payment.notice.service.ClientNoticeService; import cn.daxpay.single.service.core.payment.sync.result.AllocRemoteSyncResult; import cn.daxpay.single.service.core.record.sync.entity.PaySyncRecord; import cn.daxpay.single.service.core.record.sync.service.PaySyncRecordService; import cn.daxpay.single.service.func.AbsAllocationStrategy; +import cn.daxpay.single.service.util.PayStrategyFactory; import com.baomidou.lock.LockInfo; import com.baomidou.lock.LockTemplate; import lombok.RequiredArgsConstructor; @@ -58,12 +58,12 @@ public class AllocationSyncService { public AllocSyncResult sync(AllocSyncParam param) { // 获取分账订单 AllocationOrder allocationOrder = null; - if (Objects.nonNull(param.getAllocationNo())){ - allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocationNo()) + if (Objects.nonNull(param.getAllocNo())){ + allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocNo()) .orElseThrow(() -> new DataNotExistException("分账单不存在")); } if (Objects.isNull(allocationOrder)){ - allocationOrder = allocationOrderManager.findByAllocationNo(param.getBizAllocationNo()) + allocationOrder = allocationOrderManager.findByAllocationNo(param.getBizAllocNo()) .orElseThrow(() -> new DataNotExistException("分账单不存在")); } // 如果类型为忽略, 不进行同步处理 @@ -87,7 +87,7 @@ public class AllocationSyncService { try { List detailList = allocationOrderDetailManager.findAllByOrderId(allocationOrder.getId()); // 获取分账策略 - AbsAllocationStrategy allocationStrategy = AllocationFactory.create(allocationOrder.getChannel()); + AbsAllocationStrategy allocationStrategy = PayStrategyFactory.create(allocationOrder.getChannel(),AbsAllocationStrategy.class); allocationStrategy.initParam(allocationOrder, detailList); // 分账完结预处理 allocationStrategy.doBeforeHandler(); @@ -159,9 +159,9 @@ public class AllocationSyncService { */ private void saveRecord(AllocationOrder order, AllocRemoteSyncResult syncResult, String errorCode, String errorMsg){ PaySyncRecord paySyncRecord = new PaySyncRecord() - .setBizTradeNo(order.getBizAllocationNo()) - .setTradeNo(order.getAllocationNo()) - .setOutTradeNo(order.getOutAllocationNo()) + .setBizTradeNo(order.getBizAllocNo()) + .setTradeNo(order.getAllocNo()) + .setOutTradeNo(order.getOutAllocNo()) .setSyncType(PaymentTypeEnum.ALLOCATION.getCode()) .setChannel(order.getChannel()) .setSyncInfo(syncResult.getSyncInfo()) diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/AllocNoticeResult.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/AllocNoticeResult.java index 896779b1d..1b29227f7 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/AllocNoticeResult.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/AllocNoticeResult.java @@ -28,19 +28,19 @@ public class AllocNoticeResult extends PaymentCommonResult { * 分账单号 */ @Schema(description = "分账单号") - private String allocationNo; + private String allocNo; /** * 商户分账单号 */ @Schema(description = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; /** * 通道分账号 */ @Schema(description = "通道分账号") - private String outAllocationNo; + private String outAllocNo; /** * 支付订单号 diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/PayNoticeResult.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/PayNoticeResult.java index e92a5f30b..84f842cfa 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/PayNoticeResult.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/result/PayNoticeResult.java @@ -2,6 +2,7 @@ package cn.daxpay.single.service.core.payment.notice.result; import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.code.PayOrderRefundStatusEnum; import cn.daxpay.single.code.PayStatusEnum; import cn.daxpay.single.result.PaymentCommonResult; import cn.daxpay.single.serializer.LocalDateTimeToTimestampSerializer; @@ -75,12 +76,19 @@ public class PayNoticeResult extends PaymentCommonResult { @Schema(description = "支付状态") private String status; + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + @Schema(description = "退款状态") + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ @Schema(description = "分账状态") - private String allocationStatus; + private String allocStatus; /** 支付时间 */ @Schema(description = "支付时间") diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/service/ClientNoticeAssistService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/service/ClientNoticeAssistService.java index 6f7297784..a4e00b7d4 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/service/ClientNoticeAssistService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/notice/service/ClientNoticeAssistService.java @@ -97,7 +97,7 @@ public class ClientNoticeAssistService { .setNoticeType(ClientNoticeTypeEnum.ALLOCATION.getType()) .setSendCount(0) .setTradeId(order.getId()) - .setTradeNo(order.getAllocationNo()) + .setTradeNo(order.getAllocNo()) .setTradeStatus(order.getStatus()); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java index 9a0483aa5..8b5758b35 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java @@ -157,7 +157,7 @@ public class PayAssistService { .setChannel(payParam.getChannel()) .setMethod(payParam.getMethod()); if (!order.getAllocation()) { - order.setAllocationStatus(null); + order.setAllocStatus(null); } // 扩展信息 diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/reconcile/service/ReconcileService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/reconcile/service/ReconcileService.java index 089b8de20..0712453d6 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/reconcile/service/ReconcileService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/reconcile/service/ReconcileService.java @@ -257,7 +257,7 @@ public class ReconcileService { // 设置header信息 HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); - + // TODO 后续使用数据库中数据 PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 @@ -284,7 +284,7 @@ public class ReconcileService { byte[] bytes = byteArrayOutputStream.toByteArray();// 设置header信息 HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); - + // TODO 后续使用数据库中数据 PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 @@ -316,6 +316,7 @@ public class ReconcileService { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + // TODO 后续使用数据库中数据 PayChannelEnum channelEnum = PayChannelEnum.findByCode(reconcileOrder.getChannel()); String date = LocalDateTimeUtil.format(reconcileOrder.getDate(), DatePattern.PURE_DATE_PATTERN); // 将原始文件进行保存 通道-日期 diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/factory/TransferFactory.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/factory/TransferFactory.java deleted file mode 100644 index ca6ed388d..000000000 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/factory/TransferFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.daxpay.single.service.core.payment.transfer.factory; - -import cn.daxpay.single.code.PayChannelEnum; -import cn.daxpay.single.exception.pay.PayUnsupportedMethodException; -import cn.daxpay.single.service.core.payment.transfer.strategy.AliPayTransferStrategy; -import cn.daxpay.single.service.func.AbsTransferStrategy; -import cn.hutool.extra.spring.SpringUtil; -import lombok.experimental.UtilityClass; - -/** - * 转账工具类 - * @author xxm - * @since 2024/3/21 - */ -@UtilityClass -public class TransferFactory { - - /** - * 获取转账策略 - * @param channelCode 支付通道编码 - * @return 支付同步策略类 - */ - public AbsTransferStrategy create(String channelCode) { - AbsTransferStrategy strategy; - PayChannelEnum channelEnum = PayChannelEnum.findByCode(channelCode); - switch (channelEnum) { - case ALI: - strategy = SpringUtil.getBean(AliPayTransferStrategy.class); - break; - default: - throw new PayUnsupportedMethodException(); - } - return strategy; - } -} diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/service/TransferService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/service/TransferService.java index f5f154226..179b410a8 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/service/TransferService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/transfer/service/TransferService.java @@ -1,13 +1,12 @@ package cn.daxpay.single.service.core.payment.transfer.service; -import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.code.RefundStatusEnum; import cn.daxpay.single.param.payment.transfer.TransferParam; import cn.daxpay.single.result.transfer.TransferResult; import cn.daxpay.single.service.common.local.PaymentContextLocal; import cn.daxpay.single.service.core.order.transfer.entity.TransferOrder; -import cn.daxpay.single.service.core.payment.transfer.factory.TransferFactory; import cn.daxpay.single.service.func.AbsTransferStrategy; +import cn.daxpay.single.service.util.PayStrategyFactory; import cn.hutool.extra.spring.SpringUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -31,7 +30,7 @@ public class TransferService { public TransferResult transfer(TransferParam transferParam){ // 获取策略 - AbsTransferStrategy transferStrategy = TransferFactory.create(PayChannelEnum.ALI.getCode()); + AbsTransferStrategy transferStrategy = PayStrategyFactory.create(transferParam.getChannel(),AbsTransferStrategy.class); // 检查转账参数 transferStrategy.doValidateParam(transferParam); // 创建转账订单并设置 diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/allocation/AllocationOrderDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/allocation/AllocationOrderDto.java index f30c28172..e3aff1010 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/allocation/AllocationOrderDto.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/allocation/AllocationOrderDto.java @@ -23,18 +23,18 @@ public class AllocationOrderDto extends BaseDto { * 分账订单号 */ @Schema(description = "分账订单号") - private String allocationNo; + private String allocNo; /** * 商户分账单号 */ @Schema(description = "商户分账单号") - private String bizAllocationNo; + private String bizAllocNo; /** * 通道分账单号 */ @Schema(description = "通道分账单号") - private String outAllocationNo; + private String outAllocNo; /** * 支付订单ID diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/pay/PayOrderDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/pay/PayOrderDto.java index 7b37b0eff..912c3ad8f 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/pay/PayOrderDto.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/dto/order/pay/PayOrderDto.java @@ -3,6 +3,7 @@ package cn.daxpay.single.service.dto.order.pay; import cn.bootx.platform.common.core.rest.dto.BaseDto; import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.code.PayOrderRefundStatusEnum; import cn.daxpay.single.code.PayStatusEnum; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -78,12 +79,19 @@ public class PayOrderDto extends BaseDto { @Schema(description = "支付状态") private String status; + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + @Schema(description = "退款状态") + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ @Schema(description = "分账状态") - private String allocationStatus; + private String allocStatus; /** 支付时间 */ @Schema(description = "支付时间") diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/handler/excel/PayChannelConvert.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/handler/excel/PayChannelConvert.java index 3d0d7c8dc..2a604db99 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/handler/excel/PayChannelConvert.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/handler/excel/PayChannelConvert.java @@ -8,6 +8,7 @@ import com.alibaba.excel.metadata.property.ExcelContentProperty; /** * 支付通道转换 + * TODO 改为读取数据库 * @author xxm * @since 2024/5/6 */ diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/AllocationOrderQuery.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/AllocationOrderQuery.java index 5bcf0d1cd..7ad532b50 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/AllocationOrderQuery.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/AllocationOrderQuery.java @@ -24,7 +24,7 @@ public class AllocationOrderQuery { private String title; @Schema(description = "分账业务号") - private String allocationNo; + private String allocNo; @Schema(description = "分账通道") private String channel; diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/PayOrderQuery.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/PayOrderQuery.java index 831f03257..8c8a39dda 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/PayOrderQuery.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/order/PayOrderQuery.java @@ -4,6 +4,7 @@ import cn.bootx.platform.common.core.annotation.QueryParam; import cn.bootx.platform.common.core.rest.param.QueryOrder; import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.code.PayOrderAllocStatusEnum; +import cn.daxpay.single.code.PayOrderRefundStatusEnum; import cn.daxpay.single.code.PayStatusEnum; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -71,12 +72,19 @@ public class PayOrderQuery extends QueryOrder { @Schema(description = "支付状态") private String status; + /** + * 退款状态 + * @see PayOrderRefundStatusEnum + */ + @Schema(description = "退款状态") + private String refundStatus; + /** * 分账状态 * @see PayOrderAllocStatusEnum */ @Schema(description = "分账状态") - private String allocationStatus; + private String allocStatus; /** 错误码 */ @Schema(description = "错误码") diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/task/AllocationSyncTask.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/task/AllocationSyncTask.java index 9ba89cd2f..fbb2ac618 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/task/AllocationSyncTask.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/task/AllocationSyncTask.java @@ -43,7 +43,7 @@ public class AllocationSyncTask implements Job { allocationService.finish(allocationOrder); } } catch (Exception e) { - log.warn("分账同步或完结失败, 分账号:{}", allocationOrder.getAllocationNo()); + log.warn("分账同步或完结失败, 分账号:{}", allocationOrder.getAllocNo()); log.warn("分账同步或完结失败", e); } }