From d92ba7db0b2c6973ca5e09f95438950fc92f6600 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 20 Sep 2020 23:03:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=9A=E5=91=98=E7=9B=B8=E5=85=B3-?= =?UTF-8?q?=E5=85=9A=E5=BB=BA=E8=83=BD=E5=8A=9B=E8=AE=A1=E7=AE=97V0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginGroupMainDailyDao.java | 18 ++ .../extract/FactOriginIssueLogDailyDao.java | 10 + .../extract/FactOriginIssueMainDailyDao.java | 19 +- .../FactOriginProjectMainDailyDao.java | 22 ++ .../extract/FactOriginTopicLogDailyDao.java | 20 ++ .../FactOriginProjectMainDailyService.java | 21 ++ .../FactOriginTopicLogDailyService.java | 20 ++ .../extract/IssueExtractService.java | 30 ++- .../extract/impl/CalCpcIndexServiceImpl.java | 245 +++++++++++++++--- ...FactOriginProjectMainDailyServiceImpl.java | 37 +++ .../FactOriginTopicLogDailyServiceImpl.java | 32 +++ .../FactOriginTopicMainDailyServiceImpl.java | 1 + .../extract/impl/IssueExtractServiceImpl.java | 44 +++- .../extract/FactOriginGroupMainDailyDao.xml | 23 ++ .../extract/FactOriginIssueLogDailyDao.xml | 16 ++ .../extract/FactOriginIssueMainDailyDao.xml | 42 +-- .../extract/FactOriginProjectMainDailyDao.xml | 31 +++ .../extract/FactOriginTopicLogDailyDao.xml | 28 ++ 18 files changed, 578 insertions(+), 81 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index ff1c16d1ec..f492bb1462 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -43,4 +43,22 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectPartyCreateGroupCount(@Param("customerId") String customerId,@Param("monthId") String monthId); + /** + * @param customerId + * @param groupOwnerId + * @return java.util.List + * @author yinzuomei + * @description 查询当前用户建的所有群id + * @Date 2020/9/20 21:22 + **/ + List selectGroupIds(@Param("customerId") String customerId, @Param("groupOwnerId") String groupOwnerId); + + /** + * @return java.util.List + * @param groupIdList + * @author yinzuomei + * @description 查询组成员数(去重) + * @Date 2020/9/20 21:29 + **/ + List selectGroupMemberList(@Param("list") List groupIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index a98372928e..b7d86e4353 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -51,4 +51,14 @@ public interface FactOriginIssueLogDailyDao extends BaseDao> selectShiftIssueCount(@Param("customerId") String customerId,@Param("monthId") String monthId); - /** - * @return java.util.List> - * @param customerId - * @param monthId - * @author yinzuomei - * @description 党员提出的议题转项目数 - * @Date 2020/9/18 14:11 - **/ - List> selectShiftProjectCount(@Param("customerId") String customerId,@Param("monthId") String monthId); - /** * @Description 查询网格 党员/群众 人均提出的议题转项目数 * @param customerId @@ -102,4 +92,13 @@ public interface FactOriginIssueMainDailyDao extends BaseDao selectShiftProjectCountPlus(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("isParty") Integer isParty); + + /** + * @return java.lang.Integer + * @param topicIdList + * @author yinzuomei + * @description 查询本周期和上周期内,自建群内话题转为议题的数量的总和 + * @Date 2020/9/20 22:54 + **/ + Integer selectIssueTotalTwoMonth(@Param("list") List topicIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index a8fef6685c..db30525d58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -26,6 +26,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 项目主表_日统计 @@ -81,4 +82,25 @@ public interface FactOriginProjectMainDailyDao extends BaseDao> + * @param customerId + * @param monthId + * @author yinzuomei + * @description 党员提出的议题转项目数 + * @Date 2020/9/18 14:11 + **/ + List> selectShiftProjectCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * @return java.lang.Integer + * @param customerId + * @param monthId + * @param topicIdList + * @author yinzuomei + * @description 9、自建群活跃度——议题转项目率 用 + * @Date 2020/9/20 22:27 + **/ + Integer selectCountByPartyUser(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("list")List topicIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java index 2694c66397..ab43a21b2e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java @@ -73,4 +73,24 @@ public interface FactOriginTopicLogDailyDao extends BaseDao> selectGroupTopicCount(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * @return java.lang.Integer + * @param userId + * @param customerId + * @param monthId + * @author yinzuomei + * @description 查询当前用户在本月内评论的次数 + * @Date 2020/9/20 21:46 + **/ + Integer selectUserCommentCount(@Param("userId") String userId, @Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * @return java.util.List + * @param groupIdList + * @author yinzuomei + * @description 组内的所有话题id + * @Date 2020/9/20 22:18 + **/ + List selectTopicIds(@Param("list") List groupIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java index 338418717b..a21fb1c1a2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java @@ -140,4 +140,25 @@ public interface FactOriginProjectMainDailyService extends BaseService> + * @param customerId + * @param monthId + * @author yinzuomei + * @description 党员提出的议题转项目数 + * @Date 2020/9/18 14:11 + **/ + List> selectShiftProjectCount(String customerId, String monthId); + + /** + * @return java.lang.Integer + * @param customerId + * @param monthId + * @param topicIdList + * @author yinzuomei + * @description 9、自建群活跃度——议题转项目率 用 + * @Date 2020/9/20 22:25 + **/ + Integer selectCountByPartyUser(String customerId, String monthId, List topicIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java index 18971cf15a..f5eb32bd09 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicLogDailyService.java @@ -51,4 +51,24 @@ public interface FactOriginTopicLogDailyService extends BaseService> selectGroupTopicCount(String customerId, String monthId); + + /** + * @return int + * @param userId + * @param customerId + * @param monthId + * @author yinzuomei + * @description + * @Date 2020/9/20 21:43 + **/ + Integer selectUserCommentCount(String userId,String customerId, String monthId ); + + /** + * @return java.util.List + * @param groupIdList + * @author yinzuomei + * @description 组内的所有话题id + * @Date 2020/9/20 22:17 + **/ + List selectTopicIds(List groupIdList); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java index 55cf8cd348..0b7ec04c48 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java @@ -61,16 +61,6 @@ public interface IssueExtractService { **/ List> selectShiftIssueCount(String customerId, String monthId); - /** - * @return java.util.List> - * @param customerId - * @param monthId - * @author yinzuomei - * @description 党员提出的议题转项目数 - * @Date 2020/9/18 14:11 - **/ - List> selectShiftProjectCount(String customerId, String monthId); - /** * @Description 查询网格 党员/群众 人均提出的议题转项目数 * @param customerId @@ -80,4 +70,24 @@ public interface IssueExtractService { * @date 2020/9/19 2:26 下午 */ List selectShiftProjectCountPlus(String customerId, String monthId,Integer isParty); + + /** + * @return java.lang.Integer + * @param userId 用户id + * @param customerId + * @param monthId + * @author yinzuomei + * @description 查询用户在这个月内表决的总次数 + * @Date 2020/9/20 21:50 + **/ + Integer selectCountUserVote(String userId, String customerId, String monthId); + + /** + * @return java.lang.Integer + * @param topicIdList + * @author yinzuomei + * @description + * @Date 2020/9/20 22:50 + **/ + Integer selectIssueTotalTwoMonth(List topicIdList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java index 8559025963..d7cf968388 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java @@ -4,18 +4,20 @@ 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.extract.FactOriginGroupMainDailyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; -import com.epmet.service.evaluationindex.extract.CalCpcIndexService; -import com.epmet.service.evaluationindex.extract.FactOriginTopicLogDailyService; -import com.epmet.service.evaluationindex.extract.FactOriginTopicMainDailyService; -import com.epmet.service.evaluationindex.extract.IssueExtractService; +import com.epmet.service.evaluationindex.extract.*; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,6 +41,10 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { private FactOriginTopicLogDailyService factOriginTopicLogDailyService; @Autowired private IssueExtractService issueExtractService; + @Autowired + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Autowired + private FactOriginGroupMainDailyDao factOriginGroupMainDailyDao; /** * @param customerId 客户id @@ -52,20 +58,35 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { public void calCpcPartyAbility(String customerId, String monthId) { //1、构造初始值 List indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId); + if (CollectionUtils.isEmpty(indexPartyAblityCpcList)) { + log.info("dim_customer_partymember do not any records"); + return; + } //2、删除之前统计过的 deleteFactIndexPartyAblityCpcMonthly(customerId, monthId); + + //1、党员提出话题数 Map createTopicCountMap = calCreateTopicCount(customerId, monthId); //2、党员参与话题数(支持、反对、评论、浏览)---目前只统计 党员评论话题次数之和 - Map joinTopicCountMap=calJoinTopicCount(customerId,monthId); + Map joinTopicCountMap = calJoinTopicCount(customerId, monthId); //3、党员提出的话题转议题数 - Map shiftIssueCountMap=calShiftIssueCount(customerId,monthId); + Map shiftIssueCountMap = calShiftIssueCount(customerId, monthId); //4、党员提出的议题转项目数 - Map shiftProjectCountMap=calShiftProjectCount(customerId,monthId); - //6、党员自建群群众人数 - Map groupUserCountMap=calgroupUserCount(customerId,monthId); - //8、党员自建群活跃度——话题数 - Map groupTopicCountMap=calGroupTopicCountMap(customerId,monthId); + Map shiftProjectCountMap = calShiftProjectCount(customerId, monthId); + //5、参加“三会一课”次数 默认0 + + //可以先查询出每个党员的 自建群 + Map> userCreatedGroups = queryUserCreatedGroups(customerId, indexPartyAblityCpcList); + //6、党员自建群群众人数 (todo 和monthId无关??) + Map groupUserCountMap = calgroupUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); + //7、党员自建群活跃群众人数 + Map groupActiveUserCountMap = calGroupActiveUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); + //8、党员自建群活跃度——话题数 (todo 校验sql正确性) + Map groupTopicCountMap = calGroupTopicCount(customerId, monthId); + //9、自建群活跃度——议题转项目率 + Map topicToIssueRatioMap = caltopicToIssueRatio(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); + //3、计算实际值,更新 for (FactIndexPartyAblityCpcMonthlyEntity indexPartyAblityCpcEntity : indexPartyAblityCpcList) { //1、党员提出话题数 @@ -73,32 +94,36 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { indexPartyAblityCpcEntity.setCreateTopicCount(createTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); } //2、党员参与话题数(支持、反对、评论、浏览)---目前只统计 党员评论话题次数之和 - if(joinTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){ + if (joinTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { indexPartyAblityCpcEntity.setJoinTopicCount(joinTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); } //3、党员提出的话题转议题数 - if(shiftIssueCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){ + if (shiftIssueCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { indexPartyAblityCpcEntity.setShiftIssueCount(shiftIssueCountMap.get(indexPartyAblityCpcEntity.getUserId())); } //4、党员提出的议题转项目数 - if(shiftProjectCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){ + if (shiftProjectCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { indexPartyAblityCpcEntity.setShiftProjectCount(shiftProjectCountMap.get(indexPartyAblityCpcEntity.getUserId())); } //5、参加“三会一课”次数 目前没有此业务,默认0 - //6、党员自建群群众人数 TODO - if(groupUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){ + //6、党员自建群群众人数 + if (groupUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { indexPartyAblityCpcEntity.setGroupUserCount(groupUserCountMap.get(indexPartyAblityCpcEntity.getUserId())); } - //7、党员自建群活跃群众人数 TODO + //7、党员自建群活跃群众人数 + if (groupActiveUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { + indexPartyAblityCpcEntity.setGroupActiveUserCount(groupActiveUserCountMap.get(indexPartyAblityCpcEntity.getUserId())); + } //8、党员自建群活跃度——话题数 - if(groupTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){ + if (groupTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { indexPartyAblityCpcEntity.setGroupTopicCount(groupTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); } - //9、自建群活跃度——议题转项目率 TODO - + //9、自建群活跃度——议题转项目率 + if (topicToIssueRatioMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { + indexPartyAblityCpcEntity.setTopicToIssueRatio(topicToIssueRatioMap.get(indexPartyAblityCpcEntity.getUserId())); + } } - //4、分批插入 - //批量插入 + //4、分批插入批量插入 List> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE); partition.forEach(list -> { this.FactIndexPartyAblityCpcMonthlyEntity(list); @@ -106,6 +131,30 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { } + + /** + * @param customerId + * @param partyMemberList + * @return java.util.Map> + * @author yinzuomei + * @description 查询每个党员的自建群 + * @Date 2020/9/20 22:07 + **/ + private Map> queryUserCreatedGroups(String customerId, List partyMemberList) { + Map> map = new HashMap<>(); + for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { + //查询当前党员建了多少个组 + List groupIdList = factOriginGroupMainDailyDao.selectGroupIds(customerId, partyMember.getUserId()); + if (CollectionUtils.isEmpty(groupIdList)) { + map.put(partyMember.getUserId(), new ArrayList<>()); + continue; + } else { + map.put(partyMember.getUserId(), groupIdList); + } + } + return map; + } + /** * @param customerId * @param monthId @@ -126,9 +175,9 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { } /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei * @description 2、查询客户下,这个月内,每个党员评论话题的次数 * @Date 2020/9/18 13:33 @@ -146,9 +195,9 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei * @description 3、党员提出的话题转议题数 * @Date 2020/9/18 13:53 @@ -165,15 +214,16 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { } /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei * @description 4、党员提出的议题转项目数 * @Date 2020/9/18 14:10 **/ private Map calShiftProjectCount(String customerId, String monthId) { - List> mapList = issueExtractService.selectShiftProjectCount(customerId, monthId); + //查询fact_origin_project_main_daily 表 中议题的议题的状态为 shift_ + List> mapList = factOriginProjectMainDailyService.selectShiftProjectCount(customerId, monthId); Map resultMap = new HashMap<>(); for (Map map : mapList) { for (Map.Entry m : map.entrySet()) { @@ -184,18 +234,99 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { } /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei * @description 6、党员自建群群众人数 * @Date 2020/9/18 15:38 **/ - private Map calgroupUserCount(String customerId, String monthId) { - // TODO - return null; + private Map calgroupUserCount(String customerId, String monthId, + List partyMemberList, + Map> userCreatedGroups) { + /*含义:评价周期内,党员自建群中群众成员数。 + 数据来源:用户社群关系表。 + 计算方法:对党员i的所有j个自建群,从用户社群关系表中统计属于每个自建群的群众用户总人数,并对j个群众用户总数进行不重复累加。 + 对评价结果的影响:正向。*/ + Map map = new HashMap<>(); + for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { + //查询当前党员建了多少个组 + List groupIdList = userCreatedGroups.get(partyMember.getUserId()); + if (CollectionUtils.isEmpty(groupIdList)) { + map.put(partyMember.getUserId(), NumConstant.ZERO); + continue; + } + //去重组里面的成员 + List memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList); + if (CollectionUtils.isEmpty(memberIdList)) { + map.put(partyMember.getUserId(), NumConstant.ZERO); + continue; + } else { + map.put(partyMember.getUserId(), memberIdList.size()); + } + } + return map; + } + + /** + * @param customerId + * @param monthId + * @param partyMemberList + * @return java.util.Map + * @author yinzuomei + * @description 7、党员自建群活跃群众人数 + * @Date 2020/9/20 21:36 + **/ + private Map calGroupActiveUserCount(String customerId, String monthId, + List partyMemberList, + Map> userCreatedGroups) { + /*含义:评价周期内,党员自建群中活跃群众成员数。所谓活跃群成员,即评价周期内参与话题、事件评论、点赞、点踩总次数大于给定阈值的群众用户。 + 数据来源:话题用户阅读表、话题评论用户表态表、话题评论表、事件点赞点踩表、事件评论点赞点踩表、事件评论表、用户信息表。 + 计算方法: + a)判断群中的群众成员是否活跃 + for each 群众成员 i + 统计i的话题阅读次数、话题评论次数、话题评论表态次数、事件点赞点踩次数、事件评论点赞点踩次数、事件评论总次数。 + If 总次数>阈值 + 成员i为活跃群众成员 + b)不重复累加活跃群众成员数 + 对评价结果的影响:正向。*/ + //结合目前产品,数据来源:话题评论、议题表决 + Map map = new HashMap<>(); + for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { + int groupActiveUserCount = 0; + //1、查询当前党员建了多少个组 + List groupIdList = userCreatedGroups.get(partyMember.getUserId()); + if (CollectionUtils.isEmpty(groupIdList)) { + map.put(partyMember.getUserId(), NumConstant.ZERO); + continue; + } + //2、去重组里面的成员 + List memberIdList = factOriginGroupMainDailyDao.selectGroupMemberList(groupIdList); + if (CollectionUtils.isEmpty(memberIdList)) { + map.put(partyMember.getUserId(), NumConstant.ZERO); + continue; + } + //3、判断每个成员是否 “活跃” + for (String memberId : memberIdList) { + //1、判断成员在本月内是否评论过 + Integer topicCommentCount = factOriginTopicLogDailyService.selectUserCommentCount(memberId, customerId, monthId); + if (topicCommentCount > 0) { + groupActiveUserCount++; + continue; + } + //2、判断成员在本月内是否表决过(支持or反对)议题 + Integer voteCount = issueExtractService.selectCountUserVote(memberId, customerId, monthId); + if (voteCount > 0) { + groupActiveUserCount++; + } + } + //赋值每个党员的 -- 党员自建群活跃群众人数 + map.put(partyMember.getUserId(), groupActiveUserCount); + } + return map; } + /** * @param customerId * @param monthId @@ -204,7 +335,11 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { * @description 8、党员自建群活跃度——话题数 * @Date 2020/9/18 14:31 **/ - private Map calGroupTopicCountMap(String customerId, String monthId) { + private Map calGroupTopicCount(String customerId, String monthId) { + /*含义:评价周期内,党员自建群中话题发布数。 + 数据来源:话题表。 + 计算方法:从话题表中统计党员自建群i的话题总数;对所有自建群话题数累加。 + 对评价结果的影响:正向。*/ List> mapList = factOriginTopicLogDailyService.selectGroupTopicCount(customerId, monthId); Map resultMap = new HashMap<>(); for (Map map : mapList) { @@ -215,6 +350,54 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { return resultMap; } + /** + * @param userCreatedGroups 党员自建群 + * @return java.util.Map + * @author yinzuomei + * @description 9、自建群活跃度——议题转项目率 + * @Date 2020/9/20 22:11 + **/ + private Map caltopicToIssueRatio(String customerId, + String monthId, + List partyMemberList, + Map> userCreatedGroups) { + Map map = new HashMap<>(); + for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { + //如果党员自建群为空,直接赋值0 + if (CollectionUtils.isEmpty(userCreatedGroups.get(partyMember.getUserId()))) { + map.put(partyMember.getUserId(), BigDecimal.ZERO); + continue; + } + //自建群出来的话题 + List groupIdList = userCreatedGroups.get(partyMember.getUserId()); + List topicIdList = factOriginTopicLogDailyService.selectTopicIds(groupIdList); + if (CollectionUtils.isEmpty(topicIdList)) { + map.put(partyMember.getUserId(), BigDecimal.ZERO); + continue; + } + //分子 + //本月内新增的项目(and 源于自建群中的话题) + Integer projectTotal = factOriginProjectMainDailyService.selectCountByPartyUser(customerId, monthId, topicIdList); + if (null == projectTotal || projectTotal == NumConstant.ZERO) { + map.put(partyMember.getUserId(), BigDecimal.ZERO); + continue; + } + //分母 + //本评价周期+上一个评价周期内自建群中的议题数 + Integer issueTotal = issueExtractService.selectIssueTotalTwoMonth(topicIdList); + if (null == issueTotal || issueTotal == NumConstant.ZERO) { + map.put(partyMember.getUserId(), BigDecimal.ZERO); + continue; + } + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(6); + String topicToIssueRatioStr = numberFormat.format((float) projectTotal / issueTotal); + BigDecimal topicToIssueRatio = new BigDecimal(topicToIssueRatioStr); + map.put(partyMember.getUserId(), topicToIssueRatio); + } + return map; + } + /** * @param customerId * @param monthId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java index 1358c2fdc4..a32bbe22f0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.evaluationindex.extract.FactOriginProjectMainDailyDao; @@ -32,7 +33,9 @@ import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyServi import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -131,4 +134,38 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl> + * @author yinzuomei + * @description 党员提出的议题转项目数 + * @Date 2020/9/18 14:11 + **/ + @Override + public List> selectShiftProjectCount(String customerId, String monthId) { + //查询项目主表fact_origin_project_main_daily,这个月内新增的项目,按话题发布人分组 + /*含义:评价周期内,党员提出的议题转数目数。 + 数据来源:项目表。 + 计算方法:从项目表中按照用户ID和党员标识统计。 + 对评价结果的影响:正向。*/ + return baseDao.selectShiftProjectCount(customerId,monthId); + } + + /** + * @param customerId + * @param monthId + * @param topicIdList + * @return java.lang.Integer + * @author yinzuomei + * @description 9、自建群活跃度——议题转项目率 用 + * @Date 2020/9/20 22:25 + **/ + @Override + public Integer selectCountByPartyUser(String customerId, String monthId, List topicIdList) { + if(CollectionUtils.isEmpty(topicIdList)){ + return NumConstant.ZERO; + } + return baseDao.selectCountByPartyUser(customerId,monthId,topicIdList); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java index 07a220fa44..d1f1ed681a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicLogDailyServiceImpl.java @@ -24,7 +24,9 @@ import com.epmet.dao.evaluationindex.extract.FactOriginTopicLogDailyDao; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import com.epmet.service.evaluationindex.extract.FactOriginTopicLogDailyService; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -49,6 +51,7 @@ public class FactOriginTopicLogDailyServiceImpl extends BaseServiceImpl> selectJoinTopicCount(String customerId, String monthId) { + //这个月内新增的话题评论,按人分组,不限制评论时的身份,以当前用户最新身份为准 return baseDao.selectJoinTopicCount(customerId,monthId); } @@ -64,4 +67,33 @@ public class FactOriginTopicLogDailyServiceImpl extends BaseServiceImpl> selectGroupTopicCount(String customerId, String monthId) { return baseDao.selectGroupTopicCount(customerId,monthId); } + + /** + * @return java.lang.Integer + * @param userId + * @param customerId + * @param monthId + * @author yinzuomei + * @description 查询当前用户在本月内评论的次数 + * @Date 2020/9/20 21:45 + **/ + @Override + public Integer selectUserCommentCount(String userId,String customerId, String monthId) { + return baseDao.selectUserCommentCount(userId,customerId,monthId); + } + + /** + * @param groupIdList + * @return java.util.List + * @author yinzuomei + * @description 组内的所有话题id + * @Date 2020/9/20 22:17 + **/ + @Override + public List selectTopicIds(List groupIdList) { + if(CollectionUtils.isEmpty(groupIdList)){ + return new ArrayList<>(); + } + return baseDao.selectTopicIds(groupIdList); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicMainDailyServiceImpl.java index a61eab5a48..b82592861a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginTopicMainDailyServiceImpl.java @@ -238,6 +238,7 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl> selectPartyCreateTopicCount(String customerId, String monthId) { + //这个月内新增的话题,按人分组,不限制发话题人的身份,也就是说以用户最新的身份为准 return baseDao.selectPartyCreateTopicCount(customerId,monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java index 46ae7c8557..78bb8a187c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java @@ -278,22 +278,14 @@ public class IssueExtractServiceImpl implements IssueExtractService { @DataSource(DataSourceConstant.STATS) @Override public List> selectShiftIssueCount(String customerId, String monthId) { + //查询fact_origin_issue_main_daily 表,转议题的时间在评价周期内的,按发布话题的人分组 + /*含义:评价周期内,党员提出的话题转为议题的数目。 + 数据来源:议题表。 + 计算方法:从议题表中按照用户ID和党员标识统计。 + 对评价结果的影响:正向。*/ return issueMainDailyDao.selectShiftIssueCount(customerId,monthId); } - /** - * @param customerId - * @param monthId - * @return java.util.List> - * @author yinzuomei - * @description 党员提出的议题转项目数 - * @Date 2020/9/18 14:11 - **/ - @Override - public List> selectShiftProjectCount(String customerId, String monthId) { - return issueMainDailyDao.selectShiftProjectCount(customerId,monthId); - } - /** * @Description 查询网格 党员/群众 人均提出的议题转项目数 * @param customerId @@ -306,4 +298,30 @@ public class IssueExtractServiceImpl implements IssueExtractService { public List selectShiftProjectCountPlus(String customerId, String monthId, Integer isParty) { return issueMainDailyDao.selectShiftProjectCountPlus(customerId, monthId, isParty); } + + /** + * @param userId 用户id + * @param customerId + * @param monthId + * @return java.lang.Integer + * @author yinzuomei + * @description 查询用户在这个月内表决的总次数 + * @Date 2020/9/20 21:50 + **/ + @Override + public Integer selectCountUserVote(String userId, String customerId, String monthId) { + return issueLogDailyDao.selectCountUserVote(userId,customerId,monthId); + } + + /** + * @param topicIdList + * @return java.lang.Integer + * @author yinzuomei + * @description 查询本周期和上周期内,自建群内话题转为议题的数量的总和 + * @Date 2020/9/20 22:48 + **/ + @Override + public Integer selectIssueTotalTwoMonth(List topicIdList) { + return issueMainDailyDao.selectIssueTotalTwoMonth(topicIdList); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index fd90cd5a18..6894e88ce1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -17,5 +17,28 @@ GROUP BY GRID_ID + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index ab19b88e80..862f0488c5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -62,4 +62,20 @@ CUSTOMER_ID = #{customerId} AND DATE_ID = #{dateId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index 2e4884a8f6..de03f24dc5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -111,27 +111,12 @@ -- AND t1.TOPIC_USER_IS_PARTY = '1' AND t1.CUSTOMER_ID = #{customerId} AND t1.MONTH_ID = #{monthId} + AND ISNULL(T1.CREATE_TOPIC_USER_ID)=0 + AND LENGTH(trim(T1.CREATE_TOPIC_USER_ID))>0 GROUP BY T1.CREATE_TOPIC_USER_ID - - - + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 81472beb65..a619489c28 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -108,4 +108,35 @@ + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml index 3fcd8fba28..848a0d733a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml @@ -100,4 +100,32 @@ and t1.MONTH_ID=#{monthId} group by t2.USER_ID + + + + + + + \ No newline at end of file From 8faa729e5359b09a6b9fa847c7fb2f54e5b36b64 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 20 Sep 2020 23:29:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/impl/CalGridIndexServiceImpl.java | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java index 0b574b6009..9fea4c2476 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java @@ -6,7 +6,6 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ExtractConstant; import com.epmet.constant.ProjectEvaluateConstant; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; -import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao; import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.GridIssueCountResultDTO; import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; @@ -200,7 +199,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { autoSelf.set(false); } }); - if (autoSelf.get() == true){ + if (autoSelf.get()) { count.getAndSet(count.get() + NumConstant.ONE); } }); @@ -231,7 +230,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { Map> groupByProject = projectEvaluateInfoList.stream().collect(Collectors.groupingBy(ProjectEvaluateResultDTO::getProjectId)); groupByProject.forEach((projectId,projectList) -> { projectList.forEach(project -> { - switch (project.getActionCode()){ + switch (project.getActionCode()) { case ExtractConstant.EVALUATE_BAD: project.setScore(ProjectEvaluateConstant.BAD); break; @@ -241,9 +240,11 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { case ExtractConstant.EVALUATE_PERFECT: project.setScore(ProjectEvaluateConstant.PERFECT); break; + default: + log.warn("calGridIndexGovernAbility orther projectEvaluate,actionCode:{}", project.getActionCode()); } }); - Integer projectAllScore = projectList.stream().collect(Collectors.summingInt(ProjectEvaluateResultDTO::getScore)); + Integer projectAllScore = projectList.stream().mapToInt(ProjectEvaluateResultDTO::getScore).sum(); scoreMap.put(projectId,projectAllScore/projectList.size()); }); AtomicReference allScore = new AtomicReference<>(0); @@ -285,29 +286,25 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { }); } // 4. 网格吹哨部门准确率 - if (!CollectionUtils.isEmpty(notReturnProjectList)){ + if (!CollectionUtils.isEmpty(notReturnProjectList)) { notReturnProjectList.forEach(not -> { - if (r.getGridId().equals(not.getGridId())){ + if (r.getGridId().equals(not.getGridId())) { r.setTransferRightRatio(not.getTransferRightRatio()); } }); } // 5. 网格内解决的项目的满意度 - if (null != resultSatisfactionScore){ - resultSatisfactionScore.forEach((k,v) -> { - if (r.getGridId().equals(k)){ - r.setSatisfactionRatio(v); - } - }); - } + resultSatisfactionScore.forEach((k, v) -> { + if (r.getGridId().equals(k)) { + r.setSatisfactionRatio(v); + } + }); // 6. 网格自治项目数 - if (null != autoMap){ - autoMap.forEach((k,v) -> { - if (r.getGridId().equals(k)){ - r.setSelfSolveProjectCount(v); - } - }); - } + autoMap.forEach((k, v) -> { + if (r.getGridId().equals(k)) { + r.setSelfSolveProjectCount(v); + } + }); }); delAndInsertGovernAbility(result,customerId,monthId); return true; From 99e9518cbb8c38761af55484108af036487e57d7 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Sun, 20 Sep 2020 23:32:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B2=BB=E7=90=86=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/OrgStatisticsResultDTO.java | 1 + .../extract/FactOriginProjectLogDailyDao.java | 12 +++++ .../FactIndexPartyAblityOrgMonthlyDao.java | 11 +++++ .../FactArticlePublishedAgencyDailyDao.java | 15 ++++++ .../FactOriginProjectLogDailyService.java | 11 +++++ .../FactOriginProjectLogDailyServiceImpl.java | 5 ++ ...FactIndexPartyAblityOrgMonthlyService.java | 22 +++++++++ .../indexcoll/IndexCollCommunityService.java | 12 +---- ...IndexPartyAblityOrgMonthlyServiceImpl.java | 23 +++++++++ .../impl/IndexCollCommunityServiceImpl.java | 47 ++++++++++++++----- .../impl/IndexCollStreetServiceImpl.java | 34 ++++++++++++++ ...actArticlePublishedAgencyDailyService.java | 13 +++++ ...rticlePublishedAgencyDailyServiceImpl.java | 9 ++++ .../extract/FactOriginProjectLogDailyDao.xml | 21 +++++++++ .../FactIndexPartyAblityOrgMonthlyDao.xml | 6 +++ .../FactArticlePublishedAgencyDailyDao.xml | 12 +++++ 16 files changed, 231 insertions(+), 23 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java index 2d70c0b254..ad170c5b96 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java @@ -14,6 +14,7 @@ public class OrgStatisticsResultDTO implements Serializable { private static final long serialVersionUID = 9221060553279124719L; private String customerId; private String agencyId; + private String orgId; private Integer count; private Integer sum; private String ratio; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 759a56e82c..9eb37ea0c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -96,4 +96,16 @@ public interface FactOriginProjectLogDailyDao extends BaseDao selectSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("level")String level); + + /** + * 区直部门被吹哨次数 + * @author zhaoqifeng + * @date 2020/9/18 14:46 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List selectDepTransferCount(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level")String level); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java index 220e9a91f1..f9ab1ba754 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java @@ -77,4 +77,15 @@ public interface FactIndexPartyAblityOrgMonthlyDao extends BaseDao> selectPublishArticleCountMap(@Param("customerId")String customerId, @Param("monthId")String monthId,@Param("level")String level); + + /** + * 根据组织类型删除数据 + * @author zhaoqifeng + * @date 2020/9/20 20:52 + * @param customerId + * @param monthId + * @param type + * @return java.lang.Integer + */ + Integer deleteByCustomer(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("type") String type); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java index 5a7e9dbfc7..3e20141c80 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedAgencyDailyDao.java @@ -18,10 +18,13 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 文章发布数量【机关】日统计表 * @@ -38,4 +41,16 @@ public interface FactArticlePublishedAgencyDailyDao extends BaseDao + */ + List selectArticleCount(@Param("customerId")String customerId, @Param("monthId")String monthId, + @Param("level")String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java index 72f840ba81..32267cbe10 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java @@ -155,4 +155,15 @@ public interface FactOriginProjectLogDailyService extends BaseService */ List getSatisfaction(String customerId, String monthId, String level); + + /** + * 机关被吹哨次数 + * @author zhaoqifeng + * @date 2020/9/18 14:53 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getDepTransferCount(String customerId, String monthId, String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java index a62fdd38e2..3a2d9255e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java @@ -152,4 +152,9 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl getDepTransferCount(String customerId, String monthId, String level) { + return baseDao.selectDepTransferCount(customerId, monthId, level); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java new file mode 100644 index 0000000000..0227a835f8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java @@ -0,0 +1,22 @@ +package com.epmet.service.evaluationindex.indexcoll; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/20 23:00 + */ +public interface FactIndexPartyAblityOrgMonthlyService extends BaseService { + /** + * 根据客户清空数据 + * @author zhaoqifeng + * @date 2020/9/20 20:33 + * @param customerId + * @param monthId + * @param type + * @return void + */ + void deleteByCustomer(String customerId, String monthId, String type); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java index 40fd419333..f69747ce74 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java @@ -8,7 +8,7 @@ package com.epmet.service.evaluationindex.indexcoll; */ public interface IndexCollCommunityService { /** - * 社区治理能力统计 + * 社区能力统计 * * @author zhaoqifeng * @date 2020/9/18 13:52 @@ -18,14 +18,4 @@ public interface IndexCollCommunityService { */ void saveCommunityAbility(String customerId, String dateId); - /** - * 社区党建能力统计 - * - * @author zhaoqifeng - * @date 2020/9/18 13:52 - * @param customerId - * @param dateId - * @return void - */ - void saveCommunityPartyAbility(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java new file mode 100644 index 0000000000..7964b2788b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java @@ -0,0 +1,23 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; +import org.springframework.stereotype.Service; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/20 23:01 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class FactIndexPartyAblityOrgMonthlyServiceImpl extends BaseServiceImpl implements FactIndexPartyAblityOrgMonthlyService { + @Override + public void deleteByCustomer(String customerId, String monthId, String type) { + baseDao.deleteByCustomer(customerId, monthId, type); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java index 73e99caaa0..ad5ce2728f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java @@ -6,15 +6,18 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; -import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollCommunityService; import com.epmet.service.stats.DimAgencyService; +import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -45,6 +48,10 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; @Autowired private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Autowired + private FactArticlePublishedAgencyDailyService factArticlePublishedAgencyDailyService; + @Autowired + private FactIndexPartyAblityOrgMonthlyService factIndexPartyAblityOrgMonthlyService; @Override public void saveCommunityAbility(String customerId, String dateId) { @@ -65,15 +72,15 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService entity.setMonthId(dimId.getMonthId()); entity.setDataType(OrgTypeConstant.COMMUNITY); entity.setTransferedCount(NumConstant.ZERO); - entity.setClosedProjectCount(NumConstant.ZERO); entity.setRespProjectRatio(new BigDecimal(NumConstant.ZERO)); entity.setOverdueProjectRatio(new BigDecimal(NumConstant.ZERO)); entity.setClosedProjectRatio(new BigDecimal(NumConstant.ZERO)); entity.setSatisfactionRatio(new BigDecimal(NumConstant.ZERO)); + entity.setClosedProjectCount(NumConstant.ZERO); entity.setHandleProjectRatio(new BigDecimal(NumConstant.ZERO)); return entity; }).collect(Collectors.toList()); - + //1.治理能力 //被吹哨次数统计 List transferCount = factOriginProjectLogDailyService.getAgencyTransferCount(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); @@ -119,18 +126,34 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService } })); } + factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); factIndexGovrnAblityOrgMonthlyService.insertBatch(list); - } - @Override - public void saveCommunityPartyAbility(String customerId, String dateId) { - //当前日期前一天 - Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); - //获取日期相关维度 - DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); - //获取社区列表 - ListagencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.COMMUNITY); + //2.党建能力 //获取社区发文数量 + List articles = factArticlePublishedAgencyDailyService.getArticleCount(customerId, dimId.getMonthId(), + OrgTypeConstant.COMMUNITY); + + List partyList = agencyList.stream().map(agency ->{ + FactIndexPartyAblityOrgMonthlyEntity entity = new FactIndexPartyAblityOrgMonthlyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setParentId(agency.getPid()); + entity.setYearId(dimId.getYearId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setMonthId(dimId.getMonthId()); + entity.setDataType(OrgTypeConstant.COMMUNITY); + entity.setPublishArticleCount(NumConstant.ZERO); + return entity; + }).collect(Collectors.toList()); + if (null != articles && !articles.isEmpty()) { + partyList.forEach(entity -> articles.stream().filter(article -> entity.getAgencyId().equals(article.getAgencyId())).forEach(dto -> { + entity.setPublishArticleCount(dto.getArticleTotalCount()); + })); + } + factIndexPartyAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); + factIndexPartyAblityOrgMonthlyService.insertBatch(partyList); } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java index 8f32d7507a..617e4ac46f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java @@ -8,12 +8,16 @@ import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; import com.epmet.service.stats.DimAgencyService; +import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +48,11 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; @Autowired private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Autowired + private FactArticlePublishedAgencyDailyService factArticlePublishedAgencyDailyService; + @Autowired + private FactIndexPartyAblityOrgMonthlyService factIndexPartyAblityOrgMonthlyService; + @Override public void saveStreetAbility(String customerId, String dateId) { //当前日期前一天 @@ -107,5 +116,30 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { } factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); factIndexGovrnAblityOrgMonthlyService.insertBatch(list); + + + //2.党建能力 + //获取社区发文数量 + List articles = factArticlePublishedAgencyDailyService.getArticleCount(customerId, dimId.getMonthId(), + OrgTypeConstant.STREET); + List partyList = agencyList.stream().map(agency ->{ + FactIndexPartyAblityOrgMonthlyEntity entity = new FactIndexPartyAblityOrgMonthlyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setParentId(agency.getPid()); + entity.setYearId(dimId.getYearId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setMonthId(dimId.getMonthId()); + entity.setDataType(OrgTypeConstant.COMMUNITY); + entity.setPublishArticleCount(NumConstant.ZERO); + return entity; + }).collect(Collectors.toList()); + if (null != articles && !articles.isEmpty()) { + partyList.forEach(entity -> articles.stream().filter(article -> entity.getAgencyId().equals(article.getAgencyId())).forEach(dto -> { + entity.setPublishArticleCount(dto.getArticleTotalCount()); + })); + } + factIndexPartyAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); + factIndexPartyAblityOrgMonthlyService.insertBatch(partyList); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java index dc9d7e3d63..5838685418 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedAgencyDailyService.java @@ -18,9 +18,11 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; import java.util.Collection; +import java.util.List; /** * 文章发布数量【机关】日统计表 @@ -42,4 +44,15 @@ public interface FactArticlePublishedAgencyDailyService extends BaseService values); + /** + * 获取组织文章数量 + * @author zhaoqifeng + * @date 2020/9/20 22:49 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getArticleCount(String customerId, String monthId, String level); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java index c12d4b176f..a411475a62 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedAgencyDailyServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.stats.FactArticlePublishedAgencyDailyDao; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; import com.epmet.entity.stats.FactArticlePublishedAgencyDailyEntity; import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; import lombok.extern.slf4j.Slf4j; @@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Collection; +import java.util.List; /** * 文章发布数量【机关】日统计表 @@ -55,4 +57,11 @@ public class FactArticlePublishedAgencyDailyServiceImpl extends BaseServiceImpl< this.insertBatch(values, 100); return true; } + + @Override + public List getArticleCount(String customerId, String monthId, String level) { + return baseDao.selectArticleCount(customerId, monthId, level); + } + + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index 6047bc9726..2420d05fb6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -115,5 +115,26 @@ ) b ON a.ID = b.PROJECT_ID GROUP BY AGENCY_ID + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 4aacf64da8..cf9146cc1f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml @@ -27,6 +27,12 @@ AND MONTH_ID = #{monthId} limit 1000; + + delete from fact_index_party_ablity_org_monthly + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + AND DATA_TYPE = #{type} + insert into fact_index_party_ablity_org_monthly diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml index ea4debe1dc..5050847753 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml @@ -25,6 +25,18 @@ DELETE FROM fact_article_published_agency_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file From b79d10948f137d8d8e2aa874cd0c522832b479c4 Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 20 Sep 2020 23:39:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/impl/GroupExtractServiceImpl.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java index 9d3c89eca8..158883bf8c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java @@ -1,23 +1,20 @@ package com.epmet.service.evaluationindex.extract.impl; -import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; -import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ExtractFormDTO; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.dto.stats.result.GridAttributesResultDTO; import com.epmet.service.evaluationindex.extract.GroupExtractService; import com.epmet.service.group.GroupDataService; -import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimGridService; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -31,8 +28,6 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.List; - /** * @Description 业务数据抽取 - 组相关 * @ClassName GroupExtractServiceImpl @@ -78,14 +73,14 @@ public class GroupExtractServiceImpl implements GroupExtractService { int count = factOriginGroupMainDailyDao.selectIfExist(param.getCustomerId()); if(StringUtils.isBlank(param.getDateId())){ - Date yesterday = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24); + Date yesterday = DateUtils.addDateDays(new Date(), -1); SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); param.setDateId(format.format(yesterday)); } //原生数据,如果是首次,则为全部组,如果非首次,则只有新创建以及新进人的组 //但是每个组每天都要更新一次组长的身份信息 List originGroupData = groupDataService.extractGroupData( - count <= NumConstant.ZERO ? true : false, + count <= NumConstant.ZERO, param.getCustomerId(), param.getDateId()); List memberList = new LinkedList<>(); @@ -138,7 +133,6 @@ public class GroupExtractServiceImpl implements GroupExtractService { factOriginGroupMainDailyDao.deleteBatchByGroupId(originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList())); factOriginGroupMainDailyDao.insertBatchMembers(memberList); } - }