|
@@ -583,6 +583,64 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept>
|
|
|
return sysDeptTreeVos;
|
|
return sysDeptTreeVos;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<SysDeptTreeVo> getPartnerDeptTree() {
|
|
|
|
|
+ SysDept sysDept = getById("9");
|
|
|
|
|
+ LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lqw.eq(SysDept::getDelFlag, 0);
|
|
|
|
|
+ lqw.likeRight(SysDept::getId, "9");
|
|
|
|
|
+ lqw.orderByAsc(SysDept::getOrderNum);
|
|
|
|
|
+ List<SysDept> sysDeptList = list(lqw);
|
|
|
|
|
+
|
|
|
|
|
+ List<SysDeptTreeVo> sysDeptTreeVos = BeanUtil.copyToList(sysDeptList, SysDeptTreeVo.class);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, List<SysDeptTreeVo>> map = sysDeptTreeVos.stream().sorted(Comparator.comparing(SysDeptTreeVo::getId))
|
|
|
|
|
+ .collect(Collectors.groupingBy(SysDeptTreeVo::getParentId));
|
|
|
|
|
+ sysDeptTreeVos.forEach(i -> {
|
|
|
|
|
+ i.setChildren(map.getOrDefault(i.getId(), new ArrayList<>()));
|
|
|
|
|
+ i.setDeptCount(i.getChildren().size());
|
|
|
|
|
+ });
|
|
|
|
|
+ sysDeptTreeVos = map.get(sysDept.getParentId());
|
|
|
|
|
+ //合伙人机构树
|
|
|
|
|
+ for (SysDeptTreeVo deptTreeVo : sysDeptTreeVos) {//1
|
|
|
|
|
+ List<SysDeptTreeVo> children2 = deptTreeVo.getChildren();
|
|
|
|
|
+ for (SysDeptTreeVo children : children2) {//2
|
|
|
|
|
+ List<SysDeptTreeVo> children3 = children.getChildren();
|
|
|
|
|
+ if (children3.size()>0) {
|
|
|
|
|
+ children3=children3.stream().filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
|
|
+ children.setChildren(children3);
|
|
|
|
|
+ for (SysDeptTreeVo child4 : children3) {//3
|
|
|
|
|
+ List<SysDeptTreeVo> children4 = child4.getChildren();
|
|
|
|
|
+ if (children4.size()>0) {
|
|
|
|
|
+ children4=children4.stream().filter(SysDeptTreeVo -> SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
|
|
+ child4.setChildren(children4);
|
|
|
|
|
+ for (SysDeptTreeVo child : children4) {//4
|
|
|
|
|
+ List<SysDeptTreeVo> children5 = child.getChildren();
|
|
|
|
|
+ children5 = children5.stream().filter(SysDeptTreeVo ->SysDeptTreeVo.getComlevel() != null).collect(Collectors.toList());
|
|
|
|
|
+ child.setChildren(children5);
|
|
|
|
|
+ if (children5.size()>0) {
|
|
|
|
|
+ for (SysDeptTreeVo treeVo : children5) {
|
|
|
|
|
+ List<SysDeptTreeVo> childrenEnd = treeVo.getChildren();
|
|
|
|
|
+ if (childrenEnd.size()>0) {
|
|
|
|
|
+ childrenEnd=childrenEnd.stream().filter(SysDeptTreeVo ->SysDeptTreeVo.getComlevel() == null).collect(Collectors.toList());
|
|
|
|
|
+ treeVo.setChildren(childrenEnd);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return sysDeptTreeVos;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|