Browse Source

议题管理部门人员选择、项目流转部门人员选择接口业务逻辑调整

master
sunyuchao 5 years ago
parent
commit
fd17181079
  1. 1
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  2. 6
      epmet-module/gov-org/gov-org-client/pom.xml
  3. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CanTickStaffListFormDTO.java
  4. 27
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/TransferOptionalStaffListFormDTO.java
  5. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  6. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java
  7. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  8. 266
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  9. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  10. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java
  11. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  12. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  13. 25
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java
  14. 9
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml

1
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<IssueDao, IssueEntity> imp
//1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息
CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO();
canTick.setAgencyId(formDTO.getAgencyId());
canTick.setType("issue");
Result<DepartmentStaffListResultDTO> resultDTOResult = govOrgFeignClient.departmentStaffList(canTick);
return resultDTOResult.getData();
}

6
epmet-module/gov-org/gov-org-client/pom.xml

@ -26,6 +26,12 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-project-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

19
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;
}

27
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<ProjectStaffDTO> projectStaffList;
}

14
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<DepartmentStaffListResultDTO> departmentStaffList(@RequestBody CanTickStaffListFormDTO canTick) {
return new Result<DepartmentStaffListResultDTO>().ok(customerAgencyService.departmentStaffList(canTick));
}
/**
* @param canTick
* @return
* @Author sun
* @Description 项目流转-查询组织下组织下部门组织下网格对应的可选人员列表
**/
@PostMapping("transferoptionalstafflist")
public Result<DepartmentStaffListResultDTO> transferOptionalStaffList(@RequestBody TransferOptionalStaffListFormDTO canTick) {
return new Result<DepartmentStaffListResultDTO>().ok(customerAgencyService.transferOptionalStaffList(canTick));
}
/**
* @param formDTO
* @return

5
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<CustomerStaffAgencyEntit
* 查询组织下人员列表
* @Author sun
*/
List<StaffListResultDTO> selectAgencyStaffList(@Param("agencyId") String agencyId, @Param("staffId") String staffId);
List<StaffListResultDTO> selectAgencyStaffList(@Param("agencyId") String agencyId);
}

11
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<CustomerAgencyEntity>
* @param canTick
* @return
* @Author sun
* @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息
* @Description 议题转项目-查询组织下人员,组织下部门人员,组织下网格人员列表信息
**/
DepartmentStaffListResultDTO departmentStaffList(CanTickStaffListFormDTO canTick);
/**
* @param canTick
* @return
* @Author sun
* @Description 项目流转-查询组织下组织下部门组织下网格对应的可选人员列表
**/
DepartmentStaffListResultDTO transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick);
/**
* @param formDTO
* @return

266
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<CustomerAgencyDao
* @return
* @Author sun
* @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息
* 查询该组织下所有人员在部门或网格下存在的人员不在组织下展示
**/
@Override
public DepartmentStaffListResultDTO departmentStaffList(CanTickStaffListFormDTO canTick) {
//根据组织Id查询该组织的工作人员列表;该组织的部门列表、部门下人员(带部门领导角色)列表;该组织的网格列表、网格下人员(带网格长角色)列表。人员都不做去重处理。
//根据组织Id查询该组织的工作人员(带单位领导角色)列表;该组织的部门列表、部门下人员(带部门领导角色)列表;该组织的网格列表、网格下人员(带网格长角色)列表。人员都不做去重处理。
DepartmentStaffListResultDTO resultDTO = new DepartmentStaffListResultDTO();
//1:根据组织Id查询该组织下工作人员列表(如果当前操作人是组织下的则不查询)
String staffId = "";
if ("project".equals(canTick.getType()) && "".equals(canTick.getDeptOrGridId())) {
staffId = canTick.getStaffId();
}
List<StaffListResultDTO> agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId(),staffId);
//1:根据组织Id查询该组织下工作人员列表
List<StaffListResultDTO> agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId());
//2:根据组织Id查询该组织下部门、人员列表
//2.1:查询组织下部门列表
List<DepartmentListResultDTO> listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId());
@ -208,7 +203,190 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
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);
});
}
//3:根据组织Id查询该组织下网格、人员列表
//3.1:查询组织下网格列表
List<GridListResultDTO> gridList = customerGridDao.selectGridList(canTick.getAgencyId());
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())){
StaffListResultDTO sf = new StaffListResultDTO();
sf.setStaffId(gs.getUserId());
gridStaffList.add(sf);
}
});
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());
List<String> staffIdList3 = gridStaffs.stream().map(CustomerStaffGridDTO::getUserId).collect(Collectors.toList());
List<String> staffIdList = new ArrayList<>();
staffIdList.addAll(staffIdList1); staffIdList.addAll(staffIdList2); staffIdList.addAll(staffIdList3);
staffIdList = new ArrayList<String>(new LinkedHashSet<>(staffIdList));staffIdList.removeAll(Collections.singleton(""));
CustomerStaffListResultDTO dto = new CustomerStaffListResultDTO();
if (null != staffIdList || staffIdList.size() > NumConstant.ZERO) {
Result<CustomerStaffListResultDTO> userList = epmetUserFeignClient.getCustomerStaffList(staffIdList);
if (!userList.success() || null == userList.getData()) {
throw new RenException(CustomerAgencyConstant.SELECT_USER_EXCEPTION);
}
dto = userList.getData();
}
//5:循环数据,将人员数据放到对应数据结构下
List<StaffListResultDTO> staffList = dto.getStaffList();
List<CustomerStaffRoleResultDTO> roleList = dto.getRoleList();
//有时间再优化成jdk8的遍历方式
//5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员
//部门
Iterator<StaffListResultDTO> itDept = agencyStaffList.iterator();
while (itDept.hasNext()) {
StaffListResultDTO stf = itDept.next();
for (CustomerStaffDepartmentDTO dept : deptStaffs) {
if (dept.getUserId().equals(stf.getStaffId())) {
itDept.remove();
break;
}
}
}
//网格
Iterator<StaffListResultDTO> 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<StaffListResultDTO> 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<StaffListResultDTO> 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<ProjectStaffDTO> projectStaffList = canTick.getProjectStaffList();
//1:根据组织Id查询该组织下工作人员列表(去除组织下已经在项目节点上的人员)
List<StaffListResultDTO> agencyAllStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId());
List<StaffListResultDTO> 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<DepartmentListResultDTO> listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId());
List<DeptListResultDTO> departmentList = ConvertUtils.sourceToTarget(listDept, DeptListResultDTO.class);
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())) {
//去除每个部门下已经在项目流程中的人员
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<CustomerAgencyDao
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())) {
//去除每个网格下已经在项目流程中的人员
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<CustomerAgencyDao
grid.setGridStaffList(gridStaffList);
});
}
//4:汇总组织下人员、组织下部门下人员、组织下网格下人员Id集合,调用epmet-user服务查询工作人员基本信息
//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());
List<String> staffIdList3 = gridStaffs.stream().map(CustomerStaffGridDTO::getUserId).collect(Collectors.toList());
@ -284,71 +469,62 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
}
//5.1装载组织下人员数据
for(StaffListResultDTO sf : agencyStaffList){
agencyStaffList.forEach(sf->{
//人员信息
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<StaffListResultDTO> 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<StaffListResultDTO> 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);

3
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}
<if test="staffId != null and staffId.trim() != ''">
AND user_id != #{staffId}
</if>
</select>
</mapper>

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectStaffDao.java

@ -63,4 +63,11 @@ public interface ProjectStaffDao extends BaseDao<ProjectStaffEntity> {
*/
List<String> selectStaffsByProjectId(@Param("projectId") String projectId);
/**
* @param dto
* @return
* @Author sun
* @Description 查询当前处于项目节点中的切工作未处理的工作人员
**/
List<ProjectStaffDTO> selectProjectTransferStaffList(ProjectStaffDTO dto);
}

9
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<DepartmentStaffListResultDTO> departmentStaffList(CanTickStaffListFormDTO canTick);
@PostMapping(value = "/gov/org/customeragency/transferoptionalstafflist")
Result<DepartmentStaffListResultDTO> transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick);
/**
* @param formDTO

9
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<DepartmentStaffListResultDTO> departmentStaffList(CanTickStaffListFormDTO canTick) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", canTick);
public Result<DepartmentStaffListResultDTO> transferOptionalStaffList(TransferOptionalStaffListFormDTO canTick) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "transferOptionalStaffList", canTick);
}
@Override

25
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<ProjectStaffDao, Pr
@Override
public DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO) {
//1:查询当前工作人员代表的是哪个部门(组织下的、组织部门下的、组织网格下的),用于在人员选择时去掉自己选自己的情况(自己选自己只的是当前工作的部门下的自己)
//1:查询项目人员关联表数据
ProjectStaffEntity entity = baseDao.selectById(formDTO.getProjectStaffId());
if (null == entity) {
throw new RenException(ProjectConstant.SELECT_PROJECTSTAFF_EXCEPTION);
}
//2:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息
CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO();
//2:查询当前处于项目节点中的切工作未处理的工作人员
ProjectStaffDTO dto = new ProjectStaffDTO();
dto.setProjectId(entity.getProjectId());
dto.setIsHandle(ProjectConstant.UNHANDLED);
List<ProjectStaffDTO> 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<DepartmentStaffListResultDTO> resultDTOResult = govOrgFeignClient.departmentStaffList(canTick);
canTick.setProjectStaffList(projectStaffList);
//3:调用gov-org服务,分别查询组织下,组织下部门,组织下网格对应的可选人员列表
Result<DepartmentStaffListResultDTO> resultDTOResult = govOrgFeignClient.transferOptionalStaffList(canTick);
if(null==resultDTOResult.getData()){
throw new RenException(ProjectConstant.SELECT_GOV_ORG_EXCEPTION);
}

9
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}
</select>
<select id="selectProjectTransferStaffList" resultType="com.epmet.dto.ProjectStaffDTO">
SELECT
*
FROM
project_staff
WHERE del_flag = '0'
AND project_id = #{projectId}
AND is_handle = #{isHandle}
</select>
</mapper>
Loading…
Cancel
Save