Browse Source

district

dev_shibei_match
zxc 5 years ago
parent
commit
dd2cdb15c2
  1. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  2. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java
  4. 317
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  5. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  6. 26
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml
  8. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
  9. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml
  11. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml

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

@ -70,7 +70,7 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @author zxc * @author zxc
* @date 2021/1/15 下午4:23 * @date 2021/1/15 下午4:23
*/ */
List<AgencyScoreDTO> selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType); List<AgencyScoreDTO> selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType);
/** /**
* @Description 区下级街道得分平均值 * @Description 区下级街道得分平均值
@ -81,6 +81,17 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
*/ */
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType); List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType);
/**
* @Description 区下级街道得分平均值 存在下级客户
* @Param monthId
* @Param indexCode
* @Param dataType
* @Param areaCode
* @author zxc
* @date 2021/1/18 上午9:09
*/
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength);
/** /**
* 根据入参查询 /街道相关分数表 记录 * 根据入参查询 /街道相关分数表 记录

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java

@ -68,6 +68,16 @@ public interface DeptScoreDao extends BaseDao<DeptScoreEntity> {
*/ */
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/**
* @Description 所有直属部门治理能力平均值 存在下级客户
* @Param areaCode
* @Param monthId
* @Param indexCode
* @author zxc
* @date 2021/1/18 上午9:31
*/
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/** /**
* @return int * @return int
* @param customerId 客户id * @param customerId 客户id

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

@ -85,7 +85,7 @@ public interface FactIndexPartyAblityOrgMonthlyDao extends BaseDao<FactIndexPart
* @author zxc * @author zxc
* @date 2021/1/15 下午3:31 * @date 2021/1/15 下午3:31
*/ */
List<Map<String,Object>> selectPublishArticleCountMapExistSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode); List<Map<String,Object>> selectPublishArticleCountMapExistSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength);
/** /**
* @Description 查询社区下的发文数 Map根据areaCode * @Description 查询社区下的发文数 Map根据areaCode

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

@ -88,21 +88,43 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
public Boolean calDistrictAll(CalculateCommonFormDTO form) { public Boolean calDistrictAll(CalculateCommonFormDTO form) {
String customerId = form.getCustomerId(); String customerId = form.getCustomerId();
String monthId = form.getMonthId(); String monthId = form.getMonthId();
Boolean aBoolean = districtPartyCalculate(customerId, monthId);//党建能力 if (StringUtils.isEmpty(form.getCustomerAreaCode())) {
if (!aBoolean.equals(true)) { Boolean aBoolean = districtPartyCalculate(customerId, monthId);//党建能力
throw new RenException("calculate district-party-ability failure ......"); if (!aBoolean.equals(true)) {
} throw new RenException("calculate district-party-ability failure ......");
Boolean bBoolean = districtGovernAbilityCalculate(customerId, monthId);// 治理能力 }
if (!bBoolean.equals(true)) { Boolean bBoolean = districtGovernAbilityCalculate(customerId, monthId);// 治理能力
throw new RenException("calculate district-govern-ability failure ......"); if (!bBoolean.equals(true)) {
} throw new RenException("calculate district-govern-ability failure ......");
Boolean cBoolean = districtServiceAbilityCalculate(customerId, monthId);// 服务能力 }
if (!cBoolean.equals(true)) { Boolean cBoolean = districtServiceAbilityCalculate(customerId, monthId);// 服务能力
throw new RenException("calculate district-service-ability failure ......"); if (!cBoolean.equals(true)) {
} throw new RenException("calculate district-service-ability failure ......");
Boolean dBoolean = districtRelate(customerId, monthId); }
if (!dBoolean.equals(true)) { Boolean dBoolean = districtRelate(customerId, monthId);
throw new RenException("calculate district-all insert failure ......"); if (!dBoolean.equals(true)) {
throw new RenException("calculate district-all insert failure ......");
}
}else {
//党建能力
Boolean aBoolean = districtPartyCalculateExistSub(form);
if (!aBoolean.equals(true)) {
throw new RenException("calculate district-party-ability-exists-sub failure ......");
}
// 治理能力
Boolean bBoolean = districtGovernAbilityCalculateExistSub(form);
if (!bBoolean.equals(true)) {
throw new RenException("calculate district-govern-ability-exists-sub failure ......");
}
// 服务能力
Boolean cBoolean = districtServiceAbilityCalculateExistSub(form);
if (!cBoolean.equals(true)) {
throw new RenException("calculate district-service-ability-exists-sub failure ......");
}
Boolean dBoolean = districtRelateExistSub(form);
if (!dBoolean.equals(true)) {
throw new RenException("calculate district-all-exists-sub insert failure ......");
}
} }
//计算自身和下级 //计算自身和下级
CalculateCommonFormDTO formDTO = new CalculateCommonFormDTO(); CalculateCommonFormDTO formDTO = new CalculateCommonFormDTO();
@ -563,4 +585,269 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
return result; return result;
} }
/**
* @param form
* @Description 全区名义发文数量计算党建能力 存在下级客户
* @author zxc
* @date 2020/8/26 10:46 上午
*/
public Boolean districtPartyCalculateExistSub(CalculateCommonFormDTO form) {
// 党建能力
// 根据all_parent_index_code 获取指标明细
String customerId = form.getCustomerId();
String monthId = form.getMonthId();
List<IndexGroupDetailEntity> indexDetailList = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(indexDetailList)) {
log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL);
return true;
}
List<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>();
//党建能力平均值
indexDetailList.forEach(detail -> {
if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
} else if (subGridPartyAvgScore.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
subPartyAvgList.forEach(party -> {
List<SampleValue> index1SampleValues = new ArrayList<>();
party.forEach(c -> {
if (!c.getParentId().equals(NumConstant.ZERO_STR)) {
pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId()));
SampleValue s = new SampleValue(c.getParentId(), c.getScore());
index1SampleValues.add(s);
}
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
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>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX);
if (CollectionUtils.isEmpty(publishArticleCountList)) {
log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL);
} else {
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode()));
return;
} 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);
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(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("districtPartyAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtPartyAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
deleteOldRecord(customerId,monthId,IndexCalConstant.DISTRICT_LEVEL);
insertDetail(result);
return true;
}
/**
* @param form
* @Description 全区治理能力 存在下级客户
* @author zxc
* @date 2020/8/26 1:40 下午
*/
public Boolean districtGovernAbilityCalculateExistSub(CalculateCommonFormDTO form) {
String customerId = form.getCustomerId();
String monthId = form.getMonthId();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_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.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
for (int i = 0; i < districtGovernAvgList.size(); i++) {
if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
districtGovernAvgList.remove(districtGovernAvgList.get(i));
}
}
if (CollectionUtils.isEmpty(districtGovernAvgList)) {
log.warn("查询所有街道治理能力平均值集合为空");
} 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 -> {
List<SampleValue> index1SampleValues = new ArrayList<>();
avg.forEach(c -> {
if (!c.getParentId().equals(NumConstant.ZERO_STR)) {
pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId()));
SampleValue s = new SampleValue(c.getParentId(), c.getScore());
index1SampleValues.add(s);
}
});
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation()));
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc);
indexInputVOS.add(index1VO);
});
}
} else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){
List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode());
for (int i = 0; i < deptScoreAvgList.size(); i++) {
if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
deptScoreAvgList.remove(deptScoreAvgList.get(i));
}
}
if (CollectionUtils.isEmpty(deptScoreAvgList)) {
log.warn("查询所有直属部门治理能力平均值集合为空");
} 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.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{
// TODO 治理能力暂无自身级别
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
log.info("districtGovernAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtGovernAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
insertDetail(result);
return true;
}
/**
* @param form
* @Description 全区服务能力 存在下级客户
* @author zxc
* @date 2020/8/31 1:38 下午
*/
public Boolean districtServiceAbilityCalculateExistSub(CalculateCommonFormDTO form) {
String customerId = form.getCustomerId();
String monthId = form.getMonthId();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_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.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) {
List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
for (int i = 0; i < subStreetAvgList.size(); i++) {
if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){
subStreetAvgList.remove(subStreetAvgList.get(i));
}
}
if (CollectionUtils.isEmpty(subStreetAvgList)) {
log.warn("查询区下属街道服务能力汇总平均值集合为空");
} 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 -> {
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 -> {
if (!c.getParentId().equals(NumConstant.ZERO_STR)) {
pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId()));
SampleValue s = new SampleValue(c.getParentId(), 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 {
// todo 暂时没有自身级别
}
});
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
if (!CollectionUtils.isEmpty(indexInputVOS)) {
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
log.info("districtServiceAbilityCalculateExistsSub getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtServiceAbilityCalculateExistsSub getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
insertDetail(result);
}
return true;
}
/**
* @param form
* @Description 区相关计算 存在下级客户
* @author zxc
* @date 2020/9/1 9:21 上午
*/
public Boolean districtRelateExistSub(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(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_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.setDataType(IndexCalConstant.DISTRICT_LEVEL);
score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
score.setAllParentIndexCode(NumConstant.ZERO_STR);
score.setWeight(new BigDecimal(NumConstant.ONE_NEG));
value.forEach(community -> {
score.setScore(score.getScore().add(community.getScore()));
score.setParentAgencyId(community.getParentAgencyId());
});
result.add(score);
});
if (!CollectionUtils.isEmpty(result)){
agencyScoreDao.insertStreetRecord(result);
}
return true;
}
} }

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

@ -634,7 +634,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
} }
} else { } else {
// 街道名义发文数量 // 街道名义发文数量
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode()); List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.NINE);
if (CollectionUtils.isEmpty(mapList)) { if (CollectionUtils.isEmpty(mapList)) {
log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL);
} else { } else {
@ -826,7 +826,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
String customerId = form.getCustomerId(); String customerId = form.getCustomerId();
String monthId = form.getMonthId(); String monthId = form.getMonthId();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), monthId, IndexCalConstant.STREET_LEVEL); List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), NumConstant.NINE, monthId, IndexCalConstant.STREET_LEVEL);
detailListByParentCode.forEach(detail -> { detailListByParentCode.forEach(detail -> {
agencyScoreList.forEach(community -> { agencyScoreList.forEach(community -> {
if (detail.getIndexCode().equals(community.getIndexCode())) { if (detail.getIndexCode().equals(community.getIndexCode())) {

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

@ -141,7 +141,7 @@
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fias.AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fias.AGENCY_ID
WHERE WHERE
fias.del_flag = 0 fias.del_flag = 0
AND CHAR_LENGTH(sca.AREA_CODE) >= 6 AND CHAR_LENGTH(sca.AREA_CODE) >= #{areaCodeLength}
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND fias.MONTH_ID = #{monthId} AND fias.MONTH_ID = #{monthId}
AND fias.data_type = #{dataType} AND fias.data_type = #{dataType}
@ -150,4 +150,28 @@
OR fias.INDEX_CODE = "dangjiannengli" OR fias.INDEX_CODE = "dangjiannengli"
OR fias.INDEX_CODE = "fuwunengli") OR fias.INDEX_CODE = "fuwunengli")
</select> </select>
<!-- 区下级街道得分平均值 存在下级客户 -->
<select id="selectAgencyScoreAvgExistsSub" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fics.agency_id,
fics.month_id,
fics.quarter_id,
fics.year_id,
ROUND(AVG( fics.score ),6) AS score,
fics.customer_id,
PARENT_AGENCY_ID AS parentId
FROM
fact_index_agency_score fics
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID
WHERE
fics.del_flag = '0'
AND sca.level = 'district'
AND CHAR_LENGTH(sca.AREA_CODE) >= 6
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode}
AND fics.DATA_TYPE = #{dataType}
GROUP BY fics.parent_agency_id
</select>
</mapper> </mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml

@ -139,7 +139,7 @@
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = cs.AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = cs.AGENCY_ID
WHERE WHERE
cs.del_flag = 0 cs.del_flag = 0
AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND CHAR_LENGTH(sca.AREA_CODE) >= 12
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND cs.MONTH_ID = #{monthId} AND cs.MONTH_ID = #{monthId}
AND cs.IS_TOTAL = "0" AND cs.IS_TOTAL = "0"
@ -164,7 +164,7 @@
WHERE WHERE
fics.del_flag = '0' fics.del_flag = '0'
AND sca.DEL_FLAG = 0 AND sca.DEL_FLAG = 0
AND CHAR_LENGTH(sca.AREA_CODE) >= 6 AND CHAR_LENGTH(sca.AREA_CODE) >= 9
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND fics.month_id = #{monthId} AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode} AND fics.index_code = #{indexCode}

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml

@ -150,4 +150,27 @@
AND m.CUSTOMER_ID =#{customerId} AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId} AND m.MONTH_ID =#{monthId}
</select> </select>
<!-- 所有直属部门治理能力平均值 存在下级客户 -->
<select id="selectGovernDeptScoreAvgExistsSub" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fidc.agency_id,
fidc.month_id,
fidc.quarter_id,
fidc.year_id,
AVG( fidc.score ) AS score,
fidc.customer_id,
sca.pid AS parentId
FROM
fact_index_dept_score fidc
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fidc.AGENCY_ID
WHERE
fidc.del_flag = '0'
AND fidc.IS_TOTAL = '0'
AND CHAR_LENGTH(sca.AREA_CODE) >= 6
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND fidc.month_id = #{monthId}
AND fidc.index_code = #{indexCode}
GROUP BY fidc.agency_id
</select>
</mapper> </mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml

@ -197,7 +197,7 @@
AND sca.DEL_FLAG = 0 AND sca.DEL_FLAG = 0
AND figc.month_id = #{monthId} AND figc.month_id = #{monthId}
AND figc.index_code = #{indexCode} AND figc.index_code = #{indexCode}
AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND CHAR_LENGTH(sca.AREA_CODE) >= 12
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
GROUP BY figc.agency_id GROUP BY figc.agency_id
</select> </select>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml

@ -171,7 +171,7 @@
WHERE WHERE
gm.del_flag = '0' gm.del_flag = '0'
AND gm.month_id = #{monthId} AND gm.month_id = #{monthId}
AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND CHAR_LENGTH(sca.AREA_CODE) >= 12
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
</select> </select>
</mapper> </mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml

@ -128,7 +128,7 @@
WHERE WHERE
fm.del_flag = '0' fm.del_flag = '0'
AND fm.month_id = #{monthId} AND fm.month_id = #{monthId}
AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND CHAR_LENGTH(sca.AREA_CODE) >= 12
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
</select> </select>
@ -147,7 +147,7 @@
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID
WHERE WHERE
pm.del_flag = '0' pm.del_flag = '0'
AND CHAR_LENGTH(sca.AREA_CODE) >= 6 AND CHAR_LENGTH(sca.AREA_CODE) >= #{areaCode}
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND pm.month_id = #{monthId} AND pm.month_id = #{monthId}
</select> </select>

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

@ -127,7 +127,7 @@
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = sm.AGENCY_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = sm.AGENCY_ID
WHERE WHERE
sm.del_flag = '0' sm.del_flag = '0'
AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND CHAR_LENGTH(sca.AREA_CODE) >= 12
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND sm.month_id = #{monthId} AND sm.month_id = #{monthId}
</select> </select>

Loading…
Cancel
Save