member: 分销配置

This commit is contained in:
owen 2023-09-03 21:19:42 +08:00
parent 482a84a6f1
commit 991b53649b
8 changed files with 371 additions and 2 deletions

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 分销关系绑定模式枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageBindModeEnum implements IntArrayValuable {
/**
* 只要用户没有推广人随时都可以绑定分销关系
*/
ANYTIME(0, "没有推广人"),
/**
* 仅新用户注册时才能绑定推广关系
*/
REGISTER(1, "新用户"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageBindModeEnum::getMode).toArray();
/**
* 模式
*/
private final Integer mode;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 分佣模式枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageEnabledConditionEnum implements IntArrayValuable {
/**
* 所有用户都可以分销
*/
ALL(0, "人人分销"),
/**
* 仅可后台手动设置推广员
*/
ADMIN(1, "指定分销"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageEnabledConditionEnum::getCondition).toArray();
/**
* 模式
*/
private final Integer condition;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金记录业务类型枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageRecordBizTypeEnum implements IntArrayValuable {
ORDER(0, "获得推广佣金", "获得推广佣金 {}", true),
WITHDRAW(1, "提现申请", "提现申请扣除佣金 {}", false),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageRecordBizTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 标题
*/
private final String title;
/**
* 描述
*/
private final String description;
/**
* 是否为增加佣金
*/
private final boolean add;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金记录状态枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageRecordStatusEnum implements IntArrayValuable {
WAIT_SETTLEMENT(0, "待结算"),
SETTLEMENT(1, "已结算"),
CANCEL(2, "已取消"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageRecordStatusEnum::getStatus).toArray();
/**
* 状态
*/
private final Integer status;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金提现状态枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageWithdrawStatusEnum implements IntArrayValuable {
AUDITING(0, "审核中"),
AUDIT_SUCCESS(10, "审核通过"),
WITHDRAW_SUCCESS(11, "提现成功"),
AUDIT_FAIL(20, "审核不通过"),
WITHDRAW_FAIL(21, "提现失败"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageWithdrawStatusEnum::getStatus).toArray();
/**
* 状态
*/
private final Integer status;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.member.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金提现类型枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageWithdrawTypeEnum implements IntArrayValuable {
WALLET(1, "钱包"),
BANK(2, "银行卡"),
WECHAT(3, "微信"),
ALIPAY(4, "支付宝"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageWithdrawTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -1,9 +1,17 @@
package cn.iocoder.yudao.module.member.controller.admin.point.vo.config;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageBindModeEnum;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageEnabledConditionEnum;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageWithdrawTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.util.List;
/**
* 会员积分配置 Base VO提供给添加修改详细的子 VO 使用
@ -28,4 +36,53 @@ public class MemberPointConfigBaseVO {
@NotNull(message = "1 元赠送积分不能为空")
private Integer tradeGivePoint;
// ========== 分销相关 ==========
@Schema(description = "是否启用分佣", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否启用分佣不能为空")
private Boolean brokerageEnabled;
@Schema(description = "分佣模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@NotNull(message = "分佣模式不能为空")
@InEnum(value = BrokerageEnabledConditionEnum.class, message = "分佣模式必须是 {value}")
private Integer brokerageEnabledCondition;
@Schema(description = "分销关系绑定模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@NotNull(message = "分销关系绑定模式不能为空")
@InEnum(value = BrokerageBindModeEnum.class, message = "分销关系绑定模式必须是 {value}")
private Integer brokerageBindMode;
@Schema(description = "分销海报图地址数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/yudao.jpg]")
private List<String> brokeragePostUrls;
@Schema(description = "一级返佣比例", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
@NotNull(message = "一级返佣比例不能为空")
@Range(min = 0, max = 100, message = "一级返佣比例必须在 0 - 100 之间")
private Integer brokerageFirstPercent;
@Schema(description = "二级返佣比例", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
@NotNull(message = "二级返佣比例不能为空")
@Range(min = 0, max = 100, message = "二级返佣比例必须在 0 - 100 之间")
private Integer brokerageSecondPercent;
@Schema(description = "用户提现最低金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
@NotNull(message = "用户提现最低金额不能为空")
@PositiveOrZero(message = "用户提现最低金额不能是负数")
private Integer brokerageWithdrawMinPrice;
@Schema(description = "提现银行", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]")
@NotEmpty(message = "提现银行不能为空")
private List<Integer> brokerageBankNames;
@Schema(description = "佣金冻结时间(天)", requiredMode = Schema.RequiredMode.REQUIRED, example = "7")
@NotNull(message = "佣金冻结时间(天)不能为空")
@PositiveOrZero(message = "佣金冻结时间不能是负数")
private Integer brokerageFrozenDays;
@Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]")
@NotNull(message = "提现方式不能为空")
@InEnum(value = BrokerageWithdrawTypeEnum.class, message = "提现方式必须是 {value}")
private List<Integer> brokerageWithdrawType;
}

View File

@ -1,19 +1,25 @@
package cn.iocoder.yudao.module.member.dal.dataobject.point;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.type.IntegerListTypeHandler;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageBindModeEnum;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageEnabledConditionEnum;
import cn.iocoder.yudao.module.member.enums.brokerage.BrokerageWithdrawTypeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.math.BigDecimal;
import java.util.List;
/**
* 会员积分配置 DO
*
* @author QingX
*/
@TableName("member_point_config")
@TableName(value = "member_point_config", autoResultMap = true)
@KeySequence("member_point_config_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ -47,4 +53,56 @@ public class MemberPointConfigDO extends BaseDO {
*/
private Integer tradeGivePoint;
// ========== 分销相关 ==========
/**
* 是否启用分佣
*/
private Boolean brokerageEnabled;
/**
* 分佣模式
*
* 枚举 {@link BrokerageEnabledConditionEnum 对应的类}
*/
private Integer brokerageEnabledCondition;
/**
* 分销关系绑定模式
*
* 枚举 {@link BrokerageBindModeEnum 对应的类}
*/
private Integer brokerageBindMode;
/**
* 分销海报图地址数组
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> brokeragePostUrls;
/**
* 一级返佣比例
*/
private Integer brokerageFirstPercent;
/**
* 二级返佣比例
*/
private Integer brokerageSecondPercent;
/**
* 用户提现最低金额
*/
private Integer brokerageWithdrawMinPrice;
/**
* 提现银行
*/
@TableField(typeHandler = IntegerListTypeHandler.class)
private List<Integer> brokerageBankNames;
/**
* 佣金冻结时间()
*/
private Integer brokerageFrozenDays;
/**
* 提现方式
*
* 枚举 {@link BrokerageWithdrawTypeEnum 对应的类}
*/
@TableField(typeHandler = IntegerListTypeHandler.class)
private List<Integer> brokerageWithdrawType;
}