From fd171810794b488eb9c2b20a7dc5f0c6802c3125 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 22 May 2020 17:23:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E7=AE=A1=E7=90=86=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E4=BA=BA=E5=91=98=E9=80=89=E6=8B=A9=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=B5=81=E8=BD=AC=E9=83=A8=E9=97=A8=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=8E=A5=E5=8F=A3=E4=B8=9A=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IssueServiceImpl.java | 1 - epmet-module/gov-org/gov-org-client/pom.xml | 6 + .../dto/form/CanTickStaffListFormDTO.java | 19 +- .../TransferOptionalStaffListFormDTO.java | 27 ++ .../controller/CustomerAgencyController.java | 14 +- .../com/epmet/dao/CustomerStaffAgencyDao.java | 5 +- .../epmet/service/CustomerAgencyService.java | 11 +- .../impl/CustomerAgencyServiceImpl.java | 266 +++++++++++++++--- .../mapper/CustomerStaffAgencyDao.xml | 3 - .../java/com/epmet/dao/ProjectStaffDao.java | 7 + .../com/epmet/feign/GovOrgFeignClient.java | 9 +- .../fallback/GovOrgFeignClientFallBack.java | 9 +- .../service/impl/ProjectStaffServiceImpl.java | 25 +- .../main/resources/mapper/ProjectStaffDao.xml | 9 + 14 files changed, 314 insertions(+), 97 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/TransferOptionalStaffListFormDTO.java diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index adae13856f..632017e990 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -440,7 +440,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp //1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息 CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO(); canTick.setAgencyId(formDTO.getAgencyId()); - canTick.setType("issue"); Result resultDTOResult = govOrgFeignClient.departmentStaffList(canTick); return resultDTOResult.getData(); } diff --git a/epmet-module/gov-org/gov-org-client/pom.xml b/epmet-module/gov-org/gov-org-client/pom.xml index 59518f86e2..f97bdc99ad 100644 --- a/epmet-module/gov-org/gov-org-client/pom.xml +++ b/epmet-module/gov-org/gov-org-client/pom.xml @@ -26,6 +26,12 @@ io.springfox springfox-swagger-ui + + com.epmet + gov-project-client + 2.0.0 + compile + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CanTickStaffListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CanTickStaffListFormDTO.java index 44288c2aca..0606ef9c7e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CanTickStaffListFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CanTickStaffListFormDTO.java @@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * @Description 项目跟踪-部门人员选择-接口入参 + * @Description 议题转项目-部门人员选择-接口入参 * @Author sun */ @Data @@ -17,23 +17,6 @@ public class CanTickStaffListFormDTO implements Serializable { * 当前工作人员代表的组织Id */ private String agencyId=""; - /** - * 代表是哪个模块调用的接口 - * issue:议题管理 - * project:项目跟踪 - */ - private String type=""; - /** - * 当前工作人员可能所属的部门 - * 1:组织下的人则此字段值为空 - * 2:部门下的人此字段为部门Id - * 3:网格下的人此字段为网格Id - */ - private String deptOrGridId=""; - /** - * 工作人员Id - */ - private String staffId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/TransferOptionalStaffListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/TransferOptionalStaffListFormDTO.java new file mode 100644 index 0000000000..b895f042ac --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/TransferOptionalStaffListFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import com.epmet.dto.ProjectStaffDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 项目跟踪-部门人员选择-接口入参 + * @Author sun + */ +@Data +public class TransferOptionalStaffListFormDTO implements Serializable { + private static final long serialVersionUID = 4859779755214502427L; + + /** + * 当前工作人员代表的组织Id + */ + private String agencyId = ""; + /** + * 项目当前在节点上的自己工作未处理的工作人员 + */ + private List projectStaffList; + +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 1ccdc9738b..2bc9b1e136 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -29,6 +29,7 @@ import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.TransferOptionalStaffListFormDTO; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; @@ -122,13 +123,24 @@ public class CustomerAgencyController { * @param canTick * @return * @Author sun - * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 + * @Description 议题转项目-查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ @PostMapping("departmentstafflist") public Result departmentStaffList(@RequestBody CanTickStaffListFormDTO canTick) { return new Result().ok(customerAgencyService.departmentStaffList(canTick)); } + /** + * @param canTick + * @return + * @Author sun + * @Description 项目流转-查询组织下,组织下部门,组织下网格对应的可选人员列表 + **/ + @PostMapping("transferoptionalstafflist") + public Result transferOptionalStaffList(@RequestBody TransferOptionalStaffListFormDTO canTick) { + return new Result().ok(customerAgencyService.transferOptionalStaffList(canTick)); + } + /** * @param formDTO * @return diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 4334657bb9..767b073359 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -19,7 +19,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerStaffAgencyDTO; -import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.result.StaffListResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -27,8 +26,6 @@ import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.List; - /** * 人员-机关单位关系表 * @@ -74,5 +71,5 @@ public interface CustomerStaffAgencyDao extends BaseDao selectAgencyStaffList(@Param("agencyId") String agencyId, @Param("staffId") String staffId); + List selectAgencyStaffList(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 6cc44ea483..011b0f814e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -24,6 +24,7 @@ import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.TransferOptionalStaffListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; @@ -119,10 +120,18 @@ public interface CustomerAgencyService extends BaseService * @param canTick * @return * @Author sun - * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 + * @Description 议题转项目-查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ DepartmentStaffListResultDTO departmentStaffList(CanTickStaffListFormDTO canTick); + /** + * @param canTick + * @return + * @Author sun + * @Description 项目流转-查询组织下,组织下部门,组织下网格对应的可选人员列表 + **/ + DepartmentStaffListResultDTO transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick); + /** * @param formDTO * @return 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 0750b27c27..91770baa09 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 @@ -30,10 +30,7 @@ import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerGridConstant; import com.epmet.dao.*; import com.epmet.dto.*; -import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; -import com.epmet.dto.form.CustomerFormDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerGridEntity; @@ -49,6 +46,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; /** @@ -183,17 +181,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId(),staffId); + //1:根据组织Id查询该组织下工作人员列表 + List agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId()); //2:根据组织Id查询该组织下部门、人员列表 //2.1:查询组织下部门列表 List listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId()); @@ -208,7 +203,190 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl 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); + }); + } + //3:根据组织Id查询该组织下网格、人员列表 + //3.1:查询组织下网格列表 + List gridList = customerGridDao.selectGridList(canTick.getAgencyId()); + 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())){ + StaffListResultDTO sf = new StaffListResultDTO(); + sf.setStaffId(gs.getUserId()); + gridStaffList.add(sf); + } + }); + 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()); + List staffIdList3 = gridStaffs.stream().map(CustomerStaffGridDTO::getUserId).collect(Collectors.toList()); + List staffIdList = new ArrayList<>(); + staffIdList.addAll(staffIdList1); staffIdList.addAll(staffIdList2); staffIdList.addAll(staffIdList3); + staffIdList = new ArrayList(new LinkedHashSet<>(staffIdList));staffIdList.removeAll(Collections.singleton("")); + CustomerStaffListResultDTO dto = new CustomerStaffListResultDTO(); + if (null != staffIdList || staffIdList.size() > NumConstant.ZERO) { + Result userList = epmetUserFeignClient.getCustomerStaffList(staffIdList); + if (!userList.success() || null == userList.getData()) { + throw new RenException(CustomerAgencyConstant.SELECT_USER_EXCEPTION); + } + dto = userList.getData(); + } + //5:循环数据,将人员数据放到对应数据结构下 + List staffList = dto.getStaffList(); + List roleList = dto.getRoleList(); + //有时间再优化成jdk8的遍历方式 + //5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员 + //部门 + Iterator itDept = agencyStaffList.iterator(); + while (itDept.hasNext()) { + StaffListResultDTO stf = itDept.next(); + for (CustomerStaffDepartmentDTO dept : deptStaffs) { + if (dept.getUserId().equals(stf.getStaffId())) { + itDept.remove(); + break; + } + } + } + //网格 + Iterator itGrid = agencyStaffList.iterator(); + while (itGrid.hasNext()) { + StaffListResultDTO stf = itGrid.next(); + for (CustomerStaffGridDTO grid : gridStaffs) { + if (grid.getUserId().equals(stf.getStaffId())) { + itGrid.remove(); + break; + } + } + } + //5.1装载组织下人员数据 + agencyStaffList.forEach(sf->{ + //人员信息 + staffList.forEach(stf->{ + if(sf.getStaffId().equals(stf.getStaffId())){ + sf.setStaffName(stf.getStaffName()); + sf.setStaffHeadPhoto(stf.getStaffHeadPhoto()); + sf.setGender(stf.getGender()); + } + }); + //人员角色信息 + roleList.forEach(role->{ + if(sf.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.AGENCY_LEADER.equals(role.getRoleKey())){ + sf.setRoleName(role.getRoleName()); + } + }); + }); + //5.2装载组织下部门下人员数据 + departmentList.forEach(dept->{ + List departmentStaffList = dept.getDepartmentStaffList(); + departmentStaffList.forEach(ds->{ + //人员信息 + staffList.forEach(stf->{ + if(ds.getStaffId().equals(stf.getStaffId())){ + ds.setStaffName(stf.getStaffName()); + ds.setStaffHeadPhoto(stf.getStaffHeadPhoto()); + ds.setGender(stf.getGender()); + } + }); + //人员角色信息 + roleList.forEach(role->{ + if(ds.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.DEPT_LEADER.equals(role.getRoleKey())){ + ds.setRoleName(role.getRoleName()); + } + }); + }); + }); + //5.3装载组织下网格下人员数据 + gridList.forEach(grid->{ + List gridStaffList = grid.getGridStaffList(); + gridStaffList.forEach(gs->{ + //人员信息 + staffList.forEach(stf->{ + if(gs.getStaffId().equals(stf.getStaffId())){ + gs.setStaffName(stf.getStaffName()); + gs.setStaffHeadPhoto(stf.getStaffHeadPhoto()); + gs.setGender(stf.getGender()); + } + }); + //人员角色信息 + roleList.forEach(role->{ + if(gs.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.GRID_MANAGER.equals(role.getRoleKey())){ + gs.setRoleName(role.getRoleName()); + } + }); + }); + }); + resultDTO.setAgencyStaffList(agencyStaffList); + resultDTO.setDepartmentList(departmentList); + resultDTO.setGridList(gridList); + return resultDTO; + } + + /** + * @param canTick + * @return + * @Author sun + * @Description 项目流转-查询组织下,组织下部门,组织下网格对应的可选人员列表 + * 查询该组织下所有人员,已经在项目节点中且工作是未处理的人员不查询,在部门或网格下的人员不在组织下展示 + **/ + @Override + public DepartmentStaffListResultDTO transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick) { + //根据组织Id查询该组织的工作人员(带单位领导角色)列表;该组织的部门列表、部门下人员(带部门领导角色)列表;该组织的网格列表、网格下人员(带网格长角色)列表。去除已经在节点上的工作人员。 + DepartmentStaffListResultDTO resultDTO = new DepartmentStaffListResultDTO(); + List projectStaffList = canTick.getProjectStaffList(); + //1:根据组织Id查询该组织下工作人员列表(去除组织下已经在项目节点上的人员) + List agencyAllStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId()); + List agencyStaffList = new ArrayList<>(); + //1.1:去除组织下已在项目节点上的人员 + if (null != agencyAllStaffList && agencyAllStaffList.size() > NumConstant.ZERO) { + for(StaffListResultDTO ag : agencyAllStaffList){ + boolean bl = true; + for(ProjectStaffDTO dto : projectStaffList){ + if(ag.getStaffId().equals(dto.getStaffId())&&!StringUtils.isNotBlank(dto.getDepartmentId())&&!StringUtils.isNotBlank(dto.getGridId())){ + bl = false; + break; + } + } + if(bl){ agencyStaffList.add(ag);} + } + } + //2:根据组织Id查询该组织下部门、人员列表 + //2.1:查询组织下部门列表 + List listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId()); + List departmentList = ConvertUtils.sourceToTarget(listDept, DeptListResultDTO.class); + 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())) { + //去除每个部门下已经在项目流程中的人员 + AtomicBoolean bl = new AtomicBoolean(true); + projectStaffList.forEach(node->{ + if(dept.getDepartmentId().equals(node.getDepartmentId())&&ds.getUserId().equals(node.getStaffId())&&StringUtils.isNotBlank(node.getDepartmentId())&&!StringUtils.isNotBlank(node.getGridId())){ + bl.set(false); + } + }); + if (bl.get()) { StaffListResultDTO sf = new StaffListResultDTO(); sf.setStaffId(ds.getUserId()); departmentStaffList.add(sf); @@ -231,7 +409,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl 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())) { + //去除每个网格下已经在项目流程中的人员 + AtomicBoolean bl = new AtomicBoolean(true); + projectStaffList.forEach(node->{ + if(grid.getGridId().equals(node.getGridId())&&gs.getUserId().equals(node.getStaffId())&&!StringUtils.isNotBlank(node.getDepartmentId())&&StringUtils.isNotBlank(node.getGridId())){ + bl.set(false); + } + }); + if (bl.get()) { StaffListResultDTO sf = new StaffListResultDTO(); sf.setStaffId(gs.getUserId()); gridStaffList.add(sf); @@ -241,7 +426,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl staffIdList1 = agencyStaffList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList()); List staffIdList2 = deptStaffs.stream().map(CustomerStaffDepartmentDTO::getUserId).collect(Collectors.toList()); List staffIdList3 = gridStaffs.stream().map(CustomerStaffGridDTO::getUserId).collect(Collectors.toList()); @@ -284,71 +469,62 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl{ //人员信息 - for(StaffListResultDTO stf : staffList){ + staffList.forEach(stf->{ if(sf.getStaffId().equals(stf.getStaffId())){ - //sf = ConvertUtils.sourceToTarget(stf, StaffListResultDTO.class); sf.setStaffName(stf.getStaffName()); sf.setStaffHeadPhoto(stf.getStaffHeadPhoto()); sf.setGender(stf.getGender()); - break; } - } + }); //人员角色信息 - for(CustomerStaffRoleResultDTO role : roleList){ + roleList.forEach(role->{ if(sf.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.AGENCY_LEADER.equals(role.getRoleKey())){ sf.setRoleName(role.getRoleName()); - break; } - } - } + }); + }); //5.2装载组织下部门下人员数据 - for(DeptListResultDTO dept : departmentList){ + departmentList.forEach(dept->{ List departmentStaffList = dept.getDepartmentStaffList(); - for(StaffListResultDTO ds : departmentStaffList){ + departmentStaffList.forEach(ds->{ //人员信息 - for(StaffListResultDTO stf : staffList){ + staffList.forEach(stf->{ if(ds.getStaffId().equals(stf.getStaffId())){ - //ds = ConvertUtils.sourceToTarget(stf, StaffListResultDTO.class); ds.setStaffName(stf.getStaffName()); ds.setStaffHeadPhoto(stf.getStaffHeadPhoto()); ds.setGender(stf.getGender()); - break; } - } + }); //人员角色信息 - for(CustomerStaffRoleResultDTO role : roleList){ + roleList.forEach(role->{ if(ds.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.DEPT_LEADER.equals(role.getRoleKey())){ ds.setRoleName(role.getRoleName()); - break; } - } - } - } + }); + }); + }); //5.3装载组织下网格下人员数据 - for(GridListResultDTO grid : gridList){ + gridList.forEach(grid->{ List gridStaffList = grid.getGridStaffList(); - for(StaffListResultDTO gs : gridStaffList){ + gridStaffList.forEach(gs->{ //人员信息 - for(StaffListResultDTO stf : staffList){ + staffList.forEach(stf->{ if(gs.getStaffId().equals(stf.getStaffId())){ - //gs = ConvertUtils.sourceToTarget(stf, StaffListResultDTO.class); gs.setStaffName(stf.getStaffName()); gs.setStaffHeadPhoto(stf.getStaffHeadPhoto()); gs.setGender(stf.getGender()); - break; } - } + }); //人员角色信息 - for(CustomerStaffRoleResultDTO role : roleList){ + roleList.forEach(role->{ if(gs.getStaffId().equals(role.getStaffId())&&CustomerAgencyConstant.GRID_MANAGER.equals(role.getRoleKey())){ gs.setRoleName(role.getRoleName()); - break; } - } - } - } + }); + }); + }); resultDTO.setAgencyStaffList(agencyStaffList); resultDTO.setDepartmentList(departmentList); resultDTO.setGridList(gridList); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index 41f5add36f..cd4f40f9fb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -103,9 +103,6 @@ WHERE del_flag = '0' AND agency_id =#{agencyId} - - AND user_id != #{staffId} - \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java index e65e670f12..78a7927b43 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java @@ -63,4 +63,11 @@ public interface ProjectStaffDao extends BaseDao { */ List selectStaffsByProjectId(@Param("projectId") String projectId); + /** + * @param dto + * @return + * @Author sun + * @Description 查询当前处于项目节点中的切工作未处理的工作人员 + **/ + List selectProjectTransferStaffList(ProjectStaffDTO dto); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index ccd4421b7b..a8d19dbb5b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -4,9 +4,8 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; +import com.epmet.dto.form.TransferOptionalStaffListFormDTO; import com.epmet.dto.result.AgencyDeptGridResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.dto.result.ProcessorListResultDTO; @@ -34,10 +33,10 @@ public interface GovOrgFeignClient { * @param canTick * @return * @Author sun - * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 + * @Description 项目流转时查询组织下,组织下部门,组织下网格对应的可选人员列表 **/ - @PostMapping(value = "/gov/org/customeragency/departmentstafflist") - Result departmentStaffList(CanTickStaffListFormDTO canTick); + @PostMapping(value = "/gov/org/customeragency/transferoptionalstafflist") + Result transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick); /** * @param formDTO diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index e5dec301d0..2db7b9cce7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -4,11 +4,8 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.AgencyDeptGridFormDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; +import com.epmet.dto.form.TransferOptionalStaffListFormDTO; import com.epmet.dto.result.AgencyDeptGridResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.dto.result.ProcessorListResultDTO; @@ -27,8 +24,8 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId); } @Override - public Result departmentStaffList(CanTickStaffListFormDTO canTick) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", canTick); + public Result transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "transferOptionalStaffList", canTick); } @Override diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java index 425179c4e6..9dfa87eed5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java @@ -28,8 +28,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ProjectConstant; import com.epmet.dao.ProjectStaffDao; import com.epmet.dto.ProjectStaffDTO; -import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.DepartmentStaffListFormDTO; +import com.epmet.dto.form.TransferOptionalStaffListFormDTO; import com.epmet.dto.result.DepartmentResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.entity.ProjectStaffEntity; @@ -123,23 +123,22 @@ public class ProjectStaffServiceImpl extends BaseServiceImpl projectStaffList = baseDao.selectProjectTransferStaffList(dto); + + TransferOptionalStaffListFormDTO canTick = new TransferOptionalStaffListFormDTO(); canTick.setAgencyId(formDTO.getAgencyId()); - canTick.setType("project"); - if(null!=entity.getDepartmentId()||!"".equals(entity.getDepartmentId())){ - canTick.setDeptOrGridId(entity.getDepartmentId()); - } - if(null!=entity.getGridId()||!"".equals(entity.getGridId())){ - canTick.setDeptOrGridId(entity.getGridId()); - } - canTick.setStaffId(formDTO.getStaffId()); - Result resultDTOResult = govOrgFeignClient.departmentStaffList(canTick); + canTick.setProjectStaffList(projectStaffList); + //3:调用gov-org服务,分别查询组织下,组织下部门,组织下网格对应的可选人员列表 + Result resultDTOResult = govOrgFeignClient.transferOptionalStaffList(canTick); if(null==resultDTOResult.getData()){ throw new RenException(ProjectConstant.SELECT_GOV_ORG_EXCEPTION); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml index 1325b8cff3..8fe0e2d5f4 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml @@ -44,5 +44,14 @@ SELECT DISTINCT STAFF_ID FROM project_staff WHERE PROJECT_ID = #{projectId} + \ No newline at end of file