Browse Source

党员相关-党建能力分数计算修改end1

dev_shibei_match
yinzuomei 5 years ago
parent
commit
0a84c7e0f7
  1. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java
  2. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerDeptEntity.java
  4. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerGridEntity.java
  5. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  6. 118
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

25
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; package com.epmet.dao.evaluationindex.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO; import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -59,9 +60,29 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
int batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataDetailFormDTO> list, int batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataDetailFormDTO> list,
@Param("customerId") String customerId); @Param("customerId") String customerId);
List<Map<String, Object>> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize); /**
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @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<Map<String, Object>> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds") List<String> subCustomerIds);
Map<String, Object> getExtremeValue(@Param("customerId") String customerId, @Param("monthId") String monthId); /**
* @return java.util.Map<java.lang.String,java.lang.Object>
* @param formDTO: customerId 当前计算的客户id;monthId yyyyMM;customerAreaCode 当前计算的客户所属的area_code;subCustomerIds 当前计算的客户下的子客户id
* @description 党员相关-党建能力各个指标值的最大值最小值1有子客户时按照area_code查询2没有子客户按照customerId查询
* @Date 2021/1/15 9:44
**/
Map<String, Object> getExtremeValue(CalculateCommonFormDTO formDTO);
/** /**
* @return int * @return int

4
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; private String isDisplay;
/**
* desc: 是否参与上级计算yes:参与;no:不参与 add 01.14
*/
private String upToCal;
} }

5
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 * 2020-01-07
*/ */
private String areaCode; private String areaCode;
/**
* desc: 是否参与上级计算yes:参与;no:不参与 add 01.14
*/
private String upToCal;
} }

5
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 * 2020-01-07
*/ */
private String areaCode; private String areaCode;
/**
* desc: 是否参与上级计算yes:参与;no:不参与 add 01.14
*/
private String upToCal;
} }

13
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) { private void calculatePartScore(CalculateCommonFormDTO formDTO) {
//计算最大最小值 //计算最大最小值
Map<String, Object> minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId(), formDTO.getMonthId()); Map<String, Object> minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO);
if (CollectionUtils.isEmpty(minAndMaxMap)) { if (CollectionUtils.isEmpty(minAndMaxMap)) {
log.warn("cpcIndexCalculate getExtremeValue customerId:{} have not any fact record", formDTO.getCustomerId()); log.warn("cpcIndexCalculate getExtremeValue customerId:{} have not any fact record", formDTO.getCustomerId());
return; return;
@ -219,7 +219,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
List<Map<String, Object>> list = null; List<Map<String, Object>> list = null;
groupIndexDetailsMap.keySet().forEach(indexCode -> deleteOldData(formDTO, indexCode)); groupIndexDetailsMap.keySet().forEach(indexCode -> deleteOldData(formDTO, indexCode));
do { 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)) { if (!CollectionUtils.isEmpty(list)) {
//遍历指标分组 计算分数 //遍历指标分组 计算分数
for (Map.Entry<String, List<IndexGroupDetailEntity>> entry : groupIndexDetailsMap.entrySet()) { for (Map.Entry<String, List<IndexGroupDetailEntity>> entry : groupIndexDetailsMap.entrySet()) {
@ -232,6 +233,13 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
} while (!CollectionUtils.isEmpty(list) && list.size() == pageSize); } while (!CollectionUtils.isEmpty(list) && list.size() == pageSize);
} }
/**
* @return void
* @param formDTO
* @param indexCode 当前计算指标编码
* @description 根据客户id月idindexCodeallParentCode删除旧数据
* @Date 2021/1/15 9:52
**/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteOldData(CalculateCommonFormDTO formDTO, String indexCode) { public void deleteOldData(CalculateCommonFormDTO formDTO, String indexCode) {
int effectRow; int effectRow;
@ -275,6 +283,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
CpcScoreEntity cpcScoreEntity = new CpcScoreEntity(); CpcScoreEntity cpcScoreEntity = new CpcScoreEntity();
cpcScoreEntity.setYearId(String.valueOf(cpcCount.get(IndexCalConstant.YEAR_ID))); cpcScoreEntity.setYearId(String.valueOf(cpcCount.get(IndexCalConstant.YEAR_ID)));
//一定要赋值当前正在计算的客户id
cpcScoreEntity.setCustomerId(formDTO.getCustomerId()); cpcScoreEntity.setCustomerId(formDTO.getCustomerId());
cpcScoreEntity.setAgencyId(String.valueOf(cpcCount.get(IndexCalConstant.AGENCY_ID))); cpcScoreEntity.setAgencyId(String.valueOf(cpcCount.get(IndexCalConstant.AGENCY_ID)));
cpcScoreEntity.setGridId(String.valueOf(cpcCount.get(IndexCalConstant.GRID_ID))); cpcScoreEntity.setGridId(String.valueOf(cpcCount.get(IndexCalConstant.GRID_ID)));

118
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

@ -69,59 +69,85 @@
</insert> </insert>
<!-- 党员相关-党建能力 (1)有子客户时按照area_code查询(2)没有子客户按照customerId查询-->
<select id="getExtremeValue" resultType="java.util.Map"> <select id="getExtremeValue" resultType="java.util.Map" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO">
SELECT SELECT
MIN( CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MIN, MIN( cpc.CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MIN,
MAX( CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MAX, MAX( cpc.CREATE_TOPIC_COUNT ) CREATE_TOPIC_COUNT_MAX,
MIN( JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MIN, MIN( cpc.JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MIN,
MAX( JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MAX, MAX( cpc.JOIN_TOPIC_COUNT ) JOIN_TOPIC_COUNT_MAX,
MIN( SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MIN, MIN( cpc.SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MIN,
MAX( SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MAX, MAX( cpc.SHIFT_ISSUE_COUNT ) SHIFT_ISSUE_COUNT_MAX,
MIN( SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MIN, MIN( cpc.SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MIN,
MAX( SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MAX, MAX( cpc.SHIFT_PROJECT_COUNT ) SHIFT_PROJECT_COUNT_MAX,
MIN( JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MIN, MIN( cpc.JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MIN,
MAX( JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MAX, MAX( cpc.JOIN_THREE_MEETS_COUNT ) JOIN_THREE_MEETS_COUNT_MAX,
MIN( GROUP_USER_COUNT ) GROUP_USER_COUNT_MIN, MIN( cpc.GROUP_USER_COUNT ) GROUP_USER_COUNT_MIN,
MAX( GROUP_USER_COUNT ) GROUP_USER_COUNT_MAX, MAX( cpc.GROUP_USER_COUNT ) GROUP_USER_COUNT_MAX,
MIN( GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MIN, MIN( cpc.GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MIN,
MAX( GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MAX, MAX( cpc.GROUP_ACTIVE_USER_COUNT ) GROUP_ACTIVE_USER_COUNT_MAX,
MIN( GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MIN, MIN( cpc.GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MIN,
MAX( GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MAX, MAX( cpc.GROUP_TOPIC_COUNT ) GROUP_TOPIC_COUNT_MAX,
MIN( TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MIN, MIN( cpc.TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MIN,
MAX( TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MAX MAX( cpc.TOPIC_TO_ISSUE_RATIO ) TOPIC_TO_ISSUE_RATIO_MAX
FROM FROM
fact_index_party_ablity_cpc_monthly fact_index_party_ablity_cpc_monthly cpc
WHERE inner join screen_customer_grid scg on(
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} cpc.GRID_ID=scg.GRID_ID
AND MONTH_ID = #{monthId,jdbcType=VARCHAR} and scg.DEL_FLAG='0'
AND DEL_FLAG = '0' and scg.UP_TO_CAL='yes'
)
WHERE cpc.DEL_FLAG = '0'
AND cpc.MONTH_ID = #{monthId,jdbcType=VARCHAR}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
and cpc.CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and scg.CUSTOMER_ID=#{customerId,jdbcType=VARCHAR}
</otherwise>
</choose>
</select> </select>
<select id="getCountByMonthId" resultType="java.util.Map"> <select id="getCountByMonthId" resultType="java.util.Map">
SELECT SELECT
CUSTOMER_ID, cpc.CUSTOMER_ID,
AGENCY_ID, cpc.AGENCY_ID,
PARENT_ID, cpc.PARENT_ID,
GRID_ID, cpc.GRID_ID,
MONTH_ID, cpc.MONTH_ID,
QUARTER_ID, cpc.QUARTER_ID,
YEAR_ID, cpc.YEAR_ID,
USER_ID, cpc.USER_ID,
CREATE_TOPIC_COUNT, cpc.CREATE_TOPIC_COUNT,
JOIN_TOPIC_COUNT, cpc.JOIN_TOPIC_COUNT,
SHIFT_ISSUE_COUNT, cpc.SHIFT_ISSUE_COUNT,
SHIFT_PROJECT_COUNT, cpc.SHIFT_PROJECT_COUNT,
JOIN_THREE_MEETS_COUNT, cpc.JOIN_THREE_MEETS_COUNT,
GROUP_USER_COUNT, cpc.GROUP_USER_COUNT,
GROUP_TOPIC_COUNT, cpc.GROUP_TOPIC_COUNT,
TOPIC_TO_ISSUE_RATIO, cpc.TOPIC_TO_ISSUE_RATIO,
GROUP_ACTIVE_USER_COUNT cpc.GROUP_ACTIVE_USER_COUNT
FROM FROM
fact_index_party_ablity_cpc_monthly fact_index_party_ablity_cpc_monthly cpc
WHERE inner join screen_customer_grid scg
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} on(
AND MONTH_ID = #{monthId,jdbcType=VARCHAR} 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}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and scg.AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
and cpc.CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and scg.CUSTOMER_ID=#{customerId,jdbcType=VARCHAR}
</otherwise>
</choose>
LIMIT #{offset},#{pageSize} LIMIT #{offset},#{pageSize}
</select> </select>

Loading…
Cancel
Save