修复告警西信息

This commit is contained in:
houwei 2024-06-27 09:12:12 +08:00
parent 324df9a288
commit 29b36dbe6d
2 changed files with 5 additions and 5 deletions

View File

@ -88,7 +88,7 @@ public class SysRoleServiceImpl implements SysRoleService {
}
private String checkErrorAuthorities(List<Long> auths) {
if (auths != null && auths.size() > 0) {
if (auths != null && !auths.isEmpty()) {
List<Long> errorAuthority = new ArrayList<>();
for (Long authId : auths) {
if (authId == null) {
@ -99,7 +99,7 @@ public class SysRoleServiceImpl implements SysRoleService {
errorAuthority.add(authId);
}
}
if (errorAuthority.size() > 0) {
if (!errorAuthority.isEmpty()) {
try {
return JSON_MAPPER.writeValueAsString(errorAuthority);
} catch (JsonProcessingException e) {

View File

@ -66,7 +66,7 @@ public class SysUserServiceImpl implements SysUserService {
sysUser.setPassword(passwordEncode);
sysUserMapper.insert(sysUser);
if (sysUserDto.getRoleList() != null && sysUserDto.getRoleList().size() > 0) {
if (sysUserDto.getRoleList() != null && !sysUserDto.getRoleList().isEmpty()) {
//验证角色有效性
String errorRoles = checkErrorRole(sysUserDto.getRoleList());
if (StringUtils.hasText(errorRoles)) {
@ -96,7 +96,7 @@ public class SysUserServiceImpl implements SysUserService {
* 验证角色是否存在
*/
private String checkErrorRole(List<Long> roles) {
if (roles != null && roles.size() > 0) {
if (roles != null && !roles.isEmpty()) {
List<Long> errorRole = new ArrayList<>();
for (Long roleId : roles) {
if (roleId == null) {
@ -107,7 +107,7 @@ public class SysUserServiceImpl implements SysUserService {
errorRole.add(roleId);
}
}
if (errorRole.size() > 0) {
if (!errorRole.isEmpty()) {
try {
return JSON_MAPPER.writeValueAsString(errorRole);
} catch (JsonProcessingException e) {