补全后端基础相关模块
This commit is contained in:
47
yudao-module-member/yudao-module-member-api/pom.xml
Normal file
47
yudao-module-member/yudao-module-member-api/pom.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-member</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yudao-module-member-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
member 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.member.api.address;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 用户收件地址")
|
||||
public interface MemberAddressApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/address";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得用户收件地址")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "收件地址编号", required = true, example = "1024"),
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "2048"),
|
||||
})
|
||||
CommonResult<MemberAddressRespDTO> getAddress(@RequestParam("id") Long id,
|
||||
@RequestParam("userId") Long userId);
|
||||
|
||||
@GetMapping(PREFIX + "/get-default")
|
||||
@Operation(summary = "获得用户默认收件地址")
|
||||
@Parameter(name = "userId", description = "用户编号", required = true, example = "2048")
|
||||
CommonResult<MemberAddressRespDTO> getDefaultAddress(@RequestParam("userId") Long userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.member.api.address.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - 用户收件地址 Response DTO")
|
||||
@Data
|
||||
public class MemberAddressRespDTO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2666")
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "收件详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码 88 小区 106 号")
|
||||
private String detailAddress;
|
||||
|
||||
@Schema(description = "是否默认", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean defaultStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.member.api.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.config.dto.MemberConfigRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 用户配置")
|
||||
public interface MemberConfigApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/config";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得用户配置")
|
||||
CommonResult<MemberConfigRespDTO> getConfig();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.member.api.config.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - 用户信息 Response DTO")
|
||||
@Data
|
||||
public class MemberConfigRespDTO {
|
||||
|
||||
@Schema(description = "积分抵扣开关", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean pointTradeDeductEnable;
|
||||
|
||||
@Schema(description = "积分抵扣,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer pointTradeDeductUnitPrice; // 1 积分抵扣多少分
|
||||
|
||||
@Schema(description = "积分抵扣最大值", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer pointTradeDeductMaxPrice;
|
||||
|
||||
@Schema(description = "1 元赠送多少分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer pointTradeGivePoint;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.member.api.level;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 会员等级")
|
||||
public interface MemberLevelApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/level";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得会员等级")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<MemberLevelRespDTO> getMemberLevel(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/add")
|
||||
@Operation(summary = "增加会员经验")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "会员编号", required = true, example = "1024"),
|
||||
@Parameter(name = "experience", description = "经验值", required = true, example = "100"),
|
||||
@Parameter(name = "bizType", description = "业务类型", required = true, example = "1"),
|
||||
@Parameter(name = "bizId", description = "业务编号", required = true, example = "1")
|
||||
})
|
||||
CommonResult<Boolean> addExperience(@RequestParam("userId") Long userId,
|
||||
@RequestParam("experience") Integer experience,
|
||||
@RequestParam("bizType") Integer bizType,
|
||||
@RequestParam("bizId") String bizId);
|
||||
|
||||
@PostMapping(PREFIX + "/reduce")
|
||||
@Operation(summary = "扣减会员经验")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "会员编号", required = true, example = "1024"),
|
||||
@Parameter(name = "experience", description = "经验值", required = true, example = "100"),
|
||||
@Parameter(name = "bizType", description = "业务类型", required = true, example = "1"),
|
||||
@Parameter(name = "bizId", description = "业务编号", required = true, example = "1")
|
||||
})
|
||||
CommonResult<Boolean> reduceExperience(@RequestParam("userId") Long userId,
|
||||
@RequestParam("experience") Integer experience,
|
||||
@RequestParam("bizType") Integer bizType,
|
||||
@RequestParam("bizId") String bizId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.member.api.level.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - 会员等级 Response DTO")
|
||||
@Data
|
||||
public class MemberLevelRespDTO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "等级名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "普通会员")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer discountPercent;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status; // 参见 CommonStatusEnum 枚举
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 消息队列的消息
|
||||
*/
|
||||
package cn.iocoder.yudao.module.member.api.message;
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.member.api.message.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 会员用户创建消息
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Data
|
||||
public class MemberUserCreateMessage {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* member API 包,定义暴露给其它模块的 API
|
||||
*/
|
||||
package cn.iocoder.yudao.module.member.api;
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.member.api.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 用户积分")
|
||||
public interface MemberPointApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/point";
|
||||
|
||||
@PostMapping(PREFIX + "/add")
|
||||
@Operation(summary = "增加用户积分")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "会员编号", required = true, example = "1024"),
|
||||
@Parameter(name = "point", description = "积分", required = true, example = "100"),
|
||||
@Parameter(name = "bizType", description = "业务类型", required = true, example = "1"),
|
||||
@Parameter(name = "bizId", description = "业务编号", required = true, example = "1")
|
||||
})
|
||||
CommonResult<Boolean> addPoint(@RequestParam("userId") Long userId,
|
||||
@RequestParam("point") @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||
@RequestParam("bizType") Integer bizType,
|
||||
@RequestParam("bizId") String bizId);
|
||||
|
||||
@PostMapping(PREFIX + "/reducePoint")
|
||||
@Operation(summary = "减少用户积分")
|
||||
@Parameters({
|
||||
@Parameter(name = "userId", description = "会员编号", required = true, example = "1024"),
|
||||
@Parameter(name = "point", description = "积分", required = true, example = "100"),
|
||||
@Parameter(name = "bizType", description = "业务类型", required = true, example = "1"),
|
||||
@Parameter(name = "bizId", description = "业务编号", required = true, example = "1")
|
||||
})
|
||||
CommonResult<Boolean> reducePoint(@RequestParam("userId") Long userId,
|
||||
@RequestParam("point") @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||
@RequestParam("bizType") Integer bizType,
|
||||
@RequestParam("bizId") String bizId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.member.api.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 会员用户")
|
||||
public interface MemberUserApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/user";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得会员用户信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<MemberUserRespDTO> getUser(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "获得会员用户信息们")
|
||||
@Parameter(name = "ids", description = "用户编号的数组", example = "1,2", required = true)
|
||||
CommonResult<List<MemberUserRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得会员用户 Map
|
||||
*
|
||||
* @param ids 用户编号的数组
|
||||
* @return 会员用户 Map
|
||||
*/
|
||||
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||
List<MemberUserRespDTO> list = getUserList(ids).getCheckedData();
|
||||
return convertMap(list, MemberUserRespDTO::getId);
|
||||
}
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-nickname")
|
||||
@Operation(summary = "基于用户昵称,模糊匹配用户列表")
|
||||
@Parameter(name = "nickname", description = "用户昵称,模糊匹配", required = true, example = "土豆")
|
||||
CommonResult<List<MemberUserRespDTO>> getUserListByNickname(@RequestParam("nickname") String nickname);
|
||||
|
||||
@GetMapping(PREFIX + "/get-by-mobile")
|
||||
@Operation(summary = "基于手机号,精准匹配用户")
|
||||
@Parameter(name = "mobile", description = "基于手机号,精准匹配用户", required = true, example = "1560")
|
||||
CommonResult<MemberUserRespDTO> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@Operation(summary = "校验用户是否存在")
|
||||
@Parameter(name = "id", description = "用户编号", required = true, example = "1")
|
||||
CommonResult<Boolean> validateUser(@RequestParam("id") Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.member.api.user.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "RPC 服务 - 用户信息 Response DTO")
|
||||
@Data
|
||||
public class MemberUserRespDTO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "昵称", example = "小王同学")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "帐号状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status; // 参见 CommonStatusEnum 枚举
|
||||
|
||||
@Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.jpg")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "手机号", example = "15601691300")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// ========== 其它信息 ==========
|
||||
|
||||
@Schema(description = "会员级别编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "886")
|
||||
private Integer point;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.member.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "member-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/member";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.member.enums;
|
||||
|
||||
/**
|
||||
* Member 字典类型的枚举类
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
public interface DictTypeConstants {
|
||||
|
||||
/**
|
||||
* 会员经验记录 - 业务类型
|
||||
*/
|
||||
String MEMBER_EXPERIENCE_BIZ_TYPE = "member_experience_biz_type";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.member.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Member 错误码枚举类
|
||||
* <p>
|
||||
* member 系统,使用 1-004-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 用户相关 1-004-001-000 ============
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1_004_001_000, "用户不存在");
|
||||
ErrorCode USER_MOBILE_NOT_EXISTS = new ErrorCode(1_004_001_001, "手机号未注册用户");
|
||||
ErrorCode USER_MOBILE_USED = new ErrorCode(1_004_001_002, "修改手机失败,该手机号({})已经被使用");
|
||||
ErrorCode USER_POINT_NOT_ENOUGH = new ErrorCode(1_004_001_003, "用户积分余额不足");
|
||||
|
||||
// ========== AUTH 模块 1-004-003-000 ==========
|
||||
ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_004_003_000, "登录失败,账号密码不正确");
|
||||
ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_004_003_001, "登录失败,账号被禁用");
|
||||
ErrorCode AUTH_SOCIAL_USER_NOT_FOUND = new ErrorCode(1_004_003_005, "登录失败,解析不到三方登录信息");
|
||||
ErrorCode AUTH_MOBILE_USED = new ErrorCode(1_004_003_007, "手机号已经被使用");
|
||||
|
||||
// ========== 用户收件地址 1-004-004-000 ==========
|
||||
ErrorCode ADDRESS_NOT_EXISTS = new ErrorCode(1_004_004_000, "用户收件地址不存在");
|
||||
|
||||
//========== 用户标签 1-004-006-000 ==========
|
||||
ErrorCode TAG_NOT_EXISTS = new ErrorCode(1_004_006_000, "用户标签不存在");
|
||||
ErrorCode TAG_NAME_EXISTS = new ErrorCode(1_004_006_001, "用户标签已经存在");
|
||||
ErrorCode TAG_HAS_USER = new ErrorCode(1_004_006_002, "用户标签下存在用户,无法删除");
|
||||
|
||||
//========== 积分配置 1-004-007-000 ==========
|
||||
|
||||
//========== 积分记录 1-004-008-000 ==========
|
||||
ErrorCode POINT_RECORD_BIZ_NOT_SUPPORT = new ErrorCode(1_004_008_000, "用户积分记录业务类型不支持");
|
||||
|
||||
//========== 签到配置 1-004-009-000 ==========
|
||||
ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(1_004_009_000, "签到天数规则不存在");
|
||||
ErrorCode SIGN_IN_CONFIG_EXISTS = new ErrorCode(1_004_009_001, "签到天数规则已存在");
|
||||
|
||||
//========== 签到配置 1-004-010-000 ==========
|
||||
ErrorCode SIGN_IN_RECORD_TODAY_EXISTS = new ErrorCode(1_004_010_000, "今日已签到,请勿重复签到");
|
||||
|
||||
//========== 用户等级 1-004-011-000 ==========
|
||||
ErrorCode LEVEL_NOT_EXISTS = new ErrorCode(1_004_011_000, "用户等级不存在");
|
||||
ErrorCode LEVEL_NAME_EXISTS = new ErrorCode(1_004_011_001, "用户等级名称[{}]已被使用");
|
||||
ErrorCode LEVEL_VALUE_EXISTS = new ErrorCode(1_004_011_002, "用户等级值[{}]已被[{}]使用");
|
||||
ErrorCode LEVEL_EXPERIENCE_MIN = new ErrorCode(1_004_011_003, "升级经验必须大于上一个等级[{}]设置的升级经验[{}]");
|
||||
ErrorCode LEVEL_EXPERIENCE_MAX = new ErrorCode(1_004_011_004, "升级经验必须小于下一个等级[{}]设置的升级经验[{}]");
|
||||
ErrorCode LEVEL_HAS_USER = new ErrorCode(1_004_011_005, "用户等级下存在用户,无法删除");
|
||||
|
||||
ErrorCode EXPERIENCE_BIZ_NOT_SUPPORT = new ErrorCode(1_004_011_201, "用户经验业务类型不支持");
|
||||
|
||||
//========== 用户分组 1-004-012-000 ==========
|
||||
ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在");
|
||||
ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除");
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.member.enums;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 会员经验 - 业务类型
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MemberExperienceBizTypeEnum {
|
||||
|
||||
/**
|
||||
* 管理员调整、邀请新用户、下单、退单、签到、抽奖
|
||||
*/
|
||||
ADMIN(0, "管理员调整", "管理员调整获得 {} 经验", true),
|
||||
INVITE_REGISTER(1, "邀新奖励", "邀请好友获得 {} 经验", true),
|
||||
SIGN_IN(4, "签到奖励", "签到获得 {} 经验", true),
|
||||
LOTTERY(5, "抽奖奖励", "抽奖获得 {} 经验", true),
|
||||
ORDER_GIVE(11, "下单奖励", "下单获得 {} 经验", true),
|
||||
ORDER_GIVE_CANCEL(12, "下单奖励(整单取消)", "取消订单获得 {} 经验", false), // ORDER_GIVE 的取消
|
||||
ORDER_GIVE_CANCEL_ITEM(13, "下单奖励(单个退款)", "退款订单获得 {} 经验", false), // ORDER_GIVE 的取消
|
||||
;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private final int type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private final String title;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* 是否为扣减积分
|
||||
*/
|
||||
private final boolean add;
|
||||
|
||||
public static MemberExperienceBizTypeEnum getByType(Integer type) {
|
||||
return EnumUtil.getBy(MemberExperienceBizTypeEnum.class,
|
||||
e -> Objects.equals(type, e.getType()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.member.enums.point;
|
||||
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 会员积分的业务类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum MemberPointBizTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
SIGN(1, "签到", "签到获得 {} 积分", true),
|
||||
ADMIN(2, "管理员修改", "管理员修改 {} 积分", true),
|
||||
|
||||
ORDER_USE(11, "订单积分抵扣", "下单使用 {} 积分", false), // 下单时,扣减积分
|
||||
ORDER_USE_CANCEL(12, "订单积分抵扣(整单取消)", "订单取消,退还 {} 积分", true), // ORDER_USE 的取消
|
||||
ORDER_USE_CANCEL_ITEM(13, "订单积分抵扣(单个退款)", "订单退款,退还 {} 积分", true), // ORDER_USE 的取消
|
||||
|
||||
ORDER_GIVE(21, "订单积分奖励", "下单获得 {} 积分", true), // 支付订单时,赠送积分
|
||||
ORDER_GIVE_CANCEL(22, "订单积分奖励(整单取消)", "订单取消,退还 {} 积分", false), // ORDER_GIVE 的取消
|
||||
ORDER_GIVE_CANCEL_ITEM(23, "订单积分奖励(单个退款)", "订单退款,扣除赠送的 {} 积分", false) // ORDER_GIVE 的取消
|
||||
;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
/**
|
||||
* 是否为扣减积分
|
||||
*/
|
||||
private final boolean add;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return new Integer[0];
|
||||
}
|
||||
|
||||
public static MemberPointBizTypeEnum getByType(Integer type) {
|
||||
return EnumUtil.getBy(MemberPointBizTypeEnum.class,
|
||||
e -> Objects.equals(type, e.getType()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user