From 2a1674c13b577c1ee9af2b6a91e121f785c3583f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 8 Sep 2020 17:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E6=A0=87=E8=AE=A1=E7=AE=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/ScreenCustomerAgencyDao.java | 8 ++++ .../IndexCalculateDistrictServiceImpl.java | 44 +++++++++---------- .../impl/IndexCalculateStreetServiceImpl.java | 29 ++++++------ .../indexcal/AgencyScoreDao.xml | 2 +- .../screen/FactIndexCommunityScoreDao.xml | 6 +-- .../screen/ScreenCustomerAgencyDao.xml | 11 +++++ 6 files changed, 56 insertions(+), 44 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index c2dc598bfa..0d1acd8cf6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -74,4 +74,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListAgencyInfo(@Param("customerId")String customerId); + + /** + * @Description 根据agencyId查询上级组织Id + * @param agencyId + * @author zxc + * @date 2020/9/8 3:36 下午 + */ + String selectPid(@Param("agencyId")String agencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index dad92d33df..3720a6cc4e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -10,6 +10,7 @@ import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; +import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; @@ -55,6 +56,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict private AgencyScoreDao agencyScoreDao; @Autowired private DeptScoreDao deptScoreDao; + @Autowired + private ScreenCustomerAgencyDao customerAgencyDao; /** * @Description 计算全区相关总分 @@ -107,18 +110,14 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.error(IndexCalConstant.DISTRICT_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 if (subGridPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); subPartyAvgList.forEach(party -> { List index1SampleValues = new ArrayList<>(); party.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); - SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + 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())); @@ -184,18 +183,17 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); - if (districtGovernAvgList.size() == NumConstant.ONE) { - pid.put(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(), districtGovernAvgList.get(NumConstant.ZERO).getParentId()); - sizeOne(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); + if (CollectionUtils.isEmpty(districtGovernAvgList)) { + log.error("查询所有街道治理能力平均值集合为空"); return; - } else if (districtGovernAvgList.size() > NumConstant.ONE) { + } else if (districtGovernAvgList.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); - SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + 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())); @@ -205,17 +203,16 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - if (deptScoreAvgList.size() == NumConstant.ONE) { - pid.put(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(), deptScoreAvgList.get(NumConstant.ZERO).getParentId()); - sizeOne(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); + if (CollectionUtils.isEmpty(deptScoreAvgList)) { + log.error("查询所有直属部门治理能力平均值集合为空"); return; - } else if (deptScoreAvgList.size() > NumConstant.ONE) { + } else if (deptScoreAvgList.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); + pid.put(c.getParentId(),customerAgencyDao.selectPid(c.getParentId())); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); }); @@ -254,19 +251,18 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict String indexCode = detail.getIndexCode(); if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); - if (subStreetAvgList.size() == NumConstant.ONE) { - pid.put(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(), subStreetAvgList.get(NumConstant.ZERO).getParentId()); - sizeOne(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid); + if (CollectionUtils.isEmpty(subStreetAvgList)) { + log.error("查询区下属街道服务能力汇总平均值集合为空"); return; - } else if (subStreetAvgList.size() > NumConstant.ONE) { + } else if (subStreetAvgList.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> 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 index1SampleValues = new ArrayList<>(); serviceAvg.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); - SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId())); + SampleValue s = new SampleValue(c.getParentId(), c.getScore()); index1SampleValues.add(s); }); IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 099c69c125..978473be33 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -12,6 +12,7 @@ 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.FactIndexCommunityScoreDao; +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; @@ -61,6 +62,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ private FactIndexCommunityScoreDao communityScoreDao; @Autowired private AgencyScoreDao agencyScoreDao; + @Autowired + private ScreenCustomerAgencyDao customerAgencyDao; /** * @Description 计算街道相关总分 @@ -113,18 +116,14 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); return; - } else if (subCommPartyAvgScore.size() == NumConstant.ONE) { - pid.put(subCommPartyAvgScore.get(NumConstant.ZERO).getAgencyId(), subCommPartyAvgScore.get(NumConstant.ZERO).getParentId()); - sizeOne(subCommPartyAvgScore.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid); - return; - } else if (subCommPartyAvgScore.size() > NumConstant.ONE) { + } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); Integer indexEnd = NumConstant.TEN; List> partition = ListUtils.partition(subCommPartyAvgScore, indexEnd); partition.forEach(publish -> { List index1SampleValues = new ArrayList<>(); publish.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); + pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); }); @@ -190,17 +189,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { List subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - 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); + if (CollectionUtils.isEmpty(subGridGovernAvg)){ + log.error("查询街道下属所有社区治理能力汇总为空"); return; - } else if (subGridGovernAvg.size() > NumConstant.ONE) { + }else if (subGridGovernAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); + pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); }); @@ -269,18 +267,17 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ String indexCode = detail.getIndexCode(); if (IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode().equals(indexCode)) { List subCommServiceAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); - if (subCommServiceAvg.size() == NumConstant.ONE) { - pid.put(subCommServiceAvg.get(NumConstant.ZERO).getAgencyId(), subCommServiceAvg.get(NumConstant.ZERO).getParentId()); - sizeOne(subCommServiceAvg.get(NumConstant.ZERO).getAgencyId(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid); + if (CollectionUtils.isEmpty(subCommServiceAvg)) { + log.error("查询街道下属社区服务能力得分平均值为空"); return; - } else if (subCommServiceAvg.size() > NumConstant.ONE) { + } else if (subCommServiceAvg.size() > NumConstant.ZERO) { MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); List> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE); serviceAvgList.forEach(serviceAvg -> { BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); List index1SampleValues = new ArrayList<>(); serviceAvg.forEach(c -> { - pid.put(c.getAgencyId(), c.getParentId()); + pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index 6ba627fd68..61f3db1f65 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -101,7 +101,7 @@ AND fics.month_id = #{monthId} AND fics.index_code = #{indexCode} AND fics.DATA_TYPE = #{dataType} - GROUP BY fics.agency_id + GROUP BY fics.parent_agency_id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml index 919dec3b2b..e00f0b2c12 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml @@ -65,7 +65,7 @@ + + +