From 8fcb16ca6f6aab7e667a5b96c5824b9e7fcd70ab Mon Sep 17 00:00:00 2001 From: DaxPay Date: Tue, 22 Oct 2024 16:24:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=A2=9E=E5=8A=A0=E5=88=86=E8=B4=A6?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E8=80=85=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _doc/ChangeLog.md | 18 +++++- .../daxpay/single/sdk/code/ChannelEnum.java | 4 -- .../test/allocation/AllocReceiverTest.java | 9 +++ .../{ => receiver}/AllocReceiverAddParam.java | 2 +- .../receiver/AllocReceiverQueryParam.java | 31 ++++++++++ .../AllocReceiverRemoveParam.java | 2 +- .../receiver}/AllocReceiverResult.java | 5 +- .../trade/refund/RefundOrderResult.java | 20 ++----- .../trade/transfer/TransferOrderResult.java | 4 -- .../AllocGroupReceiverResultBo.java} | 4 +- .../allocation/AllocGroupResultBo.java} | 4 +- .../bo/allocation/AllocReceiverResultBo.java | 57 +++++++++++++++++++ .../allocation/AllocGroupController.java | 10 ++-- .../allocation/AllocReceiverController.java | 10 ++-- .../unipay/UniAllocationController.java | 20 ++++--- .../convert/allocation/AllocGroupConvert.java | 4 +- .../allocation/AllocGroupReceiverConvert.java | 4 +- .../allocation/AllocReceiverConvert.java | 11 +++- .../allocation/receiver/AllocGroup.java | 6 +- .../receiver/AllocGroupReceiver.java | 6 +- .../allocation/receiver/AllocReceiver.java | 8 +-- .../service/allocation/AllocGroupService.java | 12 ++-- .../allocation/AllocReceiverService.java | 22 +++++-- 23 files changed, 194 insertions(+), 79 deletions(-) rename daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/{ => receiver}/AllocReceiverAddParam.java (97%) create mode 100644 daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverQueryParam.java rename daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/{ => receiver}/AllocReceiverRemoveParam.java (92%) rename daxpay-single/{daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation => daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/allocation/receiver}/AllocReceiverResult.java (86%) rename daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/{result/allocation/AllocGroupReceiverResult.java => bo/allocation/AllocGroupReceiverResultBo.java} (92%) rename daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/{result/allocation/AllocGroupResult.java => bo/allocation/AllocGroupResultBo.java} (88%) create mode 100644 daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocReceiverResultBo.java diff --git a/_doc/ChangeLog.md b/_doc/ChangeLog.md index bdd8a3615..733eafd4a 100644 --- a/_doc/ChangeLog.md +++ b/_doc/ChangeLog.md @@ -1,6 +1,22 @@ # CHANGELOG ## [v3.0.0.beta1] 2024-10-24 - +- 重构: JDK版本升级为21+, Spring Boot 版本升级为3.3.x, 前端组件升级为Antd Vue 4.x + Vite5 +- 重构: 数据库更新为PostgreSQL + MySQL8.x 双版本支持 +- 重构: 脚手架全新重构, 精简和优化各种功能模块, 支持基于有赞文章实现的Redis延时队列 +- 重构: 支持多应用模式, 每个应用都可以配置单独一套支付通道、通知订阅、收款码牌等配置, 可以实现同时对接多个业务系统 +- 重构: 项目结构进行重构, 修改为支付核心+通道扩展+功能插件的方式, 实现功能模块的耦合拆分, 便于进行功能扩展和二次开发 +- 重构: 对账功能进行重构, 更加简单直观和易用 +- 重构: 删除订单调整相关逻辑, 分别放到订单同步和回调处理中, 只保留 +- 新增: 微信支付同时支持V2和V3版本的接口, 同时V3版本支持付款码和撤销接口 +- 新增: 交易调试接口功能, 用于开发时对交易流程进行测试 +- 新增: 获取通道认证信息的测试页, 便于获取微信、支付宝等用户的认证信息 +- 新增: 增加简易移动端收款码牌功能, 支持自动跳转到微信或支付宝对应的H5收银台, 支持自主配置所使用的通道和支付方式 +- 新增: 增加商户通知功能, 通过订阅指定类型的通知类型, 将会在符合条件时推送到预留的客户系统地址上 +- 优化: 各类错误处理进行统一化处理 +- 优化: 优化商户回调功能, 简化配置项, 使用延时器优化重复推送的逻辑 +- 优化: 减少在各种流程中上下文对象的线程变量使用, 非必需的上下文对象使用方法调用明确传输 +- 优化: 对各类状态码进行优化合并, 如转账接收方类型、分账接收方类型等 +- 优化: 所有金额统一为元, 保留两位小数 ## [v2.0.8] 2024-06-27 - 新增: 撤销接口 - 新增: 转账功能 diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/ChannelEnum.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/ChannelEnum.java index b15dd22f6..2d5077a4a 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/ChannelEnum.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/code/ChannelEnum.java @@ -15,12 +15,8 @@ public enum ChannelEnum { /** 支付宝 - 直连商户 */ ALI("ali_pay"), - /** 支付宝 - 服务商商户 */ - ALI_SERVICE("ali_service"), /** 微信支付 */ WECHAT("wechat_pay"), - /** 微信支付服务商 */ - WECHAT_SERVICE("wechat_service"), /** 云闪付 */ UNION_PAY("union_pay"), ; diff --git a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/test/allocation/AllocReceiverTest.java b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/test/allocation/AllocReceiverTest.java index 0569adbe7..b5b5fd196 100644 --- a/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/test/allocation/AllocReceiverTest.java +++ b/daxpay-single-sdk/src/test/java/cn/daxpay/single/sdk/test/allocation/AllocReceiverTest.java @@ -33,6 +33,15 @@ public class AllocReceiverTest { DaxPayKit.initConfig(config); } + /** + * 查询 + */ + @Test + public void query() { + AllocReceiverAddParam param = new AllocReceiverAddParam(); + param.setChannel(ChannelEnum.ALI.getCode()); + } + /** * 添加 */ diff --git a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverAddParam.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverAddParam.java similarity index 97% rename from daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverAddParam.java rename to daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverAddParam.java index 60cf7a17b..eeb7c64b8 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverAddParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverAddParam.java @@ -1,4 +1,4 @@ -package org.dromara.daxpay.core.param.allocation; +package org.dromara.daxpay.core.param.allocation.receiver; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverQueryParam.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverQueryParam.java new file mode 100644 index 000000000..aa5c8bf64 --- /dev/null +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverQueryParam.java @@ -0,0 +1,31 @@ +package org.dromara.daxpay.core.param.allocation.receiver; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.dromara.daxpay.core.enums.ChannelEnum; +import org.dromara.daxpay.core.param.PaymentCommonParam; + +/** + * 分账接收方查询参数 + * @author xxm + * @since 2024/10/22 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Accessors(chain = true) +@Schema(title = "分账接收方") +public class AllocReceiverQueryParam extends PaymentCommonParam { + /** + * 所属通道 + * @see ChannelEnum + */ + @Schema(description = "所属通道") + @NotBlank(message = "所属通道必填") + @Size(max = 20, message = "所属通道不可超过20位") + private String channel; + +} diff --git a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverRemoveParam.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverRemoveParam.java similarity index 92% rename from daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverRemoveParam.java rename to daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverRemoveParam.java index b8387cb9b..bfa687fef 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/AllocReceiverRemoveParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/param/allocation/receiver/AllocReceiverRemoveParam.java @@ -1,4 +1,4 @@ -package org.dromara.daxpay.core.param.allocation; +package org.dromara.daxpay.core.param.allocation.receiver; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocReceiverResult.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/allocation/receiver/AllocReceiverResult.java similarity index 86% rename from daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocReceiverResult.java rename to daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/allocation/receiver/AllocReceiverResult.java index ccccd4f1d..2a55e300a 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocReceiverResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/allocation/receiver/AllocReceiverResult.java @@ -1,6 +1,5 @@ -package org.dromara.daxpay.service.result.allocation; +package org.dromara.daxpay.core.result.allocation.receiver; -import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -37,12 +36,10 @@ public class AllocReceiverResult extends MchAppResult { @Schema(description = "接收方账号") - @SensitiveInfo private String receiverAccount; /** 接收方姓名 */ @Schema(description = "接收方姓名") - @SensitiveInfo(SensitiveInfo.SensitiveType.CHINESE_NAME) private String receiverName; /** diff --git a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/refund/RefundOrderResult.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/refund/RefundOrderResult.java index 5ba078a24..c483d8b08 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/refund/RefundOrderResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/refund/RefundOrderResult.java @@ -22,22 +22,18 @@ import java.time.LocalDateTime; @Schema(title = "退款订单数据") public class RefundOrderResult extends MchAppResult { - /** 支付订单ID */ - @Schema(description = "支付订单ID") - private Long orderId; - /** 支付订单号 */ @Schema(description = "支付订单号") private String orderNo; - /** 通道支付订单号 */ - @Schema(description = "通道支付订单号") - private String outOrderNo; - /** 商户支付订单号 */ @Schema(description = "商户支付订单号") private String bizOrderNo; + /** 通道支付订单号 */ + @Schema(description = "通道支付订单号") + private String outOrderNo; + /** 支付标题 */ @Schema(description = "支付标题") private String title; @@ -58,12 +54,12 @@ public class RefundOrderResult extends MchAppResult { * 退款通道 * @see ChannelEnum */ - @Schema(description = "支付通道") + @Schema(description = "退款通道") private String channel; /** 订单金额 */ @Schema(description = "订单金额") - private Integer orderAmount; + private BigDecimal orderAmount; /** 退款金额 */ @Schema(description = "退款金额") @@ -88,10 +84,6 @@ public class RefundOrderResult extends MchAppResult { @Schema(description = "商户扩展参数,回调时会原样返回, 以最后一次为准") private String attach; - /** 终端ip */ - @Schema(description = "终端ip") - private String clientIp; - /** 错误信息 */ @Schema(description = "错误信息") private String errorMsg; diff --git a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/transfer/TransferOrderResult.java b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/transfer/TransferOrderResult.java index 02842e572..d9f84f8d8 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/transfer/TransferOrderResult.java +++ b/daxpay-single/daxpay-single-core/src/main/java/org/dromara/daxpay/core/result/trade/transfer/TransferOrderResult.java @@ -85,10 +85,6 @@ public class TransferOrderResult extends MchAppResult { @Schema(description = "商户扩展参数") private String attach; - /** 终端ip */ - @Schema(description = "终端ip") - private String clientIp; - /** * 错误原因 */ diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupReceiverResult.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupReceiverResultBo.java similarity index 92% rename from daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupReceiverResult.java rename to daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupReceiverResultBo.java index a202deb59..757c129c3 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupReceiverResult.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupReceiverResultBo.java @@ -1,4 +1,4 @@ -package org.dromara.daxpay.service.result.allocation; +package org.dromara.daxpay.service.bo.allocation; import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,7 +19,7 @@ import java.math.BigDecimal; @Data @Accessors(chain = true) @Schema(title = "分账组接收方信息") -public class AllocGroupReceiverResult extends MchAppResult { +public class AllocGroupReceiverResultBo extends MchAppResult { @Schema(description = "接收方ID") private Long receiverId; diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupResult.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupResultBo.java similarity index 88% rename from daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupResult.java rename to daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupResultBo.java index d7f4e563d..8a8550807 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/result/allocation/AllocGroupResult.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocGroupResultBo.java @@ -1,4 +1,4 @@ -package org.dromara.daxpay.service.result.allocation; +package org.dromara.daxpay.service.bo.allocation; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -17,7 +17,7 @@ import java.math.BigDecimal; @Data @Accessors(chain = true) @Schema(title = "分账组") -public class AllocGroupResult extends MchAppResult { +public class AllocGroupResultBo extends MchAppResult { @Schema(description = "分账组编号") private String groupNo; diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocReceiverResultBo.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocReceiverResultBo.java new file mode 100644 index 000000000..a8ad179ef --- /dev/null +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/bo/allocation/AllocReceiverResultBo.java @@ -0,0 +1,57 @@ +package org.dromara.daxpay.service.bo.allocation; + +import cn.bootx.platform.common.jackson.sensitive.SensitiveInfo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.dromara.daxpay.core.enums.ChannelEnum; +import org.dromara.daxpay.core.result.MchAppResult; + +/** + * 分账接收方 + * @author xxm + * @since 2024/3/28 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Accessors(chain = true) +@Schema(title = "分账接收方") +public class AllocReceiverResultBo extends MchAppResult { + + @Schema(description = "接收方编号") + private String receiverNo; + + /** + * @see ChannelEnum + */ + @Schema(description = "所属通道") + private String channel; + + /** + * 分账接收方类型 个人/商户 + * @see org.dromara.daxpay.core.enums.AllocReceiverTypeEnum + */ + @Schema(description = "分账接收方类型") + private String receiverType; + + + @Schema(description = "接收方账号") + @SensitiveInfo + private String receiverAccount; + + /** 接收方姓名 */ + @Schema(description = "接收方姓名") + @SensitiveInfo(SensitiveInfo.SensitiveType.CHINESE_NAME) + private String receiverName; + + /** + * 分账关系类型 + * @see org.dromara.daxpay.core.enums.AllocRelationTypeEnum + */ + @Schema(description = "分账关系类型") + private String relationType; + + @Schema(description = "关系名称") + private String relationName; +} diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocGroupController.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocGroupController.java index 6378faadb..3a0570b42 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocGroupController.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocGroupController.java @@ -10,12 +10,12 @@ import cn.bootx.platform.core.util.ValidationUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.dromara.daxpay.service.bo.allocation.AllocGroupResultBo; import org.dromara.daxpay.service.param.allocation.group.AllocGroupBindParam; import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam; import org.dromara.daxpay.service.param.allocation.group.AllocGroupQuery; import org.dromara.daxpay.service.param.allocation.group.AllocGroupUnbindParam; -import org.dromara.daxpay.service.result.allocation.AllocGroupReceiverResult; -import org.dromara.daxpay.service.result.allocation.AllocGroupResult; +import org.dromara.daxpay.service.bo.allocation.AllocGroupReceiverResultBo; import org.dromara.daxpay.service.service.allocation.AllocGroupService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -40,14 +40,14 @@ public class AllocGroupController { @RequestPath("分页") @Operation(summary = "分页") @GetMapping("/page") - public Result> page(PageParam pageParam, AllocGroupQuery query){ + public Result> page(PageParam pageParam, AllocGroupQuery query){ return Res.ok(allocGroupService.page(pageParam,query)); } @RequestPath("查询详情") @Operation(summary = "查询详情") @GetMapping("/findById") - public Result findById(Long id){ + public Result findById(Long id){ return Res.ok(allocGroupService.findById(id)); } @@ -61,7 +61,7 @@ public class AllocGroupController { @RequestPath("查询分账接收方信息") @Operation(summary = "查询分账接收方信息") @GetMapping("/findReceiversByGroups") - public Result> findReceiversByGroups(Long groupId){ + public Result> findReceiversByGroups(Long groupId){ return Res.ok(allocGroupService.findReceiversByGroups(groupId)); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocReceiverController.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocReceiverController.java index 0e06c67ca..c6562cb07 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocReceiverController.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/allocation/AllocReceiverController.java @@ -11,10 +11,10 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; -import org.dromara.daxpay.core.param.allocation.AllocReceiverAddParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam; +import org.dromara.daxpay.service.bo.allocation.AllocReceiverResultBo; import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery; -import org.dromara.daxpay.core.param.allocation.AllocReceiverRemoveParam; -import org.dromara.daxpay.service.result.allocation.AllocReceiverResult; import org.dromara.daxpay.service.service.allocation.AllocReceiverService; import org.dromara.daxpay.service.service.assist.PaymentAssistService; import org.springframework.validation.annotation.Validated; @@ -41,14 +41,14 @@ public class AllocReceiverController { @RequestPath("分页") @Operation(summary = "分页") @GetMapping("/page") - public Result> page(PageParam pageParam, AllocReceiverQuery query){ + public Result> page(PageParam pageParam, AllocReceiverQuery query){ return Res.ok(receiverService.page(pageParam, query)); } @RequestPath("查询详情") @Operation(summary = "查询详情") @GetMapping("/findById") - public Result findById(Long id){ + public Result findById(Long id){ return Res.ok(receiverService.findById(id)); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/unipay/UniAllocationController.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/unipay/UniAllocationController.java index 6ceb436f9..64c3ca41a 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/unipay/UniAllocationController.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/controller/unipay/UniAllocationController.java @@ -1,21 +1,24 @@ package org.dromara.daxpay.service.controller.unipay; import cn.bootx.platform.core.annotation.IgnoreAuth; -import org.dromara.daxpay.core.param.PaymentCommonParam; -import org.dromara.daxpay.core.result.DaxResult; -import org.dromara.daxpay.core.util.DaxRes; -import org.dromara.daxpay.service.common.anno.PaymentVerify; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.dromara.daxpay.core.param.allocation.AllocReceiverAddParam; -import org.dromara.daxpay.core.param.allocation.AllocReceiverRemoveParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverQueryParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam; +import org.dromara.daxpay.core.result.DaxResult; +import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult; +import org.dromara.daxpay.core.util.DaxRes; +import org.dromara.daxpay.service.common.anno.PaymentVerify; import org.dromara.daxpay.service.service.allocation.AllocReceiverService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 分账控制器 * @author xxm @@ -44,8 +47,8 @@ public class UniAllocationController { @Operation(summary = "分账接收方查询接口") @PostMapping("/receiver/list") - public DaxResult receiverList(@RequestBody PaymentCommonParam param){ - return DaxRes.ok(); + public DaxResult> receiverList(@RequestBody AllocReceiverQueryParam param){ + return DaxRes.ok(allocReceiverService.list(param)); } @Operation(summary = "分账接收方添加接口") @@ -61,5 +64,4 @@ public class UniAllocationController { allocReceiverService.removeAndSync(param); return DaxRes.ok(); } - } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupConvert.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupConvert.java index 5fee92473..3d827ed92 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupConvert.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupConvert.java @@ -2,7 +2,7 @@ package org.dromara.daxpay.service.convert.allocation; import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroup; import org.dromara.daxpay.service.param.allocation.group.AllocGroupParam; -import org.dromara.daxpay.service.result.allocation.AllocGroupResult; +import org.dromara.daxpay.service.bo.allocation.AllocGroupResultBo; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -15,7 +15,7 @@ import org.mapstruct.factory.Mappers; public interface AllocGroupConvert { AllocGroupConvert CONVERT = Mappers.getMapper(AllocGroupConvert.class); - AllocGroupResult convert(AllocGroup in); + AllocGroupResultBo convert(AllocGroup in); AllocGroup convert(AllocGroupParam in); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupReceiverConvert.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupReceiverConvert.java index bd56b6abb..e4c9d713e 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupReceiverConvert.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocGroupReceiverConvert.java @@ -1,8 +1,8 @@ package org.dromara.daxpay.service.convert.allocation; +import org.dromara.daxpay.service.bo.allocation.AllocGroupReceiverResultBo; import org.dromara.daxpay.service.entity.allocation.receiver.AllocGroupReceiver; import org.dromara.daxpay.service.param.allocation.group.AllocGroupReceiverParam; -import org.dromara.daxpay.service.result.allocation.AllocGroupReceiverResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -15,7 +15,7 @@ import org.mapstruct.factory.Mappers; public interface AllocGroupReceiverConvert { AllocGroupReceiverConvert CONVERT = Mappers.getMapper(AllocGroupReceiverConvert.class); - AllocGroupReceiverResult convert(AllocGroupReceiver in); + AllocGroupReceiverResultBo convert(AllocGroupReceiver in); AllocGroupReceiver convert(AllocGroupReceiverParam in); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocReceiverConvert.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocReceiverConvert.java index 314e0feb3..778701113 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocReceiverConvert.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/convert/allocation/AllocReceiverConvert.java @@ -1,11 +1,14 @@ package org.dromara.daxpay.service.convert.allocation; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam; +import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult; +import org.dromara.daxpay.service.bo.allocation.AllocReceiverResultBo; import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver; -import org.dromara.daxpay.core.param.allocation.AllocReceiverAddParam; -import org.dromara.daxpay.service.result.allocation.AllocReceiverResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import java.util.List; + /** * * @author xxm @@ -17,5 +20,9 @@ public interface AllocReceiverConvert { AllocReceiver convert(AllocReceiverAddParam in); + AllocReceiverResultBo toBo(AllocReceiver in); + AllocReceiverResult toResult(AllocReceiver in); + + List toList(List in); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/entity/allocation/receiver/AllocGroup.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/entity/allocation/receiver/AllocGroup.java index f38c75d56..8cbcce15d 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/entity/allocation/receiver/AllocGroup.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/entity/allocation/receiver/AllocGroup.java @@ -7,9 +7,9 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.dromara.daxpay.service.bo.allocation.AllocGroupResultBo; import org.dromara.daxpay.service.common.entity.MchAppBaseEntity; import org.dromara.daxpay.service.convert.allocation.AllocGroupConvert; -import org.dromara.daxpay.service.result.allocation.AllocGroupResult; import java.math.BigDecimal; @@ -22,7 +22,7 @@ import java.math.BigDecimal; @Data @Accessors(chain = true) @TableName("pay_alloc_group") -public class AllocGroup extends MchAppBaseEntity implements ToResult { +public class AllocGroup extends MchAppBaseEntity implements ToResult { /** 分账组编码 */ private String groupNo; @@ -44,7 +44,7 @@ public class AllocGroup extends MchAppBaseEntity implements ToResult { +public class AllocGroupReceiver extends MchAppBaseEntity implements ToResult { /** 分账组ID */ private Long groupId; @@ -32,7 +32,7 @@ public class AllocGroupReceiver extends MchAppBaseEntity implements ToResult { +public class AllocReceiver extends MchAppBaseEntity implements ToResult { /** 分账接收方编号, 需要保证唯一 */ private String receiverNo; @@ -58,7 +58,7 @@ public class AllocReceiver extends MchAppBaseEntity implements ToResult page(PageParam pageParam, AllocGroupQuery query){ + public PageResult page(PageParam pageParam, AllocGroupQuery query){ return MpUtil.toPageResult(groupManager.page(pageParam, query)); } /** * 查询详情 */ - public AllocGroupResult findById(Long id){ + public AllocGroupResultBo findById(Long id){ return groupManager.findById(id).map(AllocGroup::toResult).orElseThrow(()->new DataNotExistException("分账组不存在")); } /** * 查询分账接收方 */ - public List findReceiversByGroups(Long groupId){ + public List findReceiversByGroups(Long groupId){ List groupReceivers = groupReceiverManager.findByGroupId(groupId); List receiverIds = groupReceivers.stream() .map(AllocGroupReceiver::getReceiverId) @@ -73,7 +73,7 @@ public class AllocGroupService { return groupReceivers.stream() .map(o -> { AllocReceiver receiver = receiverMap.get(o.getReceiverId()); - AllocGroupReceiverResult result = new AllocGroupReceiverResult() + AllocGroupReceiverResultBo result = new AllocGroupReceiverResultBo() .setReceiverId(receiver.getId()) .setReceiverNo(receiver.getReceiverNo()) .setReceiverAccount(receiver.getReceiverAccount()) diff --git a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/service/allocation/AllocReceiverService.java b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/service/allocation/AllocReceiverService.java index 3ad19b249..99ee2df77 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/service/allocation/AllocReceiverService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/org/dromara/daxpay/service/service/allocation/AllocReceiverService.java @@ -16,14 +16,16 @@ import lombok.extern.slf4j.Slf4j; import org.dromara.daxpay.core.exception.DataErrorException; import org.dromara.daxpay.core.exception.OperationFailException; import org.dromara.daxpay.core.exception.OperationProcessingException; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverAddParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverQueryParam; +import org.dromara.daxpay.core.param.allocation.receiver.AllocReceiverRemoveParam; +import org.dromara.daxpay.core.result.allocation.receiver.AllocReceiverResult; +import org.dromara.daxpay.service.bo.allocation.AllocReceiverResultBo; import org.dromara.daxpay.service.convert.allocation.AllocReceiverConvert; import org.dromara.daxpay.service.dao.allocation.receiver.AllocGroupReceiverManager; import org.dromara.daxpay.service.dao.allocation.receiver.AllocReceiverManager; import org.dromara.daxpay.service.entity.allocation.receiver.AllocReceiver; -import org.dromara.daxpay.core.param.allocation.AllocReceiverAddParam; import org.dromara.daxpay.service.param.allocation.receiver.AllocReceiverQuery; -import org.dromara.daxpay.core.param.allocation.AllocReceiverRemoveParam; -import org.dromara.daxpay.service.result.allocation.AllocReceiverResult; import org.dromara.daxpay.service.strategy.AbsAllocReceiverStrategy; import org.dromara.daxpay.service.strategy.PaymentStrategy; import org.dromara.daxpay.service.util.PaymentStrategyFactory; @@ -54,14 +56,14 @@ public class AllocReceiverService { /** * 分页 */ - public PageResult page(PageParam pageParam, AllocReceiverQuery query) { + public PageResult page(PageParam pageParam, AllocReceiverQuery query) { return MpUtil.toPageResult(allocReceiverManager.page(pageParam, query)); } /** * 查询详情 */ - public AllocReceiverResult findById(Long id) { + public AllocReceiverResultBo findById(Long id) { return allocReceiverManager.findById(id) .map(AllocReceiver::toResult) .orElseThrow(() -> new DataNotExistException("分账接收方不存在")); @@ -74,6 +76,16 @@ public class AllocReceiverService { return allocReceiverManager.existedByReceiverNo(receiverNo, appId); } + + /** + * 分账接收方列表 + */ + public List list(AllocReceiverQueryParam param){ + List allocReceivers = allocReceiverManager.findAllByChannel(param.getChannel(), param.getAppId()); + return AllocReceiverConvert.CONVERT.toList(allocReceivers); + } + + /** * 添加分账接收方并同步到三方支付系统中 */