新增app用户和app角色
This commit is contained in:
@@ -6,11 +6,13 @@ package com.njcn.user.pojo.constant;
|
|||||||
public interface RoleType {
|
public interface RoleType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色类型 0:超级管理员;1:管理员;2:用户
|
* 角色类型 0:超级管理员;1:管理员;2:用户 3:APP角色
|
||||||
*/
|
*/
|
||||||
int SUPER_ADMINISTRATOR = 0;
|
int SUPER_ADMINISTRATOR = 0;
|
||||||
|
|
||||||
int ADMINISTRATOR = 1;
|
int ADMINISTRATOR = 1;
|
||||||
|
|
||||||
int USER = 2;
|
int USER = 2;
|
||||||
|
|
||||||
|
int APP = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public interface UserType {
|
|||||||
int OFFICIAL = 1;
|
int OFFICIAL = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户权限类型 0:超级管理员;1:管理员;2:用户
|
* 用户权限类型 0:超级管理员;1:管理员;2:用户;3:APP用户
|
||||||
*/
|
*/
|
||||||
int SUPER_ADMINISTRATOR = 0;
|
int SUPER_ADMINISTRATOR = 0;
|
||||||
|
|
||||||
@@ -23,6 +23,8 @@ public interface UserType {
|
|||||||
|
|
||||||
int USER = 2;
|
int USER = 2;
|
||||||
|
|
||||||
|
int APP = 3;
|
||||||
|
|
||||||
String SUPER_ADMIN = "root";
|
String SUPER_ADMIN = "root";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
|||||||
//发送密码短信
|
//发送密码短信
|
||||||
//sendPasswordMessage(phone,newUser.getId());
|
//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
|
* @return
|
||||||
*/
|
*/
|
||||||
public Object autoLogin(String phone) {
|
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)
|
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(userUrl)
|
||||||
.queryParam("grant_type", "sms_code")
|
.queryParam("grant_type", "sms_code")
|
||||||
.queryParam("client_id", "njcnapp")
|
.queryParam("client_id", "njcnapp")
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||||||
role.add(RoleType.ADMINISTRATOR);
|
role.add(RoleType.ADMINISTRATOR);
|
||||||
} else {
|
} else {
|
||||||
role.add(RoleType.USER);
|
role.add(RoleType.USER);
|
||||||
|
role.add(RoleType.APP);
|
||||||
}
|
}
|
||||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode());
|
queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode());
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
type = UserType.ADMINISTRATOR;
|
type = UserType.ADMINISTRATOR;
|
||||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type)) {
|
} else if (Objects.equals(UserType.ADMINISTRATOR, type)) {
|
||||||
type = UserType.USER;
|
type = UserType.USER;
|
||||||
} else if (Objects.equals(UserType.USER, type)) {
|
} else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(queryParam)) {
|
if (ObjectUtil.isNotNull(queryParam)) {
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> impl
|
|||||||
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
Sm4Utils sm4 = new Sm4Utils(secretKey);
|
||||||
//随机生成8位密码
|
//随机生成8位密码
|
||||||
String password = PubUtils.getCode(8);
|
String password = PubUtils.getCode(8);
|
||||||
|
System.out.println("password===:" + password);
|
||||||
redisUtil.saveByKeyWithExpire(userId,password,10L);
|
redisUtil.saveByKeyWithExpire(userId,password,10L);
|
||||||
//SM4加密初始默认密码
|
//SM4加密初始默认密码
|
||||||
String strSm4 = sm4.encryptData_ECB(password);
|
String strSm4 = sm4.encryptData_ECB(password);
|
||||||
|
|||||||
Reference in New Issue
Block a user