Browse Source

youhua

dev_shibei_match
zxc 5 years ago
parent
commit
e89ef5bbce
  1. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  2. 90
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java
  3. 93
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  4. 105
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java

@ -48,11 +48,10 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @Description 删除旧记录
* @param customerId
* @param monthId
* @param indexCode
* @author zxc
* @date 2020/9/2 15:47
*/
void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType);
void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("dataType")String dataType);
/**
* @Description 查询fact_index_agency_score相关信息

90
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java

@ -87,11 +87,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.GRID_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 {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexEnd = NumConstant.TEN;
List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, indexEnd);
@ -118,11 +114,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode()));
return;
} else if (publishArticleCountList.size() == NumConstant.ONE) {
pid.put(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid);
return;
} else if (publishArticleCountList.size() > NumConstant.ONE) {
} else {
List<BigDecimal> decimalList = publishArticleCountList.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(publishArticleCountList, IndexCalConstant.PAGE_SIZE);
@ -146,7 +138,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
log.info("communityPartyCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
List<FactIndexCommunityScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), pid);
factIndexCommunityScoreDao.deleteOldRecord(customerId, monthId);
deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result);
deleteAndInsert(result);
return true;
}
@ -171,12 +163,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (CollectionUtils.isEmpty(subGridGovernAvg)){
log.error("社区下级治理能力平均分集合为空");
return;
}
if (subGridGovernAvg.size() == NumConstant.ONE) {
pid.put(subGridGovernAvg.get(NumConstant.ZERO).getAgencyId(), subGridGovernAvg.get(NumConstant.ZERO).getParentId());
sizeOne(subGridGovernAvg.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid);
return;
} else if (subGridGovernAvg.size() > NumConstant.ONE) {
}else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE);
governAvg.forEach(avg -> {
@ -197,11 +184,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL);
return;
}else if (communityGovernAbility.size() == NumConstant.ONE) {
pid.put(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid);
return;
} else if (communityGovernAbility.size() > NumConstant.ONE) {
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode()));
@ -226,11 +209,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
log.info("communityGovernAbilityCalculate getScoreCountOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
// HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
log.info("communityGovernAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
List<FactIndexCommunityScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result);
deleteAndInsert(result);
return true;
}
@ -253,11 +235,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
String indexCode = detail.getIndexCode();
if (IndexCodeEnum.SHE_QU_XIA_JI_SYWGFWNLDFPJZ.getCode().equals(indexCode)) {
List<SubGridAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode());
if (subGridServiceAvg.size() == NumConstant.ONE) {
pid.put(subGridServiceAvg.get(NumConstant.ZERO).getAgencyId(), subGridServiceAvg.get(NumConstant.ZERO).getParentId());
sizeOne(subGridServiceAvg.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid);
if (CollectionUtils.isEmpty(subGridServiceAvg)) {
log.error("查询社区下级所有网格服务能力得分平均值集合为空");
return;
} else if (subGridServiceAvg.size() > NumConstant.ONE) {
} else {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE);
serviceAvgList.forEach(serviceAvg -> {
@ -277,11 +258,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL);
return;
}else if (communityActivityCountList.size() == NumConstant.ONE) {
pid.put(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid);
return;
} else if (communityActivityCountList.size() > NumConstant.ONE) {
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode()));
@ -306,11 +283,10 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
log.info("communityServiceAbilityCalculate getScoreCountOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
// HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
log.info("communityServiceAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
List<FactIndexCommunityScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result);
deleteAndInsert(result);
return true;
}
@ -349,7 +325,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
});
result.add(score);
});
deleteAndInsert(customerId, monthId, IndexCalConstant.COMMUNITY_RELATE, result);
deleteAndInsert(result);
return true;
}
@ -396,16 +372,13 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
}
/**
* @param customerId
* @param monthId
* @param indexCode
* @param subAllGridList
* @Description 先删除记录在插入
* @author zxc
* @date 2020/9/1 4:24 下午
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(String customerId, String monthId, String indexCode, List<FactIndexCommunityScoreDTO> subAllGridList) {
public void deleteAndInsert(List<FactIndexCommunityScoreDTO> subAllGridList) {
if (!CollectionUtils.isEmpty(subAllGridList)) {
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList);
}
@ -421,28 +394,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
* @author zxc
* @date 2020/9/2 2:37 下午
*/
public List<FactIndexCommunityScoreDTO> getResult(HashMap<String, BigDecimal> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, Map<String, String> pid) {
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);
pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) {
score.setParentAgencyId(parentAgency);
}
});
result.add(score);
});
return result;
}
public List<FactIndexCommunityScoreDTO> getResultB(HashMap<String, CalculateResult> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode,String allParentIndexCode, Map<String, String> pid) {
List<FactIndexCommunityScoreDTO> result = new ArrayList<>();
scoreCountOfSampleId.forEach((k, v) -> {
@ -485,19 +436,4 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
});
return result;
}
/**
* @param agencyId
* @param customerId
* @param monthId
* @Description 当查询结果为一条时调用此方法
* @author zxc
* @date 2020/9/2 2:40 下午
*/
public void sizeOne(String agencyId, String customerId, String monthId, String indexCode, Map<String, String> pid) {
HashMap<String, BigDecimal> scoreCountOfSampleId = new HashMap<>();
scoreCountOfSampleId.put(agencyId, new BigDecimal(NumConstant.FIFTY));
List<FactIndexCommunityScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, indexCode, pid);
deleteAndInsert(customerId, monthId, indexCode, result);
}
}

93
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java

@ -24,6 +24,7 @@ import com.epmet.support.normalizing.Correlation;
import com.epmet.support.normalizing.ScoreCalculator;
import com.epmet.support.normalizing.ScoreConstants;
import com.epmet.support.normalizing.batch.BatchScoreCalculator;
import com.epmet.support.normalizing.batch.CalculateResult;
import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import lombok.extern.slf4j.Slf4j;
@ -121,7 +122,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
indexInputVOS.add(index1VO);
});
}
@ -136,11 +137,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode()));
return;
} else if (publishArticleCountList.size() == NumConstant.ONE) {
pid.put(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid);
return;
} else if (publishArticleCountList.size() > NumConstant.ONE) {
} else{
List<BigDecimal> decimalList = publishArticleCountList.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(publishArticleCountList, IndexCalConstant.PAGE_SIZE);
@ -152,16 +149,17 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
agencyScoreDao.deleteOldRecord(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL);
deleteAndInsert(result);
return true;
}
@ -186,7 +184,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
if (CollectionUtils.isEmpty(districtGovernAvgList)) {
log.error("查询所有街道治理能力平均值集合为空");
return;
} else if (districtGovernAvgList.size() > NumConstant.ZERO) {
} else{
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 -> {
@ -197,7 +195,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
indexInputVOS.add(index1VO);
});
}
@ -206,18 +204,18 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
if (CollectionUtils.isEmpty(deptScoreAvgList)) {
log.error("查询所有直属部门治理能力平均值集合为空");
return;
} else if (deptScoreAvgList.size() > NumConstant.ZERO) {
} else{
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.getParentId(),customerAgencyDao.selectPid(c.getParentId()));
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.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
indexInputVOS.add(index1VO);
});
}
@ -226,9 +224,9 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
return true;
}
@ -254,7 +252,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
if (CollectionUtils.isEmpty(subStreetAvgList)) {
log.error("查询区下属街道服务能力汇总平均值集合为空");
return;
} else if (subStreetAvgList.size() > NumConstant.ZERO) {
} else{
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 -> {
@ -265,7 +263,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
SampleValue s = new SampleValue(c.getParentId(), c.getScore());
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
@ -274,9 +272,9 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
return true;
}
@ -309,13 +307,14 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
score.setQuarterId(DateUtils.getQuarterId(monthId));
score.setDataType(IndexCalConstant.DISTRICT_LEVEL);
score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
score.setAllParentIndexCode(NumConstant.ZERO_STR);
value.forEach(community -> {
score.setScore(score.getScore().add(community.getScore()));
score.setParentAgencyId(community.getParentAgencyId());
});
result.add(score);
});
deleteAndInsert(customerId, monthId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), result);
deleteAndInsert(result);
return true;
}
@ -335,18 +334,14 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}
/**
* @param customerId
* @param monthId
* @param indexCode
* @param subAllDistrict
* @Description 先删除记录在插入
* @author zxc
* @date 2020/9/1 4:24 下午
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(String customerId, String monthId, String indexCode, List<AgencyScoreDTO> subAllDistrict) {
public void deleteAndInsert(List<AgencyScoreDTO> subAllDistrict) {
if (!CollectionUtils.isEmpty(subAllDistrict)) {
agencyScoreDao.deleteOldRecord(customerId, monthId, indexCode,IndexCalConstant.DISTRICT_LEVEL);
agencyScoreDao.insertStreetRecord(subAllDistrict);
}
}
@ -361,7 +356,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
* @author zxc
* @date 2020/9/2 2:37 下午
*/
public List<AgencyScoreDTO> getResult(HashMap<String, BigDecimal> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, Map<String, String> pid) {
public List<AgencyScoreDTO> getResultB(HashMap<String, CalculateResult> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, String allParentIndexCode, Map<String, String> pid) {
List<AgencyScoreDTO> result = new ArrayList<>();
scoreCountOfSampleId.forEach((k, v) -> {
AgencyScoreDTO score = new AgencyScoreDTO();
@ -372,30 +367,38 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
score.setYearId(DateUtils.getYearId(monthId));
score.setIsTotal(isTotal);
score.setIndexCode(indexCode);
score.setScore(v);
score.setScore(v.getTotalScore());
score.setAllParentIndexCode(allParentIndexCode);
score.setDataType(IndexCalConstant.DISTRICT_LEVEL);
pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) {
score.setParentAgencyId(parentAgency);
}
});
if (!CollectionUtils.isEmpty(v.getDetails())){
v.getDetails().forEach(streetScore -> {
AgencyScoreDTO s = new AgencyScoreDTO();
s.setCustomerId(customerId);
s.setAgencyId(k);
s.setMonthId(monthId);
s.setQuarterId(DateUtils.getQuarterId(monthId));
s.setYearId(DateUtils.getYearId(monthId));
s.setIsTotal(isTotal);
s.setIndexCode(streetScore.getIndexCode());
s.setScore(streetScore.getScore());
s.setAllParentIndexCode(streetScore.getAllParentIndexCode());
s.setDataType(IndexCalConstant.DISTRICT_LEVEL);
pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) {
s.setParentAgencyId(parentAgency);
}
});
result.add(s);
});
}
result.add(score);
});
return result;
}
/**
* @param agencyId
* @param customerId
* @param monthId
* @Description 当查询结果为一条时调用此方法
* @author zxc
* @date 2020/9/2 2:40 下午
*/
public void sizeOne(String agencyId, String customerId, String monthId, String indexCode, Map<String, String> pid) {
HashMap<String, BigDecimal> scoreCountOfSampleId = new HashMap<>();
scoreCountOfSampleId.put(agencyId, new BigDecimal(NumConstant.FIFTY));
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, indexCode, pid);
deleteAndInsert(customerId, monthId, indexCode, result);
}
}

105
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java

@ -12,7 +12,6 @@ import com.epmet.dao.evaluationindex.indexcal.CommunityScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityOrgMonthlyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO;
import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO;
@ -26,6 +25,7 @@ import com.epmet.support.normalizing.Correlation;
import com.epmet.support.normalizing.ScoreCalculator;
import com.epmet.support.normalizing.ScoreConstants;
import com.epmet.support.normalizing.batch.BatchScoreCalculator;
import com.epmet.support.normalizing.batch.CalculateResult;
import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import lombok.extern.slf4j.Slf4j;
@ -62,8 +62,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
private CommunityScoreDao communityScoreDao;
@Autowired
private AgencyScoreDao agencyScoreDao;
@Autowired
private ScreenCustomerAgencyDao customerAgencyDao;
/**
* @Description 计算街道相关总分
@ -128,7 +126,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
indexInputVOS.add(index1VO);
});
}
@ -143,11 +141,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
if (StringUtils.isEmpty(fieldName)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode()));
return;
} else if (mapList.size() == NumConstant.ONE) {
pid.put(mapList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), mapList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(mapList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid);
return;
} else if (mapList.size() > NumConstant.ONE) {
}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 -> {
@ -158,16 +152,17 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
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.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
agencyScoreDao.deleteOldRecord(customerId, monthId, IndexCalConstant.STREET_LEVEL);
deleteAndInsert(result);
return true;
}
@ -203,7 +198,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc);
indexInputVOS.add(index1VO);
});
}
@ -213,11 +208,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL);
return;
}else if (communityGovernAbility.size() == NumConstant.ONE) {
pid.put(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid);
return;
} else if (communityGovernAbility.size() > NumConstant.ONE) {
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode()));
@ -234,16 +225,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid);
deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
return true;
}
@ -280,7 +271,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
@ -289,11 +280,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL);
return;
}else if (communityActivityCountList.size() == NumConstant.ONE) {
pid.put(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString());
sizeOne(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid);
return;
} else if (communityActivityCountList.size() > NumConstant.ONE) {
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode()));
@ -310,17 +297,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
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(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
});
}
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid
);
deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result);
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
return true;
}
@ -353,13 +339,14 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
score.setQuarterId(DateUtils.getQuarterId(monthId));
score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode());
score.setDataType(IndexCalConstant.STREET_LEVEL);
score.setAllParentIndexCode(NumConstant.ZERO_STR);
value.forEach(street -> {
score.setScore(score.getScore().add(street.getScore()));
score.setParentAgencyId(street.getParentAgencyId());
});
result.add(score);
});
deleteAndInsert(customerId, monthId, IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), result);
deleteAndInsert(result);
return true;
}
@ -379,18 +366,14 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
}
/**
* @param customerId
* @param monthId
* @param indexCode
* @param subAllCommunityList
* @Description 先删除记录在插入
* @author zxc
* @date 2020/9/1 4:24 下午
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(String customerId, String monthId, String indexCode, List<AgencyScoreDTO> subAllCommunityList) {
public void deleteAndInsert(List<AgencyScoreDTO> subAllCommunityList) {
if (!CollectionUtils.isEmpty(subAllCommunityList)) {
agencyScoreDao.deleteOldRecord(customerId, monthId, indexCode,IndexCalConstant.STREET_LEVEL);
agencyScoreDao.insertStreetRecord(subAllCommunityList);
}
}
@ -405,7 +388,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
* @author zxc
* @date 2020/9/2 2:37 下午
*/
public List<AgencyScoreDTO> getResult(HashMap<String, BigDecimal> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, Map<String, String> pid) {
public List<AgencyScoreDTO> getResultB(HashMap<String, CalculateResult> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, String allParentIndexCode, Map<String, String> pid) {
List<AgencyScoreDTO> result = new ArrayList<>();
scoreCountOfSampleId.forEach((k, v) -> {
AgencyScoreDTO score = new AgencyScoreDTO();
@ -416,29 +399,37 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
score.setYearId(DateUtils.getYearId(monthId));
score.setIsTotal(isTotal);
score.setIndexCode(indexCode);
score.setScore(v);
score.setScore(v.getTotalScore());
score.setAllParentIndexCode(allParentIndexCode);
score.setDataType(IndexCalConstant.STREET_LEVEL);
pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) {
score.setParentAgencyId(parentAgency);
}
});
if (!CollectionUtils.isEmpty(v.getDetails())){
v.getDetails().forEach(streetScore -> {
AgencyScoreDTO s = new AgencyScoreDTO();
s.setCustomerId(customerId);
s.setAgencyId(k);
s.setMonthId(monthId);
s.setQuarterId(DateUtils.getQuarterId(monthId));
s.setYearId(DateUtils.getYearId(monthId));
s.setIsTotal(isTotal);
s.setIndexCode(streetScore.getIndexCode());
s.setScore(streetScore.getScore());
s.setDataType(IndexCalConstant.STREET_LEVEL);
s.setAllParentIndexCode(streetScore.getAllParentIndexCode());
pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) {
s.setParentAgencyId(parentAgency);
}
});
result.add(s);
});
}
result.add(score);
});
return result;
}
/**
* @param agencyId
* @param customerId
* @param monthId
* @Description 当查询结果为一条时调用此方法
* @author zxc
* @date 2020/9/2 2:40 下午
*/
public void sizeOne(String agencyId, String customerId, String monthId, String indexCode, Map<String, String> pid) {
HashMap<String, BigDecimal> scoreCountOfSample = new HashMap<>();
scoreCountOfSample.put(agencyId, new BigDecimal(NumConstant.FIFTY));
List<AgencyScoreDTO> result = getResult(scoreCountOfSample, customerId, monthId, NumConstant.ZERO_STR, indexCode, pid);
deleteAndInsert(customerId, monthId, indexCode, result);
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

@ -5,7 +5,7 @@
<!-- 【街道】中间表插入 -->
<insert id="insertStreetRecord">
INSERT INTO fact_index_agency_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, IS_TOTAL, SCORE, INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
INSERT INTO fact_index_agency_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, IS_TOTAL, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="lists" item="item" separator=",">
(
@ -20,6 +20,7 @@
#{item.isTotal},
#{item.score},
#{item.indexCode},
#{item.allParentIndexCode},
#{item.delFlag},
#{item.revision},
#{item.createdBy},
@ -39,7 +40,6 @@
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND index_code = #{indexCode}
AND data_type = #{dataType}
</delete>
@ -79,9 +79,11 @@
del_flag = 0
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND IS_TOTAL = "0"
AND INDEX_CODE != "jiedaoxiangguan"
AND data_type = #{dataType}
AND IS_TOTAL = "0"
AND INDEX_CODE = "zhilinengli"
OR INDEX_CODE = "dangjiannengli"
OR INDEX_CODE = "fuwunengli"
</select>
<select id="selectAgencyScoreAvg" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">

Loading…
Cancel
Save