|
|
@ -198,41 +198,49 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao |
|
|
|
//2.1:查询组织下部门列表
|
|
|
|
List<DepartmentListResultDTO> listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId()); |
|
|
|
List<DeptListResultDTO> departmentList = ConvertUtils.sourceToTarget(listDept, DeptListResultDTO.class); |
|
|
|
//2.2:查询每一个部门下人员列表
|
|
|
|
List<String> deptIdList = departmentList.stream().map(DeptListResultDTO::getDepartmentId).collect(Collectors.toList()); |
|
|
|
List<CustomerStaffDepartmentDTO> deptStaffs = customerStaffDepartmentDao.selectDeptStaffs(deptIdList); |
|
|
|
departmentList.forEach(dept->{ |
|
|
|
List<StaffListResultDTO> 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<CustomerStaffDepartmentDTO> deptStaffs = new ArrayList<>(); |
|
|
|
if (null != departmentList && departmentList.size() > NumConstant.ZERO) { |
|
|
|
//2.2:查询每一个部门下人员列表
|
|
|
|
List<String> deptIdList = departmentList.stream().map(DeptListResultDTO::getDepartmentId).collect(Collectors.toList()); |
|
|
|
deptStaffs = customerStaffDepartmentDao.selectDeptStaffs(deptIdList); |
|
|
|
List<CustomerStaffDepartmentDTO> finalDeptStaffs = deptStaffs; |
|
|
|
departmentList.forEach(dept->{ |
|
|
|
List<StaffListResultDTO> 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<GridListResultDTO> gridList = customerGridDao.selectGridList(canTick.getAgencyId()); |
|
|
|
//3.2:查询每一个网格下人员列表
|
|
|
|
List<String> gridIdList = gridList.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
List<CustomerStaffGridDTO> gridStaffs = customerStaffGridDao.selectGridStaffs(gridIdList); |
|
|
|
gridList.forEach(grid->{ |
|
|
|
List<StaffListResultDTO> 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<CustomerStaffGridDTO> gridStaffs = new ArrayList<>(); |
|
|
|
if (null != gridList && gridList.size() > NumConstant.ZERO) { |
|
|
|
//3.2:查询每一个网格下人员列表
|
|
|
|
List<String> gridIdList = gridList.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
gridStaffs = customerStaffGridDao.selectGridStaffs(gridIdList); |
|
|
|
List<CustomerStaffGridDTO> finalGridStaffs = gridStaffs; |
|
|
|
gridList.forEach(grid->{ |
|
|
|
List<StaffListResultDTO> 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<String> staffIdList1 = agencyStaffList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList()); |
|
|
|
List<String> staffIdList2 = deptStaffs.stream().map(CustomerStaffDepartmentDTO::getUserId).collect(Collectors.toList()); |
|
|
|