钱包,转账 review 修改

This commit is contained in:
jason
2023-10-21 15:28:07 +08:00
parent db0fbf0596
commit 89e847c8cd
32 changed files with 205 additions and 82 deletions

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.pay.api.transfer.dto;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum;
import lombok.Data;
import javax.validation.constraints.Min;
@ -23,7 +25,7 @@ public class PayTransferCreateReqDTO {
* 类型
*/
@NotNull(message = "转账类型不能为空")
// TODO @jason枚举的校验
@InEnum(PayTransferTypeEnum.class)
private Integer type;
/**
@ -35,14 +37,14 @@ public class PayTransferCreateReqDTO {
/**
* 转账金额,单位:分
*/
// TODO @jason这个金额是不是非空哈
@Min(value = 1, message = "转账金额必须大于零")
@NotNull(message = "转账金额不能为空")
private Integer price;
// TODO @jason这个标题是不是不允许空呀
/**
* 转账标题
*/
@NotEmpty(message = "转账标题不能为空")
private String title;
@NotEmpty(message = "收款方信息不能为空")

View File

@ -62,6 +62,7 @@ public interface ErrorCodeConstants {
ErrorCode WALLET_RECHARGE_PACKAGE_AND_PRICE_IS_EMPTY = new ErrorCode(1_007_008_011, "充值金额和充钱套餐不能同时为空");
ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_012, "钱包充值套餐不存在");
ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_013, "钱包充值套餐已禁用");
ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_014, "钱包充值套餐名称已存在");
// ========== 转账模块 1-007-009-000 ==========
ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}");

View File

@ -1,8 +1,11 @@
package cn.iocoder.yudao.module.pay.enums.member;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 钱包交易业务分类
*
@ -10,7 +13,7 @@ import lombok.Getter;
*/
@AllArgsConstructor
@Getter
public enum PayWalletBizTypeEnum {
public enum PayWalletBizTypeEnum implements IntArrayValuable {
RECHARGE(1, "充值"),
RECHARGE_REFUND(2, "充值退款"),
@ -28,4 +31,10 @@ public enum PayWalletBizTypeEnum {
*/
private final String description;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PayWalletBizTypeEnum::getType).toArray();
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.pay.enums.transfer;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 转账类型枚举
*
* @author jason
*/
@AllArgsConstructor
@Getter
public enum PayTransferTypeEnum implements IntArrayValuable {
ALIPAY_BALANCE(1, "支付宝余额"),
WX_BALANCE(2, "微信余额"),
BANK_CARD(3, "银行卡"),
WALLET_BALANCE(4, "钱包余额");
public static final String ALIPAY_LOGON_ID = "ALIPAY_LOGON_ID";
public static final String ALIPAY_ACCOUNT_NAME = "ALIPAY_ACCOUNT_NAME";
private final Integer type;
private final String name;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PayTransferTypeEnum::getType).toArray();
@Override
public int[] array() {
return ARRAYS;
}
public static PayTransferTypeEnum typeOf(Integer type) {
return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
}
}