From 6cce308cc29914774ddfb7a15f4cf7d9ee12d7e1 Mon Sep 17 00:00:00 2001 From: bootx Date: Mon, 3 Jun 2024 22:55:15 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=88=86=E8=B4=A6=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E6=96=B9=E6=9F=A5=E8=AF=A2=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E6=96=B9=E7=BC=96=E5=8F=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/param/allocation/QueryAllocReceiverParam.java | 9 ++++++++- .../cn/daxpay/single/sdk/query/QueryAllocOrderTest.java | 3 ++- .../payment/allocation/QueryAllocReceiverParam.java | 7 ++++--- .../single/gateway/controller/UniQueryController.java | 5 +++++ .../allocation/dao/AllocationReceiverManager.java | 2 ++ .../allocation/service/AllocationReceiverService.java | 6 +++++- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocReceiverParam.java b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocReceiverParam.java index 2a1fc25a8..3a8a20189 100644 --- a/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocReceiverParam.java +++ b/daxpay-single-sdk/src/main/java/cn/daxpay/single/sdk/param/allocation/QueryAllocReceiverParam.java @@ -1,5 +1,6 @@ package cn.daxpay.single.sdk.param.allocation; +import cn.daxpay.single.sdk.code.PayChannelEnum; import cn.daxpay.single.sdk.model.allocation.AllocReceiversModel; import cn.daxpay.single.sdk.net.DaxPayRequest; import cn.daxpay.single.sdk.response.DaxPayResult; @@ -19,9 +20,15 @@ import lombok.experimental.Accessors; @Accessors(chain = true) public class QueryAllocReceiverParam extends DaxPayRequest { - /** 所属通道 */ + /** + * 所属通道 + * @see PayChannelEnum + */ private String channel; + /** 分账接收方编号 */ + private String receiverNo; + @Override public String path() { return "/unipay/query/allocationReceiver"; 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 0fb885652..d7c98c2c9 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 @@ -44,12 +44,13 @@ public class QueryAllocOrderTest { } /** - * 分账接收方 + * 分账接收方查询 */ @Test public void queryAllocReceiver() { QueryAllocReceiverParam param = new QueryAllocReceiverParam(); param.setChannel(PayChannelEnum.ALI.getCode()); + param.setReceiverNo("123"); param.setClientIp("127.0.0.1"); DaxPayResult execute = DaxPayKit.execute(param); System.out.println(JSONUtil.toJsonStr(execute)); diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocReceiverParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocReceiverParam.java index 2106f00fe..1fc094f47 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocReceiverParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/QueryAllocReceiverParam.java @@ -6,8 +6,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import javax.validation.constraints.NotEmpty; - /** * 查询分账接收者参数 * @author xxm @@ -21,6 +19,9 @@ public class QueryAllocReceiverParam extends PaymentCommonParam { /** 所属通道 */ @Schema(description = "所属通道") - @NotEmpty(message = "所属通道必填") private String channel; + + /** 分账接收方编号 */ + @Schema(description = "分账接收方编号") + private String receiverNo; } diff --git a/daxpay-single/daxpay-single-gateway/src/main/java/cn/daxpay/single/gateway/controller/UniQueryController.java b/daxpay-single/daxpay-single-gateway/src/main/java/cn/daxpay/single/gateway/controller/UniQueryController.java index f9e60205b..e3375202c 100644 --- a/daxpay-single/daxpay-single-gateway/src/main/java/cn/daxpay/single/gateway/controller/UniQueryController.java +++ b/daxpay-single/daxpay-single-gateway/src/main/java/cn/daxpay/single/gateway/controller/UniQueryController.java @@ -2,6 +2,7 @@ package cn.daxpay.single.gateway.controller; import cn.bootx.platform.common.core.annotation.IgnoreAuth; import cn.daxpay.single.code.PaymentApiCode; +import cn.daxpay.single.exception.pay.PayFailureException; import cn.daxpay.single.param.payment.allocation.QueryAllocOrderParam; import cn.daxpay.single.param.payment.allocation.QueryAllocReceiverParam; import cn.daxpay.single.param.payment.pay.QueryPayParam; @@ -19,6 +20,7 @@ import cn.daxpay.single.service.core.order.refund.service.RefundOrderQueryServic import cn.daxpay.single.service.core.payment.allocation.service.AllocationReceiverService; import cn.daxpay.single.service.core.payment.allocation.service.AllocationService; import cn.daxpay.single.util.DaxRes; +import cn.hutool.core.util.StrUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; @@ -81,6 +83,9 @@ public class UniQueryController { @Operation(summary = "分账接收方查询接口") @PostMapping("/allocationReceiver") public DaxResult queryAllocReceive(@RequestBody QueryAllocReceiverParam param){ + if (StrUtil.isAllBlank(param.getChannel(), param.getReceiverNo())){ + throw new PayFailureException("所属通道和接收方编号不可同时为空"); + } return DaxRes.ok(allocationReceiverService.queryAllocReceive(param)); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/dao/AllocationReceiverManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/dao/AllocationReceiverManager.java index 238ebd3d2..33d978ce1 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/dao/AllocationReceiverManager.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/dao/AllocationReceiverManager.java @@ -55,6 +55,8 @@ public class AllocationReceiverManager extends BaseManager list = manager.findAllByChannel(param.getChannel()); + List list = manager.lambdaQuery() + .eq(StrUtil.isNotBlank(param.getChannel()), AllocationReceiver::getChannel, param.getChannel()) + .eq(StrUtil.isNotBlank(param.getReceiverNo()), AllocationReceiver::getReceiverNo, param.getReceiverNo()) + .list(); List receivers = list.stream() .map(AllocationReceiverConvert.CONVERT::toResult) .collect(Collectors.toList());