|
|
@ -62,7 +62,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Boolean communityPartyCalculate(String customerId, String monthId) { |
|
|
|
|
|
|
|
// 党建能力
|
|
|
|
// 根据all_parent_index_code 获取指标明细
|
|
|
|
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); |
|
|
@ -98,10 +97,48 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
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(); |
|
|
|
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); |
|
|
|
scoreCountOfSampleId.forEach((key,value) -> { |
|
|
|
communityPublishArticle.forEach(grid -> { |
|
|
|
if (key.equals(grid.getAgencyId())) { |
|
|
|
grid.setCustomerId(customerId); |
|
|
|
grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN); |
|
|
|
grid.setScore(grid.getScore().add(value)); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 社区名义发文数量
|
|
|
|
List<CommunityPublishArticleCountResultDTO> publishArticleCounts = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCount(customerId, monthId); |
|
|
|
/*List<CommunityPublishArticleCountResultDTO> publishArticleCounts = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCount(customerId, monthId); |
|
|
|
detailListByParentCode.forEach(indexGroup -> { |
|
|
|
if (indexGroup.getIndexCode().equals("shequmingyifwsl")) { |
|
|
|
if (publishArticleCounts.size() == NumConstant.ONE) { |
|
|
@ -134,7 +171,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
} while (collect.size() == NumConstant.TEN); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
subAllGridList.forEach(grid -> { |
|
|
|
communityPublishArticle.forEach(publish -> { |
|
|
|
if (grid.getAgencyId().equals(publish.getAgencyId())){ |
|
|
@ -196,9 +233,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni |
|
|
|
|
|
|
|
List<Map<String,Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId); |
|
|
|
if (communityGovernAbility.size() == NumConstant.ONE){ |
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
}else if (communityGovernAbility.size() > NumConstant.ONE){ |
|
|
|
List<IndexInputVO> indexInputVOS = new ArrayList<>(); |
|
|
|
detailListByParentCode.forEach(detail -> { |
|
|
|