多模块重构 1:将 yudao-user-server 涉及到 member 模块的逻辑,都迁移到 yudao-module-member 中

This commit is contained in:
YunaiV 2022-01-27 13:34:25 +08:00
parent 678e2def97
commit 06fa85a353
87 changed files with 406 additions and 307 deletions

View File

@ -13,6 +13,8 @@
<module>yudao-admin-server</module>
<module>yudao-user-server</module>
<module>yudao-core-service</module>
<module>yudao-module-member</module>
<module>yudao-server</module>
</modules>
<name>${artifactId}</name>
@ -20,7 +22,7 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>1.3.0-snapshot</revision>
<revision>1.4.0-snapshot</revision>
<!-- Maven 相关 -->
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>

View File

@ -1,6 +0,0 @@
/**
* 提供 POJO 类的实体转换
*
* 目前使用 MapStruct 框架
*/
package cn.iocoder.yudao.coreservice.modules.member.convert;

View File

@ -1,10 +0,0 @@
package cn.iocoder.yudao.coreservice.modules.member.dal.mysql.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MbrUserCoreMapper extends BaseMapperX<MbrUserDO> {
}

View File

@ -1,7 +0,0 @@
/**
* member 包下我们放会员业务.
* 例如说会员中心等等
*
* 缩写mbr
*/
package cn.iocoder.yudao.coreservice.modules.member;

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.coreservice.modules.member.service.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
/**
* 前台用户 Core Service 接口
*
* @author 芋道源码
*/
public interface MbrUserCoreService {
/**
* 通过用户 ID 查询用户
*
* @param id 用户ID
* @return 用户对象信息
*/
MbrUserDO getUser(Long id);
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.coreservice.modules.member.service.user.impl;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.coreservice.modules.member.dal.mysql.user.MbrUserCoreMapper;
import cn.iocoder.yudao.coreservice.modules.member.service.user.MbrUserCoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* User Core Service 实现类
*
* @author 芋道源码
*/
@Service
@Slf4j
public class MbrUserCoreServiceImpl implements MbrUserCoreService {
@Resource
private MbrUserCoreMapper userCoreMapper;
@Override
public MbrUserDO getUser(Long id) {
return userCoreMapper.selectById(id);
}
}

View File

@ -1,7 +0,0 @@
/**
* tool 包下我们放研发工具提升研发效率与质量
* 例如说代码生成器接口文档等等
*
* 缩写tool
*/
package cn.iocoder.yudao.coreservice.modules.tool;

View File

@ -14,7 +14,7 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>1.3.0-snapshot</revision>
<revision>1.4.0-snapshot</revision>
<!-- 统一依赖管理 -->
<spring.boot.version>2.4.12</spring.boot.version>
<!-- Web 相关 -->

View File

@ -1,53 +0,0 @@
/*
* MIT License
* Copyright (c) 2020-2029 YongWu zheng (dcenter.top and gitee.com/pcore and github.com/ZeroOrInfinity)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package cn.iocoder.yudao.framework.security.core.handler;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
import org.springframework.security.web.savedrequest.RequestCache;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author weir
*/
public class AbstractSignUpUrlAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
private RequestCache requestCache = new HttpSessionRequestCache();
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
if (requestCache.getRequest(request, response) != null) {
requestCache.getRequest(request, response);
}
super.onAuthenticationSuccess(request,response,authentication);
}
@Override
public void setRequestCache(RequestCache requestCache) {
this.requestCache = requestCache;
}
}

View File

@ -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.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>yudao-module-member-api</module>
<module>yudao-module-member-impl</module>
</modules>
<artifactId>yudao-module-member</artifactId>
<packaging>pom</packaging>
<name>${artifactId}</name>
<description>
member 模块,我们放会员业务。
例如说:会员中心等等
</description>
</project>

View File

@ -0,0 +1,26 @@
<?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.boot</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>${artifactId}</name>
<description>
member 模块 API暴露给其它模块调用
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,4 @@
/**
* member API 定义暴露给其它模块的 API
*/
package cn.iocoder.yudao.module.member.api;

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.member.api.user;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
/**
* 会员用户的 API 接口
*
* @author 芋道源码
*/
public interface MemberUserApi {
/**
* 获得会员用户信息
*
* @param id 用户编号
* @return 用户信息
*/
MemberUserRespDTO getMemberUser(Long id);
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.member.api.user.dto;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
/**
* 用户信息 Response DTO
*
* @author 芋道源码
*/
public class MemberUserRespDTO {
/**
* 用户ID
*/
private Long id;
/**
* 用户昵称
*/
private String nickname;
/**
* 帐号状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 手机
*/
private String mobile;
}

View File

@ -0,0 +1,120 @@
<?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.boot</groupId>
<artifactId>yudao-module-member</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-member-impl</artifactId>
<packaging>jar</packaging>
<name>${artifactId}</name>
<description>
member 模块,我们放会员业务。
例如说:会员中心等等
</description>
<dependencies>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-core-service</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-dict</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-sms</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<!-- Config 配置中心相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-config</artifactId>
</dependency>
<!-- Job 定时任务相关 -->
<!-- 消息队列相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mq</artifactId>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-protection</artifactId>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 工具类相关 -->
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>${artifactId}</finalName>
<plugins>
<!-- 打包 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth;
package cn.iocoder.yudao.module.member.controller.app.auth;
import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.*;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
import cn.iocoder.yudao.userserver.modules.system.service.sms.SysSmsCodeService;
import io.swagger.annotations.Api;
@ -23,12 +23,12 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUserAgent;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Api(tags = "认证")
@Api(tags = "APP 端 - 认证")
@RestController
@RequestMapping("/")
@Validated
@Slf4j
public class SysAuthController {
public class AppAuthController {
@Resource
private SysAuthService authService;
@ -39,18 +39,18 @@ public class SysAuthController {
@PostMapping("/login")
@ApiOperation("使用手机 + 密码登录")
public CommonResult<SysAuthLoginRespVO> login(@RequestBody @Valid SysAuthLoginReqVO reqVO) {
public CommonResult<AppAuthLoginRespVO> login(@RequestBody @Valid AppAuthLoginReqVO reqVO) {
String token = authService.login(reqVO, getClientIP(), getUserAgent());
// 返回结果
return success(SysAuthLoginRespVO.builder().token(token).build());
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/sms-login")
@ApiOperation("使用手机 + 验证码登录")
public CommonResult<SysAuthLoginRespVO> smsLogin(@RequestBody @Valid SysAuthSmsLoginReqVO reqVO) {
public CommonResult<AppAuthLoginRespVO> smsLogin(@RequestBody @Valid AppAuthSmsLoginReqVO reqVO) {
String token = authService.smsLogin(reqVO, getClientIP(), getUserAgent());
// 返回结果
return success(SysAuthLoginRespVO.builder().token(token).build());
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/send-sms-code")
@ -70,7 +70,7 @@ public class SysAuthController {
@PostMapping("/reset-password")
@ApiOperation(value = "重置密码", notes = "用户忘记密码时使用")
@PreAuthenticated
public CommonResult<Boolean> resetPassword(@RequestBody @Valid MbrAuthResetPasswordReqVO reqVO) {
public CommonResult<Boolean> resetPassword(@RequestBody @Valid AppAuthResetPasswordReqVO reqVO) {
authService.resetPassword(reqVO);
return success(true);
}
@ -78,12 +78,11 @@ public class SysAuthController {
@PostMapping("/update-password")
@ApiOperation(value = "修改用户密码",notes = "用户修改密码时使用")
@PreAuthenticated
public CommonResult<Boolean> updatePassword(@RequestBody @Valid MbrAuthUpdatePasswordReqVO reqVO) {
public CommonResult<Boolean> updatePassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
authService.updatePassword(getLoginUserId(), reqVO);
return success(true);
}
// ========== 社交登录相关 ==========
@GetMapping("/social-auth-redirect")
@ -97,32 +96,30 @@ public class SysAuthController {
return CommonResult.success(socialService.getAuthorizeUrl(type, redirectUri));
}
@PostMapping("/social-login")
@ApiOperation("社交登录,使用 code 授权码")
public CommonResult<SysAuthLoginRespVO> socialLogin(@RequestBody @Valid MbrAuthSocialLoginReqVO reqVO) {
public CommonResult<AppAuthLoginRespVO> socialLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
return success(SysAuthLoginRespVO.builder().token(token).build());
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/social-login2")
@ApiOperation("社交登录,使用 手机号 + 手机验证码")
public CommonResult<SysAuthLoginRespVO> socialLogin2(@RequestBody @Valid MbrAuthSocialLogin2ReqVO reqVO) {
public CommonResult<AppAuthLoginRespVO> socialLogin2(@RequestBody @Valid AppAuthSocialLogin2ReqVO reqVO) {
String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
return success(SysAuthLoginRespVO.builder().token(token).build());
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/social-bind")
@ApiOperation("社交绑定,使用 code 授权码")
public CommonResult<Boolean> socialBind(@RequestBody @Valid MbrAuthSocialBindReqVO reqVO) {
public CommonResult<Boolean> socialBind(@RequestBody @Valid AppAuthSocialBindReqVO reqVO) {
authService.socialBind(getLoginUserId(), reqVO);
return CommonResult.success(true);
}
@DeleteMapping("/social-unbind")
@ApiOperation("取消社交绑定")
public CommonResult<Boolean> socialUnbind(@RequestBody MbrAuthSocialUnbindReqVO reqVO) {
public CommonResult<Boolean> socialUnbind(@RequestBody AppAuthSocialUnbindReqVO reqVO) {
socialService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.MEMBER);
return CommonResult.success(true);
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
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;
@ -15,12 +15,12 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("校验验证码 Request VO")
@ApiModel("APP 端 - 校验验证码 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SysAuthCheckCodeReqVO {
public class AppAuthCheckCodeReqVO {
@ApiModelProperty(value = "手机号", example = "15601691234")
@NotBlank(message = "手机号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import io.swagger.annotations.ApiModel;
@ -11,12 +11,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
@ApiModel("手机 + 密码登录 Request VO")
@ApiModel("APP 端 - 手机 + 密码登录 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SysAuthLoginReqVO {
public class AppAuthLoginReqVO {
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
@NotEmpty(message = "手机号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -7,12 +7,12 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel("手机密码登录 Response VO")
@ApiModel("APP 端 - 手机密码登录 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SysAuthLoginRespVO {
public class AppAuthLoginRespVO {
@ApiModelProperty(value = "token", required = true, example = "yudaoyuanma")
private String token;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import io.swagger.annotations.ApiModel;
@ -13,12 +13,12 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
@ApiModel("重置密码 Request VO")
@ApiModel("APP 端 - 重置密码 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthResetPasswordReqVO {
public class AppAuthResetPasswordReqVO {
@ApiModelProperty(value = "新密码", required = true, example = "buzhidao")
@NotEmpty(message = "新密码不能为空")
@ -35,4 +35,5 @@ public class MbrAuthResetPasswordReqVO {
@NotBlank(message = "手机号不能为空")
@Mobile
private String mobile;
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import io.swagger.annotations.ApiModel;
@ -12,12 +12,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
@ApiModel("手机 + 验证码登录 Request VO")
@ApiModel("APP 端 - 手机 + 验证码登录 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SysAuthSmsLoginReqVO {
public class AppAuthSmsLoginReqVO {
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
@NotEmpty(message = "手机号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("社交绑定 Request VO使用 code 授权码")
@ApiModel("APP 端 - 社交绑定 Request VO使用 code 授权码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthSocialBindReqVO {
public class AppAuthSocialBindReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -14,12 +14,12 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("社交登录 Request VO使用 code 授权码 + 账号密码")
@ApiModel("APP 端 - 社交登录 Request VO使用 code 授权码 + 账号密码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthSocialLogin2ReqVO {
public class AppAuthSocialLogin2ReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("社交登录 Request VO使用 code 授权码")
@ApiModel("APP 端 - 社交登录 Request VO使用 code 授权码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthSocialLoginReqVO {
public class AppAuthSocialLoginReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("取消社交绑定 Request VO使用 code 授权码")
@ApiModel("APP 端 - 取消社交绑定 Request VO使用 code 授权码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthSocialUnbindReqVO {
public class AppAuthSocialUnbindReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
package cn.iocoder.yudao.module.member.controller.app.auth.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -11,12 +11,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@ApiModel("修改密码 Request VO")
@ApiModel("APP 端 - 修改密码 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrAuthUpdatePasswordReqVO {
public class AppAuthUpdatePasswordReqVO {
@ApiModelProperty(value = "用户旧密码", required = true, example = "123456")
@NotBlank(message = "旧密码不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo;
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;
@ -10,10 +10,10 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@ApiModel("发送手机验证码 Response VO")
@ApiModel("APP 端 - 发送手机验证码 Response VO")
@Data
@Accessors(chain = true)
public class SysAuthSendSmsReqVO {
public class AppSendSmsReqVO {
@ApiModelProperty(value = "手机号", example = "15601691234")
@Mobile

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.member.controller.app;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user;
package cn.iocoder.yudao.module.member.controller.app.user;
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
@ -25,12 +25,12 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.userserver.modules.member.enums.MbrErrorCodeConstants.FILE_IS_EMPTY;
@Api(tags = "用户个人中心")
@Api(tags = "APP 端 - 用户个人中心")
@RestController
@RequestMapping("/member/user/profile")
@RequestMapping("/member/user")
@Validated
@Slf4j
public class SysUserProfileController {
public class AppUserController {
@Resource
private MbrUserService userService;
@ -48,7 +48,7 @@ public class SysUserProfileController {
@PreAuthenticated
public CommonResult<String> updateAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
throw ServiceExceptionUtil.exception(MbrErrorCodeConstants.FILE_IS_EMPTY);
}
String avatar = userService.updateAvatar(getLoginUserId(), file.getInputStream());
return success(avatar);

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user.vo;
package cn.iocoder.yudao.module.member.controller.app.user.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -6,11 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel("用户个人信息 Response VO")
@ApiModel("APP 端 - 用户个人信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MbrUserInfoRespVO {
public class AppUserInfoRespVO {
@ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
private String nickname;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.controller.user.vo;
package cn.iocoder.yudao.module.member.controller.app.user.vo;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import io.swagger.annotations.ApiModel;
@ -13,12 +13,12 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
@ApiModel("修改手机 Request VO")
@ApiModel("APP 端 - 修改手机 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MbrUserUpdateMobileReqVO {
public class AppUserUpdateMobileReqVO {
@ApiModelProperty(value = "手机验证码", required = true, example = "1024")
@NotEmpty(message = "手机验证码不能为空")
@ -44,5 +44,4 @@ public class MbrUserUpdateMobileReqVO {
@Mobile
private String oldMobile;
}

View File

@ -0,0 +1,6 @@
/**
* 提供 RESTful API 给前端
* 1. admin 提供给管理后台 yudao-ui-admin 前端项目
* 2. app 提供给用户 APP yudao-ui-app 前端项目
*/
package cn.iocoder.yudao.module.member.controller;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.convert.auth;
package cn.iocoder.yudao.module.member.convert.auth;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;

View File

@ -3,4 +3,4 @@
*
* 目前使用 MapStruct 框架
*/
package cn.iocoder.yudao.userserver.modules.member.convert;
package cn.iocoder.yudao.module.member.convert;

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.member.convert.user;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface UserConvert {
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
AppUserInfoRespVO convert(MemberUserDO bean);
}

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.userserver.modules.system.dal.dataobject.sms;
package cn.iocoder.yudao.module.member.dal.dataobject.sms;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.experimental.Accessors;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user;
package cn.iocoder.yudao.module.member.dal.dataobject.user;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
@ -16,13 +16,13 @@ import java.util.Date;
*
* @author 芋道源码
*/
@TableName(value = "mbr_user", autoResultMap = true)
@TableName(value = "member_user", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MbrUserDO extends TenantBaseDO {
public class MemberUserDO extends TenantBaseDO {
/**
* 用户ID

View File

@ -1,11 +1,12 @@
package cn.iocoder.yudao.userserver.modules.system.dal.mysql.sms;
package cn.iocoder.yudao.module.member.dal.mysql.sms;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.sms.SysSmsCodeDO;
import cn.iocoder.yudao.userserver.modules.system.dal.dataobject.sms.SysSmsCodeDO;
import org.apache.ibatis.annotations.Mapper;
// TODO @芋艿
@Mapper
public interface SysSmsCodeMapper extends BaseMapperX<SysSmsCodeDO> {

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.dal.mysql.user;
package cn.iocoder.yudao.module.member.dal.mysql.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;

View File

@ -0,0 +1,7 @@
/**
* DAL = Data Access Layer 数据访问层
* 1. data object数据对象
* 2. redisRedis CRUD 操作
* 3. mysqlMySQL CRUD 操作
*/
package cn.iocoder.yudao.module.member.dal;

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.member.dal.redis;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.enums;
package cn.iocoder.yudao.module.member.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
@ -7,11 +7,12 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
*
* member 系统使用 1-004-000-000
*/
public interface MbrErrorCodeConstants {
public interface MemberErrorCodeConstants {
// ==========用户相关 1004001000============
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
// ==========文件相关 1004002000 ===========
ErrorCode FILE_IS_EMPTY = new ErrorCode(1004002000, "文件为空");
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.enums;
package cn.iocoder.yudao.module.member.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.enums.sms;
package cn.iocoder.yudao.module.member.enums.sms;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.enums.sms;
package cn.iocoder.yudao.module.member.enums.sms;
/**
* yudao-user-server 使用到的短信模板的 Code 编码的枚举

View File

@ -0,0 +1,6 @@
/**
* 属于 yudao-module-member-impl 的封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.module.member.framework;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.framework.security;
package cn.iocoder.yudao.module.member.framework.security;
import cn.iocoder.yudao.framework.web.config.WebProperties;
import org.springframework.context.annotation.Bean;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.framework.sms;
package cn.iocoder.yudao.module.member.framework.sms;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.framework.sms;
package cn.iocoder.yudao.module.member.framework.sms;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.member;

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.userserver.modules.system.service.auth;
package cn.iocoder.yudao.module.member.service.auth;
import cn.iocoder.yudao.framework.security.core.service.SecurityAuthFrameworkService;
import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.*;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
import javax.validation.Valid;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.service.auth.impl;
package cn.iocoder.yudao.module.member.service.auth;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
@ -12,12 +12,13 @@ import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLo
import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.*;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
import cn.iocoder.yudao.userserver.modules.system.convert.auth.SysAuthConvert;
import cn.iocoder.yudao.userserver.modules.system.enums.sms.SysSmsSceneEnum;
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
@ -131,13 +132,13 @@ public class SysAuthServiceImpl implements SysAuthService {
String unionId = socialService.getAuthUserUnionId(authUser);
List<SysSocialUserDO> socialUsers = socialService.getAllSocialUserList(reqVO.getType(), unionId, USER_TYPE_ENUM);
if (CollUtil.isEmpty(socialUsers)) {
throw exception(AUTH_THIRD_LOGIN_NOT_BIND);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND);
}
// 自动登录
MbrUserDO user = userService.getUser(socialUsers.get(0).getUserId());
if (user == null) {
throw exception(USER_NOT_EXISTS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_NOT_EXISTS);
}
this.createLoginLog(user.getMobile(), SysLoginLogTypeEnum.LOGIN_SOCIAL, SysLoginResultEnum.SUCCESS);
@ -190,14 +191,14 @@ public class SysAuthServiceImpl implements SysAuthService {
authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
} catch (BadCredentialsException badCredentialsException) {
this.createLoginLog(username, logTypeEnum, SysLoginResultEnum.BAD_CREDENTIALS);
throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
} catch (DisabledException disabledException) {
this.createLoginLog(username, logTypeEnum, SysLoginResultEnum.USER_DISABLED);
throw exception(AUTH_LOGIN_USER_DISABLED);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.AUTH_LOGIN_USER_DISABLED);
} catch (AuthenticationException authenticationException) {
log.error("[login0][username({}) 发生未知异常]", username, authenticationException);
this.createLoginLog(username, logTypeEnum, SysLoginResultEnum.UNKNOWN_ERROR);
throw exception(AUTH_LOGIN_FAIL_UNKNOWN);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.AUTH_LOGIN_FAIL_UNKNOWN);
}
// 登录成功的日志
Assert.notNull(authentication.getPrincipal(), "Principal 不会为空");
@ -248,7 +249,7 @@ public class SysAuthServiceImpl implements SysAuthService {
// 重新加载 MbrUserDO 信息
MbrUserDO user = userService.getUser(loginUser.getId());
if (user == null || CommonStatusEnum.DISABLE.getStatus().equals(user.getStatus())) {
throw exception(AUTH_TOKEN_EXPIRED); // 校验 token 用户被禁用的情况下也认为 token 过期方便前端跳转到登录界面
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.AUTH_TOKEN_EXPIRED); // 校验 token 用户被禁用的情况下也认为 token 过期方便前端跳转到登录界面
}
// 刷新 LoginUser 缓存
@ -321,11 +322,11 @@ public class SysAuthServiceImpl implements SysAuthService {
public MbrUserDO checkOldPassword(Long id, String oldPassword) {
MbrUserDO user = userMapper.selectById(id);
if (user == null) {
throw exception(USER_NOT_EXISTS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_NOT_EXISTS);
}
// 参数未加密密码编码后的密码
if (!passwordEncoder.matches(oldPassword,user.getPassword())) {
throw exception(USER_PASSWORD_FAILED);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_PASSWORD_FAILED);
}
return user;
}
@ -333,7 +334,7 @@ public class SysAuthServiceImpl implements SysAuthService {
public MbrUserDO checkUserIfExists(String mobile) {
MbrUserDO user = userMapper.selectByMobile(mobile);
if (user == null) {
throw exception(USER_NOT_EXISTS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_NOT_EXISTS);
}
return user;
}

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.member.service;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.service.sms;
package cn.iocoder.yudao.module.member.service.sms;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.validation.Mobile;

View File

@ -1,8 +1,9 @@
package cn.iocoder.yudao.userserver.modules.system.service.sms.impl;
package cn.iocoder.yudao.module.member.service.sms;
import cn.hutool.core.map.MapUtil;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
import cn.iocoder.yudao.userserver.modules.system.dal.dataobject.sms.SysSmsCodeDO;
import cn.iocoder.yudao.userserver.modules.system.dal.mysql.sms.SysSmsCodeMapper;
@ -63,7 +64,7 @@ public class SysSmsCodeServiceImpl implements SysSmsCodeService {
// 检测手机号是否已被使用
MbrUserDO userByMobile = mbrUserService.getUserByMobile(mobile);
if (userByMobile != null){
throw exception(USER_SMS_CODE_IS_EXISTS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_IS_EXISTS);
}
// 发送短信
@ -75,11 +76,11 @@ public class SysSmsCodeServiceImpl implements SysSmsCodeService {
SysSmsCodeDO lastSmsCode = smsCodeMapper.selectLastByMobile(mobile, null,null);
if (lastSmsCode != null) {
if (lastSmsCode.getTodayIndex() >= smsCodeProperties.getSendMaximumQuantityPerDay()) { // 超过当天发送的上限
throw exception(USER_SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY);
}
if (System.currentTimeMillis() - lastSmsCode.getCreateTime().getTime()
< smsCodeProperties.getSendFrequency().toMillis()) { // 发送过于频繁
throw exception(USER_SMS_CODE_SEND_TOO_FAST);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_SEND_TOO_FAST);
}
// TODO 芋艿提升每个 IP 每天可发送数量
// TODO 芋艿提升每个 IP 每小时可发送数量
@ -102,7 +103,7 @@ public class SysSmsCodeServiceImpl implements SysSmsCodeService {
// 判断验证码是否已被使用
if (Boolean.TRUE.equals(lastSmsCode.getUsed())) {
throw exception(USER_SMS_CODE_USED);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_USED);
}
// 使用验证码
@ -114,7 +115,7 @@ public class SysSmsCodeServiceImpl implements SysSmsCodeService {
public void sendSmsCodeLogin(Long userId) {
MbrUserDO user = mbrUserService.getUser(userId);
if (user == null){
throw exception(USER_NOT_EXISTS);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_NOT_EXISTS);
}
// 发送验证码
this.sendSmsCode(user.getMobile(),SysSmsSceneEnum.CHANGE_MOBILE_BY_SMS.getScene(), getClientIP());
@ -127,11 +128,11 @@ public class SysSmsCodeServiceImpl implements SysSmsCodeService {
// 若验证码不存在抛出异常
if (lastSmsCode == null) {
throw exception(USER_SMS_CODE_NOT_FOUND);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_NOT_FOUND);
}
if (System.currentTimeMillis() - lastSmsCode.getCreateTime().getTime()
>= smsCodeProperties.getExpireTimes().toMillis()) { // 验证码已过期
throw exception(USER_SMS_CODE_EXPIRED);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_EXPIRED);
}
return lastSmsCode;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.service.user;
package cn.iocoder.yudao.module.member.service.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;

View File

@ -1,10 +1,11 @@
package cn.iocoder.yudao.userserver.modules.member.service.user.impl;
package cn.iocoder.yudao.module.member.service.user;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserUpdateMobileReqVO;
import cn.iocoder.yudao.userserver.modules.member.convert.user.UserProfileConvert;
@ -135,7 +136,7 @@ public class MbrUserServiceImpl implements MbrUserService {
SysSmsCodeDO sysSmsCodeDO = smsCodeService.checkCodeIsExpired(reqVO.getOldMobile(), reqVO.getOldCode(), SysSmsSceneEnum.CHANGE_MOBILE_BY_SMS.getScene());
// 判断旧code是否未被使用如果是抛出异常
if (Boolean.FALSE.equals(sysSmsCodeDO.getUsed())){
throw exception(USER_SMS_CODE_IS_UNUSED);
throw ServiceExceptionUtil.exception(SysErrorCodeConstants.USER_SMS_CODE_IS_UNUSED);
}
// 使用新验证码

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.system.service;
package cn.iocoder.yudao.module.member.service.auth;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService;
@ -10,8 +10,8 @@ import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
import cn.iocoder.yudao.userserver.BaseDbAndRedisUnitTest;
import cn.iocoder.yudao.userserver.modules.member.dal.mysql.user.MbrUserMapper;
import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService;
import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.MbrAuthResetPasswordReqVO;
import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.MbrAuthUpdatePasswordReqVO;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.MbrAuthResetPasswordReqVO;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.MbrAuthUpdatePasswordReqVO;
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
import cn.iocoder.yudao.userserver.modules.system.service.auth.impl.SysAuthServiceImpl;
import cn.iocoder.yudao.userserver.modules.system.service.sms.SysSmsCodeService;

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.member.service;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.modules.member.service;
package cn.iocoder.yudao.module.member.service.user;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
@ -122,7 +122,7 @@ public class MbrUserServiceImplTest extends BaseDbAndRedisUnitTest {
String oldCode = RandomUtil.randomString(4);
codeDO.setMobile(userDO.getMobile());
codeDO.setCode(oldCode);
codeDO.setScene(CHANGE_MOBILE_BY_SMS.getScene());
codeDO.setScene(SysSmsSceneEnum.CHANGE_MOBILE_BY_SMS.getScene());
codeDO.setUsed(Boolean.FALSE);
when(sysSmsCodeService.checkCodeIsExpired(codeDO.getMobile(),codeDO.getCode(),codeDO.getScene())).thenReturn(codeDO);

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver;
package cn.iocoder.yudao.module.member.test;
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver;
package cn.iocoder.yudao.module.member.test;
import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.userserver.config;
package cn.iocoder.yudao.module.member.test;
import com.github.fppt.jedismock.RedisServer;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

22
yudao-server/pom.xml Normal file
View File

@ -0,0 +1,22 @@
<?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>
<artifactId>yudao</artifactId>
<groupId>cn.iocoder.boot</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-server</artifactId>
<packaging>jar</packaging>
<name>${artifactId}</name>
<description>
后端 Server 的主项目,通过引入需要 yudao-module-xxx 的依赖,
从而实现提供 RESTful API 给 yudao-ui-admin、yudao-ui-user 等前端项目。
本质上来说,它就是个空壳(容器)!
</description>
</project>

View File

@ -1,6 +0,0 @@
/**
* 属于整个 yudao-user-server framework 封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.userserver.framework;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.member.controller;

View File

@ -1,15 +0,0 @@
package cn.iocoder.yudao.userserver.modules.member.convert.user;
import cn.iocoder.yudao.coreservice.modules.member.dal.dataobject.user.MbrUserDO;
import cn.iocoder.yudao.userserver.modules.member.controller.user.vo.MbrUserInfoRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface UserProfileConvert {
UserProfileConvert INSTANCE = Mappers.getMapper(UserProfileConvert.class);
MbrUserInfoRespVO convert(MbrUserDO bean);
}

View File

@ -1,8 +0,0 @@
/**
* weixin 包下我们放微信相关业务.
* 例如说微信公众号等等
* ps微信支付还是放在 pay 包下
*
* 缩写wx
*/
package cn.iocoder.yudao.userserver.modules.member;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.member.service;

View File

@ -1,4 +0,0 @@
/**
* 占位
*/
package cn.iocoder.yudao.userserver.modules.system.controller;

View File

@ -1,6 +0,0 @@
/**
* 提供 POJO 类的实体转换
*
* 目前使用 MapStruct 框架
*/
package cn.iocoder.yudao.userserver.modules.system.convert;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.system.dal.dataobject;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.system.dal.mysql;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.system.dal.redis;

View File

@ -1,6 +0,0 @@
/**
* 属于 system 模块的 framework 封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.userserver.modules.system.framework;

View File

@ -1,7 +0,0 @@
/**
* system 包下我们放通用业务支撑上层的核心业务
* 例如说用户部门权限数据字典等等
*
* 缩写sys
*/
package cn.iocoder.yudao.userserver.modules.system;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.userserver.modules.system.service;