fix(REQ-20240731): 同步优化
This commit is contained in:
parent
abe48655b7
commit
44ff2a52b1
@ -281,6 +281,7 @@ public class FeatureResourceSyncServiceImpl implements FeatureResourceSyncServic
|
|||||||
.uniCode(featureResource.getUniCode())
|
.uniCode(featureResource.getUniCode())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
roleCodes = roleCodes.stream().filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isEmpty(roleCodes)) {
|
if (CollectionUtils.isEmpty(roleCodes)) {
|
||||||
return logResourceBindRoleDO;
|
return logResourceBindRoleDO;
|
||||||
}
|
}
|
||||||
@ -357,15 +358,19 @@ public class FeatureResourceSyncServiceImpl implements FeatureResourceSyncServic
|
|||||||
.collect(Collectors.groupingBy(SaasPgroupRoleRelation::getGroupId,
|
.collect(Collectors.groupingBy(SaasPgroupRoleRelation::getGroupId,
|
||||||
Collectors.mapping(SaasPgroupRoleRelation::getRoleId, Collectors.toList())));
|
Collectors.mapping(SaasPgroupRoleRelation::getRoleId, Collectors.toList())));
|
||||||
|
|
||||||
Map<Long, String> roleIdToRoleCodeMap = roles.stream()
|
Map<Long, String> roleIdToRoleCodeMap = Maps.newHashMap();
|
||||||
.collect(Collectors.toMap(SaasRole::getId, SaasRole::getRoleCode));
|
for (SaasRole role : roles) {
|
||||||
|
if (StringUtils.isNotBlank(role.getRoleCode())) {
|
||||||
|
roleIdToRoleCodeMap.put(role.getId(), role.getRoleCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<Long, List<String>> featureRoleMap = new HashMap<>();
|
Map<Long, List<String>> featureRoleMap = new HashMap<>();
|
||||||
featureIdToGroupIdsMap.forEach((featureId, groupIds) -> {
|
featureIdToGroupIdsMap.forEach((featureId, groupIds) -> {
|
||||||
List<String> roleCodes = groupIds.stream()
|
List<String> roleCodes = groupIds.stream()
|
||||||
.flatMap(groupId -> groupIdToRoleIdsMap.getOrDefault(groupId, Collections.emptyList()).stream())
|
.flatMap(groupId -> groupIdToRoleIdsMap.getOrDefault(groupId, Collections.emptyList()).stream())
|
||||||
.map(roleIdToRoleCodeMap::get)
|
.map(roleIdToRoleCodeMap::get)
|
||||||
.filter(Objects::nonNull)
|
.filter(StringUtils::isNotBlank)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
featureRoleMap.put(featureId, roleCodes);
|
featureRoleMap.put(featureId, roleCodes);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user