refactor(role-query): 用户增加返回ouid
This commit is contained in:
parent
611490ec33
commit
1e03e4c0df
@ -29,6 +29,9 @@ public class RoleWithUserRes {
|
||||
@Data
|
||||
public static class UserVO {
|
||||
|
||||
/** 企业组织ID **/
|
||||
private Long ouId;
|
||||
|
||||
/** 身份ID **/
|
||||
private Long identityId;
|
||||
|
||||
|
||||
@ -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<pgroupId>
|
||||
.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<pgroupId>
|
||||
.stream().collect(Collectors.groupingBy(SaasPermissionGroupVO::getId));
|
||||
}
|
||||
}
|
||||
Map<Long, List<SaasPgroupRoleRelation>> finalPgrouRelationMap = pgrouRelationMap;
|
||||
@ -129,12 +129,12 @@ public class RoleServiceImpl implements RoleService {
|
||||
List<SaasPermissionGroupVO> 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<SaasRoleGroupRelation> 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<SaasRole> 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<SaasPgroupRoleRelation> queryPermissionGroupRelation(List<Long> 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<Long> initRoleId = new HashSet<>();
|
||||
//有标准角,查询角色分组
|
||||
if (role.stream().anyMatch(r -> Objects.equals(RoleTypeEnum.INIT.getValue(), r.getRoleType()))) {
|
||||
List<SaasRoleGroupVO> roleGroupList = saasRoleGroupService.getList(QuerySaasRoleGroupReq.builder()
|
||||
List<SaasRoleGroupVO> 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<RoleWithUserRes.UserVO> 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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user