|
|
|
@ -1,10 +1,11 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.Department;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.Position;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.DepartmentRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.OrganizeRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.PositionRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysMenuRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import javafx.scene.layout.VBox;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -15,7 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 通用树实现类
|
|
|
|
|
* @Description : Core 树功能实现
|
|
|
|
|
* @Reference :
|
|
|
|
|
* @Author : wei.peng
|
|
|
|
|
* @Date : 2018-10-24 11:17
|
|
|
|
@ -32,35 +33,11 @@ public class CoreTreeServiceImpl implements ICoreTreeService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private PositionRepository positionRDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Department getDepartmentTreeByParentId(long depParentId) {
|
|
|
|
|
Department depParent = departmentRDao.getById(depParentId);
|
|
|
|
|
//封装子集
|
|
|
|
|
findDepartmentChildrenTreePack(depParent, 0);
|
|
|
|
|
return depParent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装部门子集
|
|
|
|
|
*
|
|
|
|
|
* @param parent
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void findDepartmentChildrenTreePack(Department parent, int step) {
|
|
|
|
|
++step;
|
|
|
|
|
List<Department> childDepList = departmentRDao.findByProperty("parentId", parent.getId());
|
|
|
|
|
|
|
|
|
|
if (childDepList.size() > 0) {
|
|
|
|
|
//说明有子集
|
|
|
|
|
for (Department depChild : childDepList) {
|
|
|
|
|
findDepartmentChildrenTreePack(depChild, step);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childDepList.size(), step);
|
|
|
|
|
parent.setChildList(childDepList);
|
|
|
|
|
}
|
|
|
|
|
@Autowired
|
|
|
|
|
private OrganizeRepository organizeRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysMenuRepository menuRDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Position> findPositionTreeByParentId(long parentId) {
|
|
|
|
@ -68,7 +45,6 @@ public class CoreTreeServiceImpl implements ICoreTreeService {
|
|
|
|
|
|
|
|
|
|
// 循环设置子集
|
|
|
|
|
if(result != null && result.size() > 0){
|
|
|
|
|
|
|
|
|
|
result.stream().forEach(position -> findPositionChildrenTreePack(position,0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -102,4 +78,122 @@ public class CoreTreeServiceImpl implements ICoreTreeService {
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
|
parent.setChildList(childList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Department> findDepartmentTreeByParentId(long parentId) {
|
|
|
|
|
List<Department> result = departmentRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
// 循环设置子集
|
|
|
|
|
if(result != null && result.size() > 0){
|
|
|
|
|
result.stream().forEach(department -> findDepartmentChildrenTreePack(department,0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Department getDepartmentTreeByParentId(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
Department department = departmentRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
|
ValidatorBean.checkNotNull(department,"不存在的部门信息");
|
|
|
|
|
// 递归查询子集
|
|
|
|
|
findDepartmentChildrenTreePack(department, 0);
|
|
|
|
|
|
|
|
|
|
return department;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void findDepartmentChildrenTreePack(Department parent, int step) {
|
|
|
|
|
++step;
|
|
|
|
|
List<Department> childList = departmentRDao.findByProperty("parentId", parent.getId());
|
|
|
|
|
|
|
|
|
|
if (childList.size() > 0) {
|
|
|
|
|
//说明有子集
|
|
|
|
|
for (Department child : childList) {
|
|
|
|
|
findDepartmentChildrenTreePack(child, step);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
|
parent.setChildList(childList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Organize> findOrganizeTreeByParentId(long parentId) {
|
|
|
|
|
List<Organize> result = organizeRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
// 循环设置子集
|
|
|
|
|
if(result != null && result.size() > 0){
|
|
|
|
|
result.stream().forEach(organize -> findOrganizeChildrenTreePack(organize,0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Organize getOrganizeTreeByParentId(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
Organize organize = organizeRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
|
ValidatorBean.checkNotNull(organize,"不存在的组织信息");
|
|
|
|
|
// 递归查询子集
|
|
|
|
|
findOrganizeChildrenTreePack(organize, 0);
|
|
|
|
|
|
|
|
|
|
return organize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void findOrganizeChildrenTreePack(Organize parent, int step) {
|
|
|
|
|
++step;
|
|
|
|
|
List<Organize> childList = organizeRDao.findByProperty("parentId", parent.getId());
|
|
|
|
|
|
|
|
|
|
if (childList.size() > 0) { //说明有子集
|
|
|
|
|
for (Organize child : childList) {
|
|
|
|
|
findOrganizeChildrenTreePack(child, step);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
|
parent.setChildList(childList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysMenu> findSysMenuTreeByParentId(long parentId) {
|
|
|
|
|
List<SysMenu> result = menuRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
// 循环设置子集
|
|
|
|
|
if(result != null && result.size() > 0){
|
|
|
|
|
result.stream().forEach(menu -> findSysMenuChildrenTreePack(menu,0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysMenu getSysMenuTreeByParentId(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysMenu menu = menuRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
|
ValidatorBean.checkNotNull(menu,"不存在的组织信息");
|
|
|
|
|
// 递归查询子集
|
|
|
|
|
findSysMenuChildrenTreePack(menu, 0);
|
|
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void findSysMenuChildrenTreePack(SysMenu parent, int step) {
|
|
|
|
|
++step;
|
|
|
|
|
List<SysMenu> childList = menuRDao.findByProperty("parentId", parent.getId());
|
|
|
|
|
|
|
|
|
|
if (childList.size() > 0) { //说明有子集
|
|
|
|
|
for (SysMenu child : childList) {
|
|
|
|
|
findSysMenuChildrenTreePack(child, step);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
|
parent.setChildList(childList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|