Browse Source

社区相关

dev_shibei_match
zxc 5 years ago
parent
commit
c87d2ef361
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java
  3. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java
  4. 265
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java
  6. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml
  7. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -132,7 +132,7 @@ public class DemoController {
@PostMapping("zxc2")
public Result getZxc2(){
indexCalculateCommunityService.communityServiceAbilityCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
indexCalculateCommunityService.calAll("b09527201c4409e19d1dbc5e3c3429a1","202008");
return new Result();
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java

@ -26,6 +26,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 服务能力-组织街道|社区|全区相关事实表
@ -73,4 +74,5 @@ public interface FactIndexServiceAblityOrgMonthlyDao extends BaseDao<FactIndexSe
* @date 2020/8/31 2:15 下午
*/
List<CommunityActivityCountResultDTO> selectActivityCount(@Param("customerId")String customerId, @Param("monthId")String monthId);
List<Map<String,Object>> selectActivityCountMap(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java

@ -38,12 +38,5 @@ public interface IndexCalculateCommunityService {
*/
void communityServiceAbilityCalculate(String customerId, String monthId);
/**
* @Description 社区相关计算
* @param customerId
* @param monthId
* @author zxc
* @date 2020/9/1 9:21 上午
*/
void communityRelate(String customerId, String monthId);
void calAll(String customerId, String monthId);
}

265
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java

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

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java

@ -7,7 +7,7 @@ import java.math.BigDecimal;
*/
public class ScoreConstants {
public static final BigDecimal MIN_SCORE = new BigDecimal(0);
public static final BigDecimal MIN_SCORE = new BigDecimal(1);
public static final BigDecimal MAX_SCORE = new BigDecimal(100);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml

@ -89,4 +89,23 @@
AND customer_id = #{customerId}
AND month_id = #{monthId}
</select>
<!-- 社区活动组织次数 -->
<select id="selectActivityCountMap" resultType="java.util.Map">
SELECT
AGENCY_ID,
PARENT_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
ACTIVITY_COUNT,
CUSTOMER_ID
FROM
fact_index_service_ablity_org_monthly
WHERE
del_flag = '0'
AND data_type = 'community'
AND customer_id = #{customerId}
AND month_id = #{monthId}
</select>
</mapper>

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml

@ -57,6 +57,7 @@
del_flag = 0
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND INDEX_CODE != "shequxiangguan"
</select>
</mapper>
Loading…
Cancel
Save