修复告警信息

This commit is contained in:
houwei 2024-06-28 15:52:43 +08:00
parent 6476418b5d
commit da91bb7ef2
8 changed files with 29 additions and 20 deletions

View File

@ -51,5 +51,5 @@ public class SysUserDto implements Serializable {
/**
* 角色列表
*/
private List<Long> roleList;
private List<String> roleList;
}

View File

@ -30,6 +30,7 @@ public class SysMenuVo implements Serializable {
/** 权限ID */
private Integer authorityId ;
/** 上级菜单ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long parentMenuId ;
/** 乐观锁 */
private Integer revision ;

View File

@ -30,6 +30,7 @@ public class SysOrgVo implements Serializable {
/** 机构简称 */
private String aliasName;
/** 上级组织机构id */
@JsonSerialize(using = ToStringSerializer.class)
private Long parentOrgId ;
private String parentOrgName ;

View File

@ -8,7 +8,7 @@ import java.io.Serial;
import java.io.Serializable;
/**
* 账号信息
* 权限信息
*
* @author guchengwei
*/
@ -17,7 +17,7 @@ public class SysRoleAuthVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 账号ID
* 主键ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;

View File

@ -1,5 +1,7 @@
package com.das.modules.auth.domain.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serial;
@ -29,5 +31,6 @@ public class TokenVo implements Serializable {
/**
* 账号ID
*/
@JsonSerialize(using = ToStringSerializer.class)
public long accountId;
}

View File

@ -146,7 +146,7 @@ public class LoginServiceImpl implements LoginService {
throw new ServiceException("原密码不正确");
}
String newPassword ="";
if (!StringUtils.isEmpty(changePasswordDto.getNewPassword())) {
if (StringUtils.hasText(changePasswordDto.getNewPassword())) {
newPassword = BCrypt.hashpw(changePasswordDto.getNewPassword(), BCrypt.gensalt());
sysUser.setPassword(newPassword);
}

View File

@ -44,7 +44,7 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public SysRoleDto createRole(SysRoleDto sysRoleDto) {
if (sysRoleDto.getRoleName() == null || sysRoleDto.getAuthList() == null || StringUtils.isEmpty(sysRoleDto.getRoleCode())) {
if (sysRoleDto.getRoleName() == null || sysRoleDto.getAuthList() == null || !StringUtils.hasText(sysRoleDto.getRoleCode())) {
throw new ServiceException("非法调用,参数缺失");
}
//判断角色编码code是否存在
@ -112,7 +112,7 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public SysRoleDto updateRole(SysRoleDto sysRoleDto) {
if (StringUtils.isEmpty(sysRoleDto.getId())) {
if (sysRoleDto.getId() == null) {
throw new ServiceException("参数缺失");
}
SysRole sysRole = sysRoleMapper.selectById(sysRoleDto.getId());
@ -163,7 +163,7 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public void deleteRole(DeleteDto deleteDto) {
SysRole sysRole = sysRoleMapper.selectById(deleteDto.getId());
if (StringUtils.isEmpty(deleteDto.getId())) {
if (deleteDto.getId()==null) {
throw new ServiceException("参数缺失");
}
long roleCount = sysRoleMapper.existRoleByRoleCode(sysRole.getRoleCode());

View File

@ -57,7 +57,7 @@ public class SysUserServiceImpl implements SysUserService {
BeanCopyUtils.copy(sysUserDto,sysUser);
//密码加密
String passwordEncode = "";
if (StringUtils.isEmpty(sysUserDto.getPassword())) {
if (!StringUtils.hasText(sysUserDto.getPassword())) {
passwordEncode = BCrypt.hashpw("123456789", BCrypt.gensalt());
} else {
passwordEncode = BCrypt.hashpw(sysUserDto.getPassword(), BCrypt.gensalt());
@ -80,7 +80,11 @@ public class SysUserServiceImpl implements SysUserService {
accountRoleQueryWrapper.eq("user_id",sysUser.getId());
sysUserRoleMapper.delete(accountRoleQueryWrapper);
//绑定角色
for (Long roleId : sysUserDto.getRoleList()) {
for (String srtRoleId : sysUserDto.getRoleList()) {
long roleId = Long.getLong(srtRoleId);
if (roleId == 0) {
continue;
}
SysUserRole accountRole = new SysUserRole();
accountRole.setUserId(sysUser.getId());
accountRole.setRoleId(roleId);
@ -98,16 +102,16 @@ public class SysUserServiceImpl implements SysUserService {
/**
* 验证角色是否存在
*/
private String checkErrorRole(List<Long> roles) {
private String checkErrorRole(List<String> roles) {
if (roles != null && !roles.isEmpty()) {
List<Long> errorRole = new ArrayList<>();
for (Long roleId : roles) {
if (roleId == null) {
continue;
}
long roleCount = sysRoleMapper.existRoleByRoleId(roleId);
if (roleCount == 0) {
errorRole.add(roleId);
for (String strRoleId : roles) {
if (StringUtils.hasText(strRoleId)) {
long roleId=Long.getLong(strRoleId);
long roleCount = sysRoleMapper.existRoleByRoleId(roleId);
if (roleCount == 0) {
errorRole.add(roleId);
}
}
}
if (!errorRole.isEmpty()) {
@ -157,8 +161,8 @@ public class SysUserServiceImpl implements SysUserService {
accountRoleQueryWrapper.eq("user_id",newSysUser.getId());
sysUserRoleMapper.delete(accountRoleQueryWrapper);
//绑定角色
for (Long roleId : sysUserDto.getRoleList()) {
for (String strRoleId : sysUserDto.getRoleList()) {
long roleId = Long.getLong(strRoleId);
SysUserRole accountRole = new SysUserRole();
accountRole.setUserId(sysUser.getId());
accountRole.setRoleId(roleId);
@ -190,7 +194,7 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public void deleteUser(DeleteDto deleteDto) {
if (StringUtils.isEmpty(deleteDto.getId())) {
if (deleteDto.getId() ==null) {
throw new ServiceException("参数缺失");
}
SysUser sysUser = sysUserMapper.selectById(deleteDto.getId());