|
|
@ -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; |
|
|
|