From 19c590e83bc4200b576768897c0eb515fd4c59c4 Mon Sep 17 00:00:00 2001 From: xuyang <748613696@qq.com> Date: Wed, 28 Jun 2023 09:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eapp=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=92=8Capp=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/njcn/user/pojo/constant/RoleType.java | 4 +++- .../main/java/com/njcn/user/pojo/constant/UserType.java | 4 +++- .../com/njcn/user/service/impl/AppUserServiceImpl.java | 8 ++++++-- .../java/com/njcn/user/service/impl/RoleServiceImpl.java | 1 + .../java/com/njcn/user/service/impl/UserServiceImpl.java | 2 +- .../com/njcn/user/service/impl/UserSetServiceImpl.java | 1 + 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/RoleType.java b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/RoleType.java index 8da01d897..e81110758 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/RoleType.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/RoleType.java @@ -6,11 +6,13 @@ package com.njcn.user.pojo.constant; public interface RoleType { /** - * 角色类型 0:超级管理员;1:管理员;2:用户 + * 角色类型 0:超级管理员;1:管理员;2:用户 3:APP角色 */ int SUPER_ADMINISTRATOR = 0; int ADMINISTRATOR = 1; int USER = 2; + + int APP = 3; } diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/UserType.java b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/UserType.java index f69705697..0eef7f38f 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/UserType.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/constant/UserType.java @@ -15,7 +15,7 @@ public interface UserType { int OFFICIAL = 1; /** - * 用户权限类型 0:超级管理员;1:管理员;2:用户 + * 用户权限类型 0:超级管理员;1:管理员;2:用户;3:APP用户 */ int SUPER_ADMINISTRATOR = 0; @@ -23,6 +23,8 @@ public interface UserType { int USER = 2; + int APP = 3; + String SUPER_ADMIN = "root"; } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java index 8a981d8a7..c5da5f569 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/AppUserServiceImpl.java @@ -207,7 +207,11 @@ public class AppUserServiceImpl extends ServiceImpl impleme //发送密码短信 //sendPasswordMessage(phone,newUser.getId()); //获取登录信息 - return autoLogin(phone); + Object object = autoLogin(phone); + if (Objects.isNull(object)){ + throw new BusinessException(UserResponseEnum.LOGIN_ERROR); + } + return object; } @@ -364,7 +368,7 @@ public class AppUserServiceImpl extends ServiceImpl impleme * @return */ public Object autoLogin(String phone) { - String userUrl = "http://127.0.0.1:10215/pqs-auth/oauth/token"; + String userUrl = "http://127.0.0.1:10214/oauth/token"; UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(userUrl) .queryParam("grant_type", "sms_code") .queryParam("client_id", "njcnapp") diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/RoleServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/RoleServiceImpl.java index 907003b18..9e1e71722 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/RoleServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/RoleServiceImpl.java @@ -126,6 +126,7 @@ public class RoleServiceImpl extends ServiceImpl implements IR role.add(RoleType.ADMINISTRATOR); } else { role.add(RoleType.USER); + role.add(RoleType.APP); } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode()); diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java index 672d8837a..e0073881e 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java @@ -278,7 +278,7 @@ public class UserServiceImpl extends ServiceImpl implements IU type = UserType.ADMINISTRATOR; } else if (Objects.equals(UserType.ADMINISTRATOR, type)) { type = UserType.USER; - } else if (Objects.equals(UserType.USER, type)) { + } else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) { return page; } if (ObjectUtil.isNotNull(queryParam)) { diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java index e8e732a34..6728bca4f 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java @@ -90,6 +90,7 @@ public class UserSetServiceImpl extends ServiceImpl impl Sm4Utils sm4 = new Sm4Utils(secretKey); //随机生成8位密码 String password = PubUtils.getCode(8); + System.out.println("password===:" + password); redisUtil.saveByKeyWithExpire(userId,password,10L); //SM4加密初始默认密码 String strSm4 = sm4.encryptData_ECB(password);