| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -8,12 +8,10 @@ import com.epmet.constant.ProjectConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ProjectCategoryDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ProjectDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.org.GridInfoDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.topic.TopicAttachmentDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.topic.result.ResiTopicAndImgResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -126,7 +124,12 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (null != gridInfo) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    user.setGridName(gridInfo.getGridName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    user.setOrgId(gridInfo.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    user.setOrgName(gridInfo.getOrgName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if(StringUtils.isNotBlank(gridInfo.getOrgName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        user.setOrgName(gridInfo.getOrgName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        GridInfoDTO gridInfoDTO = customerGridService.queryGridInfoDTO(user.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        user.setOrgName(gridInfoDTO.getOrgName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //原始数据Pid使用英文:隔开,大屏数据要求按照英文,隔开
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    user.setAllParentIds(gridInfo.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else{ | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -150,101 +153,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param param | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 难点赌点数据中转站 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author wangc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020.09.25 10:00 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //查询数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(), projectService.getOvertimeProjectByParameter(param.getCustomerId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(difficulties)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.查询出客户下网格的相关信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //剔除垃圾数据(本次需要更新的数据集)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //    ScreenDifficultyDataEntity pointer = iter.next();
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //    if(null == gridMap.get(pointer.getOrgId())){
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //        iter.remove();
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //    }
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //}
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        difficulties.removeIf(diff -> null == gridMap.get(diff.getOrgId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //最近一次操作
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, ProjectLatestOperationResultDTO> latestOperationMap = projectProcessService.getLatestOperation(projectIds, param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //图片
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ProjectSourceMapFormDTO> projectSourceMap = difficulties.stream().map(diff -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            map.setProjectId(diff.getEventId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            map.setSourceId(diff.getEventImgUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, List<ScreenDifficultyImgDataEntity>> imgMap = topicService.getTopicImgs(projectSourceMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> contentMap = topicService.getTopicContent(projectSourceMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        difficulties.forEach(diff -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenDifficultyImgDataEntity> figureList = CollectionUtils.isEmpty(imgMap) ? null : imgMap.get(diff.getEventId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(contentMap)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diff.setEventContent(contentMap.get(diff.getEventId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(latestOperationMap)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (null != oper) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diff.setLatestOperateDesc(oper.getOperationName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diff.setEventTitle(oper.getTitle()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diff.setEventCostTime(oper.getCostTime()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenDifficultyImgDataEntity> imgList = new LinkedList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        imgMap.values().forEach(imgList::addAll); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //立案后会有 一个process 如果没有则说明是垃圾数据 如果有其他方式立项的项目则需要考虑下兼容
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        difficulties.removeIf(diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        screenDifficultyDataService.dataClean(param.getCustomerId(), difficulties, imgList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(difficulties)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        imgList.forEach(item -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            item.setCustomerId(param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //1.根据客户Id 获取所有项目数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactOriginProjectMainDailyEntity> difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(difficultyBaseList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //获取业务库项目标题
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(bizProjectInfoList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //获取agency维度
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -261,74 +171,97 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                .collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.获取项目的所有节点耗时数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //处理部门数去重(只要流转到就算)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, Set<String>> orgCountMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //被处理次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, Integer> handleCountMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //判断是否符合难点堵点条件
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!valideProjectIdSet.contains(project.getId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Set<String> regCount = orgCountMap.get(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (regCount != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffEntity.setEventReOrg(regCount.size()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffEntity.setEventReOrg(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Integer handleOrgCount = handleCountMap.get(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (handleOrgCount != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffEntity.setEventHandledCount(handleOrgCount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffEntity.setEventHandledCount(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //获取业务库项目标题
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(bizProjectInfoList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int pageNo = NumConstant.ONE; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int pageSize = NumConstant.FIVE_HUNDRED; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactOriginProjectMainAndPeriodDTO> difficultyBaseList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //1.根据客户Id 获取所有项目数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            int offset = (pageNo++ - NumConstant.ONE) * pageSize; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isEmpty(difficultyBaseList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isNotBlank(project.getTopicId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //获取图片及话题内容
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (topicInfo != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (!CollectionUtils.isEmpty(topicImgList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        topicImgList.forEach(img -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            imgData.setEventId(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            imgData.setEventImgUrl(img.getAttachmentUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            imgData.setSort(img.getSort()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            imgDataEntities.add(imgData); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            imgData.setCustomerId(param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //2.获取项目的所有节点耗时数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = difficultyBaseList.stream() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .filter(o->o.getPeriodList() != null) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .flatMap(o->o.getPeriodList().stream()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //处理部门数去重(只要流转到就算)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, Set<String>> orgCountMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //被处理次数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, Integer> handleCountMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //判断是否符合难点堵点条件
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!valideProjectIdSet.contains(project.getId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Set<String> regCount = orgCountMap.get(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (regCount != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diffEntity.setEventReOrg(regCount.size()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diffEntity.setEventReOrg(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Integer handleOrgCount = handleCountMap.get(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (handleOrgCount != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diffEntity.setEventHandledCount(handleOrgCount); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diffEntity.setEventHandledCount(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (StringUtils.isNotBlank(project.getTopicId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //获取图片及话题内容
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (topicInfo != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (!CollectionUtils.isEmpty(topicImgList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            topicImgList.forEach(img -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                imgData.setEventId(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                imgData.setEventImgUrl(img.getAttachmentUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                imgData.setSort(img.getSort()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                imgDataEntities.add(imgData); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                imgData.setCustomerId(param.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        diffEntity.setEventContent(topicInfo.getTopicContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    diffEntity.setEventContent(topicInfo.getTopicContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                diffList.add(diffEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            diffList.add(diffEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenDifficultyDataEntity> collect = diffList.stream().filter(o -> o.getEventCostTime() < 5 * 24 * 60).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("========:" + JSON.toJSONString(collect)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("========:" + JSON.toJSONString(diffList)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("========:" + JSON.toJSONString(imgDataEntities)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("========:" + JSON.toJSONString(diffList)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("========:" + JSON.toJSONString(imgDataEntities)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3.获取项目的最后操作记录
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -417,7 +350,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param bizProjectInfoMap | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainDailyEntity project, Map<String, DimAgencyEntity> agencyMap, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainAndPeriodDTO project, Map<String, DimAgencyEntity> agencyMap, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                           Map<String, GridInfoDTO> gridMap, Map<String, ProjectDTO> bizProjectInfoMap) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |