|
|
@ -1,11 +1,14 @@
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.DepartmentRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.DepartmentRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.OrganizeRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.OrganizeRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.PositionRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.PositionRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysMenuRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysMenuRepository;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@ -81,6 +84,12 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void doValidatorPositionParentId(Position position) {
|
|
|
|
|
|
|
|
findPositionChildrenTreePack(position,0);
|
|
|
|
|
|
|
|
validatorPositionParentId(position.getChildList(),position.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<Department> findDepartmentTreeByParentId(long parentId) {
|
|
|
|
public List<Department> findDepartmentTreeByParentId(long parentId) {
|
|
|
|
List<Department> result = departmentRDao.findByProperty("parentId", parentId);
|
|
|
|
List<Department> result = departmentRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
|
@ -123,6 +132,12 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void doValidatorDepartmentParentId(Department department) {
|
|
|
|
|
|
|
|
findDepartmentChildrenTreePack(department,0);
|
|
|
|
|
|
|
|
validatorDepartmentParentId(department.getChildList(),department.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<Organize> findOrganizeTreeByParentId(long parentId) {
|
|
|
|
public List<Organize> findOrganizeTreeByParentId(long parentId) {
|
|
|
|
List<Organize> result = organizeRDao.findByProperty("parentId", parentId);
|
|
|
|
List<Organize> result = organizeRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
|
@ -164,6 +179,12 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void doValidatorOrganizeParentId(Organize organize) {
|
|
|
|
|
|
|
|
findOrganizeChildrenTreePack(organize,0);
|
|
|
|
|
|
|
|
validatorOrganizeParentId(organize.getChildList(),organize.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<SysMenu> findSysMenuTreeByParentId(long parentId) {
|
|
|
|
public List<SysMenu> findSysMenuTreeByParentId(long parentId) {
|
|
|
|
List<SysMenu> result = menuRDao.findByProperty("parentId", parentId);
|
|
|
|
List<SysMenu> result = menuRDao.findByProperty("parentId", parentId);
|
|
|
|
|
|
|
|
|
|
|
@ -203,4 +224,82 @@ public class CoreTreeService implements ICoreTreeService {
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
LOGGER.info("【{}】包含子集:{},步长:{}", parent.getName(), childList.size(), step);
|
|
|
|
parent.setChildList(childList);
|
|
|
|
parent.setChildList(childList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void doValidatorSysMenuParentId(SysMenu menu) {
|
|
|
|
|
|
|
|
findSysMenuChildrenTreePack(menu,0);
|
|
|
|
|
|
|
|
validatorSysMenuParentId(menu.getChildList(),menu.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validatorPositionParentId(List<Position> list, Long parentId){
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
|
|
|
for (Position position : list) {
|
|
|
|
|
|
|
|
// 判断子集的ID 是否是 父节点ID
|
|
|
|
|
|
|
|
if(position.getId().equals(parentId) || position.getId().equals(position.getParentId())){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("上级岗位不能为子岗位")
|
|
|
|
|
|
|
|
.setErrorSolution("请重新操作")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validatorPositionParentId(position.getChildList(),parentId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validatorDepartmentParentId(List<Department> list, Long parentId){
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
|
|
|
for (Department department : list) {
|
|
|
|
|
|
|
|
// 判断子集的ID 是否是 父节点ID
|
|
|
|
|
|
|
|
if(department.getId().equals(parentId) || department.getId().equals(department.getParentId())){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("上级部门不能为子部门")
|
|
|
|
|
|
|
|
.setErrorSolution("请重新操作")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validatorDepartmentParentId(department.getChildList(),parentId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validatorOrganizeParentId(List<Organize> list, Long parentId){
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
|
|
|
for (Organize organize : list) {
|
|
|
|
|
|
|
|
// 判断子集的ID 是否是 父节点ID
|
|
|
|
|
|
|
|
if(organize.getId().equals(parentId) || organize.getId().equals(organize.getParentId())){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("上级部门不能为子部门")
|
|
|
|
|
|
|
|
.setErrorSolution("请重新操作")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validatorOrganizeParentId(organize.getChildList(),parentId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validatorSysMenuParentId(List<SysMenu> list, Long parentId){
|
|
|
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
|
|
|
for (SysMenu menu : list) {
|
|
|
|
|
|
|
|
// 判断子集的ID 是否是 父节点ID
|
|
|
|
|
|
|
|
if(menu.getId().equals(parentId) || menu.getId().equals(menu.getParentId())){
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("上级部门不能为子部门")
|
|
|
|
|
|
|
|
.setErrorSolution("请重新操作")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validatorSysMenuParentId(menu.getChildList(),parentId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|