From 2a524946157e8961d205d18b0bf24b2a17816877 Mon Sep 17 00:00:00 2001 From: dangxin <1242347652@qq.com> Date: Mon, 24 Feb 2025 22:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/enums/UserTypeEnum.java | 6 +++--- .../service/auth/AdminAuthServiceImpl.java | 17 +++++++++-------- .../service/user/AdminUserServiceImpl.java | 3 --- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/UserTypeEnum.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/UserTypeEnum.java index c950c52..5a42ec1 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/UserTypeEnum.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/UserTypeEnum.java @@ -13,9 +13,9 @@ import java.util.Arrays; @AllArgsConstructor @Getter public enum UserTypeEnum implements IntArrayValuable { - - MEMBER(1, "会员"), // 面向 c 端,普通用户 - ADMIN(2, "管理员"); // 面向 b 端,管理后台 + ORDINARY(1, "普通用户"), // 面向 c 端,企业用户 + MEMBER(2, "企业用户"), // 面向 c 端,企业用户 + ADMIN(3, "局内用户"); // 面向 b 端,管理后台 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(UserTypeEnum::getValue).toArray(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index cacc613..cfbf627 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -307,7 +307,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { AuthUser authUser = socialClientService.getAuthUser( SocialTypeEnum.WECHAT_MINI_APP.getType(), - UserTypeEnum.ADMIN.getValue(), // 假设用户类型为会员 + reqVO.getUserType(), // 假设用户类型为会员 reqVO.getCode(), reqVO.getState() ); @@ -332,14 +332,15 @@ public class AdminAuthServiceImpl implements AdminAuthService { throw exception(INSERT_ERROR); } - user = userService.autoRegisterUser(authUser, reqVO.getUserType()); - - //给一个默认的专管员角色 - UserRoleDO userRoleDO = new UserRoleDO(); - userRoleDO.setUserId(user.getId()); - userRoleDO.setRoleId(155L); - userRoleMapper.insert(userRoleDO); + if (reqVO.getUserType() == UserTypeEnum.ADMIN.getValue()) { + //给一个默认的专管员角色 + UserRoleDO userRoleDO = new UserRoleDO(); + userRoleDO.setUserId(user.getId()); + userRoleDO.setRoleId(155L); + userRoleMapper.insert(userRoleDO); + } + user = userService.autoRegisterUser(authUser, reqVO.getUserType()); user.setIsBand(false); } else { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index b24131e..0bb5791 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -559,9 +559,6 @@ public class AdminUserServiceImpl implements AdminUserService { user.setAvatar(authUser.getAvatar()); user.setStatus(CommonStatusEnum.ENABLE.getStatus()); user.setUserType(userType); - Set post = new HashSet<>(); - post.add(4l); - user.setPostIds(post); user.setPassword(encodePassword(authUser.getUuid().substring(authUser.getUuid().length() - 10))); // 随机密码 userMapper.insert(user); return user;