diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index f93114f028..b333f09cd3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -198,41 +198,49 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId()); List departmentList = ConvertUtils.sourceToTarget(listDept, DeptListResultDTO.class); - //2.2:查询每一个部门下人员列表 - List deptIdList = departmentList.stream().map(DeptListResultDTO::getDepartmentId).collect(Collectors.toList()); - List deptStaffs = customerStaffDepartmentDao.selectDeptStaffs(deptIdList); - departmentList.forEach(dept->{ - List departmentStaffList = new ArrayList<>(); - deptStaffs.forEach(ds->{ - if (dept.getDepartmentId().equals(ds.getDepartmentId())) { - if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !dept.getDepartmentId().equals(canTick.getDeptOrGridId())) { - StaffListResultDTO sf = new StaffListResultDTO(); - sf.setStaffId(ds.getUserId()); - departmentStaffList.add(sf); + List deptStaffs = new ArrayList<>(); + if (null != departmentList && departmentList.size() > NumConstant.ZERO) { + //2.2:查询每一个部门下人员列表 + List deptIdList = departmentList.stream().map(DeptListResultDTO::getDepartmentId).collect(Collectors.toList()); + deptStaffs = customerStaffDepartmentDao.selectDeptStaffs(deptIdList); + List finalDeptStaffs = deptStaffs; + departmentList.forEach(dept->{ + List departmentStaffList = new ArrayList<>(); + finalDeptStaffs.forEach(ds->{ + if (dept.getDepartmentId().equals(ds.getDepartmentId())) { + if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !dept.getDepartmentId().equals(canTick.getDeptOrGridId())) { + StaffListResultDTO sf = new StaffListResultDTO(); + sf.setStaffId(ds.getUserId()); + departmentStaffList.add(sf); + } } - } + }); + dept.setDepartmentStaffList(departmentStaffList); }); - dept.setDepartmentStaffList(departmentStaffList); - }); + } //3:根据组织Id查询该组织下网格、人员列表 //3.1:查询组织下网格列表 List gridList = customerGridDao.selectGridList(canTick.getAgencyId()); - //3.2:查询每一个网格下人员列表 - List gridIdList = gridList.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); - List gridStaffs = customerStaffGridDao.selectGridStaffs(gridIdList); - gridList.forEach(grid->{ - List gridStaffList = new ArrayList<>(); - gridStaffs.forEach(gs->{ - if(grid.getGridId().equals(gs.getGridId())){ - if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !grid.getGridId().equals(canTick.getDeptOrGridId())) { - StaffListResultDTO sf = new StaffListResultDTO(); - sf.setStaffId(gs.getUserId()); - gridStaffList.add(sf); + List gridStaffs = new ArrayList<>(); + if (null != gridList && gridList.size() > NumConstant.ZERO) { + //3.2:查询每一个网格下人员列表 + List gridIdList = gridList.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); + gridStaffs = customerStaffGridDao.selectGridStaffs(gridIdList); + List finalGridStaffs = gridStaffs; + gridList.forEach(grid->{ + List gridStaffList = new ArrayList<>(); + finalGridStaffs.forEach(gs->{ + if(grid.getGridId().equals(gs.getGridId())){ + if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !grid.getGridId().equals(canTick.getDeptOrGridId())) { + StaffListResultDTO sf = new StaffListResultDTO(); + sf.setStaffId(gs.getUserId()); + gridStaffList.add(sf); + } } - } + }); + grid.setGridStaffList(gridStaffList); }); - grid.setGridStaffList(gridStaffList); - }); + } //4:汇总组织下人员、组织下部门下人员、组织下网格下人员Id集合,调用epmet-user服务查询工作人员基本信息 List staffIdList1 = agencyStaffList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList()); List staffIdList2 = deptStaffs.stream().map(CustomerStaffDepartmentDTO::getUserId).collect(Collectors.toList());