|
|
@ -4,14 +4,11 @@ import cn.estsh.i3plus.core.api.iservice.busi.*;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDepartment;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDepartment;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserDepartment;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
@ -21,14 +18,11 @@ import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -179,46 +173,19 @@ public class SysDepartmentController extends CoreBaseController {
|
|
|
|
@ApiOperation(value = "查询部门", notes = "组合查询部门信息外加分页信息")
|
|
|
|
@ApiOperation(value = "查询部门", notes = "组合查询部门信息外加分页信息")
|
|
|
|
public ResultBean querySysDepartment(SysDepartment department, Pager pager) {
|
|
|
|
public ResultBean querySysDepartment(SysDepartment department, Pager pager) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ListPager result = null;
|
|
|
|
List<Long> refIdList = null;
|
|
|
|
List<Long> refIds = new ArrayList<>();
|
|
|
|
if(AuthUtil.getUserType().equals(CommonEnumUtil.USER_TYPE.ADMIN)){
|
|
|
|
List<Long> refFilterIds = new ArrayList<>();
|
|
|
|
refIdList = memTreeService.findDepartmentIdListByOrganizeIdAndDepartmentId(department.getOrganizeId(), department.getParentId());
|
|
|
|
|
|
|
|
}else {
|
|
|
|
// 通过组织获取部门信息
|
|
|
|
refIdList = memTreeService.findDepartmentIdListByOrganizeIdAndDepartmentIdAndUserId(
|
|
|
|
if (department.getOrganizeId() != null && department.getOrganizeId() > 0) {
|
|
|
|
department.getOrganizeId(),
|
|
|
|
List<Long> organizeIdList = memTreeService.findSysOrganizeChildIdList(department.getOrganizeId());
|
|
|
|
department.getParentId(),
|
|
|
|
List<SysRefUserDepartment> refUserDepartmentList = personnelService.findSysRefUserDepartmentByOrganizeIdList(organizeIdList);
|
|
|
|
getSessionUser().getUser().getId());
|
|
|
|
if (refUserDepartmentList != null && refUserDepartmentList.size() > 0) {
|
|
|
|
|
|
|
|
for (SysRefUserDepartment ref : refUserDepartmentList) {
|
|
|
|
|
|
|
|
refIds.add(ref.getDepartmentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过父节点查询部门信息
|
|
|
|
|
|
|
|
if (department.getParentId() != null && department.getParentId() > 0) {
|
|
|
|
|
|
|
|
List<Long> departmentIdList = memTreeService.findSysDepartmentChildIdList(department.getParentId());
|
|
|
|
|
|
|
|
if (departmentIdList != null && departmentIdList.size() > 0) {
|
|
|
|
|
|
|
|
refIds.addAll(departmentIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户所拥有的权限
|
|
|
|
|
|
|
|
if (!AuthUtil.getUserType().equals(CommonEnumUtil.USER_TYPE.ADMIN)) {
|
|
|
|
|
|
|
|
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
|
|
|
|
|
|
|
|
if (refList != null && refList.size() > 0) {
|
|
|
|
|
|
|
|
refList.forEach(ref -> refFilterIds.add(ref.getDepartmentId()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(refIds.size() <= 0){
|
|
|
|
|
|
|
|
refIds = refFilterIds;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
// List 取交集
|
|
|
|
|
|
|
|
refIds = (ArrayList<Long>) CollectionUtils.intersection(refIds, refFilterIds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result = departmentService.findSysDepartmentPagerByIdList(department, new ArrayList<>(refIds), pager);
|
|
|
|
return ResultBean.success("操作成功")
|
|
|
|
return ResultBean.success("操作成功").setListPager(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
.setListPager(departmentService.findSysDepartmentPagerByIdList(department, refIdList, pager))
|
|
|
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|