|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysDepartmentService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysOrganizeService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
@ -10,6 +12,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysDepartment;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
@ -40,7 +43,13 @@ public class SysDepartmentController extends CoreBaseController {
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysDepartmentController.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
public ISysDepartmentService departmentService;
|
|
|
|
|
private ISysDepartmentService departmentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreTreeService coreTreeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysOrganizeService organizeService;
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/insert")
|
|
|
|
|
@ApiOperation(value = "添加部门", notes = "返回内容添加部门")
|
|
|
|
@ -146,14 +155,11 @@ public class SysDepartmentController extends CoreBaseController {
|
|
|
|
|
|
|
|
|
|
SysDepartment department = departmentService.getSysDepartmentById(Long.parseLong(id));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(department != null){
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(department);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}", busExcep.getErrorDetail(), busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
@ -167,10 +173,20 @@ public class SysDepartmentController extends CoreBaseController {
|
|
|
|
|
@ApiOperation(value = "查询部门", notes = "组合查询部门信息外加分页信息")
|
|
|
|
|
public ResultBean querySysDepartment(SysDepartment department, Pager pager) {
|
|
|
|
|
try {
|
|
|
|
|
ListPager departmentListPager = departmentService.findSysDepartmentByPager(department, pager);
|
|
|
|
|
return ResultBean.success("查询成功")
|
|
|
|
|
.setListPager(departmentListPager)
|
|
|
|
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
ListPager list = null;
|
|
|
|
|
if(department.getOrganizeId() != null){
|
|
|
|
|
SysOrganize organize = organizeService.getSysOrganizeById(department.getOrganizeId());
|
|
|
|
|
if(organize != null){
|
|
|
|
|
coreTreeService.findSysOrganizeChildrenTreePack(organize,0);
|
|
|
|
|
List<Long> childIds = coreTreeService.findSysOrganizeChildIds(organize);
|
|
|
|
|
list = departmentService.findSysDepartmentByPager(department,childIds, pager);
|
|
|
|
|
}else {
|
|
|
|
|
return ResultBean.fail("不存在组织信息").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
list = departmentService.findSysDepartmentByPager(department, pager);
|
|
|
|
|
}
|
|
|
|
|
return ResultBean.success("查询成功").setListPager(list).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
LOGGER.error(busExcep.getErrorMsg() + ":{}", busExcep.getErrorDetail(), busExcep);
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|