diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java index 295f0bd593..976bfcbf05 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java @@ -39,11 +39,13 @@ import com.epmet.constant.EventConstant; import com.epmet.constant.ResiEventAction; import com.epmet.dao.*; import com.epmet.dto.EventProjectInfoDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.ProjectCategoryService; import com.epmet.service.ResiEventService; @@ -92,6 +94,9 @@ public class ResiEventServiceImpl extends BaseServiceImpl()); // 先判断这个项目是否有分类没有直接返回 List projectCategoryDTOList=projectCategoryService.getProjectCategoryService(formDTO.getProjectId()); if(CollectionUtils.isEmpty(projectCategoryDTOList)){ - resultDTO.setProjectData(new ArrayList<>()); return resultDTO; } + //筛选出所有的一级分类 + Set firstCategoryIds=new HashSet<>(); + for(ProjectCategoryDTO categoryDTO:projectCategoryDTOList){ + if(StringUtils.isNotBlank(categoryDTO.getCategoryPids())){ + if(NumConstant.ZERO_STR.equals(categoryDTO.getCategoryPids())){ + //当前分类就是一级分类 + firstCategoryIds.add(categoryDTO.getCategoryId()); + continue; + } + //英文逗号 + if(categoryDTO.getCategoryPids().contains(StrConstant.COMMA)){ + String[] categoryAtt=categoryDTO.getCategoryPids().split(StrConstant.COMMA); + firstCategoryIds.add(categoryAtt[NumConstant.ZERO]); + continue; + } + //可能也是英文冒号吧。。不知道是啥,所以都判断下吧 + if(categoryDTO.getCategoryPids().contains(StrConstant.COLON)){ + String[] categoryAtt=categoryDTO.getCategoryPids().split(StrConstant.COLON); + firstCategoryIds.add(categoryAtt[NumConstant.ZERO]); + continue; + } + } + } + //没有一级分类直接退出 + if(CollectionUtils.isEmpty(firstCategoryIds)){ + return resultDTO; + } + //查询这些分类的名称 //查询出当前人,在居民端小程序里上报的需求且转了项目的,并且还得排除当前的这个项目 - //todo - return null; + IssueProjectCategoryDictListFormDTO dictFormDto=new IssueProjectCategoryDictListFormDTO(); + dictFormDto.setCustomerId(projectCategoryDTOList.get(NumConstant.ZERO).getCustomerId()); + dictFormDto.setCstegoryIdList(new ArrayList(firstCategoryIds)); + Result> categoryRes=govIssueOpenFeignClient.getCategoryList(dictFormDto); + if(!categoryRes.success()||CollectionUtils.isEmpty(categoryRes.getData())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取项目分类名称异常"); + } + List projectData=new ArrayList<>(); + for(IssueProjectCategoryDictDTO categoryDictDTO:categoryRes.getData()){ + //当前项目分类一致,排除当前项目,相同分类编码 + //todo + List projectList=null; + //projectDao.selectCommonCategoryEventProject(projectCategoryDTOList.get(NumConstant.ZERO).getCustomerId(), + //categoryDictDTO.getCategoryCode(),formDTO.getProjectId()); + if(!CollectionUtils.isEmpty(projectList)){ + ProjectDataDTO projectDataDTO=new ProjectDataDTO(); + projectDataDTO.setFirstCategoryCode(categoryDictDTO.getCategoryCode()); + projectDataDTO.setFirstCategoryName(categoryDictDTO.getCategoryName()); + projectDataDTO.setProjectList(projectList); + projectData.add(projectDataDTO); + } + } + resultDTO.setProjectData(projectData); + return resultDTO; }