mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 19:16:21 +00:00
feat(allocation): 实现分账接口并重构相关代码
- 新增分账请求、完结、查询接口 - 重构分账相关实体、DTO、Mapper等类- 更新数据库表结构,适应新的分账流程 - 优化代码组织,提高可维护性
This commit is contained in:
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocOrderResultEnum {
|
||||
public enum AllocTransactionResultEnum {
|
||||
|
||||
ALL_PENDING("all_pending", "处理中"),
|
||||
ALL_SUCCESS("all_success", "全部成功"),
|
@@ -10,13 +10,14 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocOrderStatusEnum {
|
||||
public enum AllocTransactionStatusEnum {
|
||||
|
||||
ALLOC_PROCESSING("alloc_processing", "分账处理中"),
|
||||
ALLOC_END("alloc_end", "分账完成"),
|
||||
ALLOC_FAILED("alloc_failed", "分账失败"),
|
||||
FINISH("finish", "完结"),
|
||||
FINISH_FAILED("finish_failed", "完结失败"),
|
||||
IGNORE("ignore", "忽略"),
|
||||
;
|
||||
|
||||
final String code;
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.core.param.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.daxpay.core.param.PaymentCommonParam;
|
||||
|
||||
/**
|
||||
* 分账完结参数
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Schema(title = "分账请求参数")
|
||||
public class AllocFinishParam extends PaymentCommonParam {
|
||||
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocNo;
|
||||
|
||||
@Schema(description = "分账单号")
|
||||
private String allocNo;
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package org.dromara.daxpay.core.param.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
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.param.PaymentCommonParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分账请求参数
|
||||
* @author xxm
|
||||
* @since 2024/11/14
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账请求参数")
|
||||
public class AllocationParam extends PaymentCommonParam {
|
||||
/** 商户分账单号 */
|
||||
@NotBlank(message = "商户分账单号不可为空")
|
||||
@Size(max = 100, message = "商户分账单号不可超过100位")
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocNo;
|
||||
|
||||
/** 支付订单号 */
|
||||
@Size(max = 32, message = "支付订单号不可超过32位")
|
||||
@Schema(description = "支付订单号")
|
||||
private String orderNo;
|
||||
|
||||
/** 商户支付订单号 */
|
||||
@Size(max = 100, message = "商户支付订单号不可超过100位")
|
||||
@Schema(description = "商户支付订单号")
|
||||
private String bizOrderNo;
|
||||
|
||||
/** 分账描述 */
|
||||
@Size(max = 150, message = "分账描述不可超过150位")
|
||||
@Schema(description = "分账描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 优先级 分账接收方列表 > 分账组编号 > 默认分账组
|
||||
*/
|
||||
@Size(max = 20, message = "分账组编号不可超过20位")
|
||||
@Schema(description = "分账组编号")
|
||||
private String groupNo;
|
||||
|
||||
/** 分账接收方列表 */
|
||||
@Schema(description = "分账接收方列表")
|
||||
@Valid
|
||||
private List<ReceiverParam> receivers;
|
||||
|
||||
/** 回调通知地址 */
|
||||
@Size(max = 200, message = "回调通知地址不可超过200位")
|
||||
@Schema(description = "回调通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
/** 商户扩展参数,回调时会原样返回 */
|
||||
@Size(max = 500, message = "商户扩展参数不可超过500位")
|
||||
@Schema(description = "商户扩展参数")
|
||||
private String attach;
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.core.param.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.daxpay.core.param.PaymentCommonParam;
|
||||
|
||||
/**
|
||||
* 分账订单查询参数
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Schema(title = "支付订单查询参数")
|
||||
public class QueryAllocTransactionParam extends PaymentCommonParam {
|
||||
|
||||
@Schema(description = "分账单号")
|
||||
private String allocNo;
|
||||
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocNo;
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package org.dromara.daxpay.core.param.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分账接收方列表
|
||||
* @author xxm
|
||||
* @since 2024/5/21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账接收方列表")
|
||||
public class ReceiverParam {
|
||||
|
||||
/** 分账接收方编号 */
|
||||
@Schema(description = "分账接收方编号")
|
||||
@NotBlank(message = "分账接收方编号必填")
|
||||
@Size(max = 32, message = "分账接收方编号不可超过32位")
|
||||
private String receiverNo;
|
||||
|
||||
/** 分账金额 */
|
||||
@Schema(description = "分账金额")
|
||||
@NotNull(message = "分账金额必填")
|
||||
@Min(value = 1,message = "分账金额至少为0.01元")
|
||||
private BigDecimal amount;
|
||||
}
|
@@ -2,10 +2,8 @@ package org.dromara.daxpay.core.result.allocation.receiver;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,11 +12,10 @@ import java.util.List;
|
||||
* @author xxm
|
||||
* @since 2024/3/28
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账接收方")
|
||||
public class AllocReceiverResult extends MchAppResult {
|
||||
public class AllocReceiverResult {
|
||||
|
||||
@Schema(description = "接收方列表")
|
||||
private List<Receiver> receivers;
|
||||
|
@@ -0,0 +1,65 @@
|
||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.AllocDetailResultEnum;
|
||||
import org.dromara.daxpay.core.enums.AllocReceiverTypeEnum;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 分账订单明细
|
||||
* @author xxm
|
||||
* @since 2024/5/21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账订单明细")
|
||||
public class AllocDetailResult {
|
||||
|
||||
@Schema(description = "分账接收方编号")
|
||||
private String receiverNo;
|
||||
|
||||
/** 分账金额 */
|
||||
@Schema(description = "分账金额")
|
||||
private Integer amount;
|
||||
|
||||
/** 分账比例 */
|
||||
@Schema(description = "分账比例(万分之多少)")
|
||||
private Integer rate;
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
|
||||
/** 接收方账号 */
|
||||
@Schema(description = "接收方账号")
|
||||
private String receiverAccount;
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @see AllocDetailResultEnum
|
||||
*/
|
||||
@Schema(description = "分账结果")
|
||||
private String result;
|
||||
|
||||
/** 错误代码 */
|
||||
@Schema(description = "错误代码")
|
||||
private String errorCode;
|
||||
|
||||
/** 错误原因 */
|
||||
@Schema(description = "错误原因")
|
||||
private String errorMsg;
|
||||
|
||||
/** 分账完成时间 */
|
||||
@Schema(description = "分账完成时间")
|
||||
private LocalDateTime finishTime;
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
||||
|
||||
/**
|
||||
* 分账请求结果
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账请求结果")
|
||||
public class AllocResult {
|
||||
/** 分账订单号 */
|
||||
@Schema(description = "分账订单号")
|
||||
private String allocNo;
|
||||
|
||||
/** 商户分账订单号 */
|
||||
@Schema(description = "商户分账订单号")
|
||||
private String bizAllocNo;
|
||||
|
||||
/**
|
||||
* 分账状态
|
||||
* @see AllocTransactionStatusEnum
|
||||
*/
|
||||
@Schema(description = "分账状态")
|
||||
private String status;
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
package org.dromara.daxpay.core.result.allocation.transaction;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.daxpay.core.enums.AllocTransactionResultEnum;
|
||||
import org.dromara.daxpay.core.enums.AllocTransactionStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.ChannelEnum;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分账订单返回结果
|
||||
* @author xxm
|
||||
* @since 2024/5/21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "分账订单返回结果")
|
||||
public class AllocTransactionResult {
|
||||
|
||||
/** 分账单号 */
|
||||
@Schema(description = "分账单号")
|
||||
private String allocNo;
|
||||
|
||||
/** 商户分账单号 */
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocNo;
|
||||
|
||||
/** 通道分账号 */
|
||||
@Schema(description = "通道分账号")
|
||||
private String outAllocNo;
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
@Schema(description = "支付订单号")
|
||||
private String orderNo;
|
||||
|
||||
/** 商户支付订单号 */
|
||||
@Schema(description = "商户支付订单号")
|
||||
private String bizOrderNo;
|
||||
|
||||
/** 通道支付订单号 */
|
||||
@Schema(description = "通道支付订单号")
|
||||
private String outOrderNo;
|
||||
|
||||
/**
|
||||
* 支付订单标题
|
||||
*/
|
||||
@Schema(description = "支付订单标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 所属通道
|
||||
* @see ChannelEnum
|
||||
*/
|
||||
@Schema(description = "所属通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 总分账金额
|
||||
*/
|
||||
@Schema(description = "总分账金额")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 分账描述
|
||||
*/
|
||||
@Schema(description = "分账描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* @see AllocTransactionStatusEnum
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
* @see AllocTransactionResultEnum
|
||||
*/
|
||||
@Schema(description = "处理结果")
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
@Schema(description = "错误码")
|
||||
private String errorCode;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@Schema(description = "错误原因")
|
||||
private String errorMsg;
|
||||
|
||||
/** 分账订单完成时间 */
|
||||
@Schema(description = "分账订单完成时间")
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 分账明细 */
|
||||
@Schema(description = "分账明细")
|
||||
private List<AllocDetailResult> details;
|
||||
|
||||
}
|
Reference in New Issue
Block a user