Browse Source

Merge remote-tracking branch 'remotes/origin/dev_screen_data' into dev_temp

master
jianjun 5 years ago
parent
commit
e700724159
  1. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcSubScoreDao.java
  2. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  3. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  4. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java
  5. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  6. 4
      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. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml
  9. 0
      epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.5__add_anningejia.sql

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcSubScoreDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.CpcSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -78,9 +79,9 @@ public interface CpcSubScoreDao extends BaseDao<CpcScoreEntity> {
**/
BigDecimal selectGridJoinIssueAvgValue(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridId") String gridId);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("indexCode") String indexCode);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode);
List<CpcScoreEntity> getPartScore(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode);
int insertBatch(@Param("list") Collection<CpcScoreEntity> values);
int insertBatch(@Param("list") Collection<CpcSubScoreEntity> values);
}

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

@ -9,9 +9,11 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.CpcScoreDao;
import com.epmet.dao.evaluationindex.indexcal.CpcSubScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.CpcSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
@ -49,6 +51,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
private IndexCodeFieldReService indexCodeFieldReService;
@Autowired
private CpcScoreDao cpcScoreDao;
@Autowired
private CpcSubScoreDao cpcSubScoreDao;
@Override
public Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO) {
@ -136,6 +140,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
* @param indexCode 指标code 非必填
* @param values
*/
@Transactional(rollbackFor = Exception.class)
private void deleteAndInsertBatch(CalculateCommonFormDTO formDTO, Collection<CpcScoreEntity> values, String indexCode) {
cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
cpcScoreDao.insertBatch(values);
@ -242,23 +247,42 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
public void saveCpcScore(CalculateCommonFormDTO formDTO, Map<String, CpcScoreEntity> indexDetails, String parentIndexCode, HashMap<String, CalculateResult> result) {
List<CpcScoreEntity> list = new ArrayList<>();
result.forEach((userId, score) -> {
List<CpcSubScoreEntity> subList = new ArrayList<>();
String allParentIndexCode = null;
for (Map.Entry<String, CalculateResult> entry : result.entrySet()) {
String userId = entry.getKey();
CalculateResult score = entry.getValue();
CpcScoreEntity cpcScoreEntity = indexDetails.get(userId);
cpcScoreEntity.setScore(score.getTotalScore());
String allParentIndexCode = score.getDetails().get(0).getAllParentIndexCode();
allParentIndexCode = score.getDetails().get(0).getAllParentIndexCode();
cpcScoreEntity.setAllParentIndexCode(allParentIndexCode.substring(0, allParentIndexCode.lastIndexOf(StrConstant.COLON)));
list.add(cpcScoreEntity);
CpcScoreEntity parent = ConvertUtils.sourceToTarget(cpcScoreEntity, CpcScoreEntity.class);
score.getDetails().forEach(o -> {
CpcScoreEntity child = ConvertUtils.sourceToTarget(parent, CpcScoreEntity.class);
CpcSubScoreEntity child = ConvertUtils.sourceToTarget(parent, CpcSubScoreEntity.class);
child.setIndexCode(o.getIndexCode());
child.setAllParentIndexCode(o.getAllParentIndexCode());
child.setScore(o.getScore());
list.add(child);
subList.add(child);
});
});
}
System.out.println("value:" + JSON.toJSONString(list));
this.deleteAndInsertBatch(formDTO, list, parentIndexCode);
this.deleteAndInsertSubBatch(formDTO, subList, allParentIndexCode);
}
/**
* desc:根据客户id和月份Id 指标code 非必填 删除数据
*
* @param formDTO
* @param subList
* @param parentIndexCode 指标code 非必填
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsertSubBatch(CalculateCommonFormDTO formDTO, List<CpcSubScoreEntity> subList, String parentIndexCode) {
cpcSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), parentIndexCode);
cpcSubScoreDao.insertBatch(subList);
}

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

@ -106,12 +106,14 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
if (NumConstant.ZERO == total) {
log.warn(String.format("customerId=%s,monthId=%s,fact_index_govrn_ablity_dept_monthly have not any fact record", formDTO.getCustomerId(), formDTO.getMonthId()));
return Boolean.FALSE;
} else if (NumConstant.ONE == total) {
}
//只有一个部门的事实记录时无需处理以下代码注释
/* else if (NumConstant.ONE == total) {
//只有一个网格时
log.warn(String.format("customerId:%s,monthId:%s,only one fact_index_govrn_ablity_dept_monthly record", formDTO.getCustomerId(), formDTO.getMonthId()));
this.handleOneGridScene(formDTO);
return Boolean.TRUE;
}
}*/
//2、计算最大最小值
Map<String, Object> minAndMaxMap = factIndexGovrnAblityDeptMonthlyDao.selectExtremeValue(formDTO);
@ -203,15 +205,15 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
* @param formDTO
* @return void
* @author yinzuomei
* @description
* @description 只有一个部门的事实记录时无需处理以下代码注释
* @Date 2020/9/3 9:35
**/
private void handleOneGridScene(CalculateCommonFormDTO formDTO) {
/*private void handleOneGridScene(CalculateCommonFormDTO formDTO) {
FactIndexGovrnAblityDeptMonthlyEntity entity = factIndexGovrnAblityDeptMonthlyDao.selectOneRecord(formDTO.getCustomerId(), formDTO.getMonthId());
HashMap<String, BigDecimal> resultMap = new HashMap<>();
resultMap.put(entity.getDeptId(), new BigDecimal(NumConstant.FIFTY_STR));
this.saveDeptScoreEntity(formDTO, resultMap);
}
}*/
/**
* @param indexList

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

@ -137,11 +137,13 @@ 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) {
}
//只有一个网格的事实记录时无需处理以下代码注释
/*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);
log.info(String.format("共%s条数据,分%s次计算", total, totalPage));
@ -200,7 +202,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @description 只有一条事实记录时分值默认赋50
* @Date 2020/9/2 14:35
**/
private void handleOneGridScene(CalculateCommonFormDTO formDTO, String indexCode) {
/*private void handleOneGridScene(CalculateCommonFormDTO formDTO, String indexCode) {
List<HashMap<String, BigDecimal>> resultMapList = new ArrayList<>();
HashMap<String, BigDecimal> resultMap = new HashMap<>();
String gridId =null;
@ -216,7 +218,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
// 保存中间表
saveGridCorreLationResult(formDTO, resultMapList, indexCode, NumConstant.ZERO_STR);
}
*/
/**
* @param calculateCommonFormDTO
* @return java.util.Map<java.lang.String, java.math.BigDecimal>
@ -484,11 +486,13 @@ 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) {
}
//只有一个网格的事实记录时无需处理以下代码注释
/*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);
log.info(String.format("共%s条数据,分%s次计算", total, totalPage));
@ -551,11 +555,13 @@ 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) {
}
//只有一个网格的事实记录时无需处理以下代码注释
/*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);
log.info(String.format("共%s条数据,分%s次计算", total, totalPage));

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -3,7 +3,6 @@ package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
@ -20,9 +19,6 @@ import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
import com.epmet.dto.screen.FactIndexGridScoreDTO;
import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
import com.epmet.dto.screencoll.form.IndexDataYearlyFormDTO;
import com.epmet.entity.evaluationindex.indexcal.AgencyScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.eum.IndexCodeEnum;
@ -83,7 +79,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGridPartyMemberData(GridPartyMemberDataFormDTO formDTO, String customerId) {
@ -99,7 +94,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGridPartyAbility(GridPartyAbilityDataFormDTO formDTO, String customerId) {
@ -114,7 +108,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertOrgPartyAbility(OrgPartyAbilityDataFormDTO formDTO, String customerId) {
@ -129,7 +122,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGridServiceAbility(GridServiceAbilityDataFormDTO formDTO, String customerId) {
@ -144,7 +136,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertOrgServiceAbility(OrgServiceAbilityDataFormDTO formDTO, String customerId) {
@ -159,7 +150,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGridGovrnAbility(GridGovrnAbilityDataFormDTO formDTO, String customerId) {
@ -174,7 +164,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertOrgGovrnAbility(OrgGovrnAbilityDataFormDTO formDTO, String customerId) {
@ -189,7 +178,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertDeptGovrnAbility(DeptGovrnAbilityDataFormDTO formDTO, String customerId) {
@ -204,7 +192,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) {

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

@ -81,9 +81,9 @@
AND MONTH_ID = #{monthId}
AND data_type = #{dataType}
AND IS_TOTAL = "0"
AND INDEX_CODE = "zhilinengli"
AND (INDEX_CODE = "zhilinengli"
OR INDEX_CODE = "dangjiannengli"
OR INDEX_CODE = "fuwunengli"
OR INDEX_CODE = "fuwunengli")
</select>
<select id="selectAgencyScoreAvg" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">

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

@ -59,9 +59,9 @@
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND IS_TOTAL = "0"
AND INDEX_CODE = "dangjiannengli"
AND (INDEX_CODE = "dangjiannengli"
OR INDEX_CODE = "zhilinengli"
OR INDEX_CODE = "fuwunengli"
OR INDEX_CODE = "fuwunengli")
</select>
<!-- 街道下级所有社区服务能力得分平均值 -->

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml

@ -4,13 +4,12 @@
<mapper namespace="com.epmet.dao.evaluationindex.indexcal.CpcSubScoreDao">
<delete id="deleteByMonthId">
delete from fact_index_cpc_score
delete from fact_index_cpc_sub_score
where
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
<if test="indexCode != null and indexCode !=''">
and INDEX_CODE = #{indexCode,jdbcType=VARCHAR}
</if>
and ALL_PARENT_INDEX_CODE = #{allParentCode,jdbcType=VARCHAR}
</delete>
<resultMap type="com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity" id="cpcScoreMap">
@ -30,7 +29,7 @@
<select id="getPartScore" resultType="com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity">
select
CUSTOMER_ID,AGENCY_ID,GRID_ID,YEAR_ID,MONTH_ID,USER_ID,SCORE,INDEX_CODE FROM fact_index_cpc_score
CUSTOMER_ID,AGENCY_ID,GRID_ID,YEAR_ID,MONTH_ID,USER_ID,SCORE,INDEX_CODE FROM fact_index_cpc_sub_score
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
@ -43,7 +42,7 @@
SELECT
round(AVG( SCORE ),6) AS AVG_CONTACT_MASSES_SCORE
FROM
fact_index_cpc_score m
fact_index_cpc_sub_score m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
@ -59,7 +58,7 @@
SELECT
round(AVG( SCORE ),6) AS AVG_CONTACT_MASSES_SCORE
FROM
fact_index_cpc_score m
fact_index_cpc_sub_score m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
@ -74,7 +73,7 @@
SELECT
round(AVG( SCORE ),6) AS AVG_JOIN_ISSUE_SCORE
FROM
fact_index_cpc_score m
fact_index_cpc_sub_score m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
@ -89,7 +88,7 @@
SELECT
round(AVG( SCORE ),6) AS AVG_CONTACT_MASSES_SCORE
FROM
fact_index_cpc_score m
fact_index_cpc_sub_score m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
@ -101,7 +100,7 @@
</select>
<insert id="insertBatch">
INSERT INTO `fact_index_cpc_score` (
INSERT INTO `fact_index_cpc_sub_score` (
`ID`,
`CUSTOMER_ID`,
`GRID_ID`,

0
epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_anningejia.sql → epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.5__add_anningejia.sql

Loading…
Cancel
Save