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