diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AuthorizationServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AuthorizationServiceImpl.java index 62d0b8e54..dd2ec06e5 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AuthorizationServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AuthorizationServiceImpl.java @@ -136,6 +136,9 @@ public class AuthorizationServiceImpl implements AuthorizationService { // 查询角色 List roleList = sysRoleService.getByUserId(user.getId()); List roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList()); + if (user.getIsAdmin()) { + roleNames.add("admin"); + } StpKit.USER.addRoleList(roleNames); // 权限赋予 List promissionList = sysMenuMapper.selectByUserId(user.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList()); @@ -143,9 +146,7 @@ public class AuthorizationServiceImpl implements AuthorizationService { if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) { promissionList.addAll(shopStaffPromissionList); } - if (user.getIsAdmin()) { - promissionList.add("admin"); - } + StpKit.USER.addPermissionList(promissionList); String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"); if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) { diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysUserServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysUserServiceImpl.java index d00d25451..578e9f1e5 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysUserServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysUserServiceImpl.java @@ -116,9 +116,11 @@ public class SysUserServiceImpl extends ServiceImpl imp @Override public Boolean edit(SysUserEditDTO sysUserEditDTO) { - long count = count(new QueryWrapper().eq(SysUser::getAccount, sysUserEditDTO.getAccount()).ne(SysUser::getId, sysUserEditDTO.getId())); - if (count > 0) { - throw new ApiNotPrintException("账号已存在"); + if (StrUtil.isNotBlank(sysUserEditDTO.getAccount())) { + long count = count(new QueryWrapper().eq(SysUser::getAccount, sysUserEditDTO.getAccount()).ne(SysUser::getId, sysUserEditDTO.getId())); + if (count > 0) { + throw new ApiNotPrintException("账号已存在"); + } } SysUser sysUser = getById(sysUserEditDTO.getId()); @@ -143,8 +145,12 @@ public class SysUserServiceImpl extends ServiceImpl imp if (sysUser == null) { throw new ApiNotPrintException("用户不存在"); } - int i = sysUsersRolesMapper.deleteByQuery(new QueryWrapper().eq(SysUsersRoles::getUserId, id)); - return i > 0; + boolean remove = remove(new QueryWrapper().eq(SysUser::getId, id)); + if (remove) { + int i = sysUsersRolesMapper.deleteByQuery(new QueryWrapper().eq(SysUsersRoles::getUserId, id)); + return i > 0; + } + return false; } @Override