|
|
@ -53,15 +53,31 @@ public class DirectoryTreeService { |
|
|
|
if (StringUtils.hasText(pid)) { |
|
|
|
if (StringUtils.hasText(pid)) { |
|
|
|
parentDir = directoryService.getById(pid); |
|
|
|
parentDir = directoryService.getById(pid); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 获取子级节点
|
|
|
|
List<DirectoryVo> directoryList = getDirectoryList(parentDir, allChild, hasMetadata, busType); |
|
|
|
List<DirectoryVo> directoryList = getDirectoryList(parentDir, allChild, hasMetadata, busType); |
|
|
|
|
|
|
|
// 审核状态
|
|
|
|
ReviewStatus status = StringUtils.hasText(reviewStatus) ? ReviewStatus.valueOf(reviewStatus) : null; |
|
|
|
ReviewStatus status = StringUtils.hasText(reviewStatus) ? ReviewStatus.valueOf(reviewStatus) : null; |
|
|
|
|
|
|
|
// 当前用户
|
|
|
|
SysUser user = SecurityUtil.getLoginSysUser(); |
|
|
|
SysUser user = SecurityUtil.getLoginSysUser(); |
|
|
|
|
|
|
|
// 根据权限类型获取权限范围内的数据的ID集合
|
|
|
|
Set<String> permisDis = "write".equals(permis) ? dirPermissionService.getByWritePermis(user) : dirPermissionService.getByReadPermis(user); |
|
|
|
Set<String> permisDis = "write".equals(permis) ? dirPermissionService.getByWritePermis(user) : dirPermissionService.getByReadPermis(user); |
|
|
|
|
|
|
|
// 判断权限范围
|
|
|
|
List<DirectoryVo> permisDirectoryList = StreamUtil.as(directoryList).filter(dir -> { |
|
|
|
List<DirectoryVo> permisDirectoryList = StreamUtil.as(directoryList).filter(dir -> { |
|
|
|
if (status == null) { |
|
|
|
if(dir.getReviewStatus() == status || status == null){ |
|
|
|
return permisDis.contains(dir.getId()); |
|
|
|
boolean permisAllow = permisDis.contains(dir.getId()); |
|
|
|
|
|
|
|
if(permisAllow){ |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return dir.getReviewStatus() == status && permisDis.contains(dir.getId()); |
|
|
|
// 如果权限不允许,则需要判断当前节点的所有子级节点是否有允许的目录,如果有则需要返回到前端的树组件中
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
}).toList(); |
|
|
|
}).toList(); |
|
|
|
DirectoryParentBuilder dpb = new DirectoryParentBuilder(directoryList, permisDirectoryList); |
|
|
|
DirectoryParentBuilder dpb = new DirectoryParentBuilder(directoryList, permisDirectoryList); |
|
|
|
|
|
|
|
|
|
|
|