|
|
@@ -147,17 +147,21 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysOrgVO> selectTreeByOrgType(Boolean includeUp, OrgTypeEnum orgType) {
|
|
|
- String path="";
|
|
|
+ public List<SysOrgVO> selectTreeByOrgType(Boolean includeUp,Boolean includeBangshichu, OrgTypeEnum orgType) {
|
|
|
+ String path = "";
|
|
|
SysOrg sysOrg = getLoginUserOrg();
|
|
|
- path=sysOrg.getPath();
|
|
|
- if(includeUp){
|
|
|
- sysOrg=null;
|
|
|
+ path = sysOrg.getPath();
|
|
|
+ if (includeUp) {
|
|
|
+ sysOrg = null;
|
|
|
}
|
|
|
|
|
|
- List<SysOrgVO> orglist = getWholePathInCache(path, orgType);
|
|
|
-
|
|
|
- return generateTree(orglist, sysOrg);
|
|
|
+ List<SysOrgVO> orglist = getWholePathInCache(includeUp, path, orgType);
|
|
|
+ if(!includeBangshichu){
|
|
|
+ orglist=orglist.stream().filter(o->ObjectUtil.notEqual(o.getType(),OrgTypeEnum.BAN_SHI_CHU.getCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<SysOrgVO> r = generateTree(orglist, sysOrg);
|
|
|
+ return r;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -229,7 +233,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysOrgVO> getWholePathInCache(String path, OrgTypeEnum orgType) {
|
|
|
+ public List<SysOrgVO> getWholePathInCache(Boolean includeUp, String path, OrgTypeEnum orgType) {
|
|
|
List<SysOrgVO> cacheList = getOrgCache();
|
|
|
List<SysOrgVO> hangshelist = cacheList.stream().filter(c -> ObjectUtil.equal(c.getType(), orgType.getCode())
|
|
|
&& ObjectUtil.isNotEmpty(c.getPath()) && c.getPath().startsWith(path))
|
|
|
@@ -246,7 +250,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
});
|
|
|
});
|
|
|
hangshelist.addAll(cacheList.stream()
|
|
|
- .filter(o -> parentIds.contains(o.getId()))
|
|
|
+ .filter(o -> parentIds.contains(o.getId()) && (includeUp || (ObjectUtil.isNotEmpty(o.getPath()) && o.getPath().startsWith(path))))
|
|
|
.collect(Collectors.toList()));
|
|
|
|
|
|
return hangshelist;
|
|
|
@@ -259,21 +263,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysOrgVO> hangsheWholePathTree(Long orgId) {
|
|
|
- List<SysOrgVO> orgs = getWholePathInCache("", OrgTypeEnum.HANG_SHE);
|
|
|
- Map<Long, SysOrgVO> orgMap = orgs.stream().collect(Collectors.toMap(o -> o.getId(), o -> o));
|
|
|
- if (!orgMap.containsKey(orgId)) {
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- SysOrgVO self = orgMap.get(orgId);
|
|
|
- List<SysOrgVO> orgVOS = orgs.stream().filter(o -> o.getTreeShowPath().startsWith(self.getTreeShowPath()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<Long> parentIds = Arrays.stream(self.getTreeShowPath().split("-")).map(o -> Long.parseLong(o)).collect(Collectors.toList());
|
|
|
- parentIds = parentIds.stream().limit(parentIds.size() - 1).collect(Collectors.toList());
|
|
|
- orgVOS.addAll(parentIds.stream().map(id -> orgMap.get(id)).collect(Collectors.toList()));
|
|
|
+ public List<SysOrgVO> hangsheWholePath(Long orgId) {
|
|
|
+ SysOrg org= orgService.getById(orgId);
|
|
|
+ List<SysOrgVO> orgs = getWholePathInCache(true,org.getPath(), OrgTypeEnum.HANG_SHE);
|
|
|
|
|
|
- return orgVOS;
|
|
|
+ return orgs;
|
|
|
}
|
|
|
|
|
|
|