|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ModelEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.model.platform.CommonTreeModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDepartment;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
|
|
|
|
@ -18,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -59,7 +63,7 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysPosition getSysPositionTreeByParentId(long id) {
|
|
|
|
|
public SysPosition getSysPositionTreeById(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysPosition position = positionRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
@ -107,7 +111,7 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysDepartment getSysDepartmentTreeByParentId(long id) {
|
|
|
|
|
public SysDepartment getSysDepartmentTreeById(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysDepartment department = departmentRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
@ -155,7 +159,7 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysOrganize getSysOrganizeTreeByParentId(long id) {
|
|
|
|
|
public SysOrganize getSysOrganizeTreeById(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysOrganize organize = organizeRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
@ -202,7 +206,7 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysMenu getSysMenuTreeByParentId(long id) {
|
|
|
|
|
public SysMenu getSysMenuTreeById(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysMenu menu = menuRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
@ -305,4 +309,98 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<CommonTreeModel> findOrganizeDepartment(long parentId) {
|
|
|
|
|
List<CommonTreeModel> result = new ArrayList<>();
|
|
|
|
|
List<SysOrganize> list = organizeRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
// 循环设置子集
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
for (SysOrganize organize : list) {
|
|
|
|
|
CommonTreeModel treeModel = new CommonTreeModel();
|
|
|
|
|
treeModel.setBean(organize);
|
|
|
|
|
treeModel.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
|
|
|
|
|
|
|
|
|
|
findOrganizeTreePack(treeModel,0);
|
|
|
|
|
|
|
|
|
|
result.add(treeModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public CommonTreeModel getOrganizeById(long id) {
|
|
|
|
|
// 查找数据
|
|
|
|
|
SysOrganize organize = organizeRDao.getById(id);
|
|
|
|
|
// 数据是否真实存在
|
|
|
|
|
ValidatorBean.checkNotNull(organize,"不存在的组织信息");
|
|
|
|
|
|
|
|
|
|
CommonTreeModel treeModel = new CommonTreeModel();
|
|
|
|
|
treeModel.setBean(organize);
|
|
|
|
|
treeModel.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
|
|
|
|
|
|
|
|
|
|
// 递归查询子集
|
|
|
|
|
findOrganizeTreePack(treeModel, 0);
|
|
|
|
|
return treeModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void findOrganizeTreePack(CommonTreeModel parent, int step) {
|
|
|
|
|
if(null != parent){
|
|
|
|
|
BaseBean bean = parent.getBean();
|
|
|
|
|
List<CommonTreeModel> childList = new ArrayList<>();
|
|
|
|
|
CommonTreeModel treeModel = null;
|
|
|
|
|
if(bean instanceof SysOrganize){
|
|
|
|
|
SysOrganize organize = (SysOrganize) bean;
|
|
|
|
|
|
|
|
|
|
List<SysOrganize> organizeList = organizeRDao.findByProperty("parentId", organize.getId());
|
|
|
|
|
if(organizeList != null && organizeList.size() > 0){
|
|
|
|
|
for (SysOrganize org : organizeList) {
|
|
|
|
|
treeModel = new CommonTreeModel();
|
|
|
|
|
treeModel.setBean(org);
|
|
|
|
|
treeModel.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
|
|
|
|
|
|
|
|
|
|
findOrganizeTreePack(treeModel,step);
|
|
|
|
|
|
|
|
|
|
childList.add(treeModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SysDepartment> departmentList = departmentRDao.findByProperty("organizeId", organize.getId());
|
|
|
|
|
if(departmentList != null && departmentList.size() > 0){
|
|
|
|
|
for (SysDepartment department : departmentList) {
|
|
|
|
|
if(department.getParentId() != null && department.getParentId() < 0){
|
|
|
|
|
treeModel = new CommonTreeModel();
|
|
|
|
|
treeModel.setBean(department);
|
|
|
|
|
treeModel.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
|
|
|
|
|
|
|
|
|
|
findOrganizeTreePack(treeModel,step);
|
|
|
|
|
|
|
|
|
|
childList.add(treeModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getBean().getClass().getName(), parent.getChildList().size(), step);
|
|
|
|
|
}else if(bean instanceof SysDepartment){
|
|
|
|
|
SysDepartment department = (SysDepartment) bean;
|
|
|
|
|
List<SysDepartment> departmentList = departmentRDao.findByProperty("parentId", department.getId());
|
|
|
|
|
if(departmentList != null && departmentList.size() > 0){
|
|
|
|
|
for (SysDepartment dep : departmentList) {
|
|
|
|
|
treeModel = new CommonTreeModel();
|
|
|
|
|
treeModel.setBean(dep);
|
|
|
|
|
treeModel.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
|
|
|
|
|
|
|
|
|
|
findOrganizeTreePack(treeModel,step);
|
|
|
|
|
|
|
|
|
|
childList.add(treeModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
parent.setChildList(childList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|