code review:钱包实现

This commit is contained in:
YunaiV
2023-08-28 18:54:40 +08:00
parent 9077f14bae
commit 6132443d26
21 changed files with 220 additions and 138 deletions

View File

@ -41,9 +41,9 @@ public interface ErrorCodeConstants {
ErrorCode REFUND_NOT_FOUND = new ErrorCode(1007006004, "支付退款单不存在");
ErrorCode REFUND_STATUS_IS_NOT_WAITING = new ErrorCode(1007006005, "支付退款单不处于待退款");
// ========== 钱包模块(退款) 1007007000 ==========
// ========== 钱包模块 1007007000 ==========
ErrorCode WALLET_NOT_FOUND = new ErrorCode(1007007000, "用户钱包不存在");
ErrorCode WALLET_NOT_ENOUGH = new ErrorCode(1007007001, "钱包余额不足");
ErrorCode WALLET_BALANCE_NOT_ENOUGH = new ErrorCode(1007007001, "钱包余额不足");
ErrorCode WALLET_TRANSACTION_NOT_FOUND = new ErrorCode(1007007002, "未找到对应的钱包交易");
ErrorCode WALLET_REFUND_AMOUNT_ERROR = new ErrorCode(1007007003, "钱包退款金额不对");
ErrorCode WALLET_REFUND_EXIST = new ErrorCode(1007007004, "已经存在钱包退款");

View File

@ -10,20 +10,22 @@ import lombok.Getter;
*/
@AllArgsConstructor
@Getter
public enum WalletBizTypeEnum {
public enum PayWalletBizTypeEnum {
RECHARGE(1, "充值"),
RECHARGE_REFUND(2, "充值退款"),
PAYMENT(3, "支付"),
PAYMENT_REFUND(4, "支付退款");
// TODO 后续增加
/**
* 业务分类
*/
private final Integer bizType;
private final Integer type;
/**
* 说明
*/
private final String desc;
private final String description;
}

View File

@ -7,20 +7,27 @@ import lombok.Getter;
import java.util.Arrays;
// TODO @jason可以简化直接 PageVO 定义两个 Integer
/**
* 钱包明细查询类型
* 钱包流水查询类型
*
* @author jason
*/
@AllArgsConstructor
@Getter
public enum WalletTransactionQueryTypeEnum implements IntArrayValuable {
RECHARGE(1, "充值"),
EXPENSE(2, "消费");
/**
* 类型
*/
private final Integer type;
private final String desc;
/**
* 描述
*/
private final String description;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(WalletTransactionQueryTypeEnum::getType).toArray();
@ -32,4 +39,5 @@ public enum WalletTransactionQueryTypeEnum implements IntArrayValuable {
public static WalletTransactionQueryTypeEnum valueOf(Integer type) {
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());
}
}