diff --git a/_doc/Task.md b/_doc/Task.md index 86d7aa66..1632efa2 100644 --- a/_doc/Task.md +++ b/_doc/Task.md @@ -11,10 +11,10 @@ - [x] 请求IP参数增加正则校验 - [x] 支付接口公共参数添加随机数字段, 预防重放问题 - [x] 请求接口增加有效期校验, 超时后失效 -- [ ] 数据库表进行规则, 字段设置长度, 增加索引, 对应请求参数添加校验 +- [x] 数据库表进行规则, 字段设置长度, 增加索引, 对应请求参数添加校验 - [x] 订单 - - [ ] 记录 - - [ ] 配置 + - [x] 记录 + - [x] 配置 - [x] 订单和扩展信息进行合并 - [x] 支付通道两个独立的配置进行合并为一个 - [X] 去除有效, icon, 颜色等字段 diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java index bced1bef..4abe240e 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/allocation/AllocationReceiverController.java @@ -5,6 +5,7 @@ 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.bootx.platform.common.core.util.ValidationUtil; import cn.daxpay.single.code.PaymentApiCode; import cn.daxpay.single.param.payment.allocation.AllocReceiverAddParam; import cn.daxpay.single.param.payment.allocation.AllocReceiverRemoveParam; @@ -66,6 +67,7 @@ public class AllocationReceiverController { @Operation(summary = "添加") @PostMapping("add") public ResResult add(@RequestBody AllocReceiverAddParam param){ + ValidationUtil.validateParam(param); receiverService.addAndSync(param); return Res.ok(); } @@ -74,6 +76,7 @@ public class AllocationReceiverController { @Operation(summary = "删除") @PostMapping("delete") public ResResult delete(@RequestBody AllocReceiverRemoveParam param){ + ValidationUtil.validateParam(param); receiverService.remove(param); return Res.ok(); } diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayApiConfigController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayApiConfigController.java index c95d0594..3f420dec 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayApiConfigController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayApiConfigController.java @@ -2,6 +2,7 @@ package cn.daxpay.single.admin.controller.system; import cn.bootx.platform.common.core.rest.Res; import cn.bootx.platform.common.core.rest.ResResult; +import cn.bootx.platform.common.core.util.ValidationUtil; import cn.daxpay.single.service.core.system.config.service.PayApiConfigService; import cn.daxpay.single.service.dto.system.config.PayApiConfigDto; import cn.daxpay.single.service.param.system.config.PayApiConfigParam; @@ -37,6 +38,7 @@ public class PayApiConfigController { @Operation(summary = "更新") @PostMapping("/update") public ResResult update(@RequestBody PayApiConfigParam param){ + ValidationUtil.validateParam(param); payApiConfigService.update(param); return Res.ok(); } diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayMethodInfoController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayMethodInfoController.java index 886e71d7..8ed5c400 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayMethodInfoController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PayMethodInfoController.java @@ -2,6 +2,7 @@ package cn.daxpay.single.admin.controller.system; import cn.bootx.platform.common.core.rest.Res; import cn.bootx.platform.common.core.rest.ResResult; +import cn.bootx.platform.common.core.util.ValidationUtil; import cn.daxpay.single.service.core.system.payinfo.service.PayMethodInfoService; import cn.daxpay.single.service.dto.system.payinfo.PayMethodInfoDto; import cn.daxpay.single.service.param.system.payinfo.PayWayInfoParam; @@ -39,6 +40,7 @@ public class PayMethodInfoController { @Operation(summary = "更新") @PostMapping("/update") public ResResult update(@RequestBody PayWayInfoParam param){ + ValidationUtil.validateParam(param); payMethodInfoService.update(param); return Res.ok(); } diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PlatformConfigController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PlatformConfigController.java index 4a370306..2868efe0 100644 --- a/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PlatformConfigController.java +++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/daxpay/single/admin/controller/system/PlatformConfigController.java @@ -2,6 +2,7 @@ package cn.daxpay.single.admin.controller.system; import cn.bootx.platform.common.core.rest.Res; import cn.bootx.platform.common.core.rest.ResResult; +import cn.bootx.platform.common.core.util.ValidationUtil; import cn.daxpay.single.service.core.system.config.service.PlatformConfigService; import cn.daxpay.single.service.dto.system.config.PlatformConfigDto; import cn.daxpay.single.service.param.system.config.PlatformConfigParam; @@ -31,6 +32,7 @@ public class PlatformConfigController { @Operation(summary = "更新平台配置项") @PostMapping("/update") public ResResult update(@RequestBody PlatformConfigParam param){ + ValidationUtil.validateParam(param); platformConfigService.update(param); return Res.ok(); } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverAddParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverAddParam.java index 045265b2..1a259d43 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverAddParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverAddParam.java @@ -9,7 +9,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; /** * 分账接收者添加参数 @@ -23,7 +24,8 @@ import javax.validation.constraints.NotEmpty; public class AllocReceiverAddParam extends PaymentCommonParam { @Schema(description = "接收者编号, 需要保证唯一") - @NotEmpty(message = "接收者编号必填") + @NotBlank(message = "接收者编号必填") + @Size(max = 32, message = "接收者编号不可超过32位") private String receiverNo; /** @@ -31,7 +33,8 @@ public class AllocReceiverAddParam extends PaymentCommonParam { * @see PayChannelEnum */ @Schema(description = "所属通道") - @NotEmpty(message = "所属通道必填") + @NotBlank(message = "所属通道必填") + @Size(max = 20, message = "所属通道不可超过20位") private String channel; /** @@ -39,16 +42,19 @@ public class AllocReceiverAddParam extends PaymentCommonParam { * @see AllocReceiverTypeEnum */ @Schema(description = "分账接收方类型") - @NotEmpty(message = "分账接收方类型必填") + @NotBlank(message = "分账接收方类型必填") + @Size(max = 20, message = "分账接收方类型不可超过20位") private String receiverType; /** 接收方账号 */ @Schema(description = "接收方账号") - @NotEmpty(message = "接收方账号必填") + @NotBlank(message = "接收方账号必填") + @Size(max = 100, message = "接收方账号不可超过100位") private String receiverAccount; /** 接收方姓名 */ @Schema(description = "接收方姓名") + @Size(max = 100, message = "接收方姓名不可超过50位") private String receiverName; /** @@ -56,10 +62,12 @@ public class AllocReceiverAddParam extends PaymentCommonParam { * @see AllocRelationTypeEnum */ @Schema(description = "分账关系类型") - @NotEmpty(message = "分账关系类型必填") + @NotBlank(message = "分账关系类型必填") + @Size(max = 20, message = "分账关系类型不可超过20位") private String relationType; /** 关系名称 关系类型为自定义是填写 */ @Schema(description = "关系名称") + @Size(max = 50, message = "关系名称不可超过50位") private String relationName; } diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverParam.java index 7ab1fb8e..1afa43e9 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverParam.java @@ -5,6 +5,7 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @@ -20,7 +21,7 @@ public class AllocReceiverParam { /** 分账接收方编号 */ @Schema(description = "分账接收方编号") - @NotEmpty(message = "分账接收方编号必填") + @NotBlank(message = "分账接收方编号必填") private String receiverNo; /** 分账金额 */ diff --git a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverRemoveParam.java b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverRemoveParam.java index 06f21e6d..a20715dd 100644 --- a/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverRemoveParam.java +++ b/daxpay-single/daxpay-single-core/src/main/java/cn/daxpay/single/param/payment/allocation/AllocReceiverRemoveParam.java @@ -6,7 +6,9 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; /** * 分账接收者删除参数 @@ -20,7 +22,8 @@ import javax.validation.constraints.NotEmpty; public class AllocReceiverRemoveParam extends PaymentCommonParam { @Schema(description = "接收者编号") - @NotEmpty(message = "接收者编号必填") + @NotBlank(message = "接收者编号必填") + @Size(max = 32, message = "接收者编号不可超过32位") private String receiverNo; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/entity/AliPayConfig.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/entity/AliPayConfig.java index df2ed13a..9af6af7c 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/entity/AliPayConfig.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/channel/alipay/entity/AliPayConfig.java @@ -47,7 +47,7 @@ public class AliPayConfig extends MpBaseEntity implements EntityBaseFunction 本网关进行处理 -> 发送消息通知业务系统 */ - @DbColumn(comment = "异步通知页面路径") + @DbColumn(comment = "异步通知接收路径", length = 200) private String notifyUrl; /** @@ -65,22 +65,22 @@ public class AliPayConfig extends MpBaseEntity implements EntityBaseFunction 本网关进行处理 -> 重定向到业务系统中 */ - @DbColumn(comment = "同步通知页面路径") + @DbColumn(comment = "同步通知页面路径", length = 200) private String returnUrl; /** 支付网关地址 */ - @DbColumn(comment = "支付网关地址") + @DbColumn(comment = "支付网关地址", length = 200) private String serverUrl; /** * 认证类型 证书/公钥 * @see AliPayCode#AUTH_TYPE_KEY */ - @DbColumn(comment = "认证类型") + @DbColumn(comment = "认证类型", length = 20) private String authType; /** 签名类型 RSA2 */ - @DbColumn(comment = "签名类型 RSA2") + @DbColumn(comment = "签名类型 RSA2", length = 20) public String signType; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocOrderDetail.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocOrderDetail.java index 59c10eed..1a2a67f0 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocOrderDetail.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/allocation/entity/AllocOrderDetail.java @@ -59,12 +59,12 @@ public class AllocOrderDetail extends MpBaseEntity implements EntityBaseFunction private String receiverType; /** 接收方账号 */ - @DbColumn(comment = "接收方账号", length = 150, isNull = false) + @DbColumn(comment = "接收方账号", length = 100, isNull = false) @TableField(typeHandler = DecryptTypeHandler.class) private String receiverAccount; /** 接收方姓名 */ - @DbColumn(comment = "接收方姓名", length = 150) + @DbColumn(comment = "接收方姓名", length = 100) private String receiverName; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/reconcile/entity/ReconcileDiff.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/reconcile/entity/ReconcileDiff.java index 487330b1..bb69e75d 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/reconcile/entity/ReconcileDiff.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/order/reconcile/entity/ReconcileDiff.java @@ -36,65 +36,65 @@ import java.util.List; public class ReconcileDiff extends MpBaseEntity implements EntityBaseFunction { /** 对账单ID */ - @DbColumn(comment = "对账单ID") + @DbColumn(comment = "对账单ID", isNull = false) private Long reconcileId; /** 对账号 */ - @DbColumn(comment = "对账号") + @DbColumn(comment = "对账号", length = 32, isNull = false) private String reconcileNo; /** 对账单明细ID */ - @DbColumn(comment = "对账单明细ID") + @DbColumn(comment = "对账单明细ID", isNull = false) private Long detailId; /** 对账日期 */ - @DbColumn(comment = "对账日期") + @DbColumn(comment = "对账日期", isNull = false) private LocalDate reconcileDate; /** 本地交易号 */ - @DbColumn(comment = "本地交易号") + @DbColumn(comment = "本地交易号", length = 32, isNull = false) private String tradeNo; /** 通道交易号 */ - @DbColumn(comment = "通道交易号") + @DbColumn(comment = "通道交易号", length = 150, isNull = false) private String outTradeNo; /** 交易时间 */ - @DbColumn(comment = "交易时间") + @DbColumn(comment = "交易时间", isNull = false) private LocalDateTime tradeTime; /** 订单标题 */ - @DbColumn(comment = "订单标题") + @DbColumn(comment = "订单标题", length = 100) private String title; /** * 通道 * @see PayChannelEnum */ - @DbColumn(comment = "通道") + @DbColumn(comment = "通道", length = 20, isNull = false) private String channel; /** 本地交易金额 */ - @DbColumn(comment = "本地交易金额") + @DbColumn(comment = "本地交易金额", length = 15) private Integer amount; /** 通道交易金额 */ - @DbColumn(comment = "通道交易金额") + @DbColumn(comment = "通道交易金额", length = 15) private Integer outAmount; /** * 交易类型 * @see ReconcileTradeEnum */ - @DbColumn(comment = "交易类型") + @DbColumn(comment = "交易类型", length = 20) private String tradeType; /** * 差异类型 * @see ReconcileDiffTypeEnum */ - @DbColumn(comment = "差异类型") + @DbColumn(comment = "差异类型", length = 20) private String diffType; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationGroupReceiver.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationGroupReceiver.java index 48a7f45a..137a6f59 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationGroupReceiver.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationGroupReceiver.java @@ -20,12 +20,12 @@ import lombok.experimental.Accessors; @TableName("pay_allocation_group_receiver") public class AllocationGroupReceiver extends MpCreateEntity { - @DbColumn(comment = "分账组ID") + @DbColumn(comment = "分账组ID", isNull = false) private Long groupId; - @DbColumn(comment = "接收者ID") + @DbColumn(comment = "接收者ID", isNull = false) private Long receiverId; - @DbColumn(comment = "分账比例(万分之多少)") + @DbColumn(comment = "分账比例(万分之多少)", length = 5) private Integer rate; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationReceiver.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationReceiver.java index 7f3020bb..7e9dab39 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationReceiver.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/allocation/entity/AllocationReceiver.java @@ -30,14 +30,14 @@ import lombok.experimental.Accessors; public class AllocationReceiver extends MpBaseEntity implements EntityBaseFunction { /** 分账接收方编号, 需要保证唯一 */ - @DbColumn(comment = "分账接收方编号") + @DbColumn(comment = "分账接收方编号", length = 32, isNull = false) private String receiverNo; /** * 所属通道 * @see PayChannelEnum */ - @DbColumn(comment = "所属通道") + @DbColumn(comment = "所属通道", length = 20, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String channel; @@ -45,16 +45,16 @@ public class AllocationReceiver extends MpBaseEntity implements EntityBaseFuncti * 分账接收方类型 * @see AllocReceiverTypeEnum */ - @DbColumn(comment = "分账接收方类型") + @DbColumn(comment = "分账接收方类型", length = 20, isNull = false) private String receiverType; /** 接收方账号 */ - @DbColumn(comment = "接收方账号") + @DbColumn(comment = "接收方账号", length = 100, isNull = false) @TableField(typeHandler = DecryptTypeHandler.class) private String receiverAccount; /** 接收方姓名 */ - @DbColumn(comment = "接收方姓名") + @DbColumn(comment = "接收方姓名", length = 100) @TableField(updateStrategy = FieldStrategy.ALWAYS) private String receiverName; @@ -62,11 +62,11 @@ public class AllocationReceiver extends MpBaseEntity implements EntityBaseFuncti * 分账关系类型 * @see AllocRelationTypeEnum */ - @DbColumn(comment = "分账关系类型") + @DbColumn(comment = "分账关系类型", length = 20, isNull = false) private String relationType; /** 关系名称 */ - @DbColumn(comment = "关系名称") + @DbColumn(comment = "关系名称", length = 50) private String relationName; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java index b8fe8e70..0d185cb8 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/payment/pay/service/PayAssistService.java @@ -167,8 +167,7 @@ public class PayAssistService { */ public void validationLimitAmount(PayParam payParam) { // 总额校验 - PlatformLocal platformInfo = PaymentContextLocal.get() - .getPlatformInfo(); + PlatformLocal platformInfo = PaymentContextLocal.get().getPlatformInfo(); if (payParam.getAmount() > platformInfo.getLimitAmount()) { throw new PayFailureException("支付金额超过限额"); } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/callback/entity/PayCallbackRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/callback/entity/PayCallbackRecord.java index 4abc28b0..d2eaaceb 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/callback/entity/PayCallbackRecord.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/callback/entity/PayCallbackRecord.java @@ -64,7 +64,6 @@ public class PayCallbackRecord extends MpCreateEntity implements EntityBaseFunct @DbColumn(comment = "回调处理状态", length = 20, isNull = false) private String status; - /** 修复号 */ @DbColumn(comment = "修复号", length = 32, isNull = false) private String repairOrderNo; diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/flow/entity/TradeFlowRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/flow/entity/TradeFlowRecord.java index 5e1a949c..567908dd 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/flow/entity/TradeFlowRecord.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/flow/entity/TradeFlowRecord.java @@ -4,6 +4,7 @@ import cn.bootx.platform.common.core.function.EntityBaseFunction; import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity; import cn.bootx.table.modify.annotation.DbColumn; import cn.bootx.table.modify.annotation.DbTable; +import cn.bootx.table.modify.mysql.annotation.DbMySqlIndex; import cn.daxpay.single.code.PayChannelEnum; import cn.daxpay.single.service.code.TradeFlowRecordTypeEnum; import cn.daxpay.single.service.core.record.flow.convert.TradeFlowRecordConvert; @@ -26,37 +27,40 @@ import lombok.experimental.Accessors; public class TradeFlowRecord extends MpCreateEntity implements EntityBaseFunction { /** 订单标题 */ - @DbColumn(comment = "标题") + @DbColumn(comment = "标题", length = 100, isNull = false) private String title; /** 金额 */ - @DbColumn(comment = "金额") + @DbColumn(comment = "金额", length = 15, isNull = false) private Integer amount; /** * 业务类型 * @see TradeFlowRecordTypeEnum */ - @DbColumn(comment = "业务类型") + @DbColumn(comment = "业务类型", length = 20, isNull = false) private String type; /** * 支付通道 * @see PayChannelEnum */ - @DbColumn(comment = "支付通道") + @DbColumn(comment = "支付通道", length = 20, isNull = false) private String channel; /** 本地交易号 */ - @DbColumn(comment = "本地交易号") + @DbMySqlIndex(comment = "本地交易号索引") + @DbColumn(comment = "本地交易号", length = 32, isNull = false) private String tradeNo; /** 商户交易号 */ - @DbColumn(comment = "商户交易号") + @DbMySqlIndex(comment = "商户交易号索引") + @DbColumn(comment = "商户交易号", length = 100, isNull = false) private String bizTradeNo; /** 通道交易号 */ - @DbColumn(comment = "通道交易号") + @DbMySqlIndex(comment = "通道交易号索引") + @DbColumn(comment = "通道交易号", length = 150, isNull = false) private String outTradeNo; @Override diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/repair/entity/PayRepairRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/repair/entity/PayRepairRecord.java index 8d606587..45329189 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/repair/entity/PayRepairRecord.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/repair/entity/PayRepairRecord.java @@ -2,15 +2,16 @@ package cn.daxpay.single.service.core.record.repair.entity; import cn.bootx.platform.common.core.function.EntityBaseFunction; import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity; +import cn.bootx.table.modify.annotation.DbColumn; +import cn.bootx.table.modify.annotation.DbTable; +import cn.bootx.table.modify.mysql.annotation.DbMySqlIndex; import cn.daxpay.single.code.PayStatusEnum; -import cn.daxpay.single.service.code.PaymentTypeEnum; import cn.daxpay.single.service.code.PayRepairSourceEnum; import cn.daxpay.single.service.code.PayRepairWayEnum; +import cn.daxpay.single.service.code.PaymentTypeEnum; import cn.daxpay.single.service.code.RefundRepairWayEnum; import cn.daxpay.single.service.core.record.repair.convert.PayRepairRecordConvert; import cn.daxpay.single.service.dto.record.repair.PayRepairRecordDto; -import cn.bootx.table.modify.annotation.DbColumn; -import cn.bootx.table.modify.annotation.DbTable; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -32,31 +33,32 @@ public class PayRepairRecord extends MpCreateEntity implements EntityBaseFunctio * 修复号 * 如果一次修复产生的修复记录有多个记录, 使用这个作为关联 */ - @DbColumn(comment = "修复号") + @DbColumn(comment = "修复号", length = 32, isNull = false) private String repairNo; /** 支付ID/退款ID */ - @DbColumn(comment = "本地订单ID") + @DbColumn(comment = "本地订单ID", isNull = false) private Long tradeId; /** * 本地交易号, 支付号/退款号 */ - @DbColumn(comment = "本地业务号") + @DbMySqlIndex(comment = "本地交易号索引") + @DbColumn(comment = "本地交易号", length = 32, isNull = false) private String tradeNo; /** * 修复类型 支付修复/退款修复 * @see PaymentTypeEnum */ - @DbColumn(comment = "修复类型") + @DbColumn(comment = "修复类型", length = 20, isNull = false) private String repairType; /** * 修复来源 * @see PayRepairSourceEnum */ - @DbColumn(comment = "修复来源") + @DbColumn(comment = "修复来源", length = 20, isNull = false) private String repairSource; /** @@ -64,25 +66,25 @@ public class PayRepairRecord extends MpCreateEntity implements EntityBaseFunctio * @see PayRepairWayEnum * @see RefundRepairWayEnum */ - @DbColumn(comment = "修复方式") + @DbColumn(comment = "修复方式", length = 20, isNull = false) private String repairWay; /** 修复的通道 */ - @DbColumn(comment = "修复的通道") + @DbColumn(comment = "修复的通道", length = 20, isNull = false) private String channel; /** * 修复前状态 * @see PayStatusEnum */ - @DbColumn(comment = "修复前状态") + @DbColumn(comment = "修复前状态", length = 20, isNull = false) private String beforeStatus; /** * 修复后状态 * @see PayStatusEnum */ - @DbColumn(comment = "修复后状态") + @DbColumn(comment = "修复后状态", length = 20, isNull = false) private String afterStatus; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/sync/entity/PaySyncRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/sync/entity/PaySyncRecord.java index f7eaccf3..1812bd47 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/sync/entity/PaySyncRecord.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/record/sync/entity/PaySyncRecord.java @@ -2,17 +2,17 @@ package cn.daxpay.single.service.core.record.sync.entity; import cn.bootx.platform.common.core.function.EntityBaseFunction; import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity; -import cn.daxpay.single.code.AllocOrderStatusEnum; -import cn.daxpay.single.code.PayChannelEnum; -import cn.daxpay.single.code.RefundSyncStatusEnum; -import cn.daxpay.single.code.PaySyncStatusEnum; -import cn.daxpay.single.service.code.PaymentTypeEnum; -import cn.daxpay.single.service.core.record.sync.convert.PaySyncRecordConvert; -import cn.daxpay.single.service.dto.record.sync.PaySyncRecordDto; import cn.bootx.table.modify.annotation.DbColumn; import cn.bootx.table.modify.annotation.DbTable; import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType; +import cn.bootx.table.modify.mysql.annotation.DbMySqlIndex; import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum; +import cn.daxpay.single.code.PayChannelEnum; +import cn.daxpay.single.code.PaySyncStatusEnum; +import cn.daxpay.single.code.RefundSyncStatusEnum; +import cn.daxpay.single.service.code.PaymentTypeEnum; +import cn.daxpay.single.service.core.record.sync.convert.PaySyncRecordConvert; +import cn.daxpay.single.service.dto.record.sync.PaySyncRecordDto; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -31,53 +31,55 @@ import lombok.experimental.Accessors; public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction { /** 本地交易号 */ - @DbColumn(comment = "本地交易号") + @DbMySqlIndex(comment = "本地交易号索引") + @DbColumn(comment = "本地交易号", length = 32, isNull = false) private String tradeNo; /** 商户交易号 */ - @DbColumn(comment = "商户交易号") + @DbMySqlIndex(comment = "商户交易号索引") + @DbColumn(comment = "商户交易号", length = 100, isNull = false) private String bizTradeNo; /** 通道交易号 */ - @DbColumn(comment = "通道交易号") + @DbMySqlIndex(comment = "通道交易号索引") + @DbColumn(comment = "通道交易号", length = 150, isNull = false) private String outTradeNo; - /** * 三方支付返回状态 * @see PaySyncStatusEnum * @see RefundSyncStatusEnum */ - @DbColumn(comment = "网关返回状态") + @DbColumn(comment = "网关返回状态", length = 20, isNull = false) private String outTradeStatus; /** * 同步类型 支付/退款 * @see PaymentTypeEnum */ - @DbColumn(comment = "同步类型") + @DbColumn(comment = "同步类型", length = 20, isNull = false) private String syncType; /** * 同步的异步通道 * @see PayChannelEnum#getCode() */ - @DbColumn(comment = "同步的异步通道") + @DbColumn(comment = "同步的异步通道", length = 20, isNull = false) private String channel; /** 网关返回的同步消息 */ @DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT) - @DbColumn(comment = "同步消息") + @DbColumn(comment = "同步消息", isNull = false) private String syncInfo; /** * 支付单如果状态不一致, 是否进行修复 */ - @DbColumn(comment = "是否进行修复") + @DbColumn(comment = "是否进行修复", isNull = false) private boolean repair; /** 修复单号 */ - @DbColumn(comment = "修复单号") + @DbColumn(comment = "修复单号", length = 32) private String repairNo; /** 错误码 */ diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayApiConfig.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayApiConfig.java index 9f8375db..dbd49dee 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayApiConfig.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayApiConfig.java @@ -25,22 +25,22 @@ import lombok.experimental.Accessors; @TableName("pay_api_config") public class PayApiConfig extends MpBaseEntity implements EntityBaseFunction { - @DbColumn(comment = "编码") + @DbColumn(comment = "编码",length = 50, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String code; - @DbColumn(comment = "接口地址") + @DbColumn(comment = "接口地址", length = 200, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String api; - @DbColumn(comment = "名称") + @DbColumn(comment = "名称", length = 100, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String name; - @DbColumn(comment = "是否启用") + @DbColumn(comment = "是否启用", isNull = false) private boolean enable; - @DbColumn(comment = "备注") + @DbColumn(comment = "备注", length = 200) private String remark; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayChannelConfig.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayChannelConfig.java index 43feaf27..c6516bc3 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayChannelConfig.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PayChannelConfig.java @@ -27,17 +27,17 @@ import lombok.experimental.Accessors; public class PayChannelConfig extends MpBaseEntity implements EntityBaseFunction { /** 需要与系统中配置的枚举一致 */ - @DbColumn(comment = "代码") + @DbColumn(comment = "代码", length = 20, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String code; /** 需要与系统中配置的枚举一致 */ - @DbColumn(comment = "名称") + @DbColumn(comment = "名称", length = 20, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String name; /** 备注 */ - @DbColumn(comment = "备注") + @DbColumn(comment = "备注", length = 200) private String remark; /** diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PlatformConfig.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PlatformConfig.java index 3ced85ce..6b055fde 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PlatformConfig.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/core/system/config/entity/PlatformConfig.java @@ -8,6 +8,8 @@ import cn.daxpay.single.service.core.system.config.convert.PlatformConfigConvert import cn.daxpay.single.service.dto.system.config.PlatformConfigDto; import cn.bootx.table.modify.annotation.DbColumn; import cn.bootx.table.modify.annotation.DbTable; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -25,21 +27,23 @@ import lombok.experimental.Accessors; @TableName("pay_platform_config") public class PlatformConfig extends MpBaseEntity implements EntityBaseFunction { - @DbColumn(comment = "网站地址") + @DbColumn(comment = "网站地址", length = 200, isNull = false) private String websiteUrl; /** * @see PaySignTypeEnum */ - @DbColumn(comment = "签名方式") + @DbColumn(comment = "签名方式", length = 20) + @TableField(updateStrategy = FieldStrategy.ALWAYS) private String signType; /** 签名秘钥 */ - @DbColumn(comment = "签名秘钥") + @DbColumn(comment = "签名秘钥", length = 50) + @TableField(updateStrategy = FieldStrategy.ALWAYS) private String signSecret; /** 是否对请求进行验签 */ - @DbColumn(comment = "是否对请求进行验签") + @DbColumn(comment = "是否对请求进行验签", isNull = false) private boolean reqSign; /** @@ -47,30 +51,35 @@ public class PlatformConfig extends MpBaseEntity implements EntityBaseFunction

{ /** 需要与系统中配置的枚举一致 */ - @DbColumn(comment = "代码") + @DbColumn(comment = "代码", length = 20, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String code; /** 需要与系统中配置的枚举一致 */ - @DbColumn(comment = "名称") + @DbColumn(comment = "名称", length = 100, isNull = false) @TableField(updateStrategy = FieldStrategy.NEVER) private String name; /** 备注 */ - @DbColumn(comment = "备注") + @DbColumn(comment = "备注", length = 200) private String remark; public static PayMethodInfoDto convert(PayMethodInfo in) { diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/allocation/group/AllocationGroupUnbindParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/allocation/group/AllocationGroupUnbindParam.java index f82de6db..32810ab6 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/allocation/group/AllocationGroupUnbindParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/allocation/group/AllocationGroupUnbindParam.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.List; @@ -22,7 +23,7 @@ public class AllocationGroupUnbindParam { @Schema(description = "分账组ID") private Long groupId; - @NotEmpty(message = "分账接收方不可为空") + @NotBlank(message = "分账接收方不可为空") @Schema(description = "分账接收方集合") List receiverIds; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PayApiConfigParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PayApiConfigParam.java index e68a6f61..5282d84f 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PayApiConfigParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PayApiConfigParam.java @@ -4,6 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + /** * 支付开放接口管理 * @author xxm @@ -14,12 +17,15 @@ import lombok.experimental.Accessors; @Schema(title = "支付开放接口管理") public class PayApiConfigParam { - @Schema(description = "id") + + @NotNull(message = "主键不能为空") + @Schema(description = "主键") private Long id; @Schema(description = "是否启用") private boolean enable; + @Size(max = 200, message = "备注长度不能超过200") @Schema(description = "备注") private String remark; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PlatformConfigParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PlatformConfigParam.java index 6d310ae3..73bd55d9 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PlatformConfigParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/config/PlatformConfigParam.java @@ -6,6 +6,10 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + /** * 平台配置 * @author xxm @@ -16,6 +20,8 @@ import lombok.experimental.Accessors; @Schema(title = "平台配置") public class PlatformConfigParam { + @NotBlank(message = "网站地址必填") + @Size(min = 1, max = 200, message = "网站地址不可超过200位") @Schema(description = "网站地址") private String websiteUrl; @@ -28,15 +34,20 @@ public class PlatformConfigParam { * 如果传输的请求时间早于当前服务时间, 而且差值超过配置的时长, 将会请求失败 * 如果传输的请求时间比服务时间大于配置的时长(超过一分钟), 将会请求失败 */ + @Min(value = 1, message = "请求有效时长不可小于1秒") @Schema(description = "请求有效时长(秒)") private Integer reqTimeout; /** + * 签名方式 * @see PaySignTypeEnum */ + @Size(max = 20, message = "签名方式不可超过20位") @Schema(description = "签名方式") private String signType; + /** 签名秘钥 */ + @Size(max = 50, message = "签名秘钥不可超过50位") @Schema(description = "签名秘钥") private String signSecret; @@ -44,20 +55,27 @@ public class PlatformConfigParam { * 消息通知方式, 目前只支持http * @see TradeNotifyTypeEnum */ + @Size(max = 20, message = "消息通知方式不可超过20位") @Schema(description = "消息通知方式") private String notifyType; /** 消息通知地址 */ - + @Size(max = 200, message = "消息通知地址不可超过200位") @Schema(description = "消息通知地址") private String notifyUrl; + /** 同步支付跳转地址 */ + @Size(max = 200, message = "同步支付跳转地址不可超过200位") @Schema(description = "同步支付跳转地址") private String returnUrl; + /** 订单默认超时时间(分钟) */ + @Min(value = 5, message = "订单默认超时时间不可小于5分钟") @Schema(description = "订单默认超时时间(分钟)") private Integer orderTimeout; + /** 订单支付限额(分) */ + @Min(value = 1, message = "订单支付限额不可小于0.01元") @Schema(description = "订单支付限额(分)") private Integer limitAmount; } diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayChannelInfoParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayChannelInfoParam.java index 11b1170a..5df6672d 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayChannelInfoParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayChannelInfoParam.java @@ -5,26 +5,18 @@ import lombok.Data; import lombok.experimental.Accessors; /** - * + * 支付通道配置 * @author xxm * @since 2024/1/8 */ @Data @Accessors(chain = true) -@Schema(title = "") +@Schema(title = "支付通道配置") public class PayChannelInfoParam { @Schema(description= "主键") private Long id; - /** logo图片 */ - @Schema(description = "logo图片") - private Long iconId; - - /** 卡牌背景色 */ - @Schema(description = "卡牌背景色") - private String bgColor; - /** 备注 */ @Schema(description = "备注") private String remark; diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayWayInfoParam.java b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayWayInfoParam.java index dddd38cc..30547eb8 100644 --- a/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayWayInfoParam.java +++ b/daxpay-single/daxpay-single-service/src/main/java/cn/daxpay/single/service/param/system/payinfo/PayWayInfoParam.java @@ -4,6 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + /** * * @author xxm @@ -14,9 +17,11 @@ import lombok.experimental.Accessors; @Schema(title = "支付方式信息") public class PayWayInfoParam { + @NotNull(message = "主键不能为空") @Schema(description= "主键") private Long id; + @Size(max = 200, message = "备注长度不能超过200") @Schema(description = "备注") private String remark; }