mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 02:56:20 +00:00
feat 分账接收方查询支持通过接收方编号查询
This commit is contained in:
@@ -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<AllocReceiversModel> {
|
||||
|
||||
/** 所属通道 */
|
||||
/**
|
||||
* 所属通道
|
||||
* @see PayChannelEnum
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/** 分账接收方编号 */
|
||||
private String receiverNo;
|
||||
|
||||
@Override
|
||||
public String path() {
|
||||
return "/unipay/query/allocationReceiver";
|
||||
|
@@ -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<AllocReceiversModel> execute = DaxPayKit.execute(param);
|
||||
System.out.println(JSONUtil.toJsonStr(execute));
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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<AllocReceiversResult> queryAllocReceive(@RequestBody QueryAllocReceiverParam param){
|
||||
if (StrUtil.isAllBlank(param.getChannel(), param.getReceiverNo())){
|
||||
throw new PayFailureException("所属通道和接收方编号不可同时为空");
|
||||
}
|
||||
return DaxRes.ok(allocationReceiverService.queryAllocReceive(param));
|
||||
}
|
||||
|
||||
|
@@ -55,6 +55,8 @@ public class AllocationReceiverManager extends BaseManager<AllocationReceiverMap
|
||||
return findAllByField(AllocationReceiver::getChannel, channel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean existedByReceiverNo(String receiverNo) {
|
||||
return existedByField(AllocationReceiver::getReceiverNo, receiverNo);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import cn.daxpay.single.service.core.payment.allocation.factory.AllocationReceiv
|
||||
import cn.daxpay.single.service.dto.allocation.AllocationReceiverDto;
|
||||
import cn.daxpay.single.service.func.AbsAllocationReceiverStrategy;
|
||||
import cn.daxpay.single.service.param.allocation.receiver.AllocationReceiverQuery;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.lock.LockInfo;
|
||||
import com.baomidou.lock.LockTemplate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -171,7 +172,10 @@ public class AllocationReceiverService {
|
||||
*/
|
||||
public AllocReceiversResult queryAllocReceive(QueryAllocReceiverParam param){
|
||||
// 查询对应通道分账接收方的信息
|
||||
List<AllocationReceiver> list = manager.findAllByChannel(param.getChannel());
|
||||
List<AllocationReceiver> list = manager.lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(param.getChannel()), AllocationReceiver::getChannel, param.getChannel())
|
||||
.eq(StrUtil.isNotBlank(param.getReceiverNo()), AllocationReceiver::getReceiverNo, param.getReceiverNo())
|
||||
.list();
|
||||
List<AllocReceiverResult> receivers = list.stream()
|
||||
.map(AllocationReceiverConvert.CONVERT::toResult)
|
||||
.collect(Collectors.toList());
|
||||
|
Reference in New Issue
Block a user