|  |  | @ -10,6 +10,7 @@ import com.epmet.constant.IndexCalConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcal.AgencyScoreDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -55,6 +56,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict | 
			
		
	
		
			
				
					|  |  |  |     private AgencyScoreDao agencyScoreDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private DeptScoreDao deptScoreDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private ScreenCustomerAgencyDao customerAgencyDao; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Description  计算全区相关总分 | 
			
		
	
	
		
			
				
					|  |  | @ -107,18 +110,14 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { | 
			
		
	
		
			
				
					|  |  |  |                     log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); | 
			
		
	
		
			
				
					|  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |                 } else if (subGridPartyAvgScore.size() == NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                     pid.put(subGridPartyAvgScore.get(NumConstant.ZERO).getAgencyId(), subGridPartyAvgScore.get(NumConstant.ZERO).getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                     sizeOne(subGridPartyAvgScore.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid); | 
			
		
	
		
			
				
					|  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |                 } else if (subGridPartyAvgScore.size() > NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                 } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  |                     MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
			
		
	
		
			
				
					|  |  |  |                     List<List<SubAgencyScoreAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); | 
			
		
	
		
			
				
					|  |  |  |                     subPartyAvgList.forEach(party -> { | 
			
		
	
		
			
				
					|  |  |  |                         List<SampleValue> index1SampleValues = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                         party.forEach(c -> { | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getAgencyId(), c.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getParentId(),customerAgencyDao.selectPid(c.getParentId())); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getParentId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             index1SampleValues.add(s); | 
			
		
	
		
			
				
					|  |  |  |                         }); | 
			
		
	
		
			
				
					|  |  |  |                         BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); | 
			
		
	
	
		
			
				
					|  |  | @ -184,18 +183,17 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict | 
			
		
	
		
			
				
					|  |  |  |         detailListByParentCode.forEach(detail -> { | 
			
		
	
		
			
				
					|  |  |  |             if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { | 
			
		
	
		
			
				
					|  |  |  |                 List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); | 
			
		
	
		
			
				
					|  |  |  |                 if (districtGovernAvgList.size() == NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                     pid.put(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(), districtGovernAvgList.get(NumConstant.ZERO).getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                     sizeOne(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isEmpty(districtGovernAvgList)) { | 
			
		
	
		
			
				
					|  |  |  |                     log.error("查询所有街道治理能力平均值集合为空"); | 
			
		
	
		
			
				
					|  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |                 } else if (districtGovernAvgList.size() > NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                 } else if (districtGovernAvgList.size() > NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  |                     MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
			
		
	
		
			
				
					|  |  |  |                     List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); | 
			
		
	
		
			
				
					|  |  |  |                     governAvg.forEach(avg -> { | 
			
		
	
		
			
				
					|  |  |  |                         List<SampleValue> index1SampleValues = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                         avg.forEach(c -> { | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getAgencyId(), c.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getParentId(),customerAgencyDao.selectPid(c.getParentId())); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getParentId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             index1SampleValues.add(s); | 
			
		
	
		
			
				
					|  |  |  |                         }); | 
			
		
	
		
			
				
					|  |  |  |                         BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); | 
			
		
	
	
		
			
				
					|  |  | @ -205,17 +203,16 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ | 
			
		
	
		
			
				
					|  |  |  |                 List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); | 
			
		
	
		
			
				
					|  |  |  |                 if (deptScoreAvgList.size() == NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                     pid.put(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(), deptScoreAvgList.get(NumConstant.ZERO).getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                     sizeOne(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isEmpty(deptScoreAvgList)) { | 
			
		
	
		
			
				
					|  |  |  |                     log.error("查询所有直属部门治理能力平均值集合为空"); | 
			
		
	
		
			
				
					|  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |                 } else if (deptScoreAvgList.size() > NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                 } else if (deptScoreAvgList.size() > NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  |                     MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
			
		
	
		
			
				
					|  |  |  |                     List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); | 
			
		
	
		
			
				
					|  |  |  |                     governAvg.forEach(avg -> { | 
			
		
	
		
			
				
					|  |  |  |                         List<SampleValue> index1SampleValues = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                         avg.forEach(c -> { | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getAgencyId(), c.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getParentId(),customerAgencyDao.selectPid(c.getParentId())); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             index1SampleValues.add(s); | 
			
		
	
		
			
				
					|  |  |  |                         }); | 
			
		
	
	
		
			
				
					|  |  | @ -254,19 +251,18 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict | 
			
		
	
		
			
				
					|  |  |  |             String indexCode = detail.getIndexCode(); | 
			
		
	
		
			
				
					|  |  |  |             if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { | 
			
		
	
		
			
				
					|  |  |  |                 List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); | 
			
		
	
		
			
				
					|  |  |  |                 if (subStreetAvgList.size() == NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                     pid.put(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(), subStreetAvgList.get(NumConstant.ZERO).getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                     sizeOne(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid); | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isEmpty(subStreetAvgList)) { | 
			
		
	
		
			
				
					|  |  |  |                     log.error("查询区下属街道服务能力汇总平均值集合为空"); | 
			
		
	
		
			
				
					|  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |                 } else if (subStreetAvgList.size() > NumConstant.ONE) { | 
			
		
	
		
			
				
					|  |  |  |                 } else if (subStreetAvgList.size() > NumConstant.ZERO) { | 
			
		
	
		
			
				
					|  |  |  |                     MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); | 
			
		
	
		
			
				
					|  |  |  |                     List<List<SubAgencyScoreAvgResultDTO>> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); | 
			
		
	
		
			
				
					|  |  |  |                     serviceAvgList.forEach(serviceAvg -> { | 
			
		
	
		
			
				
					|  |  |  |                         BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); | 
			
		
	
		
			
				
					|  |  |  |                         List<SampleValue> index1SampleValues = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                         serviceAvg.forEach(c -> { | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getAgencyId(), c.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId())); | 
			
		
	
		
			
				
					|  |  |  |                             SampleValue s = new SampleValue(c.getParentId(), c.getScore()); | 
			
		
	
		
			
				
					|  |  |  |                             index1SampleValues.add(s); | 
			
		
	
		
			
				
					|  |  |  |                         }); | 
			
		
	
		
			
				
					|  |  |  |                         IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); | 
			
		
	
	
		
			
				
					|  |  | 
 |