过滤无效节点
This commit is contained in:
parent
fa678f893f
commit
8eb3168177
@ -179,11 +179,16 @@ public class PermissionPointApplyVO {
|
||||
/** 下级节点 **/
|
||||
private List<PermissionPointInfoVO> children;
|
||||
|
||||
public static PermissionPointInfoVO fromTreeNode(PermissionPointTreeNode node) {
|
||||
public static PermissionPointInfoVO fromTreeNode(PermissionPointTreeNode node, Set<Long> featureIds) {
|
||||
PermissionPointInfoVO res = null;
|
||||
if (node == null) {
|
||||
return res;
|
||||
}
|
||||
if (featureIds != null) {
|
||||
if (Objects.equals(node.getDataType(), 3) && !featureIds.contains(node.getPermissionPointId())) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
res = new PermissionPointInfoVO();
|
||||
res.setId(buildId(node.getDataType(), node.getPermissionPointId()));
|
||||
res.setSourceId(node.getPermissionPointId());
|
||||
@ -220,7 +225,7 @@ public class PermissionPointApplyVO {
|
||||
res.setParentBusinessNo(node.getParentBusinessNo());
|
||||
res.setDelegatedType(node.getDelegatedType());
|
||||
if (node.getChildren() != null) {
|
||||
res.setChildren(node.getChildren().stream().map(PermissionPointInfoVO::fromTreeNode).collect(Collectors.toList()));
|
||||
res.setChildren(node.getChildren().stream().map(e -> PermissionPointInfoVO.fromTreeNode(e, featureIds)).filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -248,17 +248,16 @@ public class SaasFeatureApplyServiceImpl implements SaasFeatureApplyService {
|
||||
req.setIds(featureIds);
|
||||
//如果权限点被删除了,数据渲染有问题
|
||||
List<PermissionPointTreeNode> top = permissionPointService.listTreeNodes(req);
|
||||
root = top.stream().map(PermissionPointApplyVO.PermissionPointInfoVO::fromTreeNode).collect(Collectors.toList());
|
||||
root = top.stream().map(e -> PermissionPointApplyVO.PermissionPointInfoVO.fromTreeNode(e, featureIds)).collect(Collectors.toList());
|
||||
} else {
|
||||
root = new ArrayList<>();
|
||||
}
|
||||
return buildTerminal(root, businessCodeParentMap, terminalParentMap, featureIds);
|
||||
return buildTerminal(root, businessCodeParentMap, terminalParentMap);
|
||||
}
|
||||
|
||||
private List<PermissionPointApplyVO.PermissionPointInfoVO> buildTerminal(List<PermissionPointApplyVO.PermissionPointInfoVO> root,
|
||||
Map<String, List<PermissionPointApplyVO.PermissionPointInfoVO>> businessCodeParentMap,
|
||||
Map<String, List<PermissionPointApplyVO.PermissionPointInfoVO>> terminalParentMap,
|
||||
Set<Long> featureIds) {
|
||||
Map<String, List<PermissionPointApplyVO.PermissionPointInfoVO>> terminalParentMap) {
|
||||
|
||||
if (MapUtils.isNotEmpty(terminalParentMap)) {
|
||||
// 如果有直接在端上的跟节点,需要补上节点
|
||||
@ -317,17 +316,9 @@ public class SaasFeatureApplyServiceImpl implements SaasFeatureApplyService {
|
||||
}
|
||||
}
|
||||
});
|
||||
// if (CollectionUtils.isNotEmpty(featureIds)) {
|
||||
// Set<String> targetIds = featureIds.stream().map(e -> PermissionPointApplyVO.PermissionPointInfoVO.buildId(3, e)).collect(Collectors.toSet());
|
||||
// flatRoot.removeIf(e -> targetIds.contains(e.getId()));
|
||||
// }
|
||||
return root;
|
||||
}
|
||||
|
||||
private void filterUnInclude() {
|
||||
|
||||
}
|
||||
|
||||
private List<PermissionPointApplyVO.PermissionPointInfoVO> detailToVO(List<SaasFeatureApplyDetail> details) {
|
||||
List<PermissionPointApplyVO.PermissionPointInfoVO> all =
|
||||
details.stream().sorted(Comparator.nullsLast(Comparator.comparing(SaasFeatureApplyDetail::getSort))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user