|
|
@ -91,21 +91,43 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
public Boolean calStreetAll(CalculateCommonFormDTO form) { |
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
Boolean aBoolean = streetPartyCalculate(customerId, monthId);//党建能力
|
|
|
|
if (!aBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-party-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean bBoolean = streetGovernAbilityCalculate(customerId, monthId);// 治理能力
|
|
|
|
if (!bBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-govern-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean cBoolean = streetServiceAbilityCalculate(customerId, monthId);// 服务能力
|
|
|
|
if (!cBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-service-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean dBoolean = streetRelate(customerId, monthId); |
|
|
|
if (!dBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-all insert failure ......"); |
|
|
|
if (StringUtils.isEmpty(form.getCustomerAreaCode())) { |
|
|
|
Boolean aBoolean = streetPartyCalculate(customerId, monthId);//党建能力
|
|
|
|
if (!aBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-party-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean bBoolean = streetGovernAbilityCalculate(customerId, monthId);// 治理能力
|
|
|
|
if (!bBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-govern-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean cBoolean = streetServiceAbilityCalculate(customerId, monthId);// 服务能力
|
|
|
|
if (!cBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-service-ability failure ......"); |
|
|
|
} |
|
|
|
Boolean dBoolean = streetRelate(customerId, monthId); |
|
|
|
if (!dBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-all insert failure ......"); |
|
|
|
} |
|
|
|
}else { |
|
|
|
//党建能力
|
|
|
|
Boolean aBoolean = streetPartyCalculateExistsSub(form); |
|
|
|
if (!aBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-party-ability-exists-sub failure ......"); |
|
|
|
} |
|
|
|
// 治理能力
|
|
|
|
Boolean bBoolean = streetGovernAbilityCalculateExistsSub(form); |
|
|
|
if (!bBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-govern-ability-exists-sub failure ......"); |
|
|
|
} |
|
|
|
// 服务能力
|
|
|
|
Boolean cBoolean = streetServiceAbilityCalculateExistsSub(form); |
|
|
|
if (!cBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-service-ability-exists-sub failure ......"); |
|
|
|
} |
|
|
|
Boolean dBoolean = streetRelateExistsSub(form); |
|
|
|
if (!dBoolean.equals(true)) { |
|
|
|
throw new RenException("calculate street-all-exists-sub insert failure ......"); |
|
|
|
} |
|
|
|
} |
|
|
|
//计算自身和下级
|
|
|
|
CalculateCommonFormDTO formDTO = new CalculateCommonFormDTO(); |
|
|
@ -569,4 +591,273 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
|
result.setFiveLevel(resultFive); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param form |
|
|
|
* @Description 社区名义发文数量计算【党建能力】 |
|
|
|
* @author zxc |
|
|
|
* @date 2020/8/26 10:46 上午 |
|
|
|
*/ |
|
|
|
public Boolean streetPartyCalculateExistsSub(CalculateCommonFormDTO form) { |
|
|
|
// 党建能力
|
|
|
|
// 根据all_parent_index_code 获取指标明细
|
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(detailListByParentCode)) { |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
//下属所有社区的党建能力平均值
|
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { |
|
|
|
log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); |
|
|
|
} else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); |
|
|
|
Integer indexEnd = NumConstant.TEN; |
|
|
|
List<List<SubCommunityAvgResultDTO>> partition = ListUtils.partition(subCommPartyAvgScore, indexEnd); |
|
|
|
partition.forEach(publish -> { |
|
|
|
List<SampleValue> index1SampleValues = new ArrayList<>(); |
|
|
|
publish.forEach(c -> { |
|
|
|
pid.put(c.getAgencyId(),c.getParentId()); |
|
|
|
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); |
|
|
|
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.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 街道名义发文数量
|
|
|
|
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(mapList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); |
|
|
|
} else { |
|
|
|
String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
|
if (StringUtils.isEmpty(fieldName)) { |
|
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode())); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(mapList.stream().map(m -> new BigDecimal(m.get(fieldName).toString())).collect(Collectors.toList())); |
|
|
|
List<List<Map<String, Object>>> publishArticleList = ListUtils.partition(mapList, IndexCalConstant.PAGE_SIZE); |
|
|
|
publishArticleList.forEach(publish -> { |
|
|
|
ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
|
List<SampleValue> index1SampleValues = new ArrayList<>(); |
|
|
|
publish.forEach(c -> { |
|
|
|
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(), c.get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldName)))); |
|
|
|
index1SampleValues.add(s); |
|
|
|
}); |
|
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
|
log.info("streetPartyAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); |
|
|
|
log.info("streetPartyAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId)); |
|
|
|
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
|
deleteOldRecord(customerId, monthId, IndexCalConstant.STREET_LEVEL); |
|
|
|
insertDetail(result); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 街道治理能力 |
|
|
|
* @param form |
|
|
|
* @author zxc |
|
|
|
* @date 2020/8/26 1:40 下午 |
|
|
|
*/ |
|
|
|
public Boolean streetGovernAbilityCalculateExistsSub(CalculateCommonFormDTO form) { |
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(detailListByParentCode)) { |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { |
|
|
|
List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subGridGovernAvg)){ |
|
|
|
log.warn("查询街道下属所有社区治理能力汇总为空"); |
|
|
|
}else if (subGridGovernAvg.size() > NumConstant.ZERO) { |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); |
|
|
|
List<List<SubCommunityAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, 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()); |
|
|
|
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.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 治理能力的六个五级指标
|
|
|
|
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSub(monthId,form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
|
log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); |
|
|
|
}else{ |
|
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,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, IndexCalConstant.PAGE_SIZE); |
|
|
|
governAbilityList.forEach(governAbility -> { |
|
|
|
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
|
List<SampleValue> index1SampleValues = new ArrayList<>(); |
|
|
|
governAbility.forEach(c -> { |
|
|
|
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(), c.get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
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.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
|
log.info("streetGovernAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); |
|
|
|
log.info("streetGovernAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId)); |
|
|
|
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
|
insertDetail(result); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 街道服务能力 |
|
|
|
* @param form |
|
|
|
* @author zxc |
|
|
|
* @date 2020/8/31 1:38 下午 |
|
|
|
*/ |
|
|
|
public Boolean streetServiceAbilityCalculateExistsSub(CalculateCommonFormDTO form) { |
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); |
|
|
|
if (CollectionUtils.isEmpty(detailListByParentCode)) { |
|
|
|
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); |
|
|
|
return true; |
|
|
|
} |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
Map<String, String> pid = new HashMap<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
String indexCode = detail.getIndexCode(); |
|
|
|
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode().equals(indexCode)) { |
|
|
|
List<SubCommunityAvgResultDTO> subCommServiceAvg = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subCommServiceAvg)) { |
|
|
|
log.warn("查询街道下属社区服务能力得分平均值为空"); |
|
|
|
} else if (subCommServiceAvg.size() > NumConstant.ZERO) { |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); |
|
|
|
List<List<SubCommunityAvgResultDTO>> serviceAvgList = ListUtils.partition(subCommServiceAvg, 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()); |
|
|
|
index1SampleValues.add(s); |
|
|
|
}); |
|
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSub(monthId,form.getCustomerAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
|
log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
|
}else{ |
|
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); |
|
|
|
return; |
|
|
|
} |
|
|
|
List<BigDecimal> decimalList = communityActivityCountList.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); |
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); |
|
|
|
List<List<Map<String, Object>>> communityActivityList = ListUtils.partition(communityActivityCountList, IndexCalConstant.PAGE_SIZE); |
|
|
|
communityActivityList.forEach(communityActivity -> { |
|
|
|
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
|
List<SampleValue> index1SampleValues = new ArrayList<>(); |
|
|
|
communityActivity.forEach(c -> { |
|
|
|
pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(), c.get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
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.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1); |
|
|
|
indexInputVOS.add(index1VO); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
|
log.info("streetServiceAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); |
|
|
|
log.info("streetServiceAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId)); |
|
|
|
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
|
insertDetail(result); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 街道相关计算 |
|
|
|
* @param form |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/3 9:21 上午 |
|
|
|
*/ |
|
|
|
public Boolean streetRelateExistsSub(CalculateCommonFormDTO form) { |
|
|
|
String customerId = form.getCustomerId(); |
|
|
|
String monthId = form.getMonthId(); |
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); |
|
|
|
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), monthId, IndexCalConstant.STREET_LEVEL); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|
agencyScoreList.forEach(community -> { |
|
|
|
if (detail.getIndexCode().equals(community.getIndexCode())) { |
|
|
|
community.setScore(community.getScore().multiply(detail.getWeight())); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
Map<String, List<AgencyScoreDTO>> collect = agencyScoreList.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); |
|
|
|
List<AgencyScoreDTO> result = new ArrayList<>(); |
|
|
|
collect.forEach((key, value) -> { |
|
|
|
AgencyScoreDTO score = new AgencyScoreDTO(); |
|
|
|
score.setIsTotal(NumConstant.ONE_STR); |
|
|
|
score.setCustomerId(customerId); |
|
|
|
score.setAgencyId(key); |
|
|
|
score.setMonthId(monthId); |
|
|
|
score.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
score.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode()); |
|
|
|
score.setDataType(IndexCalConstant.STREET_LEVEL); |
|
|
|
score.setAllParentIndexCode(NumConstant.ZERO_STR); |
|
|
|
score.setWeight(new BigDecimal(NumConstant.ONE_NEG)); |
|
|
|
value.forEach(street -> { |
|
|
|
score.setScore(score.getScore().add(street.getScore())); |
|
|
|
score.setParentAgencyId(street.getParentAgencyId()); |
|
|
|
}); |
|
|
|
result.add(score); |
|
|
|
}); |
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
agencyScoreDao.insertStreetRecord(result); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|