Browse Source

项目详情-当前处理部门显示工作人员

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
a76644de52
  1. 16
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java
  2. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java
  3. 40
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  4. 13
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml
  5. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

16
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @dscription
* @date 2020/5/11 15:33
*/
@NoArgsConstructor
@Data
public class ProjectDetailResultDTO implements Serializable {
@ -49,6 +51,18 @@ public class ProjectDetailResultDTO implements Serializable {
/**
* 当前跟进部门
*/
private List<String> departmentNameList;
private List<DepartmentNameListBean> departmentNameList;
@NoArgsConstructor
@Data
public static class DepartmentNameListBean {
/**
* 部门名
*/
private String departmentName;
/**
* 工作人员
*/
private List<String> staffList;
}
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.ProjectStaffDTO;
import com.epmet.dto.form.LatestListFormDTO;
import com.epmet.dto.form.ProjectListFromDTO;
import com.epmet.dto.form.ShiftProjectsFromDTO;
@ -78,6 +79,15 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
*/
List<String> selectDepartmentNameList(ProjectDTO dto);
/**
* 当前处理部门及工作人员
* @author zhaoqifeng
* @date 2020/8/14 10:56
* @param dto
* @return java.util.List<com.epmet.dto.ProjectStaffDTO>
*/
List<ProjectStaffDTO> selectCurrentDepartmentList(ProjectDTO dto);
/**
* 获取项目详情
* @author zhaoqifeng

40
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -44,10 +44,7 @@ import com.epmet.entity.ProjectEntity;
import com.epmet.entity.ProjectProcessEntity;
import com.epmet.entity.ProjectRelatedPersonnelEntity;
import com.epmet.entity.ProjectStaffEntity;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.MessageFeignClient;
import com.epmet.feign.*;
import com.epmet.redis.ProjectRedis;
import com.epmet.service.*;
import org.apache.commons.lang3.StringUtils;
@ -87,6 +84,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
private MessageFeignClient messageFeignClient;
@Autowired
private ProjectRelatedPersonnelService projectRelatedPersonnelService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
@ -281,16 +280,41 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
}
//获取当前跟进部门
List<String> departmentNameList = new ArrayList<>();
List<ProjectStaffDTO> departmentNameList = new ArrayList<>();
List<ProjectDetailResultDTO.DepartmentNameListBean> departmentList = new ArrayList<>();
if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) {
//项目已结案,跟进部门为空
resultDTO.setDepartmentNameList(departmentNameList);
resultDTO.setDepartmentNameList(departmentList);
} else {
//项目未结案,找出所有跟进部门
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setId(fromDTO.getProjectId());
departmentNameList = baseDao.selectDepartmentNameList(projectDTO);
resultDTO.setDepartmentNameList(departmentNameList);
departmentNameList = baseDao.selectCurrentDepartmentList(projectDTO);
//提取工作人员ID
List<String> staffIdList = departmentNameList.stream().map(ProjectStaffDTO::getStaffId).collect(Collectors.toList());
staffIdList = staffIdList.stream().distinct().collect(Collectors.toList());
//根据部门分组
Map<String, List<ProjectStaffDTO>> departmentMap =
departmentNameList.stream().collect(Collectors.groupingBy(ProjectStaffDTO::getDepartmentName));
//获取工作人员信息(姓名)
UserIdsFormDTO userIdsFormDTO = new UserIdsFormDTO();
userIdsFormDTO.setUserIds(staffIdList);
Result<List<StaffSinGridResultDTO>> staffListResult = epmetUserOpenFeignClient.getStaffInfoList(userIdsFormDTO);
if (!staffListResult.success()) {
throw new RenException(staffListResult.getCode(), staffListResult.getMsg());
}
List<StaffSinGridResultDTO> staffList = staffListResult.getData();
for (String departmentName : departmentMap.keySet()) {
ProjectDetailResultDTO.DepartmentNameListBean bean = new ProjectDetailResultDTO.DepartmentNameListBean();
bean.setDepartmentName(departmentName);
List<ProjectStaffDTO> staffDTOList = departmentMap.get(departmentName);
List<String> staffNameList =
staffDTOList.stream().flatMap(staffDto -> staffList.stream().filter(staffInfo ->
staffDto.getStaffId().equals(staffInfo.getStaffId())).map((StaffSinGridResultDTO::getStaffName))).collect(Collectors.toList());
bean.setStaffList(staffNameList);
departmentList.add(bean);
}
resultDTO.setDepartmentNameList(departmentList);
}
return resultDTO;

13
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml

@ -183,5 +183,16 @@
AND origin = #{origin}
AND origin_id = #{originId}
</select>
<select id="selectCurrentDepartmentList" resultType="com.epmet.dto.ProjectStaffDTO">
SELECT DISTINCT
DEPARTMENT_NAME,
STAFF_ID
FROM
project p
INNER JOIN project_staff ps ON p.ID = ps.PROJECT_ID
WHERE p.DEL_FLAG = '0'
AND ps.DEL_FLAG = '0'
AND p.ID = #{id}
AND ps.IS_HANDLE = 'unhandled'
</select>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -225,10 +225,9 @@
gender AS gender
FROM
customer_staff cs
LEFT JOIN user_wechat uw ON uw.user_id = cs.user_id
LEFT JOIN user_wechat uw ON uw.user_id = cs.user_id AND uw.del_flag = 0
WHERE
cs.del_flag = 0
AND uw.del_flag = 0
AND cs.active_flag = 'active'
AND cs.enable_flag = 'enable'
AND

Loading…
Cancel
Save