From 028c99aa10dff05d2acbcb6fbd99667a4bce057b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 10 Oct 2021 16:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20user-admin-server=20?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E6=89=8B=E6=9C=BA=20+=20=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- http-client.env.json | 1 + yudao-dependencies/pom.xml | 2 +- .../member/enums/MbrErrorCodeConstants.java | 5 ----- .../modules/member/service/package-info.java | 1 + .../controller/auth/SysAuthController.http | 8 ++++++++ .../controller/auth/SysAuthController.java} | 16 ++++++++-------- .../controller/auth/vo/MbrAuthLoginRespVO.java | 2 +- .../controller/auth/vo/MbrAuthSendSmsReqVO.java | 4 ++-- .../auth/vo/MbrAuthSmsLoginReqVO.java | 2 +- .../auth/vo/MbrAuthSocialBindReqVO.java | 2 +- .../auth/vo/MbrAuthSocialLogin2ReqVO.java | 2 +- .../auth/vo/MbrAuthSocialLoginReqVO.java | 2 +- .../auth/vo/MbrAuthSocialUnbindReqVO.java | 2 +- .../controller/auth/vo/SysAuthLoginReqVO.java} | 4 ++-- .../auth/vo/SysAuthResetPasswordReqVO.java} | 4 ++-- .../modules/system/controller/package-info.java | 4 ++++ .../convert/auth}/MbrAuthConvert.java | 4 +++- .../system/enums/SysErrorCodeConstants.java | 17 +++++++++++++++++ .../service/auth/SysAuthService.java} | 8 ++++---- .../service/auth/impl/SysAuthServiceImpl.java} | 14 +++++++------- .../modules/system/service/package-info.java | 1 + 更新日志.md | 1 + 23 files changed, 69 insertions(+), 39 deletions(-) create mode 100644 yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/package-info.java create mode 100644 yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.http rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/controller/auth/MbrAuthController.java => system/controller/auth/SysAuthController.java} (91%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthLoginRespVO.java (87%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSendSmsReqVO.java (90%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSmsLoginReqVO.java (95%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSocialBindReqVO.java (94%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java (96%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSocialLoginReqVO.java (94%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member => system}/controller/auth/vo/MbrAuthSocialUnbindReqVO.java (94%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/controller/auth/vo/MbrAuthLoginReqVO.java => system/controller/auth/vo/SysAuthLoginReqVO.java} (89%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/controller/auth/vo/MbrAuthResetPasswordReqVO.java => system/controller/auth/vo/SysAuthResetPasswordReqVO.java} (90%) create mode 100644 yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/package-info.java rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/convert/user => system/convert/auth}/MbrAuthConvert.java (80%) create mode 100644 yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/enums/SysErrorCodeConstants.java rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/service/auth/MbrAuthService.java => system/service/auth/SysAuthService.java} (64%) rename yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/{member/service/auth/impl/MbrAuthServiceImpl.java => system/service/auth/impl/SysAuthServiceImpl.java} (91%) create mode 100644 yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/package-info.java diff --git a/README.md b/README.md index ac5125193..c5a210733 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ | `yudao-admin-ui` | 管理后台的 UI 界面 | | `yudao-user-server` | 用户前台的服务端 | | `yudao-user-ui` | 用户前台的 UI 界面 | -| `yudao-core-service` | 通用服务,提供共享逻辑 | +| `yudao-core-service` | 公共服务,提供共享逻辑 | > 友情提示:`yudao-admin-server` 和 `yudao-user-server` 会存在需要复用的逻辑,通过 `yudao-core-service` 实现。 diff --git a/http-client.env.json b/http-client.env.json index ad661c281..c4686b274 100644 --- a/http-client.env.json +++ b/http-client.env.json @@ -1,6 +1,7 @@ { "local": { "baseUrl": "http://127.0.0.1:48080/api", + "userServerUrl": "http://127.0.0.1:28080/api", "token": "test1" } } diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index a177593ea..e3c970481 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -26,7 +26,7 @@ 1.2.4 3.4.2 3.3.2 - 3.15.1 + 3.16.3 1.7.0 diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java index c8e94afb6..265d1d485 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/enums/MbrErrorCodeConstants.java @@ -9,9 +9,4 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; */ public interface MbrErrorCodeConstants { - // ========== AUTH 模块 1004000000 ========== - ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1004000000, "登录失败,账号密码不正确"); - ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1004000001, "登录失败,账号被禁用"); - ErrorCode AUTH_LOGIN_FAIL_UNKNOWN = new ErrorCode(1004000002, "登录失败"); // 登录失败的兜底,未知原因 - } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/package-info.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/package-info.java new file mode 100644 index 000000000..b12c6427a --- /dev/null +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.userserver.modules.member.service; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.http b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.http new file mode 100644 index 000000000..33c20cf2b --- /dev/null +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.http @@ -0,0 +1,8 @@ +### 请求 /login 接口 => 成功 +POST {{userServerUrl}}/login +Content-Type: application/json + +{ + "mobile": "15601691300", + "password": "admin123" +} diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/MbrAuthController.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.java similarity index 91% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/MbrAuthController.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.java index cabf98cc3..89b6b65f5 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/MbrAuthController.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/SysAuthController.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth; +package cn.iocoder.yudao.userserver.modules.system.controller.auth; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.userserver.modules.member.controller.auth.vo.*; -import cn.iocoder.yudao.userserver.modules.member.service.auth.MbrAuthService; +import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.*; +import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -23,14 +23,14 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUse @RequestMapping("/") @Validated @Slf4j -public class MbrAuthController { +public class SysAuthController { @Resource - private MbrAuthService authService; + private SysAuthService authService; @PostMapping("/login") @ApiOperation("使用手机 + 密码登录") - public CommonResult login(@RequestBody @Valid MbrAuthLoginReqVO reqVO) { + public CommonResult login(@RequestBody @Valid SysAuthLoginReqVO reqVO) { String token = authService.login(reqVO, getClientIP(), getUserAgent()); // 返回结果 return success(MbrAuthLoginRespVO.builder().token(token).build()); @@ -38,7 +38,7 @@ public class MbrAuthController { @PostMapping("/sms-login") @ApiOperation("使用手机 + 验证码登录") - public CommonResult smsLogin(@RequestBody @Valid MbrAuthLoginReqVO reqVO) { + public CommonResult smsLogin(@RequestBody @Valid SysAuthLoginReqVO reqVO) { return null; } @@ -53,7 +53,7 @@ public class MbrAuthController { @PostMapping("/reset-password") @ApiOperation(value = "重置密码", notes = "用户忘记密码时使用") - public CommonResult resetPassword(@RequestBody @Valid MbrAuthResetPasswordReqVO reqVO) { + public CommonResult resetPassword(@RequestBody @Valid SysAuthResetPasswordReqVO reqVO) { return null; } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginRespVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthLoginRespVO.java similarity index 87% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginRespVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthLoginRespVO.java index fcc7e09c9..1601baa4a 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginRespVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthLoginRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSendSmsReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSendSmsReqVO.java similarity index 90% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSendSmsReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSendSmsReqVO.java index d3ceecf9c..afda3aa65 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSendSmsReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSendSmsReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.Mobile; import io.swagger.annotations.ApiModel; @@ -21,4 +21,4 @@ public class MbrAuthSendSmsReqVO { @NotNull(message = "发送场景不能为空") private Integer scene; -} \ No newline at end of file +} diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSmsLoginReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSmsLoginReqVO.java similarity index 95% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSmsLoginReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSmsLoginReqVO.java index 6c07e5e72..56b4e50e4 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSmsLoginReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSmsLoginReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.Mobile; import io.swagger.annotations.ApiModel; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialBindReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialBindReqVO.java similarity index 94% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialBindReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialBindReqVO.java index 44f16dcfa..d866411d2 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialBindReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialBindReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.userserver.modules.member.enums.social.SysSocialTypeEnum; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java similarity index 96% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java index 1769fe2ef..371e7e9b3 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLogin2ReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.userserver.modules.member.enums.social.SysSocialTypeEnum; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLoginReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLoginReqVO.java similarity index 94% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLoginReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLoginReqVO.java index 96fd0f661..5fdd424c1 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialLoginReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialLoginReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.userserver.modules.member.enums.social.SysSocialTypeEnum; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialUnbindReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialUnbindReqVO.java similarity index 94% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialUnbindReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialUnbindReqVO.java index cb798cb49..ea9050a29 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthSocialUnbindReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/MbrAuthSocialUnbindReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.userserver.modules.member.enums.social.SysSocialTypeEnum; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthLoginReqVO.java similarity index 89% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthLoginReqVO.java index 1b2e9b52a..1d51f8001 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthLoginReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthLoginReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import cn.iocoder.yudao.framework.common.validation.Mobile; import io.swagger.annotations.ApiModel; @@ -16,7 +16,7 @@ import javax.validation.constraints.NotEmpty; @NoArgsConstructor @AllArgsConstructor @Builder -public class MbrAuthLoginReqVO { +public class SysAuthLoginReqVO { @ApiModelProperty(value = "手机号", required = true, example = "15601691300") @NotEmpty(message = "手机号不能为空") diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthResetPasswordReqVO.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthResetPasswordReqVO.java similarity index 90% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthResetPasswordReqVO.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthResetPasswordReqVO.java index ef24af7b7..01e438cb7 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/controller/auth/vo/MbrAuthResetPasswordReqVO.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/auth/vo/SysAuthResetPasswordReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.controller.auth.vo; +package cn.iocoder.yudao.userserver.modules.system.controller.auth.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -16,7 +16,7 @@ import javax.validation.constraints.Pattern; @NoArgsConstructor @AllArgsConstructor @Builder -public class MbrAuthResetPasswordReqVO { +public class SysAuthResetPasswordReqVO { @ApiModelProperty(value = "新密码", required = true, example = "buzhidao") @NotEmpty(message = "新密码不能为空") diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/package-info.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/package-info.java new file mode 100644 index 000000000..aa4f746ad --- /dev/null +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/controller/package-info.java @@ -0,0 +1,4 @@ +/** + * 占位 + */ +package cn.iocoder.yudao.userserver.modules.system.controller; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/convert/user/MbrAuthConvert.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/convert/auth/MbrAuthConvert.java similarity index 80% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/convert/user/MbrAuthConvert.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/convert/auth/MbrAuthConvert.java index 4aed7ed1a..00edbfd5f 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/convert/user/MbrAuthConvert.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/convert/auth/MbrAuthConvert.java @@ -1,9 +1,10 @@ -package cn.iocoder.yudao.userserver.modules.member.convert.user; +package cn.iocoder.yudao.userserver.modules.system.convert.auth; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.userserver.modules.member.dal.dataobject.user.MbrUserDO; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @Mapper @@ -11,6 +12,7 @@ public interface MbrAuthConvert { MbrAuthConvert INSTANCE = Mappers.getMapper(MbrAuthConvert.class); + @Mapping(source = "mobile", target = "username") LoginUser convert0(MbrUserDO bean); default LoginUser convert(MbrUserDO bean) { diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/enums/SysErrorCodeConstants.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/enums/SysErrorCodeConstants.java new file mode 100644 index 000000000..b62525cf1 --- /dev/null +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/enums/SysErrorCodeConstants.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.userserver.modules.system.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + +/** + * System 错误码枚举类 + * + * system 系统,使用 1-005-000-000 段 + */ +public interface SysErrorCodeConstants { + + // ========== AUTH 模块 1005000000 ========== + ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1005000000, "登录失败,账号密码不正确"); + ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1005000001, "登录失败,账号被禁用"); + ErrorCode AUTH_LOGIN_FAIL_UNKNOWN = new ErrorCode(1005000002, "登录失败"); // 登录失败的兜底,未知原因 + +} diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/MbrAuthService.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/SysAuthService.java similarity index 64% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/MbrAuthService.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/SysAuthService.java index 3f998ddc4..b560f9d78 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/MbrAuthService.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/SysAuthService.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.userserver.modules.member.service.auth; +package cn.iocoder.yudao.userserver.modules.system.service.auth; import cn.iocoder.yudao.framework.security.core.service.SecurityAuthFrameworkService; -import cn.iocoder.yudao.userserver.modules.member.controller.auth.vo.MbrAuthLoginReqVO; +import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.SysAuthLoginReqVO; import javax.validation.Valid; @@ -12,7 +12,7 @@ import javax.validation.Valid; * * @author 芋道源码 */ -public interface MbrAuthService extends SecurityAuthFrameworkService { +public interface SysAuthService extends SecurityAuthFrameworkService { /** * 手机 + 密码登录 @@ -22,6 +22,6 @@ public interface MbrAuthService extends SecurityAuthFrameworkService { * @param userAgent 用户 UA * @return 身份令牌,使用 JWT 方式 */ - String login(@Valid MbrAuthLoginReqVO reqVO, String userIp, String userAgent); + String login(@Valid SysAuthLoginReqVO reqVO, String userIp, String userAgent); } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/impl/MbrAuthServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java similarity index 91% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/impl/MbrAuthServiceImpl.java rename to yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java index 341a3368b..4a2c32fd5 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/member/service/auth/impl/MbrAuthServiceImpl.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.member.service.auth.impl; +package cn.iocoder.yudao.userserver.modules.system.service.auth.impl; import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; @@ -6,10 +6,10 @@ import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLo 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.controller.auth.vo.MbrAuthLoginReqVO; -import cn.iocoder.yudao.userserver.modules.member.convert.user.MbrAuthConvert; +import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.SysAuthLoginReqVO; +import cn.iocoder.yudao.userserver.modules.system.convert.auth.MbrAuthConvert; import cn.iocoder.yudao.userserver.modules.member.dal.dataobject.user.MbrUserDO; -import cn.iocoder.yudao.userserver.modules.member.service.auth.MbrAuthService; +import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService; import cn.iocoder.yudao.userserver.modules.member.service.user.MbrUserService; import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginLogTypeEnum; import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginResultEnum; @@ -30,7 +30,7 @@ import javax.annotation.Resource; import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.userserver.modules.member.enums.MbrErrorCodeConstants.*; +import static cn.iocoder.yudao.userserver.modules.system.enums.SysErrorCodeConstants.*; /** * Auth Service 实现类 @@ -39,7 +39,7 @@ import static cn.iocoder.yudao.userserver.modules.member.enums.MbrErrorCodeConst */ @Service @Slf4j -public class MbrAuthServiceImpl implements MbrAuthService { +public class SysAuthServiceImpl implements SysAuthService { @Resource @Lazy // 延迟加载,因为存在相互依赖的问题 @@ -64,7 +64,7 @@ public class MbrAuthServiceImpl implements MbrAuthService { } @Override - public String login(MbrAuthLoginReqVO reqVO, String userIp, String userAgent) { + public String login(SysAuthLoginReqVO reqVO, String userIp, String userAgent) { // 使用手机 + 密码,进行登录。 LoginUser loginUser = this.login0(reqVO.getMobile(), reqVO.getPassword()); diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/package-info.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/package-info.java new file mode 100644 index 000000000..d1896cb92 --- /dev/null +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.userserver.modules.system.service; diff --git a/更新日志.md b/更新日志.md index 9a56d5f3a..9dd7c2ac3 100644 --- a/更新日志.md +++ b/更新日志.md @@ -15,6 +15,7 @@ * 新增管理后台的企业微信、钉钉等社交登录 * 新增用户前台(例如说,用户使用的小程序)的后端项目 `yudao-user-server` +* 新增公共服务 `yudao-core-service` 项目,通过 Jar 包的方式,提供 `yudao-user-server` 和 `yudao-admin-server` 的共享逻辑的复用。 * 新增用户前台的手机登录、验证码登录、TODO * 修复管理后台的用户头像上传 404 的问题