feat SDK分账接口联调, 修改菜单关键词字段, 添加PGSQL脚本数据

This commit is contained in:
bootx
2024-06-01 18:11:11 +08:00
parent 73e43115ad
commit 408c231f79
48 changed files with 6076 additions and 106 deletions

View File

@@ -5,8 +5,10 @@ import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.daxpay.single.code.PaymentApiCode;
import cn.daxpay.single.param.payment.allocation.AllocReceiverAddParam;
import cn.daxpay.single.param.payment.allocation.AllocReceiverRemoveParam;
import cn.daxpay.single.service.annotation.InitPaymentContext;
import cn.daxpay.single.service.core.payment.allocation.service.AllocationReceiverService;
import cn.daxpay.single.service.dto.allocation.AllocationReceiverDto;
import cn.daxpay.single.service.param.allocation.receiver.AllocationReceiverQuery;
@@ -60,6 +62,7 @@ public class AllocationReceiverController {
return Res.ok(receiverService.findReceiverTypeByChannel(channel));
}
@InitPaymentContext(value = PaymentApiCode.ALLOCATION_RECEIVER_ADD)
@Operation(summary = "添加")
@PostMapping("add")
public ResResult<Void> add(@RequestBody AllocReceiverAddParam param){
@@ -67,6 +70,7 @@ public class AllocationReceiverController {
return Res.ok();
}
@InitPaymentContext(value = PaymentApiCode.ALLOCATION_RECEIVER_REMOVE)
@Operation(summary = "删除")
@PostMapping("delete")
public ResResult<Void> delete(@RequestBody AllocReceiverRemoveParam param){

View File

@@ -40,7 +40,7 @@ public interface PaymentApiCode {
String GET_WX_AUTH_URL = "getWxAuthUrl";
/** 获取微信AccessToken */
String GET_WX_ACCESS_TOKEN = "getWxAccessToken";
/** 添加分账方接口 */
/** 添加分账方 */
String ALLOCATION_RECEIVER_ADD = "allocationReceiverAdd";
/** 删除分账方 */
String ALLOCATION_RECEIVER_REMOVE = "allocationReceiverRemove";

View File

@@ -1,16 +1,19 @@
package cn.daxpay.single.param.payment.allocation;
import cn.daxpay.single.param.PaymentCommonParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 分账同步请求参数
* @author xxm
* @since 2024/4/12
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(title = "分账同步请求参数")
public class AllocSyncParam {
public class AllocSyncParam extends PaymentCommonParam {
@Schema(description = "分账号")
private String allocationNo;

View File

@@ -15,7 +15,7 @@ import org.slf4j.MDC;
*/
@Getter
@Setter
@ToString
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DaxResult<T> extends ResResult<T> {

View File

@@ -17,9 +17,15 @@ import lombok.experimental.Accessors;
@Schema(title = "分账请求结果")
public class AllocationResult extends PaymentCommonResult {
/** 分账订单号 */
@Schema(description = "分账订单号")
private String allocationNo;
/** 商户分账订单号 */
@Schema(description = "商户分账订单号")
private String bizAllocationNo;
/** 分账状态 */
@Schema(description = "分账状态")
private String status;
}

View File

@@ -57,7 +57,7 @@ public class UniAllocationController {
@PaymentSign
@InitPaymentContext(PaymentApiCode.ALLOCATION_RECEIVER_ADD)
@Operation(summary = "添加分账接收方接口")
@Operation(summary = "分账接收方添加接口")
@PostMapping("/receiver/add")
public DaxResult<AllocReceiverAddResult> receiverAdd(@RequestBody AllocReceiverAddParam param){
return DaxRes.ok(receiverService.addAndSync(param));
@@ -65,7 +65,7 @@ public class UniAllocationController {
@PaymentSign
@InitPaymentContext(PaymentApiCode.ALLOCATION_RECEIVER_REMOVE)
@Operation(summary = "删除分账接收方接口")
@Operation(summary = "分账接收方删除接口")
@PostMapping("/receiver/remove")
public DaxResult<AllocReceiverRemoveResult> receiverRemove(@RequestBody AllocReceiverRemoveParam param){
return DaxRes.ok(receiverService.remove(param));

View File

@@ -144,7 +144,7 @@ public class AllocationReceiverService {
AllocationReceiver receiver = allocationReceiverManager.findByReceiverNo(param.getReceiverNo())
.orElseThrow(() -> new PayFailureException("该接收方不存在"));
if (groupReceiverManager.isUsed(receiver.getId())){
throw new PayFailureException("该接收方已被使用删除");
throw new PayFailureException("该接收方已被使用,无法被删除");
}
// 获取策略
PayChannelEnum channelEnum = PayChannelEnum.findByCode(receiver.getChannel());

View File

@@ -111,6 +111,7 @@ public class AllocationService {
if (Objects.equals(order.getStatus(),AllocOrderStatusEnum.IGNORE.getCode())){
return new AllocationResult()
.setAllocationNo(order.getAllocationNo())
.setBizAllocationNo(order.getBizAllocationNo())
.setStatus(order.getStatus());
}
@@ -140,6 +141,7 @@ public class AllocationService {
allocationOrderManager.updateById(order);
return new AllocationResult()
.setAllocationNo(order.getAllocationNo())
.setBizAllocationNo(order.getBizAllocationNo())
.setStatus(order.getStatus());
} finally {
lockTemplate.releaseLock(lock);
@@ -188,6 +190,7 @@ public class AllocationService {
allocationOrderManager.updateById(order);
return new AllocationResult()
.setAllocationNo(order.getAllocationNo())
.setBizAllocationNo(order.getBizAllocationNo())
.setStatus(order.getStatus());
} finally {
lockTemplate.releaseLock(lock);
@@ -241,6 +244,7 @@ public class AllocationService {
allocationOrderManager.updateById(allocationOrder);
return new AllocationResult()
.setAllocationNo(allocationOrder.getAllocationNo())
.setBizAllocationNo(allocationOrder.getBizAllocationNo())
.setStatus(allocationOrder.getStatus());
}