diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java index 619b621d7a..1102a159b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import org.apache.ibatis.annotations.Mapper; @@ -59,9 +60,29 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao list, @Param("customerId") String customerId); - List> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize); + /** + * @return java.util.List> + * @param customerId 当前计算的客户id + * @param monthId yyyyMM + * @param offset + * @param pageSize + * @param customerAreaCode 当前计算的客户所属的area_code + * @param subCustomerIds 当前计算的客户下的子客户id + * @description 分页查询党建能力-党员相关 指标原始数据 + * @Date 2021/1/15 10:04 + **/ + List> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds") List subCustomerIds); - Map getExtremeValue(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * @return java.util.Map + * @param formDTO: customerId 当前计算的客户id;monthId yyyyMM;customerAreaCode 当前计算的客户所属的area_code;subCustomerIds 当前计算的客户下的子客户id + * @description 党员相关-党建能力各个指标值的最大值、最小值(1)有子客户时按照area_code查询(2)没有子客户按照customerId查询 + * @Date 2021/1/15 9:44 + **/ + Map getExtremeValue(CalculateCommonFormDTO formDTO); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java index 46903b52b5..5f11e113bb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java @@ -105,4 +105,8 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity { */ private String isDisplay; + /** + * desc: 是否参与上级计算yes:参与;no:不参与 add 01.14 + */ + private String upToCal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java index 6c67961fde..d8adca7a34 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java @@ -82,4 +82,9 @@ public class ScreenCustomerDeptEntity extends BaseEpmetEntity { * 2020-01-07 */ private String areaCode; + + /** + * desc: 是否参与上级计算yes:参与;no:不参与 add 01.14 + */ + private String upToCal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java index 1da1c7a11d..4a0d8e53c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java @@ -87,4 +87,9 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity { * 2020-01-07 */ private String areaCode; + + /** + * desc: 是否参与上级计算yes:参与;no:不参与 add 01.14 + */ + private String upToCal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java index b2e0158aa4..d52c6891c5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java @@ -201,7 +201,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { private void calculatePartScore(CalculateCommonFormDTO formDTO) { //计算最大最小值 - Map minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId(), formDTO.getMonthId()); + Map minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO); if (CollectionUtils.isEmpty(minAndMaxMap)) { log.warn("cpcIndexCalculate getExtremeValue customerId:{} have not any fact record", formDTO.getCustomerId()); return; @@ -219,7 +219,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { List> list = null; groupIndexDetailsMap.keySet().forEach(indexCode -> deleteOldData(formDTO, indexCode)); do { - list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), (pageNo - 1) * pageSize, pageSize); + list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(),(pageNo - 1) * pageSize, pageSize, + formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); if (!CollectionUtils.isEmpty(list)) { //遍历指标分组 计算分数 for (Map.Entry> entry : groupIndexDetailsMap.entrySet()) { @@ -232,6 +233,13 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { } while (!CollectionUtils.isEmpty(list) && list.size() == pageSize); } + /** + * @return void + * @param formDTO + * @param indexCode 当前计算指标编码 + * @description 根据客户id、月id、indexCode、allParentCode删除旧数据 + * @Date 2021/1/15 9:52 + **/ @Transactional(rollbackFor = Exception.class) public void deleteOldData(CalculateCommonFormDTO formDTO, String indexCode) { int effectRow; @@ -275,6 +283,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { CpcScoreEntity cpcScoreEntity = new CpcScoreEntity(); cpcScoreEntity.setYearId(String.valueOf(cpcCount.get(IndexCalConstant.YEAR_ID))); + //一定要赋值当前正在计算的客户id cpcScoreEntity.setCustomerId(formDTO.getCustomerId()); cpcScoreEntity.setAgencyId(String.valueOf(cpcCount.get(IndexCalConstant.AGENCY_ID))); cpcScoreEntity.setGridId(String.valueOf(cpcCount.get(IndexCalConstant.GRID_ID))); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml index 788af38336..9610514dcf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml @@ -69,59 +69,85 @@ - - SELECT - MIN( CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MIN, - MAX( CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MAX, - MIN( JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MIN, - MAX( JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MAX, - MIN( SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MIN, - MAX( SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MAX, - MIN( SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MIN, - MAX( SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MAX, - MIN( JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MIN, - MAX( JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MAX, - MIN( GROUP_USER_COUNT ) GROUP_USER_COUNT_MIN, - MAX( GROUP_USER_COUNT ) GROUP_USER_COUNT_MAX, - MIN( GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MIN, - MAX( GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MAX, - MIN( GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MIN, - MAX( GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MAX, - MIN( TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MIN, - MAX( TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MAX + MIN( cpc.CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MIN, + MAX( cpc.CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MAX, + MIN( cpc.JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MIN, + MAX( cpc.JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MAX, + MIN( cpc.SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MIN, + MAX( cpc.SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MAX, + MIN( cpc.SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MIN, + MAX( cpc.SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MAX, + MIN( cpc.JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MIN, + MAX( cpc.JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MAX, + MIN( cpc.GROUP_USER_COUNT ) GROUP_USER_COUNT_MIN, + MAX( cpc.GROUP_USER_COUNT ) GROUP_USER_COUNT_MAX, + MIN( cpc.GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MIN, + MAX( cpc.GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MAX, + MIN( cpc.GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MIN, + MAX( cpc.GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MAX, + MIN( cpc.TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MIN, + MAX( cpc.TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MAX FROM - fact_index_party_ablity_cpc_monthly - WHERE - CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} - AND MONTH_ID = #{monthId,jdbcType=VARCHAR} - AND DEL_FLAG = '0' + fact_index_party_ablity_cpc_monthly cpc + inner join screen_customer_grid scg on( + cpc.GRID_ID=scg.GRID_ID + and scg.DEL_FLAG='0' + and scg.UP_TO_CAL='yes' + ) + WHERE cpc.DEL_FLAG = '0' + AND cpc.MONTH_ID = #{monthId,jdbcType=VARCHAR} + + + and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + and cpc.CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + and scg.CUSTOMER_ID=#{customerId,jdbcType=VARCHAR} + +