| 
						
						
							
								
							
						
						
					 | 
					@ -19,13 +19,13 @@ import com.epmet.service.screen.IndexGroupDetailService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.*; | 
					 | 
					 | 
					import com.epmet.support.normalizing.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.BatchScoreCalculator; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.BatchScoreCalculator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.IndexInputVO; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.IndexInputVO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.IndexOutputVO; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.SampleValue; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.SampleValue; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import org.springframework.beans.BeanUtils; | 
					 | 
					 | 
					import org.apache.commons.collections4.ListUtils; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.math.BigDecimal; | 
					 | 
					 | 
					import java.math.BigDecimal; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.*; | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -55,8 +55,8 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactIndexGridScoreDao factIndexGridScoreDao; | 
					 | 
					 | 
					    private FactIndexGridScoreDao factIndexGridScoreDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  社区名义发文数量计算【党建能力】 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 社区名义发文数量计算【党建能力】 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/8/26 10:46 上午 | 
					 | 
					 | 
					     * @date 2020/8/26 10:46 上午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -64,314 +64,210 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Boolean communityPartyCalculate(String customerId, String monthId) { | 
					 | 
					 | 
					    public Boolean communityPartyCalculate(String customerId, String monthId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 党建能力
 | 
					 | 
					 | 
					        // 党建能力
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 根据all_parent_index_code  获取指标明细
 | 
					 | 
					 | 
					        // 根据all_parent_index_code  获取指标明细
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); | 
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(detailListByParentCode)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>(); | 
					 | 
					 | 
					            log.error("指标明细查询集合为空"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<IndexInputVO> indexInputVOS = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //下属所有网格的党建能力平均值
 | 
					 | 
					 | 
					        //下属所有网格的党建能力平均值
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        detailListByParentCode.forEach(indexGroup -> { | 
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (indexGroup.getIndexCode().equals(IndexCalConstant.COMMUNITY_PARTY_AVG)){ | 
					 | 
					 | 
					            if (IndexCodeEnum.XIA_SHU_SUO_YOU_WGDDJNLPJZ.getCode().equals(detail.getIndexCode())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(customerId, monthId); | 
					 | 
					 | 
					                List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (subGridPartyAvgScore.size() != NumConstant.ZERO){ | 
					 | 
					 | 
					                if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
					 | 
					 | 
					                    log.error("查询下属所有网格的党建能力平均值集合为空"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					                    return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                    Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<SubGridPartyAvgResultDTO> collect; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    do { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        collect = subGridPartyAvgScore.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        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); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, indexGroup); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        result.forEach((key,value) -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            subAllGridList.forEach(grid -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                if (grid.getAgencyId().equals(key)){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                    grid.setScore(value); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        indexStart++; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    }while (collect.size() == NumConstant.TEN); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }else { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<IndexInputVO> indexInputVOS = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<Map<String, Object>> maps = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(indexGroup.getIndexCode()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (!StringUtils.isEmpty(fieldNameByIndexCode)) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    if (maps.get(NumConstant.ZERO).containsKey(fieldNameByIndexCode)) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<BigDecimal> decimalList = maps.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<Map<String, Object>> collect; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        do { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            collect = maps.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> index1SampleValues = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            collect.forEach(c -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                index1SampleValues.add(s); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                BeanUtils.copyProperties(c,publishArticle); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                communityPublishArticle.add(publishArticle); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), index1SampleValues, indexGroup.getThreshold(), indexGroup.getWeight(), sc1); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            indexInputVOS.add(index1VO); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        } while (collect.size() == NumConstant.TEN); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
					 | 
					 | 
					                MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
					 | 
					 | 
					                Integer indexEnd = NumConstant.TEN; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                scoreCountOfSampleId.forEach((key,value) -> { | 
					 | 
					 | 
					                List<List<SubGridPartyAvgResultDTO>> partition = ListUtils.partition(subGridPartyAvgScore, indexEnd); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    communityPublishArticle.forEach(grid -> { | 
					 | 
					 | 
					                partition.forEach(publish -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        if (key.equals(grid.getAgencyId())) { | 
					 | 
					 | 
					                    List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            grid.setCustomerId(customerId); | 
					 | 
					 | 
					                    publish.forEach(c -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); | 
					 | 
					 | 
					                        SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            grid.setScore(grid.getScore().add(value)); | 
					 | 
					 | 
					                        index1SampleValues.add(s); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                        } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    }); | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    indexInputVOS.add(index1VO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        }); | 
					 | 
					 | 
					                // 社区名义发文数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        // 社区名义发文数量
 | 
					 | 
					 | 
					                List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        /*List<CommunityPublishArticleCountResultDTO> publishArticleCounts = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCount(customerId, monthId); | 
					 | 
					 | 
					                if (CollectionUtils.isEmpty(mapList)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        detailListByParentCode.forEach(indexGroup -> { | 
					 | 
					 | 
					                    log.error("查询社区名义发文数量集合为空"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (indexGroup.getIndexCode().equals("shequmingyifwsl")) { | 
					 | 
					 | 
					                    return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                if (publishArticleCounts.size() == NumConstant.ONE) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    //TODO 结果为一条时
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } else if (publishArticleCounts.size() > NumConstant.ONE) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<CommunityPublishArticleCountResultDTO> collect; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    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()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<SampleValue> ll = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        collect.forEach(c -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            ll.add(s); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            BeanUtils.copyProperties(c,publishArticle); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            communityPublishArticle.add(publishArticle); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, ll, indexGroup); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        result.forEach((key,value) -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            communityPublishArticle.forEach(publish -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                if (publish.getAgencyId().equals(key)){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                    publish.setIndexCode(indexGroup.getIndexCode()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                    publish.setScore(value); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        indexStart++; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } while (collect.size() == NumConstant.TEN); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            } | 
					 | 
					 | 
					                String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        });*/ | 
					 | 
					 | 
					                if (StringUtils.isEmpty(fieldNameByIndexCode)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        subAllGridList.forEach(grid -> { | 
					 | 
					 | 
					                    log.error("指标Code未查询出对应字段 【" + detail.getIndexCode() + "】"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            communityPublishArticle.forEach(publish -> { | 
					 | 
					 | 
					                    return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                if (grid.getAgencyId().equals(publish.getAgencyId())){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    grid.setScore(grid.getScore().add(publish.getScore())); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    grid.setIndexCode(IndexCalConstant.COMMUNITY_PARTY); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }); | 
					 | 
					 | 
					                List<BigDecimal> decimalList = mapList.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<List<Map<String, Object>>> publishArticleList = ListUtils.partition(mapList, 10); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                publishArticleList.forEach(publish -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    publish.forEach(c -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        index1SampleValues.add(s); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    indexInputVOS.add(index1VO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_PARTY,subAllGridList); | 
					 | 
					 | 
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  社区治理能力 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param monthId | 
					 | 
					 | 
					     * @param monthId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 社区治理能力 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/8/26 1:40 下午 | 
					 | 
					 | 
					     * @date 2020/8/26 1:40 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Boolean communityGovernAbilityCalculate(String customerId, String monthId) { | 
					 | 
					 | 
					    public Boolean communityGovernAbilityCalculate(String customerId, String monthId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); | 
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(detailListByParentCode)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("指标明细查询集合为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<IndexInputVO> indexInputVOS = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (detail.getIndexCode().equals(IndexCalConstant.COMMUNITY_GOVERN_AVG)){ | 
					 | 
					 | 
					            if (IndexCodeEnum.SHE_QU_XIA_SHU_SYWGZLNLHZPJZ.getCode().equals(detail.getIndexCode())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                List<SubGridGovernAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(customerId, monthId); | 
					 | 
					 | 
					                List<SubGridGovernAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (subGridGovernAvg.size() == NumConstant.ONE){ | 
					 | 
					 | 
					                if (subGridGovernAvg.size() == NumConstant.ONE) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    // TODO
 | 
					 | 
					 | 
					                    // TODO
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					                } else if (subGridGovernAvg.size() > NumConstant.ONE) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                }else if (subGridGovernAvg.size() > NumConstant.ONE){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					                    List<List<SubGridGovernAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, 10); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					                    governAvg.forEach(avg -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<SubGridGovernAvgResultDTO> collect; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    do { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        collect = subGridGovernAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        collect.forEach(c -> { | 
					 | 
					 | 
					                        avg.forEach(c -> { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            index1SampleValues.add(s); | 
					 | 
					 | 
					                            index1SampleValues.add(s); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            BeanUtils.copyProperties(c,dto); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            subAllGridList.add(dto); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					                        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        HashMap<String, BigDecimal> result = this.getCalResult(maxAndMinBigDecimal, index1SampleValues, detail); | 
					 | 
					 | 
					                        BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        result.forEach((key,value) -> { | 
					 | 
					 | 
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            subAllGridList.forEach(grid -> { | 
					 | 
					 | 
					                        indexInputVOS.add(index1VO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                if (grid.getAgencyId().equals(key)){ | 
					 | 
					 | 
					                    }); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                    grid.setScore(value); | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                } | 
					 | 
					 | 
					            } else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            }); | 
					 | 
					 | 
					                List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (communityGovernAbility.size() == NumConstant.ONE) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    // TODO
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } else if (communityGovernAbility.size() > NumConstant.ONE) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (StringUtils.isEmpty(fieldNameByIndexCode)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        log.error("指标Code未查询出对应字段 【" + detail.getIndexCode() + "】"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    List<BigDecimal> decimalList = communityGovernAbility.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    List<List<Map<String, Object>>> governAbilityList = ListUtils.partition(communityGovernAbility, 10); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    governAbilityList.forEach(governAbility -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        governAbility.forEach(c -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                            index1SampleValues.add(s); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					                        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        indexStart++; | 
					 | 
					 | 
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    }while (collect.size() == NumConstant.TEN); | 
					 | 
					 | 
					                        indexInputVOS.add(index1VO); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<Map<String,Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId); | 
					 | 
					 | 
					        HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (communityGovernAbility.size() == NumConstant.ONE){ | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            // TODO
 | 
					 | 
					 | 
					        deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					        }else if (communityGovernAbility.size() > NumConstant.ONE){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<IndexInputVO> indexInputVOS = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            detailListByParentCode.forEach(detail -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (!StringUtils.isEmpty(fieldNameByIndexCode)){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    if (communityGovernAbility.get(NumConstant.ZERO).containsKey(fieldNameByIndexCode)) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<BigDecimal> decimalList = communityGovernAbility.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<Map<String, Object>> collect; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        do { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            collect = communityGovernAbility.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> index1SampleValues = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            collect.forEach(c -> { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                index1SampleValues.add(s); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            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(customerId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        grid.setScore(grid.getScore().add(value)); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN,subAllGridList); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  社区服务能力 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param monthId | 
					 | 
					 | 
					     * @param monthId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 社区服务能力 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/8/31 1:38 下午 | 
					 | 
					 | 
					     * @date 2020/8/31 1:38 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Boolean communityServiceAbilityCalculate(String customerId, String monthId) { | 
					 | 
					 | 
					    public Boolean communityServiceAbilityCalculate(String customerId, String monthId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); | 
					 | 
					 | 
					        List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtils.isEmpty(detailListByParentCode)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("指标明细查询集合为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<IndexInputVO> indexInputVOS = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String indexCode = detail.getIndexCode(); | 
					 | 
					 | 
					            String indexCode = detail.getIndexCode(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (indexCode.equals(IndexCalConstant.COMMUNITY_SERVICE_AVG)){ | 
					 | 
					 | 
					            if (IndexCodeEnum.SHE_QU_XIA_JI_SYWGFWNLDFPJZ.getCode().equals(indexCode)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); | 
					 | 
					 | 
					                List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (subGridServiceAvg.size() == NumConstant.ONE){ | 
					 | 
					 | 
					                if (subGridServiceAvg.size() == NumConstant.ONE) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    // TODO 只有一条记录时
 | 
					 | 
					 | 
					                    // TODO 只有一条记录时
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }else if (subGridServiceAvg.size() > NumConstant.ONE ){ | 
					 | 
					 | 
					                } else if (subGridServiceAvg.size() > NumConstant.ONE) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					                    List<List<SubGridServiceAvgResultDTO>> serviceAvgList = ListUtils.partition(subGridServiceAvg, 10); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					                    serviceAvgList.forEach(serviceAvg -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                    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); | 
					 | 
					 | 
					                        BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        collect.forEach(c -> { | 
					 | 
					 | 
					                        serviceAvg.forEach(c -> { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                            index1SampleValues.add(s); | 
					 | 
					 | 
					                            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); | 
					 | 
					 | 
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO); | 
					 | 
					 | 
					                        indexInputVOS.add(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); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }else{ | 
					 | 
					 | 
					            } else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                List<CommunityActivityCountResultDTO> communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId); | 
					 | 
					 | 
					                List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (communityActivityCount.size() == NumConstant.ONE){ | 
					 | 
					 | 
					                if (CollectionUtils.isEmpty(communityActivityCountList)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    log.error(""); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (communityActivityCountList.size() == NumConstant.ONE) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    // TODO
 | 
					 | 
					 | 
					                    // TODO
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }else if (communityActivityCount.size() > NumConstant.ONE){ | 
					 | 
					 | 
					                } else if (communityActivityCountList.size() > NumConstant.ONE) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexStart = NumConstant.ZERO; | 
					 | 
					 | 
					                    String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    Integer indexEnd = NumConstant.TEN; | 
					 | 
					 | 
					                    if (StringUtils.isEmpty(fieldNameByIndexCode)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    List<CommunityActivityCountResultDTO> collect; | 
					 | 
					 | 
					                        log.error("指标Code未查询出对应字段 【" + detail.getIndexCode() + "】"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList())); | 
					 | 
					 | 
					                        return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    do { | 
					 | 
					 | 
					                    } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList()); | 
					 | 
					 | 
					                    List<BigDecimal> decimalList = communityActivityCountList.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        List<SampleValue> ll = new ArrayList<>(); | 
					 | 
					 | 
					                    MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        collect.forEach(c -> { | 
					 | 
					 | 
					                    List<List<Map<String, Object>>> communityActivityList = ListUtils.partition(communityActivityCountList, 10); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount()); | 
					 | 
					 | 
					                    communityActivityList.forEach(communityActivity -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            ll.add(s); | 
					 | 
					 | 
					                        ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO(); | 
					 | 
					 | 
					                        List<SampleValue> index1SampleValues = new ArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            BeanUtils.copyProperties(c,publishArticle); | 
					 | 
					 | 
					                        communityActivity.forEach(c -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                            communityPublishArticle.add(publishArticle); | 
					 | 
					 | 
					                            SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                        }); | 
					 | 
					 | 
					                            index1SampleValues.add(s); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                        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++; | 
					 | 
					 | 
					                        IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    } while (collect.size() == NumConstant.TEN); | 
					 | 
					 | 
					                        indexInputVOS.add(index1VO); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        subAllGridList.forEach(grid -> { | 
					 | 
					 | 
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            grid.setIndexCode(IndexCalConstant.COMMUNITY_SERVICE); | 
					 | 
					 | 
					        HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            communityPublishArticle.forEach(publish -> { | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (grid.getAgencyId().equals(publish.getAgencyId())){ | 
					 | 
					 | 
					        deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result); | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					                    grid.setScore(grid.getScore().add(publish.getScore())); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    grid.setCustomerId(customerId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_SERVICE,subAllGridList); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  社区相关计算 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param monthId | 
					 | 
					 | 
					     * @param monthId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 社区相关计算 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/9/1 9:21 上午 | 
					 | 
					 | 
					     * @date 2020/9/1 9:21 上午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -380,14 +276,14 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId); | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
					 | 
					 | 
					        detailListByParentCode.forEach(detail -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            factIndexCommunityScoreEntities.forEach(community -> { | 
					 | 
					 | 
					            factIndexCommunityScoreEntities.forEach(community -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if (detail.getIndexCode().equals(community.getIndexCode())){ | 
					 | 
					 | 
					                if (detail.getIndexCode().equals(community.getIndexCode())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    community.setScore(community.getScore().multiply(detail.getWeight())); | 
					 | 
					 | 
					                    community.setScore(community.getScore().multiply(detail.getWeight())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Map<String, List<FactIndexCommunityScoreDTO>> collect = factIndexCommunityScoreEntities.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); | 
					 | 
					 | 
					        Map<String, List<FactIndexCommunityScoreDTO>> collect = factIndexCommunityScoreEntities.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = new ArrayList<>(); | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        collect.forEach((key,value) -> { | 
					 | 
					 | 
					        collect.forEach((key, value) -> { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            FactIndexCommunityScoreDTO score = new FactIndexCommunityScoreDTO(); | 
					 | 
					 | 
					            FactIndexCommunityScoreDTO score = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            score.setIsTotal(NumConstant.ONE_STR); | 
					 | 
					 | 
					            score.setIsTotal(NumConstant.ONE_STR); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            score.setCustomerId(customerId); | 
					 | 
					 | 
					            score.setCustomerId(customerId); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -401,44 +297,44 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.add(score); | 
					 | 
					 | 
					            result.add(score); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        deleteAndInsert(customerId,monthId,IndexCalConstant.COMMUNITY_RELATE,result); | 
					 | 
					 | 
					        deleteAndInsert(customerId, monthId, IndexCalConstant.COMMUNITY_RELATE, result); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  计算社区相关总分 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param monthId | 
					 | 
					 | 
					     * @param monthId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 计算社区相关总分 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/9/1 4:12 下午 | 
					 | 
					 | 
					     * @date 2020/9/1 4:12 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Boolean calCommunityAll(String customerId,String monthId){ | 
					 | 
					 | 
					    public Boolean calCommunityAll(String customerId, String monthId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力
 | 
					 | 
					 | 
					        Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (!aBoolean.equals(true)){ | 
					 | 
					 | 
					        if (!aBoolean.equals(true)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("calculate community-party-ability failure ......"); | 
					 | 
					 | 
					            throw new RenException("calculate community-party-ability failure ......"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力
 | 
					 | 
					 | 
					        Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (!bBoolean.equals(true)){ | 
					 | 
					 | 
					        if (!bBoolean.equals(true)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("calculate community-govern-ability failure ......"); | 
					 | 
					 | 
					            throw new RenException("calculate community-govern-ability failure ......"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力
 | 
					 | 
					 | 
					        Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (!cBoolean.equals(true)){ | 
					 | 
					 | 
					        if (!cBoolean.equals(true)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("calculate community-service-ability failure ......"); | 
					 | 
					 | 
					            throw new RenException("calculate community-service-ability failure ......"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Boolean dBoolean = communityRelate(customerId, monthId); | 
					 | 
					 | 
					        Boolean dBoolean = communityRelate(customerId, monthId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (!dBoolean.equals(true)){ | 
					 | 
					 | 
					        if (!dBoolean.equals(true)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("calculate community-all insert failure ......"); | 
					 | 
					 | 
					            throw new RenException("calculate community-all insert failure ......"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  BigDecimal类型获取最大数和最小数 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param list | 
					 | 
					 | 
					     * @param list | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description BigDecimal类型获取最大数和最小数 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/8/27 1:30 下午 | 
					 | 
					 | 
					     * @date 2020/8/27 1:30 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List<BigDecimal> list){ | 
					 | 
					 | 
					    public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List<BigDecimal> list) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        BigDecimal max = Collections.max(list); | 
					 | 
					 | 
					        BigDecimal max = Collections.max(list); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        BigDecimal min = Collections.min(list); | 
					 | 
					 | 
					        BigDecimal min = Collections.min(list); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        MaxAndMinBigDecimalResultDTO result = new MaxAndMinBigDecimalResultDTO(); | 
					 | 
					 | 
					        MaxAndMinBigDecimalResultDTO result = new MaxAndMinBigDecimalResultDTO(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -447,25 +343,34 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return result; | 
					 | 
					 | 
					        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); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @Description  先删除记录,在插入 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param monthId | 
					 | 
					 | 
					     * @param monthId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param indexCode | 
					 | 
					 | 
					     * @param indexCode | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param subAllGridList | 
					 | 
					 | 
					     * @param subAllGridList | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description 先删除记录,在插入 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/9/1 4:24 下午 | 
					 | 
					 | 
					     * @date 2020/9/1 4:24 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void deleteAndInsert(String customerId,String monthId,String indexCode,List<FactIndexCommunityScoreDTO> subAllGridList){ | 
					 | 
					 | 
					    public void deleteAndInsert(String customerId, String monthId, String indexCode, List<FactIndexCommunityScoreDTO> subAllGridList) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,indexCode); | 
					 | 
					 | 
					        factIndexCommunityScoreDao.deleteOldRecord(customerId, monthId, indexCode); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); | 
					 | 
					 | 
					        factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public List<FactIndexCommunityScoreDTO> getResult(HashMap<String, BigDecimal> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<FactIndexCommunityScoreDTO> result = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        scoreCountOfSampleId.forEach((k, v) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            FactIndexCommunityScoreDTO score = new FactIndexCommunityScoreDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setAgencyId(k); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setMonthId(monthId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setQuarterId(DateUtils.getQuarterId(monthId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setYearId(DateUtils.getYearId(monthId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setIsTotal(isTotal); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setIndexCode(indexCode); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.setScore(v); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            result.add(score); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |