mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-08 22:54:59 +08:00
trade: 分销业务完善校验
This commit is contained in:
parent
0a0c3c0ede
commit
b85d660a5c
@ -1,6 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record;
|
package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -8,12 +11,12 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class AppBrokerageRecordPageReqVO extends PageParam {
|
public class AppBrokerageRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
// TODO @疯狂:要加下枚举校验
|
|
||||||
|
|
||||||
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@InEnum(value = BrokerageRecordBizTypeEnum.class, message = "业务类型必须是 {value}")
|
||||||
private Integer bizType;
|
private Integer bizType;
|
||||||
|
|
||||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@InEnum(value = BrokerageRecordStatusEnum.class, message = "状态必须是 {value}")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,76 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw;
|
package cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.URL;
|
import org.hibernate.validator.constraints.URL;
|
||||||
|
|
||||||
|
import javax.validation.Validator;
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
@Schema(description = "用户 App - 分销提现创建 Request VO")
|
@Schema(description = "用户 App - 分销提现创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
public class AppBrokerageWithdrawCreateReqVO {
|
public class AppBrokerageWithdrawCreateReqVO {
|
||||||
|
|
||||||
// TODO @疯狂:参数校验逻辑,需要根据 type 进行不同的校验;感觉可以通过分组?
|
|
||||||
|
|
||||||
@Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@InEnum(value = BrokerageWithdrawTypeEnum.class, message = "提现方式必须是 {value}")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@Schema(description = "提现账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456789") // 银行卡号/微信账号/支付宝账号
|
@Schema(description = "提现金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
|
||||||
|
@Min(value = 1, message = "提现金额不能小于 1")
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
|
||||||
|
// ========== 银行卡、微信、支付宝 提现相关字段 ==========
|
||||||
|
|
||||||
|
@Schema(description = "提现账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456789")
|
||||||
|
@NotBlank(message = "提现账号不能为空", groups = {Bank.class, Wechat.class, Alipay.class})
|
||||||
private String accountNo;
|
private String accountNo;
|
||||||
|
|
||||||
|
|
||||||
|
// ========== 微信、支付宝 提现相关字段 ==========
|
||||||
|
|
||||||
@Schema(description = "收款码的图片", example = "https://www.iocoder.cn/1.png")
|
@Schema(description = "收款码的图片", example = "https://www.iocoder.cn/1.png")
|
||||||
@URL(message = "收款码的图片,必须是一个 URL")
|
@URL(message = "收款码的图片,必须是一个 URL")
|
||||||
private String accountQrCodeUrl;
|
private String accountQrCodeUrl;
|
||||||
|
|
||||||
@Schema(description = "提现金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
|
|
||||||
@Min(value = 1, message = "提现金额必须大于 1")
|
// ========== 银行卡 提现相关字段 ==========
|
||||||
private Integer price;
|
|
||||||
|
@Schema(description = "持卡人姓名", example = "张三")
|
||||||
|
@NotBlank(message = "持卡人姓名不能为空", groups = {Bank.class})
|
||||||
|
private String name;
|
||||||
|
@Schema(description = "提现银行", example = "1")
|
||||||
|
@NotBlank(message = "提现银行不能为空", groups = {Bank.class})
|
||||||
|
private Integer bankName;
|
||||||
|
@Schema(description = "开户地址", example = "海淀支行")
|
||||||
|
private String bankAddress;
|
||||||
|
|
||||||
|
public interface Wallet {
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Bank {
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Wechat {
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Alipay {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validate(Validator validator) {
|
||||||
|
if (BrokerageWithdrawTypeEnum.WALLET.getType().equals(type)) {
|
||||||
|
ValidationUtils.validate(validator, this, Wallet.class);
|
||||||
|
} else if (BrokerageWithdrawTypeEnum.BANK.getType().equals(type)) {
|
||||||
|
ValidationUtils.validate(validator, this, Bank.class);
|
||||||
|
} else if (BrokerageWithdrawTypeEnum.WECHAT.getType().equals(type)) {
|
||||||
|
ValidationUtils.validate(validator, this, Wechat.class);
|
||||||
|
} else if (BrokerageWithdrawTypeEnum.ALIPAY.getType().equals(type)) {
|
||||||
|
ValidationUtils.validate(validator, this, Alipay.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 佣金 增加 Request BO
|
* 佣金 增加 Request BO
|
||||||
*
|
*
|
||||||
@ -14,11 +16,10 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class BrokerageAddReqBO {
|
public class BrokerageAddReqBO {
|
||||||
|
|
||||||
// TODO @疯狂:bo 的话,也可以考虑加下 @Validated 注解,校验下参数;防御性下哈,虽然不一定用的到
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务ID
|
* 业务编号
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "业务编号不能为空")
|
||||||
private String bizId;
|
private String bizId;
|
||||||
/**
|
/**
|
||||||
* 佣金基数
|
* 佣金基数
|
||||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
|||||||
import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO;
|
import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO;
|
||||||
import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO;
|
import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryBO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +40,7 @@ public interface BrokerageRecordService {
|
|||||||
* @param bizType 业务类型
|
* @param bizType 业务类型
|
||||||
* @param list 请求参数列表
|
* @param list 请求参数列表
|
||||||
*/
|
*/
|
||||||
void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, List<BrokerageAddReqBO> list);
|
void addBrokerage(Long userId, BrokerageRecordBizTypeEnum bizType, @Valid List<BrokerageAddReqBO> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消佣金:将佣金记录,状态修改为已失效
|
* 取消佣金:将佣金记录,状态修改为已失效
|
||||||
|
Loading…
Reference in New Issue
Block a user