| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -62,7 +62,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void communityPartyCalculate(String customerId, String monthId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerId = "b09527201c4409e19d1dbc5e3c3429a1"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 党建能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 根据all_parent_index_code  获取指标明细
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -70,10 +69,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //下属所有网格的党建能力平均值
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String finalCustomerId = customerId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        detailListByParentCode.forEach(indexGroup -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (indexGroup.getIndexCode().equals(IndexCalConstant.COMMUNITY_PARTY_AVG)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(finalCustomerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (subGridPartyAvgScore.size() != NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -81,7 +79,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<SubGridPartyAvgResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect = subGridPartyAvgScore.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -90,14 +87,11 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BeanUtils.copyProperties(c,dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), index1SampleValues,indexGroup.getThreshold(), indexGroup.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, indexGroup); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (grid.getAgencyId().equals(agency.getSampleId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setScore(agency.getSampleScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (grid.getAgencyId().equals(key)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setScore(value); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -122,11 +116,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexEnd = NumConstant.TEN; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<CommunityPublishArticleCountResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    MaxAndMinIntegerResultDTO maxAndMinInteger = this.getMaxAndMinInteger(publishArticleCounts.stream().map(CommunityPublishArticleCountResultDTO::getPublishArticleCount).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(publishArticleCounts.stream().map(o -> new BigDecimal(o.getPublishArticleCount())).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect = publishArticleCounts.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        ScoreCalculator<Integer> sc1 = new IntegerScoreCalculator(maxAndMinInteger.getMin(), maxAndMinInteger.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue<Integer>> ll = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue> ll = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            ll.add(s); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -134,15 +127,12 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BeanUtils.copyProperties(c,publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            communityPublishArticle.add(publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        IndexInputVO<Integer> index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll,indexGroup.getThreshold(), indexGroup.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, ll, indexGroup); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            communityPublishArticle.forEach(publish -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (publish.getAgencyId().equals(agency.getSampleId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (publish.getAgencyId().equals(key)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    publish.setIndexCode(indexGroup.getIndexCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    publish.setScore(agency.getSampleScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    publish.setScore(value); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -173,16 +163,11 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void communityGovernAbilityCalculate(String customerId, String monthId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerId = "b09527201c4409e19d1dbc5e3c3429a1"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String finalCustomerId = customerId; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (detail.getIndexCode().equals(IndexCalConstant.COMMUNITY_GOVERN_AVG)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<SubGridGovernAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(finalCustomerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<SubGridGovernAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (subGridGovernAvg.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // TODO
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -194,7 +179,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<SubGridGovernAvgResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect = subGridGovernAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -203,11 +187,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BeanUtils.copyProperties(c,dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold() ,detail.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        scoreCountOfSampleId.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, detail); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (grid.getAgencyId().equals(key)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setScore(value); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -218,12 +199,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<Map<String,Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(finalCustomerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<Map<String,Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (communityGovernAbility.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // TODO
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -250,21 +228,20 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            indexInputVOS.add(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        scoreCountOfSampleId.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (key.equals(grid.getAgencyId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setCustomerId(finalCustomerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setScore(grid.getScore().add(value)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            scoreCountOfSampleId.forEach((key,value) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (key.equals(grid.getAgencyId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        grid.setCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        grid.setScore(grid.getScore().add(value)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -289,82 +266,75 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            switch (detail.getIndexCode()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                case IndexCalConstant.COMMUNITY_SERVICE_AVG: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (subGridServiceAvg.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String indexCode = detail.getIndexCode(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (indexCode.equals(IndexCalConstant.COMMUNITY_SERVICE_AVG)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (subGridServiceAvg.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // TODO 只有一条记录时
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // TODO 只有一条记录时
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else if (subGridServiceAvg.size() > NumConstant.ONE ){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        Integer indexEnd = NumConstant.TEN; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SubGridServiceAvgResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            collect = subGridServiceAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                index1SampleValues.add(s); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                BeanUtils.copyProperties(c,dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                subAllGridList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues,detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if (grid.getAgencyId().equals(agency.getSampleId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        grid.setScore(agency.getSampleScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else if (subGridServiceAvg.size() > NumConstant.ONE ){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexEnd = NumConstant.TEN; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<SubGridServiceAvgResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect = subGridServiceAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            index1SampleValues.add(s); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BeanUtils.copyProperties(c,dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues,detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            subAllGridList.forEach(grid -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (grid.getAgencyId().equals(agency.getSampleId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    grid.setScore(agency.getSampleScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            indexStart++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                case "shequhuodongzzcs": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<CommunityActivityCountResultDTO> communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (communityActivityCount.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        indexStart++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CommunityActivityCountResultDTO> communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (communityActivityCount.size() == NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // TODO
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // TODO
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else if (communityActivityCount.size() > NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        Integer indexEnd = NumConstant.TEN; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<CommunityActivityCountResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<SampleValue<Integer>> ll = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                ll.add(s); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                BeanUtils.copyProperties(c,publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                communityPublishArticle.add(publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            IndexInputVO<Integer> index1VO = new IndexInputVO<>(detail.getIndexId(), ll, detail.getThreshold(),detail.getWeight(), sc1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                communityPublishArticle.forEach(publish -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    if (publish.getAgencyId().equals(agency.getSampleId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                        publish.setScore(agency.getSampleScore()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else if (communityActivityCount.size() > NumConstant.ONE){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexStart = NumConstant.ZERO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Integer indexEnd = NumConstant.TEN; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<CommunityActivityCountResultDTO> collect; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<SampleValue> ll = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        collect.forEach(c -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            ll.add(s); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            BeanUtils.copyProperties(c,publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            communityPublishArticle.add(publishArticle); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, ll, detail); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.forEach((k,v) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            communityPublishArticle.forEach(publish -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (publish.getAgencyId().equals(k)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    publish.setScore(v); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            indexStart++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                default: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        indexStart++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } while (collect.size() == NumConstant.TEN); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        subAllGridList.forEach(grid -> { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -388,15 +358,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/9/1 9:21 上午 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void communityRelate(String customerId, String monthId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityPartyCalculate(customerId, monthId); //党建能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityGovernAbilityCalculate(customerId, monthId);  // 治理能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityServiceAbilityCalculate(customerId, monthId);  // 服务能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -406,7 +368,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, List<FactIndexCommunityScoreDTO>> collect = factIndexCommunityScoreEntities.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<FactIndexCommunityScoreDTO> result = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collect.forEach((key,value) -> { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -417,7 +378,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            score.setMonthId(monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            score.setYearId(DateUtils.getYearId(monthId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            score.setQuarterId(DateUtils.getQuarterId(monthId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            factIndexCommunityScoreEntities.forEach(community -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            score.setIndexCode(IndexCalConstant.COMMUNITY_RELATE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            value.forEach(community -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                score.setScore(score.getScore().add(community.getScore())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result.add(score); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -426,22 +388,20 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        factIndexCommunityScoreDao.insertCommunityPartyRecord(result); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void calAll(String customerId,String monthId){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityPartyCalculate(customerId, monthId); //党建能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityGovernAbilityCalculate(customerId, monthId);  // 治理能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        this.communityServiceAbilityCalculate(customerId, monthId);  // 服务能力
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        communityRelate(customerId, monthId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  Integer类型获取最大数和最小数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  BigDecimal类型获取最大数和最小数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param list | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/8/27 1:30 下午 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public MaxAndMinIntegerResultDTO getMaxAndMinInteger(List<Integer> list){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Integer max = Collections.max(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Integer min = Collections.min(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        MaxAndMinIntegerResultDTO result = new MaxAndMinIntegerResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.setMax(max); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.setMin(min); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List<BigDecimal> list){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        BigDecimal max = Collections.max(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        BigDecimal min = Collections.min(list); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -451,20 +411,11 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description  Double类型获取最大数和最小数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param list | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/8/27 1:32 下午 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public MaxAndMinDoubleResultDTO getMaxAndMinDouble(List<Double> list){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Double max = Collections.max(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Double min = Collections.min(list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        MaxAndMinDoubleResultDTO result = new MaxAndMinDoubleResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.setMax(max); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        result.setMin(min); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public HashMap<String, BigDecimal> getCalResult(MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal,List<SampleValue> ll, IndexGroupDetailEntity indexGroup){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), ll,indexGroup.getThreshold(), indexGroup.getWeight(), sc); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |