Browse Source

党员相关-党建能力计算V0.1

dev_shibei_match
yinzuomei 5 years ago
parent
commit
fe4288e7f3
  1. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java
  2. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java
  3. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/CalCpcIndexService.java
  4. 97
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java
  6. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java
  7. 60
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml
  8. 30
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java

@ -62,4 +62,13 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
List<Map<String, Object>> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
Map<String, Object> getExtremeValue(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* @return int
* @param list
* @author yinzuomei
* @description 批量插入 入参为entity
* @Date 2020/9/18 10:30
**/
int insertBatchEntity(@Param("list") List<FactIndexPartyAblityCpcMonthlyEntity> list);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.stats.form.DimCustomerPartyMemberFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.entity.stats.DimCustomerPartymemberEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -50,4 +51,13 @@ public interface DimCustomerPartymemberDao extends BaseDao<DimCustomerPartymembe
* @date 2020/9/17 2:43 下午
*/
void deleteOldPartyRecord(@Param("customerId")String customerId,@Param("dateId")String dateId);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity>
* @param customerId 客户id
* @author yinzuomei
* @description 查询客户下所有的党员, 构造好党员相关-党建能力初始值
* @Date 2020/9/18 9:00
**/
List<FactIndexPartyAblityCpcMonthlyEntity> selectPartyMemberList(String customerId);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/CalCpcIndexService.java

@ -0,0 +1,19 @@
package com.epmet.service.evaluationindex.extract;
/**
* 党员相关
*
* @author yinzuomei@elink-cn.com
* @date 2020/9/17 14:05
*/
public interface CalCpcIndexService {
/**
* @return void
* @param customerId 客户id
* @param monthId yyyyMM
* @author yinzuomei
* @description 党员相关-党建能力
* @Date 2020/9/17 14:08
**/
void calCpcPartyAbility(String customerId, String monthId);
}

97
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java

@ -0,0 +1,97 @@
package com.epmet.service.evaluationindex.extract.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.service.evaluationindex.extract.CalCpcIndexService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 党员相关
*
* @author yinzuomei@elink-cn.com
* @date 2020/9/17 14:06
*/
@Slf4j
@Service
public class CalCpcIndexServiceImpl implements CalCpcIndexService {
@Autowired
private DimCustomerPartymemberService dimCustomerPartymemberService;
@Autowired
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao;
/**
* @param customerId 客户id
* @param monthId yyyyMM
* @return void
* @author yinzuomei
* @description 党员相关-党建能力
* @Date 2020/9/17 14:08
**/
@Override
public void calCpcPartyAbility(String customerId, String monthId) {
//1、构造初始值
List<FactIndexPartyAblityCpcMonthlyEntity> indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId);
//2、删除之前统计过的
deleteFactIndexPartyAblityCpcMonthly(customerId, monthId);
//3、计算实际值,更新
for (FactIndexPartyAblityCpcMonthlyEntity indexPartyAblityCpcEntity : indexPartyAblityCpcList) {
//TODO
//党员提出话题数
//党员参与话题数(支持、反对、评论、浏览)
//党员提出的话题转议题数
//党员提出的议题转项目数
//参加“三会一课”次数
//党员自建群群众人数
//党员自建群活跃群众人数
//党员自建群活跃度——话题数
//自建群活跃度——议题转项目率
}
//4、分批插入
//批量插入
List<List<FactIndexPartyAblityCpcMonthlyEntity>> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> {
this.FactIndexPartyAblityCpcMonthlyEntity(list);
});
}
/**
* @param customerId
* @param monthId
* @return void
* @author yinzuomei
* @description 删除这个客户这个月 党员相关-党建能力的数据
* @Date 2020/9/18 10:20
**/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX)
public void deleteFactIndexPartyAblityCpcMonthly(String customerId, String monthId) {
int deleteNum;
do {
deleteNum = factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId, monthId);
} while (deleteNum > NumConstant.ZERO);
}
/**
* @param list
* @return void
* @author yinzuomei
* @description 批量插入党员相关党建能力表
* @Date 2020/9/18 10:27
**/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX)
private void FactIndexPartyAblityCpcMonthlyEntity(List<FactIndexPartyAblityCpcMonthlyEntity> list) {
factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list);
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerPartymemberService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.stats.DimCustomerPartymemberDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.entity.stats.DimCustomerPartymemberEntity;
import java.util.List;
@ -101,4 +102,13 @@ public interface DimCustomerPartymemberService extends BaseService<DimCustomerPa
* @date 2020/9/17 11:05 上午
*/
Boolean statsPartyMember(CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity>
* @param customerId 客户id
* @author yinzuomei
* @description 查询客户下所有的党员, 构造好党员相关-党建能力初始值
* @Date 2020/9/18 9:03
**/
List<FactIndexPartyAblityCpcMonthlyEntity> selectPartyMemberList(String customerId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerPartymemberServiceImpl.java

@ -19,6 +19,7 @@ package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.dto.form.TimeListResultDTO;
import com.epmet.commons.tools.exception.RenException;
@ -26,12 +27,14 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.StatsConstant;
import com.epmet.dao.stats.DimCustomerPartymemberDao;
import com.epmet.dto.stats.DimCustomerPartymemberDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.stats.form.DimCustomerPartyMemberFormDTO;
import com.epmet.dto.stats.result.GridBelongAgencyResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.entity.stats.DimCustomerPartymemberEntity;
import com.epmet.service.partymember.PartyMemberService;
import com.epmet.service.stats.DimCustomerPartymemberService;
@ -155,6 +158,19 @@ public class DimCustomerPartymemberServiceImpl extends BaseServiceImpl<DimCustom
return true;
}
/**
* @param customerId 客户id
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity>
* @author yinzuomei
* @description 查询客户下所有的党员, 构造好党员相关-党建能力初始值
* @Date 2020/9/18 9:03
**/
@DataSource(value = DataSourceConstant.STATS)
@Override
public List<FactIndexPartyAblityCpcMonthlyEntity> selectPartyMemberList(String customerId) {
return baseDao.selectPartyMemberList(customerId);
}
/**
* @Description 删除旧纪录插入新纪录
* @param partyMemberList

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

@ -125,5 +125,63 @@
LIMIT #{offset},#{pageSize}
</select>
<!-- 批量插入 入参为entity -->
<insert id="insertBatchEntity" parameterType="map">
insert into fact_index_party_ablity_cpc_monthly
(
ID,
CUSTOMER_ID,
AGENCY_ID,
PARENT_ID,
GRID_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
CREATE_TOPIC_COUNT,
JOIN_TOPIC_COUNT,
SHIFT_ISSUE_COUNT,
SHIFT_PROJECT_COUNT,
JOIN_THREE_MEETS_COUNT,
GROUP_USER_COUNT,
GROUP_TOPIC_COUNT,
TOPIC_TO_ISSUE_RATIO,
GROUP_ACTIVE_USER_COUNT,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
USER_ID
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.agencyId},
#{item.parentId},
#{item.gridId},
#{item.monthId},
#{item.quarterId},
#{item.yearId},
#{item.createTopicCount},
#{item.joinTopicCount},
#{item.shiftIssueCount},
#{item.shiftProjectCount},
#{item.joinThreeMeetsCount},
#{item.groupUserCount},
#{item.groupTopicCount},
#{item.topicToIssueRatio},
#{item.groupActiveUserCount},
0,
0,
'APP_USER',
now(),
'APP_USER',
now(),
#{item.userId}
)
</foreach>
</insert>
</mapper>

30
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

@ -59,4 +59,34 @@
CUSTOMER_ID = #{customerId}
AND DATE_ID = #{dateId}
</delete>
<!-- 查询客户下所有的党员, 构造好党员相关-党建能力初始值 -->
<select id="selectPartyMemberList" parameterType="java.lang.String" resultType="com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity">
SELECT
dcp.CUSTOMER_ID,
dcp.GRID_ID,
dcp.AGENCY_ID,
dcp.PARENT_ID,
dcp.DATE_ID,
dcp.WEEK_ID,
dcp.MONTH_ID,
dcp.QUARTER_ID,
dcp.YEAR_ID,
dcp.USER_ID,
0 as CREATE_TOPIC_COUNT,
0 as JOIN_TOPIC_COUNT,
0 as SHIFT_ISSUE_COUNT,
0 as SHIFT_PROJECT_COUNT,
0 as OIN_THREE_MEETS_COUNT,
0 as GROUP_USER_COUNT,
0 as GROUP_ACTIVE_USER_COUNT,
0 as GROUP_TOPIC_COUNT,
0 as TOPIC_TO_ISSUE_RATIO
FROM
dim_customer_partymember dcp
WHERE
dcp.DEL_FLAG = '0'
AND dcp.CUSTOMER_ID =#{customerId}
</select>
</mapper>
Loading…
Cancel
Save