Browse Source

网格相关-只上传一条事实记录,分值默认50

dev_shibei_match
yinzuomei 5 years ago
parent
commit
667dd0ef25
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  2. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java
  3. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java
  4. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java
  5. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
  6. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
  7. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml
  8. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml

4
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";
}

11
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<FactIndexGov
* @return int
* @param formDTO
* @author yinzuomei
* @description 查询当前月共上传了多少条记录治理能力-网格相关事实表
* @description 查询治理能力-网格相关事实表当前月共上传了多少条记录
* @Date 2020/8/31 14:31
**/
int selectCount(CalculateCommonFormDTO formDTO);
/**
* @return java.lang.String
* @param formDTO
* @author yinzuomei
* @description 场景客户这个月只上传了一个网格的事实记录
* @Date 2020/9/2 14:46
**/
String selectTheOneGrid(CalculateCommonFormDTO formDTO);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java

@ -88,5 +88,21 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao<FactIndexPar
**/
Map<String, Object> 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);
}

19
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<FactIndexS
* @Date 2020/8/27 13:15
**/
Map<String, Object> 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);
}

75
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<HashMap<String, BigDecimal>> resultMapList = new ArrayList<>();
HashMap<String, BigDecimal> 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<java.lang.String, java.math.BigDecimal>
@ -190,7 +219,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
**/
private Map<String, BigDecimal> getContactMassesAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>();
/*List<BigDecimal> list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO);
List<BigDecimal> 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<String, BigDecimal> getJoinIssueAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>();
/*List<BigDecimal> list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO);
List<BigDecimal> 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<SampleValue<BigDecimal>> 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<IndexGroupDetailEntity> 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);

12
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}
</select>
<!-- 场景:客户这个月只上传了一个网格的事实记录 -->
<select id="selectTheOneGrid" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.String">
select
GRID_ID
FROM
fact_index_govrn_ablity_grid_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml

@ -170,6 +170,7 @@
AND m.MONTH_ID =#{monthId}
</select>
<!-- 查询 党建能力-网格相关事实表 这个月共上传记录数 -->
<select id="selectCount" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.Integer">
SELECT
count(1) as total
@ -180,4 +181,16 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
<!-- 场景:客户这个月只上传了一个网格的事实记录 -->
<select id="selectTheOneGrid" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.String">
select
GRID_ID
FROM
fact_index_party_ablity_grid_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
</mapper>

24
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}
</select>
<!-- 查询(服务能力-网格相关事实表)共上传记录数 -->
<select id="selectCount" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.Integer">
SELECT
count(1) as total
FROM
fact_index_service_ablity_grid_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
<!-- 场景:客户这个月只上传了一个网格的事实记录 -->
<select id="selectTheOneGrid" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.String">
select
GRID_ID
FROM
fact_index_service_ablity_grid_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
</mapper>

Loading…
Cancel
Save