微调
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.gather.device.err.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2024-12-02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqErrSysDtlsVO {
|
||||||
|
/**
|
||||||
|
* 列1
|
||||||
|
*/
|
||||||
|
private String col1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列2
|
||||||
|
*/
|
||||||
|
private String col2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置等级
|
||||||
|
*/
|
||||||
|
private String devLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测量类型
|
||||||
|
*/
|
||||||
|
private String testType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测量条件 & 最大误差
|
||||||
|
*/
|
||||||
|
private List<Map<String, Object>> info;
|
||||||
|
}
|
||||||
@@ -183,11 +183,12 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
|||||||
if (CollectionUtils.isEmpty(dictTree.getChildren())) {
|
if (CollectionUtils.isEmpty(dictTree.getChildren())) {
|
||||||
list.remove(i);
|
list.remove(i);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!CollectionUtils.isEmpty(children)) {
|
|
||||||
filter(children, keyword);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// if (!CollectionUtils.isEmpty(children)) {
|
||||||
|
// filter(children, keyword);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.gather.user.pojo.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2024/11/11
|
||||||
|
*/
|
||||||
|
public interface UserConst {
|
||||||
|
Integer STATE_DELETE = 0;
|
||||||
|
Integer STATE_ENABLE = 1;
|
||||||
|
Integer STATE_LOCKED = 2;
|
||||||
|
Integer STATE_WAITING_FOR_APPROVAL = 3;
|
||||||
|
Integer STATE_SLEEPING = 4;
|
||||||
|
Integer STATE_PASSWORD_EXPIRED = 5;
|
||||||
|
|
||||||
|
String SUPER_ADMIN = "root";
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.njcn.gather.user.pojo.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author caozehui
|
|
||||||
* @data 2024/11/11
|
|
||||||
*/
|
|
||||||
public interface UserState {
|
|
||||||
Integer DELETE = 0;
|
|
||||||
Integer ENABLE = 1;
|
|
||||||
Integer LOCKED = 2;
|
|
||||||
Integer WAITING_FOR_APPROVAL = 3;
|
|
||||||
Integer SLEEPING = 4;
|
|
||||||
Integer PASSWORD_EXPIRED = 5;
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,8 @@ public enum UserResponseEnum {
|
|||||||
SUPER_ADMINSTRATOR_ROLE_CANNOT_DELETE("A010009", "禁止删除超级管理员角色"),
|
SUPER_ADMINSTRATOR_ROLE_CANNOT_DELETE("A010009", "禁止删除超级管理员角色"),
|
||||||
SUPER_ADMIN_CANNOT_DELETE("A010010", "禁止删除超级管理员用户"),
|
SUPER_ADMIN_CANNOT_DELETE("A010010", "禁止删除超级管理员用户"),
|
||||||
COMPONENT_NOT_BLANK("A010011", "组件地址不能为空"),
|
COMPONENT_NOT_BLANK("A010011", "组件地址不能为空"),
|
||||||
FUNCTION_PATH_FORMAT_ERROR("A010012", "路由地址格式错误");
|
FUNCTION_PATH_FORMAT_ERROR("A010012", "路由地址格式错误"),
|
||||||
|
SUPER_ADMIN_REPEAT("A010013","超级管理员已存在,请勿重复添加" );
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
private String message;
|
private String message;
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
|
|||||||
return buttonMap;
|
return buttonMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private <T extends SysFunction> List<SysFunction> getChildrenList(T currMenu, List<? extends SysFunction> categories) {
|
private <T extends SysFunction> List<SysFunction> getChildrenList(T currMenu, List<? extends SysFunction> categories) {
|
||||||
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId())).peek(o -> o.setChildren(getChildrenList(o, categories))).sorted(Comparator.comparingInt(SysFunction::getSort)).collect(Collectors.toList());
|
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId())).peek(o -> o.setChildren(getChildrenList(o, categories))).sorted(Comparator.comparingInt(SysFunction::getSort)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -211,52 +210,12 @@ public class SysFunctionServiceImpl extends ServiceImpl<SysFunctionMapper, SysFu
|
|||||||
if (CollectionUtils.isEmpty(function.getChildren())) {
|
if (CollectionUtils.isEmpty(function.getChildren())) {
|
||||||
list.remove(i);
|
list.remove(i);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!CollectionUtils.isEmpty(children)) {
|
|
||||||
filter(children, keyword);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
// else {
|
||||||
}
|
// if (!CollectionUtils.isEmpty(children)) {
|
||||||
|
// filter(children, keyword);
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public List<MenuVO> getMenuByUserId(String userId) {
|
|
||||||
// List<MenuVO> menu = this.baseMapper.getMenuByUserId(userId);
|
|
||||||
// HashSet<String> menuIdSet = new HashSet<>();
|
|
||||||
// menuIdSet.addAll(menu.stream().map(MenuVO::getId).collect(Collectors.toList()));
|
|
||||||
// menu.stream().forEach(m -> {
|
|
||||||
// String pids = m.getPids();
|
|
||||||
// if (StrUtil.isNotBlank(pids)) {
|
|
||||||
// String[] pidArr = pids.split(",");
|
|
||||||
// for (String pid : pidArr) {
|
|
||||||
// menuIdSet.add(pid);
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
}
|
||||||
// List<MenuVO> menu this.baseMapper.getMenuByIds(menuIdSet);
|
}
|
||||||
// menu.stream().forEach(m -> {
|
|
||||||
// MetaVO meta = new MetaVO();
|
|
||||||
// meta.setIcon(m.getIcon());
|
|
||||||
// meta.setTitle(m.getName());
|
|
||||||
// meta.setIsLink("");
|
|
||||||
// meta.setHide(false);
|
|
||||||
// meta.setFull(false);
|
|
||||||
// meta.setAffix(false);
|
|
||||||
// meta.setKeepAlive(true);
|
|
||||||
// m.setMeta(meta);
|
|
||||||
// m.setName(m.getCode());
|
|
||||||
// });
|
|
||||||
// return menu.stream().filter(fun -> Objects.equals(FunctionConst.FATHER_PID, fun.getPid())).peek(funS -> {
|
|
||||||
// List<SysFunction> childrenList = getChildrenList(funS, menu);
|
|
||||||
// if (ObjectUtil.isNull(childrenList) || childrenList.size() == 0) {
|
|
||||||
// funS.setRedirect(null);
|
|
||||||
// } else {
|
|
||||||
// funS.setRedirect(funS.getComponent());
|
|
||||||
// funS.setComponent(null);
|
|
||||||
// }
|
|
||||||
// funS.setChildren(childrenList);
|
|
||||||
// })
|
|
||||||
// .sorted(Comparator.comparingInt(MenuVO::getSort)).collect(Collectors.toList());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@@ -11,13 +11,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.utils.sm.Sm4Utils;
|
import com.njcn.common.utils.sm.Sm4Utils;
|
||||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||||
import com.njcn.gather.user.pojo.constant.RoleConst;
|
import com.njcn.gather.user.pojo.constant.RoleConst;
|
||||||
import com.njcn.gather.user.pojo.constant.UserState;
|
import com.njcn.gather.user.pojo.constant.UserConst;
|
||||||
import com.njcn.gather.user.pojo.enums.UserResponseEnum;
|
import com.njcn.gather.user.pojo.enums.UserResponseEnum;
|
||||||
import com.njcn.gather.user.user.mapper.SysUserMapper;
|
import com.njcn.gather.user.user.mapper.SysUserMapper;
|
||||||
import com.njcn.gather.user.user.pojo.param.SysUserParam;
|
import com.njcn.gather.user.user.pojo.param.SysUserParam;
|
||||||
import com.njcn.gather.user.user.pojo.po.SysRole;
|
import com.njcn.gather.user.user.pojo.po.SysRole;
|
||||||
import com.njcn.gather.user.user.pojo.po.SysUser;
|
import com.njcn.gather.user.user.pojo.po.SysUser;
|
||||||
import com.njcn.gather.user.user.service.ISysRoleService;
|
|
||||||
import com.njcn.gather.user.user.service.ISysUserRoleService;
|
import com.njcn.gather.user.user.service.ISysUserRoleService;
|
||||||
import com.njcn.gather.user.user.service.ISysUserService;
|
import com.njcn.gather.user.user.service.ISysUserService;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
@@ -42,7 +41,6 @@ import java.util.stream.Collectors;
|
|||||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
|
||||||
|
|
||||||
private final ISysUserRoleService sysUserRoleService;
|
private final ISysUserRoleService sysUserRoleService;
|
||||||
private final ISysRoleService sysRoleService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SysUser> listUser(SysUserParam.SysUserQueryParam queryParam) {
|
public Page<SysUser> listUser(SysUserParam.SysUserQueryParam queryParam) {
|
||||||
@@ -59,7 +57,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
} else {
|
} else {
|
||||||
queryWrapper.orderByDesc("sys_user.update_time");
|
queryWrapper.orderByDesc("sys_user.update_time");
|
||||||
}
|
}
|
||||||
queryWrapper.ne("sys_user.state", UserState.DELETE);
|
queryWrapper.ne("sys_user.Login_Name", UserConst.SUPER_ADMIN).ne("sys_user.state", UserConst.STATE_DELETE);
|
||||||
Page<SysUser> page = this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
Page<SysUser> page = this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||||
page.getRecords().forEach(sysUser -> {
|
page.getRecords().forEach(sysUser -> {
|
||||||
List<SysRole> sysRoles = sysUserRoleService.listRoleByUserId(sysUser.getId());
|
List<SysRole> sysRoles = sysUserRoleService.listRoleByUserId(sysUser.getId());
|
||||||
@@ -72,20 +70,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
@Override
|
@Override
|
||||||
public List<SysUser> listUserByDeptId(String deptId) {
|
public List<SysUser> listUserByDeptId(String deptId) {
|
||||||
if (StrUtil.isNotBlank(deptId)) {
|
if (StrUtil.isNotBlank(deptId)) {
|
||||||
return this.lambdaQuery().ne(SysUser::getState, UserState.DELETE).eq(SysUser::getDeptId, deptId).orderByAsc(SysUser::getCreateTime).list();
|
return this.lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getDeptId, deptId).orderByAsc(SysUser::getCreateTime).list();
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUser getUserByLoginName(String loginName) {
|
public SysUser getUserByLoginName(String loginName) {
|
||||||
return this.lambdaQuery().ne(SysUser::getState, UserState.DELETE).eq(SysUser::getLoginName, loginName).one();
|
return this.lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getLoginName, loginName).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUser getUserByPhone(String phone, boolean isExcludeSelf, String id) {
|
public SysUser getUserByPhone(String phone, boolean isExcludeSelf, String id) {
|
||||||
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
||||||
lambdaQuery.eq(SysUser::getPhone, phone).ne(SysUser::getState, UserState.DELETE);
|
lambdaQuery.eq(SysUser::getPhone, phone).ne(SysUser::getState, UserConst.STATE_DELETE);
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
lambdaQuery.ne(SysUser::getId, id);
|
lambdaQuery.ne(SysUser::getId, id);
|
||||||
}
|
}
|
||||||
@@ -95,7 +93,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
@Override
|
@Override
|
||||||
public SysUser getUserByName(String name, boolean isExcludeSelf, String id) {
|
public SysUser getUserByName(String name, boolean isExcludeSelf, String id) {
|
||||||
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
||||||
lambdaQuery.eq(SysUser::getName, name).ne(SysUser::getState, UserState.DELETE);
|
lambdaQuery.eq(SysUser::getName, name).ne(SysUser::getState, UserConst.STATE_DELETE);
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
lambdaQuery.ne(SysUser::getId, id);
|
lambdaQuery.ne(SysUser::getId, id);
|
||||||
}
|
}
|
||||||
@@ -105,7 +103,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
@Override
|
@Override
|
||||||
public SysUser getUserByEmail(String email, boolean isExcludeSelf, String id) {
|
public SysUser getUserByEmail(String email, boolean isExcludeSelf, String id) {
|
||||||
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysUser> lambdaQuery = new LambdaQueryWrapper<>();
|
||||||
lambdaQuery.eq(SysUser::getEmail, email).ne(SysUser::getState, UserState.DELETE);
|
lambdaQuery.eq(SysUser::getEmail, email).ne(SysUser::getState, UserConst.STATE_DELETE);
|
||||||
if (isExcludeSelf) {
|
if (isExcludeSelf) {
|
||||||
lambdaQuery.ne(SysUser::getId, id);
|
lambdaQuery.ne(SysUser::getId, id);
|
||||||
}
|
}
|
||||||
@@ -114,6 +112,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addUser(SysUserParam.SysUserAddParam addUserParam) {
|
public boolean addUser(SysUserParam.SysUserAddParam addUserParam) {
|
||||||
|
if (UserConst.SUPER_ADMIN.equals(addUserParam.getLoginName())) {
|
||||||
|
throw new BusinessException(UserResponseEnum.SUPER_ADMIN_REPEAT);
|
||||||
|
}
|
||||||
if (!Objects.isNull(getUserByLoginName(addUserParam.getLoginName()))) {
|
if (!Objects.isNull(getUserByLoginName(addUserParam.getLoginName()))) {
|
||||||
throw new BusinessException(UserResponseEnum.LOGIN_NAME_REPEAT);
|
throw new BusinessException(UserResponseEnum.LOGIN_NAME_REPEAT);
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
// todo 别忘记移除登录时间
|
// todo 别忘记移除登录时间
|
||||||
sysUser.setLoginTime(LocalDateTimeUtil.now());
|
sysUser.setLoginTime(LocalDateTimeUtil.now());
|
||||||
sysUser.setLoginErrorTimes(0);
|
sysUser.setLoginErrorTimes(0);
|
||||||
sysUser.setState(UserState.ENABLE);
|
sysUser.setState(UserConst.STATE_ENABLE);
|
||||||
boolean result = this.save(sysUser);
|
boolean result = this.save(sysUser);
|
||||||
sysUserRoleService.addUserRole(sysUser.getId(), addUserParam.getRoleIds());
|
sysUserRoleService.addUserRole(sysUser.getId(), addUserParam.getRoleIds());
|
||||||
return result;
|
return result;
|
||||||
@@ -143,7 +144,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean oldPwdConfirm(String userId, String oldPassword) {
|
public boolean oldPwdConfirm(String userId, String oldPassword) {
|
||||||
SysUser user = lambdaQuery().ne(SysUser::getState, UserState.DELETE).eq(SysUser::getId, userId).one();
|
SysUser user = lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getId, userId).one();
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
String secretkey = Sm4Utils.globalSecretKey;
|
String secretkey = Sm4Utils.globalSecretKey;
|
||||||
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
||||||
@@ -156,7 +157,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updatePassword(String userId, String newPassword) {
|
public boolean updatePassword(String userId, String newPassword) {
|
||||||
SysUser user = lambdaQuery().ne(SysUser::getState, UserState.DELETE).eq(SysUser::getId, userId).one();
|
SysUser user = lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getId, userId).one();
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
String secretkey = Sm4Utils.globalSecretKey;
|
String secretkey = Sm4Utils.globalSecretKey;
|
||||||
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
||||||
@@ -179,7 +180,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
// 删除用户角色关联数据
|
// 删除用户角色关联数据
|
||||||
sysUserRoleService.deleteUserRoleByUserIds(ids);
|
sysUserRoleService.deleteUserRoleByUserIds(ids);
|
||||||
return this.lambdaUpdate()
|
return this.lambdaUpdate()
|
||||||
.set(SysUser::getState, UserState.DELETE)
|
.set(SysUser::getState, UserConst.STATE_DELETE)
|
||||||
.in(SysUser::getId, ids)
|
.in(SysUser::getId, ids)
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
@@ -188,14 +189,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
public SysUser getUserByLoginNameAndPassword(String loginName, String password) {
|
public SysUser getUserByLoginNameAndPassword(String loginName, String password) {
|
||||||
String secretkey = Sm4Utils.globalSecretKey;
|
String secretkey = Sm4Utils.globalSecretKey;
|
||||||
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
Sm4Utils sm4 = new Sm4Utils(secretkey);
|
||||||
return this.lambdaQuery().ne(SysUser::getState, UserState.DELETE)
|
return this.lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE)
|
||||||
.eq(SysUser::getLoginName, loginName)
|
.eq(SysUser::getLoginName, loginName)
|
||||||
.eq(SysUser::getPassword, sm4.encryptData_ECB(password)).one();
|
.eq(SysUser::getPassword, sm4.encryptData_ECB(password)).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAdmin(String userId) {
|
public boolean isAdmin(String userId) {
|
||||||
SysUser user = lambdaQuery().ne(SysUser::getState, UserState.DELETE).eq(SysUser::getId, userId).one();
|
SysUser user = lambdaQuery().ne(SysUser::getState, UserConst.STATE_DELETE).eq(SysUser::getId, userId).one();
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
List<SysRole> sysRoles = sysUserRoleService.listRoleByUserId(user.getId());
|
List<SysRole> sysRoles = sysUserRoleService.listRoleByUserId(user.getId());
|
||||||
for (SysRole sysRole : sysRoles) {
|
for (SysRole sysRole : sysRoles) {
|
||||||
|
|||||||
Reference in New Issue
Block a user