| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -921,4 +921,333 @@ public class TopicServiceImpl implements TopicService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 根据话题状态的维度自动匹配、分析数据 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author wangc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020.06.30 17:04 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    void analyzeTopicGroupByIssueStatus(Map<String, Set<String>> subGridOfAgency, List<AgencySubTreeDto> agencies, Map<String,List<ResiGroupTopicResultDTO>> gridGroupMap, Map<String,List<ResiTopicOperationResultDTO>> topicOperationMap, Date targetDate, TopicStatisticalData dataPacket, List<DimTopicStatusDTO> statusDimension, DimIdGenerator.DimIdBean timeDimension){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Boolean isMonthEnd = false;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Calendar calendar = Calendar.getInstance(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.setTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //前一天零点
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.add(Calendar.DATE, NumConstant.ONE_NEG); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.MINUTE, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.SECOND, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.setTime(targetDateCheck); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果目标日期是当月的最后一天
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //求出这个月的第一天
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.setTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.MINUTE, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        calendar.set(Calendar.SECOND, NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // isMonthEnd = true;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //}
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //计算百分比使用,保留小数点后两位
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        NumberFormat numberFormat = NumberFormat.getInstance(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        numberFormat.setMaximumFractionDigits(NumConstant.SIX); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,DimTopicStatusDTO> statusMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        statusDimension.forEach(status -> statusMap.put(status.getId(),status)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,AgencySubTreeDto> agencyMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        agencies.forEach(agency -> {agencyMap.put(agency.getAgencyId(),agency);}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiGroupTopicResultDTO> groupList = new LinkedList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(Map.Entry<String,List<ResiGroupTopicResultDTO>> entry : gridGroupMap.entrySet()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                groupList.addAll(entry.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //key -> groupId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,GroupTopicData> groupTopicData =  traverseGroupTopic(groupList,topicOperationMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,Boolean> gridDistinct = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        agencies.forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                agency.getGridIds().forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    gridDistinct.put(grid,false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(Map.Entry<String,Set<String>> entry : subGridOfAgency.entrySet()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FactTopicIssueAgencyDailyDTO issueAgencyD = new FactTopicIssueAgencyDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FactTopicTotalAgencyDailyDTO totalAgencyD = new FactTopicTotalAgencyDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //initAgencyDailyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyD,totalAgencyD);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            statusMap.forEach((k,v) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //无状态标识
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                boolean noStatusFlag = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(StringUtils.equals(k,"discussing")){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    noStatusFlag = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                final boolean noStatusFlagFinal = noStatusFlag; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //k:状态的key
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //对应状态key的一条话题-状态记录
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                FactTopicStatusAgencyDailyDTO topicAgencyD = new FactTopicStatusAgencyDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                topicAgencyD.setTopicStatusId(k); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //initAgencyDailyDTO
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    entry.getValue().forEach(gridId -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        FactTopicStatusGridDailyDTO topicGridD = new FactTopicStatusGridDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        topicGridD.setTopicStatusId(k); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        FactTopicIssueGridDailyDTO issueGridD = new FactTopicIssueGridDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        FactTopicTotalGridDailyDTO totalGirdD = new FactTopicTotalGridDailyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //init
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //if(noStatusFlagFinal){
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            //initGridDailyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueGridD,totalGirdD,topicGridD_discussing);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //}else{
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            //initGridDailyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,topicGridD_discussing);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //}
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<ResiGroupTopicResultDTO> groups = gridGroupMap.get(gridId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(null != groups && groups.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            groups.forEach(group -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (null != group && StringUtils.isNotBlank(group.getGroupId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if(noStatusFlagFinal) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueAgencyD.setIssueIncr(issueAgencyD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueAgencyD.setIssueTotal(issueAgencyD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalAgencyD.setIssueTotalCount(issueAgencyD.getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalAgencyD.setHiddenTotalCount(totalAgencyD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalAgencyD.setTopicIncr(totalAgencyD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalAgencyD.setTopicTotal(totalAgencyD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueGridD.setIssueIncr(issueGridD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueGridD.setIssueTotal(issueGridD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalGirdD.setIssueTotalCount(issueGridD.getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalGirdD.setHiddenTotalCount(totalGirdD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalGirdD.setTopicIncr(totalGirdD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        totalGirdD.setTopicTotal(totalGirdD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    GroupTopicData data = groupTopicData.get(group.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if (null != data) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        //根据当前的话题状态key,去data中取相应的数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        switch(k){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case "discussing": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getDiscussingTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getDiscussingIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getDiscussingTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getDiscussingIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case "hidden": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getHiddenTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getHiddenIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getHiddenTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getHiddenIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case "closed": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicCount(topicAgencyD.getTopicCount() + data.getClosedTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyD.setTopicIncrement(topicAgencyD.getTopicIncrement() + data.getClosedIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicCount(topicGridD.getTopicCount() + data.getClosedTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicGridD.setTopicIncrement(topicGridD.getTopicIncrement() + data.getClosedIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //网格-百分比
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        //setGridTopicProportion(numberFormat, topicGridD, totalGirdD);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(!gridDistinct.get(gridId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            //setGridDailyDataPacket(dataPacket, issueGridD, totalGirdD, topicGridD_discussing, topicGridD_hidden, topicGridD_closed);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        /* | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if(noStatusFlagFinal){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    set :: issueGridD | totalGridD | topicGridD | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    set :: topicGridD | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                         */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            gridDistinct.put(gridId,true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //机关-百分比
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //setAgencyTopicProportion(numberFormat,topicAgencyD,totalAgencyD);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //setAgencyDailyDataPacket(dataPacket,issueAgencyD,totalAgencyD,topicAgencyD_discussing,topicAgencyD_hidden,topicAgencyD_closed);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             /* | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(noStatusFlagFinal){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    set :: issueAgencyD | totalAgencyD | topicAgencyD | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    set :: topicAgencyD | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        gridDistinct.forEach((k,v) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            gridDistinct.put(k,false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiGroupTopicResultDTO> topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //key : gridId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,List<ResiGroupTopicResultDTO>> GridGroupMapBetweenTimeRange = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiGroupTopicResultDTO> groupListBetweenTimeRange = new LinkedList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(Map.Entry<String,List<ResiGroupTopicResultDTO>> entryBetweenTimeRange : GridGroupMapBetweenTimeRange.entrySet()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null != entryBetweenTimeRange.getValue() && entryBetweenTimeRange.getValue().size() > NumConstant.ZERO) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                groupListBetweenTimeRange.addAll(entryBetweenTimeRange.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiTopicOperationResultDTO> operationsBetweenTimeRange = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                topicDao.selectTopicOperationRecordBetweenTimeRange(calendar.getTime(),targetDate); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //key: topicId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,List<ResiTopicOperationResultDTO>> topicOperationMapBetweenTimeRange = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                operationsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getTopicId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //key: groupId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String,GroupTopicData> groupTopicDataBetweenTimeRange =  traverseGroupTopic(groupListBetweenTimeRange,topicOperationMapBetweenTimeRange); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for(Map.Entry<String,Set<String>> entry : subGridOfAgency.entrySet()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FactTopicIssueAgencyMonthlyDTO issueAgencyM = new FactTopicIssueAgencyMonthlyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					           //initAgencyMonthlyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyM);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            statusMap.forEach((k,v) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                boolean noStatusFlag = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(StringUtils.equals(k,"discussing")){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    noStatusFlag = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                final boolean noStatusFlagFinal = noStatusFlag; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                FactTopicStatusAgencyMonthlyDTO topicAgencyM = new FactTopicStatusAgencyMonthlyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                topicAgencyM.setTopicStatusId(k); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    entry.getValue().forEach(gridId -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        FactTopicIssueGridMonthlyDTO issueGridM = new FactTopicIssueGridMonthlyDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        initGridMonthlyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,issueGridM); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<ResiGroupTopicResultDTO> groups = gridGroupMap.get(gridId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(null != groups) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            groups.forEach(group -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (null != group && StringUtils.isNotBlank(group.getGroupId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if(noStatusFlagFinal) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueAgencyM.setIssueIncr(issueAgencyM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueAgencyM.setIssueTotal(issueAgencyM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueGridM.setIssueIncr(issueGridM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        issueGridM.setIssueTotal(issueGridM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    GroupTopicData data = groupTopicDataBetweenTimeRange.get(group.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if (null != data) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        switch(k){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case  "discussing": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getDiscussingTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getDiscussingIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case  "hidden": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getHiddenTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getHiddenIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                            case  "closed": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicCount(topicAgencyM.getTopicCount() + data.getClosedTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                topicAgencyM.setTopicIncr(topicAgencyM.getTopicIncr() + data.getClosedIncr()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(!gridDistinct.get(gridId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            setGridMonthlyDataPacket(dataPacket, issueGridM); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        gridDistinct.put(gridId,true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //机关-百分比
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //Integer topicTotal = dataPacket.getTotalAgencyDailyList().stream().filter( obj -> StringUtils.equals(obj.getAgencyId(),entry.getKey())).findFirst().get().getTopicTotal();
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //setAgencyTopicMonthlyProportion(numberFormat,topicAgencyM,topicTotal);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            /* | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if(noStatusFlagFinal){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        set :: issueAgencyM | topicAgencyM | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        set topicAgencyM | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					             */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |