|
|
|
@ -63,15 +63,18 @@ public class DirectoryTreeService { |
|
|
|
|
Set<String> permisDis = "write".equals(permis) ? dirPermissionService.getByWritePermis(user) : dirPermissionService.getByReadPermis(user); |
|
|
|
|
// 判断权限范围
|
|
|
|
|
List<DirectoryVo> permisDirectoryList = StreamUtil.as(directoryList).filter(dir -> { |
|
|
|
|
if(dir.getReviewStatus() == status || status == null){ |
|
|
|
|
if (dir.getReviewStatus() == status || status == null) { |
|
|
|
|
boolean permisAllow = permisDis.contains(dir.getId()); |
|
|
|
|
if(permisAllow){ |
|
|
|
|
if (permisAllow) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
// 如果权限不允许,则需要判断当前节点的所有子级节点是否有允许的目录,如果有则需要返回到前端的树组件中
|
|
|
|
|
Set<String> childrenIds = getDirectoryList(dir, true, false, busType).stream().map(DirectoryVo::getId).collect(Collectors.toSet()); |
|
|
|
|
for(String id : childrenIds){ |
|
|
|
|
if(permisDis.contains(id)){ |
|
|
|
|
Set<String> childrenIds = getDirectoryList(dir, true, false, busType) |
|
|
|
|
.stream() |
|
|
|
|
.map(DirectoryVo::getId) |
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
for (String id : childrenIds) { |
|
|
|
|
if (permisDis.contains(id)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -103,9 +106,9 @@ public class DirectoryTreeService { |
|
|
|
|
*/ |
|
|
|
|
private List<DirectoryVo> getDirectoryList(DirectoryVo parentDir, boolean allChild, boolean hasResource, int busType) { |
|
|
|
|
QueryWrapper<DirectoryVo> wrapper = new QueryWrapper<>(); |
|
|
|
|
if(parentDir == null){ |
|
|
|
|
if (parentDir == null) { |
|
|
|
|
wrapper.eq("ID", "ROOT"); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
wrapper.in(!hasResource, "DIRECTORY_TYPE", DirectoryType.DIRECTORY, DirectoryType.LINK_DIR).eq("IS_BASIC_DIR", busType); |
|
|
|
|
if (parentDir != null) { |
|
|
|
|
if (allChild) { |
|
|
|
|