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;