| 
						
						
							
								
							
						
						
					 | 
					@ -33,7 +33,6 @@ import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Service | 
					 | 
					 | 
					@Service | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Slf4j | 
					 | 
					 | 
					@Slf4j | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//@DataSource(DataSourceConstant.EVALUATION_INDEX)
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					public class CalGridIndexServiceImpl implements CalGridIndexService { | 
					 | 
					 | 
					public class CalGridIndexServiceImpl implements CalGridIndexService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -56,6 +55,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactArticlePublishedGridDailyService articlePublishedGridDailyService; | 
					 | 
					 | 
					    private FactArticlePublishedGridDailyService articlePublishedGridDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private GroupExtractService groupExtractService; | 
					 | 
					 | 
					    private GroupExtractService groupExtractService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private FactOriginTopicLogDailyService topicLogService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  计算网格指标党建能力 | 
					 | 
					 | 
					     * @Description  计算网格指标党建能力 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -88,6 +89,32 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<GridProjectCountResultDTO> gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); | 
					 | 
					 | 
					        List<GridProjectCountResultDTO> gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 建群党员数
 | 
					 | 
					 | 
					        // 建群党员数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<PartyCreateGroupCountResultDTO> partyCreateGroupCountList = groupExtractService.selectPartyCreateGroupCount(customerId, monthId); | 
					 | 
					 | 
					        List<PartyCreateGroupCountResultDTO> partyCreateGroupCountList = groupExtractService.selectPartyCreateGroupCount(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //结合目前产品,数据来源:话题评论、议题表决
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //网格活跃群众用户数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String,Integer> gridMassActiveMap = new HashMap<>(16); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyActiveResultDTO> massActiveList = topicLogService.selectPartyActiveTopic(customerId, monthId, NumConstant.ZERO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyActiveResultDTO> massActiveIssueVote = issueExtractService.selectPartyActiveIssueVote(customerId, monthId, NumConstant.ZERO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        massActiveList.addAll(massActiveIssueVote); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(massActiveList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Map<String, List<PartyActiveResultDTO>> collectMap = massActiveList.stream().collect(Collectors.groupingBy(PartyActiveResultDTO::getGridId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            collectMap.forEach((gridId, massActive) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<String> userIds = massActive.stream().map(mass -> mass.getUserId()).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                gridMassActiveMap.put(gridId, userIds.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //网格活跃党员用户数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String,Integer> gridPartyActiveMap = new HashMap<>(16); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyActiveResultDTO> partyActiveList = topicLogService.selectPartyActiveTopic(customerId, monthId, NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyActiveResultDTO> partyActiveIssueVote = issueExtractService.selectPartyActiveIssueVote(customerId, monthId, NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        partyActiveList.addAll(partyActiveIssueVote); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(partyActiveList)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Map<String, List<PartyActiveResultDTO>> collectMap = massActiveList.stream().collect(Collectors.groupingBy(PartyActiveResultDTO::getGridId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            collectMap.forEach((gridId, partyActive) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<String> userIds = partyActive.stream().map(party -> party.getUserId()).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                gridPartyActiveMap.put(gridId, userIds.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String quarterId = DateUtils.getQuarterId(monthId); | 
					 | 
					 | 
					        String quarterId = DateUtils.getQuarterId(monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String yearId = DateUtils.getYearId(monthId); | 
					 | 
					 | 
					        String yearId = DateUtils.getYearId(monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        result.forEach(r -> { | 
					 | 
					 | 
					        result.forEach(r -> { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -158,6 +185,22 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 9. 网格活跃群众用户数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (null != gridMassActiveMap){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                gridMassActiveMap.forEach((k,v) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (r.getGridId().equals(k)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        r.setActiveUserCount(v); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 10. 网格活跃党员用户数
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (null != gridPartyActiveMap){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                gridPartyActiveMap.forEach((k,v) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (r.getGridId().equals(k)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        r.setActivePartyCount(v); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        delAndInsertPartyAbility(result,customerId,monthId); | 
					 | 
					 | 
					        delAndInsertPartyAbility(result,customerId,monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -323,7 +366,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					     * @Description  小数四舍五入 | 
					 | 
					 | 
					     * @Description  小数四舍五入【保留六位小数】 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					     * @param d | 
					 | 
					 | 
					     * @param d | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/9/18 2:01 下午 | 
					 | 
					 | 
					     * @date 2020/9/18 2:01 下午 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |