【代码优化】商城:优化分销提现的逻辑(余额)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletCreateReqDto;
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
||||
|
||||
/**
|
||||
* 钱包 API 接口
|
||||
@@ -10,21 +9,11 @@ import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletRespDTO;
|
||||
*/
|
||||
public interface PayWalletApi {
|
||||
|
||||
// TODO @luchi:1)改成 addWalletBalance;2)PayWalletCreateReqDto 搞成 userId、userType;3)bizType 使用 integer,不然后续挪到 cloud 不好弄,因为枚举不好序列化
|
||||
/**
|
||||
* 添加钱包
|
||||
* 添加钱包余额
|
||||
*
|
||||
* @param reqDTO 创建请求
|
||||
* @param reqDTO 增加余额请求
|
||||
*/
|
||||
void addWallet(PayWalletCreateReqDto reqDTO);
|
||||
|
||||
// TODO @luchi:不用去 getWalletByUserId 钱包,直接添加余额就好。里面内部去创建。如果删除掉的化,PayWalletRespDTO 也删除哈。
|
||||
/**
|
||||
* 根据用户编号,获取钱包信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 钱包信息
|
||||
*/
|
||||
PayWalletRespDTO getWalletByUserId(Long userId);
|
||||
void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO);
|
||||
|
||||
}
|
||||
|
@@ -1,36 +1,43 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 钱包余额增加 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class PayWalletCreateReqDto {
|
||||
public class PayWalletAddBalanceReqDTO {
|
||||
|
||||
/**
|
||||
* 钱包编号
|
||||
* 用户编号
|
||||
*
|
||||
* 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性
|
||||
*/
|
||||
@NotNull(message = "钱包编号不能为空")
|
||||
private Long walletId;
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户类型
|
||||
*
|
||||
* 关联 {@link UserTypeEnum}
|
||||
*/
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 关联业务分类
|
||||
*/
|
||||
@NotNull(message = "关联业务分类不能为空")
|
||||
private PayWalletBizTypeEnum bizType;
|
||||
|
||||
private Integer bizType;
|
||||
/**
|
||||
* 关联业务编号
|
||||
*/
|
||||
@NotNull(message = "关联业务编号不能为空")
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* 流水说明
|
||||
*/
|
||||
@NotNull(message = "流水说明不能为空")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 交易金额,单位分
|
||||
*
|
@@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PayWalletRespDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 余额,单位分
|
||||
*/
|
||||
private Integer balance;
|
||||
|
||||
}
|
@@ -20,7 +20,7 @@ public enum PayWalletBizTypeEnum implements IntArrayValuable {
|
||||
PAYMENT(3, "支付"),
|
||||
PAYMENT_REFUND(4, "支付退款"),
|
||||
UPDATE_BALANCE(5, "更新余额"),
|
||||
WITHDRAW(6, "分佣提现");
|
||||
BROKERAGE_WITHDRAW(6, "分佣提现");
|
||||
|
||||
/**
|
||||
* 业务分类
|
||||
@@ -38,4 +38,8 @@ public enum PayWalletBizTypeEnum implements IntArrayValuable {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static PayWalletBizTypeEnum valueOf(Integer type) {
|
||||
return Arrays.stream(values()).filter(item -> item.getType().equals(type)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user