新增app用户和app角色

This commit is contained in:
2023-06-28 09:31:19 +08:00
parent b8ca417fbd
commit 19c590e83b
6 changed files with 15 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -15,7 +15,7 @@ public interface UserType {
int OFFICIAL = 1;
/**
* 用户权限类型 0超级管理员1管理员2用户
* 用户权限类型 0超级管理员1管理员2用户3APP用户
*/
int SUPER_ADMINISTRATOR = 0;
@@ -23,6 +23,8 @@ public interface UserType {
int USER = 2;
int APP = 3;
String SUPER_ADMIN = "root";
}

View File

@@ -207,7 +207,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> 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<AppUserMapper, User> 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")

View File

@@ -126,6 +126,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
role.add(RoleType.ADMINISTRATOR);
} else {
role.add(RoleType.USER);
role.add(RoleType.APP);
}
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode());

View File

@@ -278,7 +278,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> 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)) {

View File

@@ -90,6 +90,7 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> 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);