diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 0ac7dbf706..e906535166 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -1,5 +1,7 @@ package com.epmet.commons.tools.constant; +import java.math.BigDecimal; + /** * 常用数字常量 * @@ -56,4 +58,6 @@ public interface NumConstant { String POSITIVE_EIGHT_STR = "+8"; String EMPTY_STR = ""; String ONE_NEG_STR = "-1"; + + String FIFTY_STR="50"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java index b3002609d1..589a9103c3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java @@ -91,8 +91,17 @@ public interface FactIndexGovrnAblityGridMonthlyDao extends BaseDao selectPartyAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * @return java.lang.Integer + * @param formDTO + * @author yinzuomei + * @description 查询(党建能力-网格相关事实表) 这个月共上传记录数 + * @Date 2020/9/2 14:28 + **/ Integer selectCount(CalculateCommonFormDTO formDTO); + + /** + * @return java.lang.String + * @param formDTO + * @author yinzuomei + * @description 场景:客户这个月只上传了一个网格的事实记录 + * @Date 2020/9/2 14:45 + **/ + String selectTheOneGrid(CalculateCommonFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java index 7357c0cedc..fecd99a00b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO; import com.epmet.dto.indexcollect.form.GridServiceAbilityFormDTO; @@ -85,4 +86,22 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao selectServiceAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * @return int + * @param formDTO + * @author yinzuomei + * @description 查询(服务能力-网格相关事实表)共上传记录数 + * @Date 2020/9/2 14:28 + **/ + int selectCount(CalculateCommonFormDTO formDTO); + + /** + * @return java.lang.String + * @param formDTO + * @author yinzuomei + * @description 场景:客户这个月只上传了一个网格的事实记录 + * @Date 2020/9/2 14:46 + **/ + String selectTheOneGrid(CalculateCommonFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java index 40013cfaf5..6bb15d784d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java @@ -130,6 +130,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { if (NumConstant.ZERO == total) { log.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; + } else if (NumConstant.ONE == total) { + //只有一个网格时 + log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_party_ablity_grid_monthly record",IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); + this.handleOneGridScene(formDTO,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); } //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); @@ -181,6 +185,31 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { saveGridCorreLationResult(formDTO, resultMapList, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), NumConstant.ZERO_STR); } + /** + * @param formDTO + * @param indexCode + * @return void + * @author yinzuomei + * @description 只有一条事实记录时,分值默认赋50 + * @Date 2020/9/2 14:35 + **/ + private void handleOneGridScene(CalculateCommonFormDTO formDTO, String indexCode) { + List> resultMapList = new ArrayList<>(); + HashMap resultMap = new HashMap<>(); + String gridId =null; + if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(indexCode)) { + gridId = factIndexPartyAblityGridMonthlyDao.selectTheOneGrid(formDTO); + } else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(indexCode)) { + gridId = factIndexGovrnAblityGridMonthlyDao.selectTheOneGrid(formDTO); + } else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(indexCode)) { + gridId = factIndexServiceAblityGridMonthlyDao.selectTheOneGrid(formDTO); + } + resultMap.put(gridId, new BigDecimal(NumConstant.FIFTY_STR)); + resultMapList.add(resultMap); + // 保存中间表 + saveGridCorreLationResult(formDTO, resultMapList, indexCode, NumConstant.ZERO_STR); + } + /** * @param calculateCommonFormDTO * @return java.util.Map @@ -190,7 +219,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { **/ private Map getContactMassesAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) { Map map = new HashMap<>(); - /*List list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO); + List list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO); if (!CollectionUtils.isEmpty(list)) { BigDecimal minValue = Collections.min(list); BigDecimal maxValue = Collections.max(list); @@ -199,10 +228,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { return map; } map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR)); - map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR));*/ + map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR)); //FOR TEST - map.put(StrConstant.MIN, new BigDecimal("24.35")); - map.put(StrConstant.MAX, new BigDecimal("46.13")); + /*map.put(StrConstant.MIN, new BigDecimal("24.35")); + map.put(StrConstant.MAX, new BigDecimal("46.13"));*/ return map; } @@ -215,19 +244,19 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @Date 2020/8/31 9:50 **/ private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { - /*BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); + BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); if (null == result) { return new BigDecimal(NumConstant.ZERO_STR); - }*/ + } //FOR TEST - BigDecimal result=null; + /*BigDecimal result=null; if(IndexCalConstant.S1_C1_G1.equals(gridId)){ result= new BigDecimal("24.43"); }else if(IndexCalConstant.S1_C1_G2.equals(gridId)){ result=new BigDecimal("46.13"); }else if(IndexCalConstant.S1_C2_G1.equals(gridId)){ result=new BigDecimal("24.35"); - } + }*/ return result; } @@ -240,19 +269,19 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @Date 2020/8/31 15:51 **/ private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { - /*BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); + BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); if (null == result) { return new BigDecimal(NumConstant.ZERO_STR); - }*/ + } //FOR TEST - BigDecimal result=null; + /*BigDecimal result=null; if(IndexCalConstant.S1_C1_G1.equals(gridId)){ result= new BigDecimal("29.40"); }else if(IndexCalConstant.S1_C1_G2.equals(gridId)){ result=new BigDecimal("18.30"); }else if(IndexCalConstant.S1_C2_G1.equals(gridId)){ result=new BigDecimal("9.15"); - } + }*/ return result; } @@ -265,7 +294,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { **/ private Map getJoinIssueAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) { Map map = new HashMap<>(); - /*List list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO); + List list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO); if (!CollectionUtils.isEmpty(list)) { BigDecimal minValue = Collections.min(list); BigDecimal maxValue = Collections.max(list); @@ -274,10 +303,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { return map; } map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR)); - map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR));*/ + map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR)); // FOR TEST - map.put(StrConstant.MIN, new BigDecimal("9.15")); - map.put(StrConstant.MAX, new BigDecimal("29.4")); + /*map.put(StrConstant.MIN, new BigDecimal("9.15")); + map.put(StrConstant.MAX, new BigDecimal("29.4"));*/ return map; } @@ -414,8 +443,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { List> sampleValueList = new ArrayList<>(); IndexInputVO indexInputVO1 = new IndexInputVO(index.getIndexCode(), sampleValueList, -// index.getThreshold(), - new BigDecimal("-1"),//FOR TEST + index.getThreshold(), +// new BigDecimal("-1"),//FOR TEST index.getWeight(), scoreCalculator); map.put(index.getIndexCode(), indexInputVO1); @@ -437,6 +466,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { if (NumConstant.ZERO == total) { log.warn(String.format("customerId%s,monthId%s,没有上传网格相关-治理能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; + }else if (NumConstant.ONE == total) { + //只有一个网格时 + log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_govrn_ablity_grid_monthly record",IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); + this.handleOneGridScene(formDTO,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); } //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); @@ -496,10 +529,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { **/ private void calculateGridFuWu(CalculateCommonFormDTO formDTO, List indexList) { //查询总记录数 - int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO); + int total = factIndexServiceAblityGridMonthlyDao.selectCount(formDTO); if (NumConstant.ZERO == total) { log.warn(String.format("customerId:%s,monthId:%s,没有上传网格相关-服务能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); return; + }else if (NumConstant.ONE == total) { + //只有一个网格时 + log.warn(String.format("indexCode:%s,customerId:%s,monthId:%s,only one fact_index_service_ablity_grid_monthly record",IndexCodeEnum.FU_WU_NENG_LI.getCode(),formDTO.getCustomerId(),formDTO.getMonthId())); + this.handleOneGridScene(formDTO,IndexCodeEnum.FU_WU_NENG_LI.getCode()); } //总页数,进行批量查询,批量计算 int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml index 52d6ad6c20..976d74e3ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml @@ -149,4 +149,16 @@ AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID=#{monthId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml index f0d83bf06c..239e7c349b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml @@ -170,6 +170,7 @@ AND m.MONTH_ID =#{monthId} + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml index 1ab7d916d0..2afb14cf3c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml @@ -108,4 +108,28 @@ and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + + + + + +