diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/model/res/RoleWithUserRes.java b/tyr-api/src/main/java/cn/axzo/tyr/client/model/res/RoleWithUserRes.java index ce2a6e0d..dc5479f1 100644 --- a/tyr-api/src/main/java/cn/axzo/tyr/client/model/res/RoleWithUserRes.java +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/model/res/RoleWithUserRes.java @@ -29,6 +29,9 @@ public class RoleWithUserRes { @Data public static class UserVO { + /** 企业组织ID **/ + private Long ouId; + /** 身份ID **/ private Long identityId; diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/RoleServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/RoleServiceImpl.java index ecc4f893..da51ec43 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/RoleServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/RoleServiceImpl.java @@ -111,15 +111,15 @@ public class RoleServiceImpl implements RoleService { pgrouRelationMap = saasPgroupRoleRelations.stream().collect(Collectors.groupingBy(SaasPgroupRoleRelation::getRoleId)); // 查询权限集 pGroupMap = permissionGroupService.page(QuerySaasPermissionGroupReq.builder() - .isCommon(isCommon) - .roleIds(roleIds) - .ids(saasPgroupRoleRelations.stream().map(SaasPgroupRoleRelation::getGroupId).collect(Collectors.toList())) - .workspaceId(workspaceId) - .ouId(ouId) - .fetchPage(Boolean.FALSE) - .build()).getList() - // 转map - .stream().collect(Collectors.groupingBy(SaasPermissionGroupVO::getId)); + .isCommon(isCommon) + .roleIds(roleIds) + .ids(saasPgroupRoleRelations.stream().map(SaasPgroupRoleRelation::getGroupId).collect(Collectors.toList())) + .workspaceId(workspaceId) + .ouId(ouId) + .fetchPage(Boolean.FALSE) + .build()).getList() + // 转map + .stream().collect(Collectors.groupingBy(SaasPermissionGroupVO::getId)); } } Map> finalPgrouRelationMap = pgrouRelationMap; @@ -129,12 +129,12 @@ public class RoleServiceImpl implements RoleService { List pGroup = new ArrayList<>(); if (finalPgrouRelationMap != null && finalPgrouRelationMap.containsKey(role.getId())) { pGroup = finalPgrouRelationMap.get(role.getId()) - .stream() - .map(SaasPgroupRoleRelation::getGroupId) - .map(finalPGroupMap::get) - .filter(Objects::nonNull) - .flatMap(List::stream) - .collect(Collectors.toList()); + .stream() + .map(SaasPgroupRoleRelation::getGroupId) + .map(finalPGroupMap::get) + .filter(Objects::nonNull) + .flatMap(List::stream) + .collect(Collectors.toList()); } SaasRoleVO saasRoleVO = BeanUtil.copyProperties(role, SaasRoleVO.class); saasRoleVO.setPermissionGroup(pGroup); @@ -173,8 +173,8 @@ public class RoleServiceImpl implements RoleService { List groupRelation = new ArrayList<>(); if (CollectionUtils.isNotEmpty(roleGroup)) { groupRelation = roleGroupRelationDao.lambdaQuery() - .in(SaasRoleGroupRelation::getSaasRoleGroupId, roleGroup.stream().map(BaseEntity::getId).collect(Collectors.toList())) - .list(); + .in(SaasRoleGroupRelation::getSaasRoleGroupId, roleGroup.stream().map(BaseEntity::getId).collect(Collectors.toList())) + .list(); if (CollectionUtils.isEmpty(groupRelation)) { return new ArrayList<>(); } @@ -197,12 +197,12 @@ public class RoleServiceImpl implements RoleService { req.forEach(e -> { result.add(QueryBatchByIdentityIdTypeRes.builder() - .identityId(e.getIdentityId()) - .identityType(e.getIdentityType()) - .workspaceId(e.getWorkspaceId()) - .ouId(e.getOuId()) - .role(queryByIdentityIdType(e.getIdentityId(),e.getIdentityType(),e.getWorkspaceId(),e.getOuId())) - .build()); + .identityId(e.getIdentityId()) + .identityType(e.getIdentityType()) + .workspaceId(e.getWorkspaceId()) + .ouId(e.getOuId()) + .role(queryByIdentityIdType(e.getIdentityId(),e.getIdentityType(),e.getWorkspaceId(),e.getOuId())) + .build()); }); return result; } @@ -264,17 +264,17 @@ public class RoleServiceImpl implements RoleService { List list = new ArrayList<>(); if (CollectionUtils.isNotEmpty(roleIds)) { list = saasRoleDao.lambdaQuery() - .in(BaseEntity::getId, roleIds) - .eq(SaasRole::getRoleType, RoleTypeEnum.SUPER_ADMIN.getValue()) - .list(); + .in(BaseEntity::getId, roleIds) + .eq(SaasRole::getRoleType, RoleTypeEnum.SUPER_ADMIN.getValue()) + .list(); } result.add(IsSuperAdminRes.builder() - .identityId(e.getIdentityId()) - .identityType(e.getIdentityType()) - .workspaceId(e.getWorkspaceId()) - .ouId(e.getOuId()) - .isSuperAdmin(CollectionUtils.isNotEmpty(list)?true:false) - .build()); + .identityId(e.getIdentityId()) + .identityType(e.getIdentityType()) + .workspaceId(e.getWorkspaceId()) + .ouId(e.getOuId()) + .isSuperAdmin(CollectionUtils.isNotEmpty(list)?true:false) + .build()); }); return result; } @@ -407,9 +407,9 @@ public class RoleServiceImpl implements RoleService { */ public List queryPermissionGroupRelation(List roleIds) { return saasPgroupRoleRelationDao.lambdaQuery() - .in(SaasPgroupRoleRelation::getRoleId, roleIds) - .eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value) - .list(); + .in(SaasPgroupRoleRelation::getRoleId, roleIds) + .eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value) + .list(); } @Override @@ -422,7 +422,7 @@ public class RoleServiceImpl implements RoleService { Set initRoleId = new HashSet<>(); //有标准角,查询角色分组 if (role.stream().anyMatch(r -> Objects.equals(RoleTypeEnum.INIT.getValue(), r.getRoleType()))) { - List roleGroupList = saasRoleGroupService.getList(QuerySaasRoleGroupReq.builder() + List roleGroupList = saasRoleGroupService.getList(QuerySaasRoleGroupReq.builder() .workspaceTypeCode(Collections.singletonList(userRoleInfoMap.getWorkspaceType().toString())) .ouTypeCode(Collections.singletonList(userRoleInfoMap.getWorkspaceJoinType().getValue().toString())) .build()); @@ -436,7 +436,7 @@ public class RoleServiceImpl implements RoleService { .collect(Collectors.toList()); return resultRole.stream().map( - e -> e.getMatchFeature(userRoleInfoMap.workspaceId, userRoleInfoMap.getOuId())) + e -> e.getMatchFeature(userRoleInfoMap.workspaceId, userRoleInfoMap.getOuId())) .flatMap(List::stream) .map(PermissionPointTreeNode::getPermissionPointId) .collect(Collectors.toSet()); @@ -471,6 +471,7 @@ public class RoleServiceImpl implements RoleService { if (CollectionUtil.isNotEmpty(relations)) { List users = relations.stream().map(e -> { RoleWithUserRes.UserVO user = new RoleWithUserRes.UserVO(); + user.setOuId(req.getOuId()); user.setIdentityId(e.getIdentityId()); user.setIdentityType(e.getIdentityType()); return user;