member:初始化会员服务
parent
6ec18e8942
commit
4277ff1c52
4
pom.xml
4
pom.xml
|
@ -12,10 +12,10 @@
|
||||||
<module>yudao-gateway</module>
|
<module>yudao-gateway</module>
|
||||||
<module>yudao-framework</module>
|
<module>yudao-framework</module>
|
||||||
<!-- 各种 module 拓展 -->
|
<!-- 各种 module 拓展 -->
|
||||||
<!-- <module>yudao-module-member</module>-->
|
|
||||||
<module>yudao-module-bpm</module>
|
|
||||||
<module>yudao-module-system</module>
|
<module>yudao-module-system</module>
|
||||||
<module>yudao-module-infra</module>
|
<module>yudao-module-infra</module>
|
||||||
|
<module>yudao-module-member</module>
|
||||||
|
<module>yudao-module-bpm</module>
|
||||||
<module>yudao-module-pay</module>
|
<module>yudao-module-pay</module>
|
||||||
<module>yudao-module-report</module>
|
<module>yudao-module-report</module>
|
||||||
<module>yudao-module-mp</module>
|
<module>yudao-module-mp</module>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<modules>
|
||||||
|
<module>yudao-module-member-api</module>
|
||||||
|
<module>yudao-module-member-biz</module>
|
||||||
|
</modules>
|
||||||
|
<artifactId>yudao-module-member</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
member 模块,我们放会员业务。
|
||||||
|
例如说:会员中心等等
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<!-- 参数校验 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.address;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收件地址 API 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface AddressApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户收件地址
|
||||||
|
*
|
||||||
|
* @param id 收件地址编号
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 用户收件地址
|
||||||
|
*/
|
||||||
|
AddressRespDTO getAddress(Long id, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户默认收件地址
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 用户收件地址
|
||||||
|
*/
|
||||||
|
AddressRespDTO getDefaultAddress(Long userId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.address.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收件地址 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddressRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 收件人名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 地区编号
|
||||||
|
*/
|
||||||
|
private Integer areaId;
|
||||||
|
/**
|
||||||
|
* 收件详细地址
|
||||||
|
*/
|
||||||
|
private String detailAddress;
|
||||||
|
/**
|
||||||
|
* 是否默认
|
||||||
|
*/
|
||||||
|
private Boolean defaultStatus;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.config.dto.MemberConfigRespDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户配置 API 接口
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
public interface MemberConfigApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得积分配置
|
||||||
|
*
|
||||||
|
* @return 积分配置
|
||||||
|
*/
|
||||||
|
MemberConfigRespDTO getConfig();
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.config.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberConfigRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分抵扣开关
|
||||||
|
*/
|
||||||
|
private Boolean pointTradeDeductEnable;
|
||||||
|
/**
|
||||||
|
* 积分抵扣,单位:分
|
||||||
|
* <p>
|
||||||
|
* 1 积分抵扣多少分
|
||||||
|
*/
|
||||||
|
private Integer pointTradeDeductUnitPrice;
|
||||||
|
/**
|
||||||
|
* 积分抵扣最大值
|
||||||
|
*/
|
||||||
|
private Integer pointTradeDeductMaxPrice;
|
||||||
|
/**
|
||||||
|
* 1 元赠送多少分
|
||||||
|
*/
|
||||||
|
private Integer pointTradeGivePoint;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员等级 API 接口
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
public interface MemberLevelApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会员等级
|
||||||
|
*
|
||||||
|
* @param id 会员等级编号
|
||||||
|
* @return 会员等级
|
||||||
|
*/
|
||||||
|
MemberLevelRespDTO getMemberLevel(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加会员经验
|
||||||
|
*
|
||||||
|
* @param userId 会员ID
|
||||||
|
* @param experience 经验
|
||||||
|
* @param bizType 业务类型 {@link MemberExperienceBizTypeEnum}
|
||||||
|
* @param bizId 业务编号
|
||||||
|
*/
|
||||||
|
void addExperience(Long userId, Integer experience, Integer bizType, String bizId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扣减会员经验
|
||||||
|
*
|
||||||
|
* @param userId 会员ID
|
||||||
|
* @param experience 经验
|
||||||
|
* @param bizType 业务类型 {@link MemberExperienceBizTypeEnum}
|
||||||
|
* @param bizId 业务编号
|
||||||
|
*/
|
||||||
|
void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.level.dto;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员等级 Resp DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberLevelRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 等级名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 等级
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
/**
|
||||||
|
* 升级经验
|
||||||
|
*/
|
||||||
|
private Integer experience;
|
||||||
|
/**
|
||||||
|
* 享受折扣
|
||||||
|
*/
|
||||||
|
private Integer discountPercent;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* member API 包,定义暴露给其它模块的 API
|
||||||
|
*/
|
||||||
|
package cn.iocoder.yudao.module.member.api;
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.point;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分的 API 接口
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
public interface MemberPointApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加用户积分
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param point 积分
|
||||||
|
* @param bizType 业务类型 {@link MemberPointBizTypeEnum}
|
||||||
|
* @param bizId 业务编号
|
||||||
|
*/
|
||||||
|
void addPoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||||
|
Integer bizType, String bizId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减少用户积分
|
||||||
|
*
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @param point 积分
|
||||||
|
* @param bizType 业务类型 {@link MemberPointBizTypeEnum}
|
||||||
|
* @param bizId 业务编号
|
||||||
|
*/
|
||||||
|
void reducePoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
|
||||||
|
Integer bizType, String bizId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.user;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员用户的 API 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface MemberUserApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会员用户信息
|
||||||
|
*
|
||||||
|
* @param id 用户编号
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
MemberUserRespDTO getUser(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会员用户信息们
|
||||||
|
*
|
||||||
|
* @param ids 用户编号的数组
|
||||||
|
* @return 用户信息们
|
||||||
|
*/
|
||||||
|
List<MemberUserRespDTO> getUserList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会员用户 Map
|
||||||
|
*
|
||||||
|
* @param ids 用户编号的数组
|
||||||
|
* @return 会员用户 Map
|
||||||
|
*/
|
||||||
|
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||||
|
return convertMap(getUserList(ids), MemberUserRespDTO::getId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于用户昵称,模糊匹配用户列表
|
||||||
|
*
|
||||||
|
* @param nickname 用户昵称,模糊匹配
|
||||||
|
* @return 用户信息的列表
|
||||||
|
*/
|
||||||
|
List<MemberUserRespDTO> getUserListByNickname(String nickname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于手机号,精准匹配用户
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
MemberUserRespDTO getUserByMobile(String mobile);
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.user.dto;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberUserRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
/**
|
||||||
|
* 帐号状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
/**
|
||||||
|
* 手机
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 创建时间(注册时间)
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
// ========== 其它信息 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员级别编号
|
||||||
|
*/
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分
|
||||||
|
*/
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
}
|
|
@ -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_THIRD_LOGIN_NOT_BIND = 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.IntArrayValuable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员积分的业务类型枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum MemberPointBizTypeEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
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 int[] array() {
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MemberPointBizTypeEnum getByType(Integer type) {
|
||||||
|
return EnumUtil.getBy(MemberPointBizTypeEnum.class,
|
||||||
|
e -> Objects.equals(type, e.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?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-biz</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
member 模块,我们放会员业务。
|
||||||
|
例如说:会员中心等等
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-module-member-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-module-system-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-module-infra-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Web 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 消息队列相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test 测试相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 工具类相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.address;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收件地址 API 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class AddressApiImpl implements AddressApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AddressService addressService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressRespDTO getAddress(Long id, Long userId) {
|
||||||
|
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressRespDTO getDefaultAddress(Long userId) {
|
||||||
|
return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.config.dto.MemberConfigRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.config.MemberConfigConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.service.config.MemberConfigService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户配置 API 实现类
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MemberConfigApiImpl implements MemberConfigApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberConfigService memberConfigService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MemberConfigRespDTO getConfig() {
|
||||||
|
return MemberConfigConvert.INSTANCE.convert01(memberConfigService.getConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员等级 API 实现类
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MemberLevelApiImpl implements MemberLevelApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelService memberLevelService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MemberLevelRespDTO getMemberLevel(Long id) {
|
||||||
|
return MemberLevelConvert.INSTANCE.convert02(memberLevelService.getLevel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
||||||
|
MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType);
|
||||||
|
if (bizTypeEnum == null) {
|
||||||
|
throw exception(EXPERIENCE_BIZ_NOT_SUPPORT);
|
||||||
|
}
|
||||||
|
memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
||||||
|
addExperience(userId, -experience, bizType, bizId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api;
|
|
@ -0,0 +1,46 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.point;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分的 API 实现类
|
||||||
|
*
|
||||||
|
* @author owen
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MemberPointApiImpl implements MemberPointApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberPointRecordService memberPointRecordService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPoint(Long userId, Integer point, Integer bizType, String bizId) {
|
||||||
|
Assert.isTrue(point > 0);
|
||||||
|
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||||
|
if (bizTypeEnum == null) {
|
||||||
|
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||||
|
}
|
||||||
|
memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reducePoint(Long userId, Integer point, Integer bizType, String bizId) {
|
||||||
|
Assert.isTrue(point > 0);
|
||||||
|
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||||
|
if (bizTypeEnum == null) {
|
||||||
|
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||||
|
}
|
||||||
|
memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package cn.iocoder.yudao.module.member.api.user;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员用户的 API 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MemberUserApiImpl implements MemberUserApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MemberUserRespDTO getUser(Long id) {
|
||||||
|
MemberUserDO user = userService.getUser(id);
|
||||||
|
return MemberUserConvert.INSTANCE.convert2(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MemberUserRespDTO> getUserList(Collection<Long> ids) {
|
||||||
|
return MemberUserConvert.INSTANCE.convertList2(userService.getUserList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MemberUserRespDTO> getUserListByNickname(String nickname) {
|
||||||
|
return MemberUserConvert.INSTANCE.convertList2(userService.getUserListByNickname(nickname));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MemberUserRespDTO getUserByMobile(String mobile) {
|
||||||
|
return MemberUserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.address;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.address.vo.AddressRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户收件地址")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/address")
|
||||||
|
@Validated
|
||||||
|
public class AddressController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AddressService addressService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得用户收件地址列表")
|
||||||
|
@Parameter(name = "userId", description = "用户编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||||
|
public CommonResult<List<AddressRespVO>> getAddressList(@RequestParam("userId") Long userId) {
|
||||||
|
List<MemberAddressDO> list = addressService.getAddressList(userId);
|
||||||
|
return success(AddressConvert.INSTANCE.convertList2(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.address;
|
|
@ -0,0 +1,37 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.address.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户收件地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddressBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@NotNull(message = "收件人名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "手机号不能为空")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "地区编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "15716")
|
||||||
|
@NotNull(message = "地区编码不能为空")
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
|
@Schema(description = "收件详细地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "收件详细地址不能为空")
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
@Schema(description = "是否默认", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "是否默认不能为空")
|
||||||
|
private Boolean defaultStatus;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.address.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户收件地址 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AddressRespVO extends AddressBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "收件地址编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7380")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.config.vo.MemberConfigRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.config.vo.MemberConfigSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.config.MemberConfigConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.config.MemberConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.config.MemberConfigService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员设置")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/config")
|
||||||
|
@Validated
|
||||||
|
public class MemberConfigController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberConfigService memberConfigService;
|
||||||
|
|
||||||
|
@PutMapping("/save")
|
||||||
|
@Operation(summary = "保存会员配置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:config:save')")
|
||||||
|
public CommonResult<Boolean> saveConfig(@Valid @RequestBody MemberConfigSaveReqVO saveReqVO) {
|
||||||
|
memberConfigService.saveConfig(saveReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员配置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:config:query')")
|
||||||
|
public CommonResult<MemberConfigRespVO> getConfig() {
|
||||||
|
MemberConfigDO config = memberConfigService.getConfig();
|
||||||
|
return success(MemberConfigConvert.INSTANCE.convert(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员配置 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberConfigBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "积分抵扣开关", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||||
|
@NotNull(message = "积分抵扣开发不能为空")
|
||||||
|
private Boolean pointTradeDeductEnable;
|
||||||
|
|
||||||
|
@Schema(description = "积分抵扣,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "13506")
|
||||||
|
@NotNull(message = "积分抵扣不能为空")
|
||||||
|
private Integer pointTradeDeductUnitPrice;
|
||||||
|
|
||||||
|
@Schema(description = "积分抵扣最大值", requiredMode = Schema.RequiredMode.REQUIRED, example = "32428")
|
||||||
|
@NotNull(message = "积分抵扣最大值不能为空")
|
||||||
|
private Integer pointTradeDeductMaxPrice;
|
||||||
|
|
||||||
|
@Schema(description = "1 元赠送多少分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "1 元赠送积分不能为空")
|
||||||
|
private Integer pointTradeGivePoint;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员配置 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberConfigRespVO extends MemberConfigBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员配置保存 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberConfigSaveReqVO extends MemberConfigBaseVO {
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.group.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.group.MemberGroupConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.group.MemberGroupService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户分组")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/group")
|
||||||
|
@Validated
|
||||||
|
public class MemberGroupController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberGroupService groupService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户分组")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:group:create')")
|
||||||
|
public CommonResult<Long> createGroup(@Valid @RequestBody MemberGroupCreateReqVO createReqVO) {
|
||||||
|
return success(groupService.createGroup(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户分组")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:group:update')")
|
||||||
|
public CommonResult<Boolean> updateGroup(@Valid @RequestBody MemberGroupUpdateReqVO updateReqVO) {
|
||||||
|
groupService.updateGroup(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户分组")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:group:delete')")
|
||||||
|
public CommonResult<Boolean> deleteGroup(@RequestParam("id") Long id) {
|
||||||
|
groupService.deleteGroup(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户分组")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:group:query')")
|
||||||
|
public CommonResult<MemberGroupRespVO> getGroup(@RequestParam("id") Long id) {
|
||||||
|
MemberGroupDO group = groupService.getGroup(id);
|
||||||
|
return success(MemberGroupConvert.INSTANCE.convert(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取会员分组精简信息列表", description = "只包含被开启的会员分组,主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<MemberGroupSimpleRespVO>> getSimpleGroupList() {
|
||||||
|
// 获用户列表,只要开启状态的
|
||||||
|
List<MemberGroupDO> list = groupService.getEnableGroupList();
|
||||||
|
return success(MemberGroupConvert.INSTANCE.convertSimpleList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户分组分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:group:query')")
|
||||||
|
public CommonResult<PageResult<MemberGroupRespVO>> getGroupPage(@Valid MemberGroupPageReqVO pageVO) {
|
||||||
|
PageResult<MemberGroupDO> pageResult = groupService.getGroupPage(pageVO);
|
||||||
|
return success(MemberGroupConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户分组 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "购物达人")
|
||||||
|
@NotNull(message = "名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
@InEnum(CommonStatusEnum.class)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分组创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberGroupCreateReqVO extends MemberGroupBaseVO {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分组分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberGroupPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "购物达人")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分组 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberGroupRespVO extends MemberGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20357")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分组 Response VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberGroupSimpleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", example = "6103")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "等级名称", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.group.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户分组更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberGroupUpdateReqVO extends MemberGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20357")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberExperienceRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberExperienceRecordService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员经验记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/experience-record")
|
||||||
|
@Validated
|
||||||
|
public class MemberExperienceRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberExperienceRecordService experienceLogService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员经验记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:experience-record:query')")
|
||||||
|
public CommonResult<MemberExperienceRecordRespVO> getExperienceRecord(@RequestParam("id") Long id) {
|
||||||
|
MemberExperienceRecordDO experienceLog = experienceLogService.getExperienceRecord(id);
|
||||||
|
return success(MemberExperienceRecordConvert.INSTANCE.convert(experienceLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会员经验记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:experience-record:query')")
|
||||||
|
public CommonResult<PageResult<MemberExperienceRecordRespVO>> getExperienceRecordPage(
|
||||||
|
@Valid MemberExperienceRecordPageReqVO pageVO) {
|
||||||
|
PageResult<MemberExperienceRecordDO> pageResult = experienceLogService.getExperienceRecordPage(pageVO);
|
||||||
|
return success(MemberExperienceRecordConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.*;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员等级")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/level")
|
||||||
|
@Validated
|
||||||
|
public class MemberLevelController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelService levelService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建会员等级")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level:create')")
|
||||||
|
public CommonResult<Long> createLevel(@Valid @RequestBody MemberLevelCreateReqVO createReqVO) {
|
||||||
|
return success(levelService.createLevel(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新会员等级")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level:update')")
|
||||||
|
public CommonResult<Boolean> updateLevel(@Valid @RequestBody MemberLevelUpdateReqVO updateReqVO) {
|
||||||
|
levelService.updateLevel(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除会员等级")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level:delete')")
|
||||||
|
public CommonResult<Boolean> deleteLevel(@RequestParam("id") Long id) {
|
||||||
|
levelService.deleteLevel(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员等级")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level:query')")
|
||||||
|
public CommonResult<MemberLevelRespVO> getLevel(@RequestParam("id") Long id) {
|
||||||
|
MemberLevelDO level = levelService.getLevel(id);
|
||||||
|
return success(MemberLevelConvert.INSTANCE.convert(level));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取会员等级精简信息列表", description = "只包含被开启的会员等级,主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<MemberLevelSimpleRespVO>> getSimpleLevelList() {
|
||||||
|
// 获用户列表,只要开启状态的
|
||||||
|
List<MemberLevelDO> list = levelService.getEnableLevelList();
|
||||||
|
// 排序后,返回给前端
|
||||||
|
return success(MemberLevelConvert.INSTANCE.convertSimpleList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得会员等级列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level:query')")
|
||||||
|
public CommonResult<List<MemberLevelRespVO>> getLevelList(@Valid MemberLevelListReqVO listReqVO) {
|
||||||
|
List<MemberLevelDO> result = levelService.getLevelList(listReqVO);
|
||||||
|
return success(MemberLevelConvert.INSTANCE.convertList(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.record.MemberLevelRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.level.vo.record.MemberLevelRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberLevelRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelRecordService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员等级记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/level-record")
|
||||||
|
@Validated
|
||||||
|
public class MemberLevelRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelRecordService levelLogService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员等级记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level-record:query')")
|
||||||
|
public CommonResult<MemberLevelRecordRespVO> getLevelRecord(@RequestParam("id") Long id) {
|
||||||
|
MemberLevelRecordDO levelLog = levelLogService.getLevelRecord(id);
|
||||||
|
return success(MemberLevelRecordConvert.INSTANCE.convert(levelLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会员等级记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:level-record:query')")
|
||||||
|
public CommonResult<PageResult<MemberLevelRecordRespVO>> getLevelRecordPage(
|
||||||
|
@Valid MemberLevelRecordPageReqVO pageVO) {
|
||||||
|
PageResult<MemberLevelRecordDO> pageResult = levelLogService.getLevelRecordPage(pageVO);
|
||||||
|
return success(MemberLevelRecordConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.experience;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员经验记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberExperienceRecordBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3638")
|
||||||
|
@NotNull(message = "用户编号不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12164")
|
||||||
|
@NotNull(message = "业务编号不能为空")
|
||||||
|
private String bizId;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "业务类型不能为空")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "增加经验")
|
||||||
|
@NotNull(message = "标题不能为空")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "经验不能为空")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
@Schema(description = "变更后的经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||||
|
@NotNull(message = "变更后的经验不能为空")
|
||||||
|
private Integer totalExperience;
|
||||||
|
|
||||||
|
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "下单增加 100 经验")
|
||||||
|
@NotNull(message = "描述不能为空")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.experience;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员经验记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberExperienceRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "3638")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "业务编号", example = "12164")
|
||||||
|
private String bizId;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", example = "1")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "标题", example = "增加经验")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.experience;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员经验记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberExperienceRecordRespVO extends MemberExperienceRecordBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
import org.hibernate.validator.constraints.URL;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Positive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员等级 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberLevelBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "等级名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@NotBlank(message = "等级名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "升级经验不能为空")
|
||||||
|
@Positive(message = "升级经验必须大于 0")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
@Schema(description = "等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "等级不能为空")
|
||||||
|
@Positive(message = "等级必须大于 0")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "98")
|
||||||
|
@NotNull(message = "享受折扣不能为空")
|
||||||
|
@Range(min = 0, max = 100, message = "享受折扣的范围为 0-100")
|
||||||
|
private Integer discountPercent;
|
||||||
|
|
||||||
|
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
|
@URL(message = "等级图标必须是 URL 格式")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
@Schema(description = "等级背景图", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
|
@URL(message = "等级背景图必须是 URL 格式")
|
||||||
|
private String backgroundUrl;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
@InEnum(CommonStatusEnum.class)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelCreateReqVO extends MemberLevelBaseVO {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级列表筛选 Request VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelListReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "等级名称", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelRespVO extends MemberLevelBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6103")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级 Response VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelSimpleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", example = "6103")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "等级名称", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelUpdateReqVO extends MemberLevelBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6103")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.record;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员等级记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberLevelRecordBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25923")
|
||||||
|
@NotNull(message = "用户编号不能为空")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25985")
|
||||||
|
@NotNull(message = "等级编号不能为空")
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
@Schema(description = "会员等级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "会员等级不能为空")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||||
|
@NotNull(message = "享受折扣不能为空")
|
||||||
|
private Integer discountPercent;
|
||||||
|
|
||||||
|
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||||
|
@NotNull(message = "升级经验不能为空")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
@Schema(description = "会员此时的经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||||
|
@NotNull(message = "会员此时的经验不能为空")
|
||||||
|
private Integer userExperience;
|
||||||
|
|
||||||
|
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "推广需要")
|
||||||
|
@NotNull(message = "备注不能为空")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "升级为金牌会员")
|
||||||
|
@NotNull(message = "描述不能为空")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.record;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "25923")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "等级编号", example = "25985")
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.level.vo.record;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员等级记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberLevelRecordRespVO extends MemberLevelRecordBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8741")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.point;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 签到记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/point/record")
|
||||||
|
@Validated
|
||||||
|
public class MemberPointRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberPointRecordService pointRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户积分记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||||
|
public CommonResult<PageResult<MemberPointRecordRespVO>> getPointRecordPage(@Valid MemberPointRecordPageReqVO pageVO) {
|
||||||
|
// 执行分页查询
|
||||||
|
PageResult<MemberPointRecordDO> pageResult = pointRecordService.getPointRecordPage(pageVO);
|
||||||
|
if (CollectionUtils.isEmpty(pageResult.getList())) {
|
||||||
|
return success(PageResult.empty(pageResult.getTotal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接结果返回
|
||||||
|
List<MemberUserRespDTO> users = memberUserApi.getUserList(
|
||||||
|
convertSet(pageResult.getList(), MemberPointRecordDO::getUserId));
|
||||||
|
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户积分记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberPointRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "张三")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "123")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", example = "1")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "积分标题", example = "呵呵")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户积分记录 Response VO")
|
||||||
|
@Data
|
||||||
|
public class MemberPointRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "昵称", example = "张三")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "业务编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "22706")
|
||||||
|
private String bizId;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "积分标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "积分描述", example = "你猜")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
@Schema(description = "变动后的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||||
|
private Integer totalPoint;
|
||||||
|
|
||||||
|
@Schema(description = "发生时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.config.MemberSignInConfigCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.config.MemberSignInConfigRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.config.MemberSignInConfigUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.signin.MemberSignInConfigService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
// TODO 芋艿:url
|
||||||
|
@Tag(name = "管理后台 - 签到规则")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/sign-in/config")
|
||||||
|
@Validated
|
||||||
|
public class MemberSignInConfigController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberSignInConfigService signInConfigService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建签到规则")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-config:create')")
|
||||||
|
public CommonResult<Long> createSignInConfig(@Valid @RequestBody MemberSignInConfigCreateReqVO createReqVO) {
|
||||||
|
return success(signInConfigService.createSignInConfig(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新签到规则")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-config:update')")
|
||||||
|
public CommonResult<Boolean> updateSignInConfig(@Valid @RequestBody MemberSignInConfigUpdateReqVO updateReqVO) {
|
||||||
|
signInConfigService.updateSignInConfig(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除签到规则")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-config:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSignInConfig(@RequestParam("id") Long id) {
|
||||||
|
signInConfigService.deleteSignInConfig(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得签到规则")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||||
|
public CommonResult<MemberSignInConfigRespVO> getSignInConfig(@RequestParam("id") Long id) {
|
||||||
|
MemberSignInConfigDO signInConfig = signInConfigService.getSignInConfig(id);
|
||||||
|
return success(MemberSignInConfigConvert.INSTANCE.convert(signInConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得签到规则列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||||
|
public CommonResult<List<MemberSignInConfigRespVO>> getSignInConfigList() {
|
||||||
|
List<MemberSignInConfigDO> list = signInConfigService.getSignInConfigList();
|
||||||
|
return success(MemberSignInConfigConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 签到记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/sign-in/record")
|
||||||
|
@Validated
|
||||||
|
public class MemberSignInRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberSignInRecordService signInRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得签到记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||||
|
public CommonResult<PageResult<MemberSignInRecordRespVO>> getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) {
|
||||||
|
// 执行分页查询
|
||||||
|
PageResult<MemberSignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(pageVO);
|
||||||
|
if (CollectionUtils.isEmpty(pageResult.getList())) {
|
||||||
|
return success(PageResult.empty(pageResult.getTotal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接结果返回
|
||||||
|
List<MemberUserRespDTO> users = memberUserApi.getUserList(
|
||||||
|
convertSet(pageResult.getList(), MemberSignInRecordDO::getUserId));
|
||||||
|
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.AssertTrue;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.PositiveOrZero;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到规则 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberSignInConfigBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "签到第 x 天", requiredMode = Schema.RequiredMode.REQUIRED, example = "7")
|
||||||
|
@NotNull(message = "签到天数不能为空")
|
||||||
|
private Integer day;
|
||||||
|
|
||||||
|
@Schema(description = "奖励积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@NotNull(message = "奖励积分不能为空")
|
||||||
|
@PositiveOrZero(message = "奖励积分不能小于 0")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
@Schema(description = "奖励经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@NotNull(message = "奖励经验不能为空")
|
||||||
|
@PositiveOrZero(message = "奖励经验不能小于 0")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
@InEnum(CommonStatusEnum.class)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@AssertTrue(message = "签到奖励积分和经验不能同时为空")
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean isConfigAward() {
|
||||||
|
return ObjUtil.notEqual(point, 0) || ObjUtil.notEqual(experience, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.config;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 签到规则创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberSignInConfigCreateReqVO extends MemberSignInConfigBaseVO {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 签到规则 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberSignInConfigRespVO extends MemberSignInConfigBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 签到规则更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberSignInConfigUpdateReqVO extends MemberSignInConfigBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "规则自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13653")
|
||||||
|
@NotNull(message = "规则自增主键不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.record;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 签到记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberSignInRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "签到用户", example = "土豆")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "第几天签到", example = "10")
|
||||||
|
private Integer day;
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "123")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "签到时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.signin.vo.record;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 签到记录 Response VO")
|
||||||
|
@Data
|
||||||
|
public class MemberSignInRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "签到自增 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11903")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "签到用户", requiredMode = Schema.RequiredMode.REQUIRED, example = "6507")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "昵称", example = "张三")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "第几天签到", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer day;
|
||||||
|
|
||||||
|
@Schema(description = "签到的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
@Schema(description = "签到时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.tag.vo.MemberTagUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.tag.MemberTagConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.tag.MemberTagService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员标签")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/tag")
|
||||||
|
@Validated
|
||||||
|
public class MemberTagController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberTagService tagService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建会员标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:create')")
|
||||||
|
public CommonResult<Long> createTag(@Valid @RequestBody MemberTagCreateReqVO createReqVO) {
|
||||||
|
return success(tagService.createTag(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新会员标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:update')")
|
||||||
|
public CommonResult<Boolean> updateTag(@Valid @RequestBody MemberTagUpdateReqVO updateReqVO) {
|
||||||
|
tagService.updateTag(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除会员标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTag(@RequestParam("id") Long id) {
|
||||||
|
tagService.deleteTag(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:query')")
|
||||||
|
public CommonResult<MemberTagRespVO> getMemberTag(@RequestParam("id") Long id) {
|
||||||
|
MemberTagDO tag = tagService.getTag(id);
|
||||||
|
return success(MemberTagConvert.INSTANCE.convert(tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取会员标签精简信息列表", description = "只包含被开启的会员标签,主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<MemberTagRespVO>> getSimpleTagList() {
|
||||||
|
// 获用户列表,只要开启状态的
|
||||||
|
List<MemberTagDO> list = tagService.getTagList();
|
||||||
|
// 排序后,返回给前端
|
||||||
|
return success(MemberTagConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得会员标签列表")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:query')")
|
||||||
|
public CommonResult<List<MemberTagRespVO>> getMemberTagList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
|
List<MemberTagDO> list = tagService.getTagList(ids);
|
||||||
|
return success(MemberTagConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会员标签分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:tag:query')")
|
||||||
|
public CommonResult<PageResult<MemberTagRespVO>> getTagPage(@Valid MemberTagPageReqVO pageVO) {
|
||||||
|
PageResult<MemberTagDO> pageResult = tagService.getTagPage(pageVO);
|
||||||
|
return success(MemberTagConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员标签 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberTagBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@NotNull(message = "标签名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员标签创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberTagCreateReqVO extends MemberTagBaseVO {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员标签分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberTagPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "标签名称", example = "李四")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员标签 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberTagRespVO extends MemberTagBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "907")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员标签更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberTagUpdateReqVO extends MemberTagBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "907")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.admin.user.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.group.MemberGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.tag.MemberTagDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.member.service.group.MemberGroupService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.tag.MemberTagService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
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.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 会员用户")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/user")
|
||||||
|
@Validated
|
||||||
|
public class MemberUserController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberUserService memberUserService;
|
||||||
|
@Resource
|
||||||
|
private MemberTagService memberTagService;
|
||||||
|
@Resource
|
||||||
|
private MemberLevelService memberLevelService;
|
||||||
|
@Resource
|
||||||
|
private MemberGroupService memberGroupService;
|
||||||
|
@Resource
|
||||||
|
private MemberPointRecordService memberPointRecordService;
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新会员用户")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:update')")
|
||||||
|
public CommonResult<Boolean> updateUser(@Valid @RequestBody MemberUserUpdateReqVO updateReqVO) {
|
||||||
|
memberUserService.updateUser(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-level")
|
||||||
|
@Operation(summary = "更新会员用户等级")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:update-level')")
|
||||||
|
public CommonResult<Boolean> updateUserLevel(@Valid @RequestBody MemberUserUpdateLevelReqVO updateReqVO) {
|
||||||
|
memberLevelService.updateUserLevel(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-point")
|
||||||
|
@Operation(summary = "更新会员用户积分")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:update-point')")
|
||||||
|
public CommonResult<Boolean> updateUserPoint(@Valid @RequestBody MemberUserUpdatePointReqVO updateReqVO) {
|
||||||
|
memberPointRecordService.createPointRecord(updateReqVO.getId(), updateReqVO.getPoint(),
|
||||||
|
MemberPointBizTypeEnum.ADMIN, String.valueOf(getLoginUserId()));
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-balance")
|
||||||
|
@Operation(summary = "更新会员用户余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:update-balance')")
|
||||||
|
public CommonResult<Boolean> updateUserBalance(@Valid @RequestBody Long id) {
|
||||||
|
// todo @jason:增加一个【修改余额】
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会员用户")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||||
|
public CommonResult<MemberUserRespVO> getUser(@RequestParam("id") Long id) {
|
||||||
|
MemberUserDO user = memberUserService.getUser(id);
|
||||||
|
return success(MemberUserConvert.INSTANCE.convert03(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会员用户分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||||
|
public CommonResult<PageResult<MemberUserRespVO>> getUserPage(@Valid MemberUserPageReqVO pageVO) {
|
||||||
|
PageResult<MemberUserDO> pageResult = memberUserService.getUserPage(pageVO);
|
||||||
|
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||||
|
return success(PageResult.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理用户标签返显
|
||||||
|
Set<Long> tagIds = pageResult.getList().stream()
|
||||||
|
.map(MemberUserDO::getTagIds)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
List<MemberTagDO> tags = memberTagService.getTagList(tagIds);
|
||||||
|
// 处理用户级别返显
|
||||||
|
List<MemberLevelDO> levels = memberLevelService.getLevelList(
|
||||||
|
convertSet(pageResult.getList(), MemberUserDO::getLevelId));
|
||||||
|
// 处理用户分组返显
|
||||||
|
List<MemberGroupDO> groups = memberGroupService.getGroupList(
|
||||||
|
convertSet(pageResult.getList(), MemberUserDO::getGroupId));
|
||||||
|
return success(MemberUserConvert.INSTANCE.convertPage(pageResult, tags, levels, groups));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.URL;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员用户 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MemberUserBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||||
|
@NotNull(message = "手机号不能为空")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Byte status;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
@NotNull(message = "用户昵称不能为空")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/x.png")
|
||||||
|
@URL(message = "头像必须是 URL 格式")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "李四")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "用户性别", example = "1")
|
||||||
|
private Byte sex;
|
||||||
|
|
||||||
|
@Schema(description = "所在地编号", example = "4371")
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
|
@Schema(description = "所在地全程", example = "上海上海市普陀区")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@Schema(description = "出生日期", example = "2023-03-12")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
|
private LocalDateTime birthday;
|
||||||
|
|
||||||
|
@Schema(description = "会员备注", example = "我是小备注")
|
||||||
|
private String mark;
|
||||||
|
|
||||||
|
@Schema(description = "会员标签", example = "[1, 2]")
|
||||||
|
private List<Long> tagIds;
|
||||||
|
|
||||||
|
@Schema(description = "会员等级编号", example = "1")
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
@Schema(description = "用户分组编号", example = "1")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员用户分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberUserPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", example = "15601691300")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "李四")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "最后登录时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] loginDate;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "会员标签编号列表", example = "[1, 2]")
|
||||||
|
private List<Long> tagIds;
|
||||||
|
|
||||||
|
@Schema(description = "会员等级编号", example = "1")
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
@Schema(description = "用户分组编号", example = "1")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
// TODO 芋艿:注册用户类型;
|
||||||
|
|
||||||
|
// TODO 芋艿:登录用户类型;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员用户 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberUserRespVO extends MemberUserBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23788")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "注册 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
|
||||||
|
private String registerIp;
|
||||||
|
|
||||||
|
@Schema(description = "最后登录IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
|
||||||
|
private String loginIp;
|
||||||
|
|
||||||
|
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime loginDate;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
// ========== 其它信息 ==========
|
||||||
|
|
||||||
|
@Schema(description = "积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
@Schema(description = "总积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
|
||||||
|
private Integer totalPoint;
|
||||||
|
|
||||||
|
@Schema(description = "会员标签", example = "[红色, 快乐]")
|
||||||
|
private List<String> tagNames;
|
||||||
|
|
||||||
|
@Schema(description = "会员等级", example = "黄金会员")
|
||||||
|
private String levelName;
|
||||||
|
|
||||||
|
@Schema(description = "用户分组", example = "购物达人")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@Schema(description = "用户经验值", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户修改等级 Request VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberUserUpdateLevelReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23788")
|
||||||
|
@NotNull(message = "用户编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消用户等级时,值为空
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户等级编号", example = "1")
|
||||||
|
private Long levelId;
|
||||||
|
|
||||||
|
@Schema(description = "修改原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "推广需要")
|
||||||
|
@NotBlank(message = "修改原因不能为空")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户修改积分 Request VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberUserUpdatePointReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23788")
|
||||||
|
@NotNull(message = "用户编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "变动积分,正数为增加,负数为减少", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "变动积分不能为空")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会员用户更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MemberUserUpdateReqVO extends MemberUserBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23788")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
### 请求 /create 接口 => 成功
|
||||||
|
POST {{appApi}}//member/address/create
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "yunai",
|
||||||
|
"mobile": "15601691300",
|
||||||
|
"areaId": "610632",
|
||||||
|
"postCode": "200000",
|
||||||
|
"detailAddress": "芋道源码 233 号 666 室",
|
||||||
|
"defaulted": true
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /update 接口 => 成功
|
||||||
|
PUT {{appApi}}//member/address/update
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "yunai888",
|
||||||
|
"mobile": "15601691300",
|
||||||
|
"areaId": "610632",
|
||||||
|
"postCode": "200000",
|
||||||
|
"detailAddress": "芋道源码 233 号 666 室",
|
||||||
|
"defaulted": false
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /delete 接口 => 成功
|
||||||
|
DELETE {{appApi}}//member/address/delete?id=2
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
|
||||||
|
### 请求 /get 接口 => 成功
|
||||||
|
GET {{appApi}}//member/address/get?id=1
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
|
||||||
|
### 请求 /get-default 接口 => 成功
|
||||||
|
GET {{appApi}}//member/address/get-default
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
|
||||||
|
### 请求 /list 接口 => 成功
|
||||||
|
GET {{appApi}}//member/address/list
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
Authorization: Bearer {{appToken}}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.address;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.address.MemberAddressDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
@Tag(name = "用户 APP - 用户收件地址")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/address")
|
||||||
|
@Validated
|
||||||
|
public class AppAddressController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AddressService addressService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户收件地址")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Long> createAddress(@Valid @RequestBody AppAddressCreateReqVO createReqVO) {
|
||||||
|
return success(addressService.createAddress(getLoginUserId(), createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户收件地址")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Boolean> updateAddress(@Valid @RequestBody AppAddressUpdateReqVO updateReqVO) {
|
||||||
|
addressService.updateAddress(getLoginUserId(), updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户收件地址")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Boolean> deleteAddress(@RequestParam("id") Long id) {
|
||||||
|
addressService.deleteAddress(getLoginUserId(), id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户收件地址")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<AppAddressRespVO> getAddress(@RequestParam("id") Long id) {
|
||||||
|
MemberAddressDO address = addressService.getAddress(getLoginUserId(), id);
|
||||||
|
return success(AddressConvert.INSTANCE.convert(address));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-default")
|
||||||
|
@Operation(summary = "获得默认的用户收件地址")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<AppAddressRespVO> getDefaultUserAddress() {
|
||||||
|
MemberAddressDO address = addressService.getDefaultUserAddress(getLoginUserId());
|
||||||
|
return success(AddressConvert.INSTANCE.convert(address));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得用户收件地址列表")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<List<AppAddressRespVO>> getAddressList() {
|
||||||
|
List<MemberAddressDO> list = addressService.getAddressList(getLoginUserId());
|
||||||
|
return success(AddressConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.address.vo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
// TODO 芋艿:example 缺失
|
||||||
|
/**
|
||||||
|
* 用户收件地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppAddressBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "收件人名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "手机号不能为空")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "地区编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "地区编号不能为空")
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
|
@Schema(description = "收件详细地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "收件详细地址不能为空")
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
@Schema(description = "是否默认地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "是否默认地址不能为空")
|
||||||
|
private Boolean defaultStatus;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.address.vo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 用户收件地址创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AppAddressCreateReqVO extends AppAddressBaseVO {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.address.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 用户收件地址 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AppAddressRespVO extends AppAddressBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海上海市普陀区")
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.address.vo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 用户收件地址更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AppAddressUpdateReqVO extends AppAddressBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
### 请求 /login 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/login
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"mobile": "15601691300",
|
||||||
|
"password": "admin123"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /send-sms-code 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/send-sms-code
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"mobile": "15601691399",
|
||||||
|
"scene": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /sms-login 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/sms-login
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"mobile": "15601691301",
|
||||||
|
"code": 9999
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /social-login 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/social-login
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": 34,
|
||||||
|
"code": "0e1oc9000CTjFQ1oim200bhtb61oc90g",
|
||||||
|
"state": "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /weixin-mini-app-login 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/weixin-mini-app-login
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"phoneCode": "618e6412e0c728f5b8fc7164497463d0158a923c9e7fd86af8bba393b9decbc5",
|
||||||
|
"loginCode": "001frTkl21JUf94VGxol2hSlff1frTkR"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 请求 /logout 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/logout
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer c1b76bdaf2c146c581caa4d7fd81ee66
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
### 请求 /auth/refresh-token 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/refresh-token?refreshToken=bc43d929094849a28b3a69f6e6940d70
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
### 请求 /auth/create-weixin-jsapi-signature 接口 => 成功
|
||||||
|
POST {{appApi}}/member/auth/create-weixin-jsapi-signature?url=http://www.iocoder.cn
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
tenant-id: {{appTenentId}}
|
|
@ -0,0 +1,128 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.yudao.framework.security.config.SecurityProperties;
|
||||||
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.auth.AuthConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.service.auth.MemberAuthService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.annotation.security.PermitAll;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
@Tag(name = "用户 APP - 认证")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/auth")
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class AppAuthController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberAuthService authService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SocialClientApi socialClientApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SecurityProperties securityProperties;
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
@Operation(summary = "使用手机 + 密码登录")
|
||||||
|
public CommonResult<AppAuthLoginRespVO> login(@RequestBody @Valid AppAuthLoginReqVO reqVO) {
|
||||||
|
return success(authService.login(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/logout")
|
||||||
|
@PermitAll
|
||||||
|
@Operation(summary = "登出系统")
|
||||||
|
public CommonResult<Boolean> logout(HttpServletRequest request) {
|
||||||
|
String token = SecurityFrameworkUtils.obtainAuthorization(request, securityProperties.getTokenHeader());
|
||||||
|
if (StrUtil.isNotBlank(token)) {
|
||||||
|
authService.logout(token);
|
||||||
|
}
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/refresh-token")
|
||||||
|
@Operation(summary = "刷新令牌")
|
||||||
|
@Parameter(name = "refreshToken", description = "刷新令牌", required = true)
|
||||||
|
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||||
|
public CommonResult<AppAuthLoginRespVO> refreshToken(@RequestParam("refreshToken") String refreshToken) {
|
||||||
|
return success(authService.refreshToken(refreshToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 短信登录相关 ==========
|
||||||
|
|
||||||
|
@PostMapping("/sms-login")
|
||||||
|
@Operation(summary = "使用手机 + 验证码登录")
|
||||||
|
public CommonResult<AppAuthLoginRespVO> smsLogin(@RequestBody @Valid AppAuthSmsLoginReqVO reqVO,
|
||||||
|
@RequestHeader Integer terminal) {
|
||||||
|
return success(authService.smsLogin(reqVO, terminal));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/send-sms-code")
|
||||||
|
@Operation(summary = "发送手机验证码")
|
||||||
|
public CommonResult<Boolean> sendSmsCode(@RequestBody @Valid AppAuthSmsSendReqVO reqVO) {
|
||||||
|
authService.sendSmsCode(getLoginUserId(), reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/validate-sms-code")
|
||||||
|
@Operation(summary = "校验手机验证码")
|
||||||
|
public CommonResult<Boolean> validateSmsCode(@RequestBody @Valid AppAuthSmsValidateReqVO reqVO) {
|
||||||
|
authService.validateSmsCode(getLoginUserId(), reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 社交登录相关 ==========
|
||||||
|
|
||||||
|
@GetMapping("/social-auth-redirect")
|
||||||
|
@Operation(summary = "社交授权的跳转")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "type", description = "社交类型", required = true),
|
||||||
|
@Parameter(name = "redirectUri", description = "回调路径")
|
||||||
|
})
|
||||||
|
public CommonResult<String> socialAuthRedirect(@RequestParam("type") Integer type,
|
||||||
|
@RequestParam("redirectUri") String redirectUri) {
|
||||||
|
return CommonResult.success(authService.getSocialAuthorizeUrl(type, redirectUri));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/social-login")
|
||||||
|
@Operation(summary = "社交快捷登录,使用 code 授权码", description = "适合未登录的用户,但是社交账号已绑定用户")
|
||||||
|
public CommonResult<AppAuthLoginRespVO> socialLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
|
||||||
|
return success(authService.socialLogin(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/weixin-mini-app-login")
|
||||||
|
@Operation(summary = "微信小程序的一键登录")
|
||||||
|
public CommonResult<AppAuthLoginRespVO> weixinMiniAppLogin(@RequestBody @Valid AppAuthWeixinMiniAppLoginReqVO reqVO) {
|
||||||
|
return success(authService.weixinMiniAppLogin(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create-weixin-jsapi-signature")
|
||||||
|
@Operation(summary = "创建微信 JS SDK 初始化所需的签名",
|
||||||
|
description = "参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档")
|
||||||
|
public CommonResult<SocialWxJsapiSignatureRespDTO> createWeixinMpJsapiSignature(@RequestParam("url") String url) {
|
||||||
|
SocialWxJsapiSignatureRespDTO signature = socialClientApi.createWxMpJsapiSignature(
|
||||||
|
UserTypeEnum.MEMBER.getValue(), url);
|
||||||
|
return success(AuthConvert.INSTANCE.convert(signature));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
// TODO 芋艿:code review 相关逻辑
|
||||||
|
@Schema(description = "用户 APP - 校验验证码 Request VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthCheckCodeReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", example = "15601691234")
|
||||||
|
@NotBlank(message = "手机号不能为空")
|
||||||
|
@Mobile
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "手机验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotBlank(message = "手机验证码不能为空")
|
||||||
|
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||||
|
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "发送场景,对应 SmsSceneEnum 枚举", example = "1")
|
||||||
|
@NotNull(message = "发送场景不能为空")
|
||||||
|
@InEnum(SmsSceneEnum.class)
|
||||||
|
private Integer scene;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.AssertTrue;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 手机 + 密码登录 Request VO,如果登录并绑定社交用户,需要传递 social 开头的参数")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthLoginReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||||
|
@NotEmpty(message = "手机号不能为空")
|
||||||
|
@Mobile
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "buzhidao")
|
||||||
|
@NotEmpty(message = "密码不能为空")
|
||||||
|
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
// ========== 绑定社交登录时,需要传递如下参数 ==========
|
||||||
|
|
||||||
|
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@InEnum(SocialTypeEnum.class)
|
||||||
|
private Integer socialType;
|
||||||
|
|
||||||
|
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private String socialCode;
|
||||||
|
|
||||||
|
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||||
|
private String socialState;
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权码不能为空")
|
||||||
|
public boolean isSocialCodeValid() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权 state 不能为空")
|
||||||
|
public boolean isSocialState() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 登录 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthLoginRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "访问令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "happy")
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
@Schema(description = "刷新令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "nice")
|
||||||
|
private String refreshToken;
|
||||||
|
|
||||||
|
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime expiresTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅社交登录、社交绑定时会返回
|
||||||
|
*
|
||||||
|
* 为什么需要返回?微信公众号、微信小程序支付需要传递 openid 给支付接口
|
||||||
|
*/
|
||||||
|
@Schema(description = "社交用户 openid", example = "qq768")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.AssertTrue;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 手机 + 验证码登录 Request VO,如果登录并绑定社交用户,需要传递 social 开头的参数")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthSmsLoginReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||||
|
@NotEmpty(message = "手机号不能为空")
|
||||||
|
@Mobile
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "手机验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotEmpty(message = "手机验证码不能为空")
|
||||||
|
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||||
|
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
// ========== 绑定社交登录时,需要传递如下参数 ==========
|
||||||
|
|
||||||
|
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@InEnum(SocialTypeEnum.class)
|
||||||
|
private Integer socialType;
|
||||||
|
|
||||||
|
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private String socialCode;
|
||||||
|
|
||||||
|
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||||
|
private String socialState;
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权码不能为空")
|
||||||
|
public boolean isSocialCodeValid() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权 state 不能为空")
|
||||||
|
public boolean isSocialState() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 发送手机验证码 Request VO")
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AppAuthSmsSendReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", example = "15601691234")
|
||||||
|
@Mobile
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "发送场景,对应 SmsSceneEnum 枚举", example = "1")
|
||||||
|
@NotNull(message = "发送场景不能为空")
|
||||||
|
@InEnum(SmsSceneEnum.class)
|
||||||
|
private Integer scene;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 校验手机验证码 Request VO")
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AppAuthSmsValidateReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机号", example = "15601691234")
|
||||||
|
@Mobile
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "发送场景,对应 SmsSceneEnum 枚举", example = "1")
|
||||||
|
@NotNull(message = "发送场景不能为空")
|
||||||
|
@InEnum(SmsSceneEnum.class)
|
||||||
|
private Integer scene;
|
||||||
|
|
||||||
|
@Schema(description = "手机验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotEmpty(message = "手机验证码不能为空")
|
||||||
|
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||||
|
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 社交快捷登录 Request VO,使用 code 授权码")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthSocialLoginReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@InEnum(SocialTypeEnum.class)
|
||||||
|
@NotNull(message = "社交平台的类型不能为空")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotEmpty(message = "授权码不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||||
|
@NotEmpty(message = "state 不能为空")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 微信小程序手机登录 Request VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AppAuthWeixinMiniAppLoginReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "手机 code,小程序通过 wx.getPhoneNumber 方法获得", requiredMode = Schema.RequiredMode.REQUIRED, example = "hello")
|
||||||
|
@NotEmpty(message = "手机 code 不能为空")
|
||||||
|
private String phoneCode;
|
||||||
|
|
||||||
|
@Schema(description = "登录 code,小程序通过 wx.login 方法获得", requiredMode = Schema.RequiredMode.REQUIRED, example = "word")
|
||||||
|
@NotEmpty(message = "登录 code 不能为空")
|
||||||
|
private String loginCode;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Schema(description = "用户 APP - 微信公众号 JSAPI 签名 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AuthWeixinJsapiSignatureRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "微信公众号的 appId", requiredMode = Schema.RequiredMode.REQUIRED, example = "hello")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
@Schema(description = "匿名串", requiredMode = Schema.RequiredMode.REQUIRED, example = "world")
|
||||||
|
private String nonceStr;
|
||||||
|
|
||||||
|
@Schema(description = "时间戳", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long timestamp;
|
||||||
|
|
||||||
|
@Schema(description = "URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Schema(description = "签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "阿巴阿巴")
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.level.vo.experience.AppMemberExperienceRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberExperienceRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberExperienceRecordService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
@Tag(name = "用户 App - 会员经验记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/experience-record")
|
||||||
|
@Validated
|
||||||
|
public class AppMemberExperienceRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberExperienceRecordService experienceLogService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会员经验记录分页")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<PageResult<AppMemberExperienceRecordRespVO>> getExperienceRecordPage(
|
||||||
|
@Valid PageParam pageParam) {
|
||||||
|
PageResult<MemberExperienceRecordDO> pageResult = experienceLogService.getExperienceRecordPage(
|
||||||
|
getLoginUserId(), pageParam);
|
||||||
|
return success(MemberExperienceRecordConvert.INSTANCE.convertPage02(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.level;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.level.vo.level.AppMemberLevelRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "用户 App - 会员等级")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/level")
|
||||||
|
@Validated
|
||||||
|
public class AppMemberLevelController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberLevelService levelService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得会员等级列表")
|
||||||
|
public CommonResult<List<AppMemberLevelRespVO>> getLevelList() {
|
||||||
|
List<MemberLevelDO> result = levelService.getEnableLevelList();
|
||||||
|
return success(MemberLevelConvert.INSTANCE.convertList02(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.level.vo.experience;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "用户 App - 会员经验记录 Response VO")
|
||||||
|
@Data
|
||||||
|
public class AppMemberExperienceRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "增加经验")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
private Integer experience;
|
||||||
|
|
||||||
|
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "下单增加 100 经验")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.level.vo.level;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "用户 App - 会员等级 Response VO")
|
||||||
|
@Data
|
||||||
|
public class AppMemberLevelRespVO {
|
||||||
|
|
||||||
|
@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 = "98")
|
||||||
|
private Integer discountPercent;
|
||||||
|
|
||||||
|
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
@Schema(description = "等级背景图", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
|
private String backgroundUrl;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.iocoder.yudao.module.member.controller.app.point;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
|
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
|
@Tag(name = "用户 App - 签到记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/member/point/record")
|
||||||
|
@Validated
|
||||||
|
public class AppMemberPointRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MemberPointRecordService pointRecordService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户积分记录分页")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<PageResult<AppMemberPointRecordRespVO>> getPointRecordPage(@Valid PageParam pageVO) {
|
||||||
|
PageResult<MemberPointRecordDO> pageResult = pointRecordService.getPointRecordPage(getLoginUserId(), pageVO);
|
||||||
|
return success(MemberPointRecordConvert.INSTANCE.convertPage02(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue