mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
角色分配用户增加organid和角色的organid统一的处理:为空或不一致都统一为角色的机构;
This commit is contained in:
+16
-3
@@ -172,8 +172,9 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
throw new ServiceException(ErrorCodeConstants.ROLE_NOT_EXISTS);
|
||||
}
|
||||
// 前端没传或者查一次后切换了组织导致跟角色组织不一致的统一为角色的组织
|
||||
if (Objects.isNull(organId) || ObjectUtil.notEqual(role.getOrganId(), organId)) {
|
||||
organId = role.getOrganId();
|
||||
Long roleOrganId = role.getOrganId();
|
||||
if (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId)) {
|
||||
organId = roleOrganId;
|
||||
}
|
||||
final Long finalOrganId = organId;
|
||||
|
||||
@@ -304,6 +305,8 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
Set<Long> userIds = reqVO.getUserIds();
|
||||
// 组织id
|
||||
Long organId = reqVO.getOrganId();
|
||||
// 角色id
|
||||
Long roleId = reqVO.getRoleId();
|
||||
// 超管不传组织id则操作本机构角色
|
||||
// 非超管不传组织id不允许操作
|
||||
if (isSupAdmin) {
|
||||
@@ -313,8 +316,18 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
throw new ServiceException(ErrorCodeConstants.ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR);
|
||||
}
|
||||
}
|
||||
// 查询角色获取角色的组织id,如果没有传入组织id就跟角色的组织统一
|
||||
RoleDO role = roleService.getRole(roleId);
|
||||
if (Objects.isNull(role)) {
|
||||
throw new ServiceException(ErrorCodeConstants.ROLE_NOT_EXISTS);
|
||||
}
|
||||
// 前端没传或者查一次后切换了组织导致跟角色组织不一致的统一为角色的组织
|
||||
Long roleOrganId = role.getOrganId();
|
||||
if (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId)) {
|
||||
organId = roleOrganId;
|
||||
}
|
||||
final Long finalOrganId = organId;
|
||||
Long roleId = reqVO.getRoleId();
|
||||
|
||||
// 当前用户不能操作含有自己的角色
|
||||
if (CollectionUtil.isNotEmpty(userIds)) {
|
||||
Long incloudSelf = userIds.stream().filter(userId -> userId.equals(loginUser.getId())).findAny().orElse(null);
|
||||
|
||||
Reference in New Issue
Block a user