|  |  | @ -1,7 +1,10 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.service.evaluationindex.extract.dataToIndex.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.ExceptionUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.extract.UserGroupIdDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService; | 
			
		
	
	
		
			
				
					|  |  | @ -9,8 +12,10 @@ import com.epmet.service.evaluationindex.extract.todata.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.group.GroupDataService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.stats.DimCustomerPartymemberService; | 
			
		
	
		
			
				
					|  |  |  | import com.google.common.collect.Lists; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.MapUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -20,6 +25,8 @@ import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.HashMap; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.CompletableFuture; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * 党员相关 | 
			
		
	
	
		
			
				
					|  |  | @ -134,6 +141,237 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { | 
			
		
	
		
			
				
					|  |  |  |         factIndexPartyAblityCpcMonthlyService.delAndSavePartyAblityCpcMonthly(customerId,monthId,indexPartyAblityCpcList); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void calCpcPartyAbilityV2(String customerId, String monthId) { | 
			
		
	
		
			
				
					|  |  |  |         //1、构造初始值 当前客户下所有的党员
 | 
			
		
	
		
			
				
					|  |  |  |         List<FactIndexPartyAblityCpcMonthlyEntity> indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isEmpty(indexPartyAblityCpcList)) { | 
			
		
	
		
			
				
					|  |  |  |             log.info("dim_customer_partymember do not any records customerId=" + customerId); | 
			
		
	
		
			
				
					|  |  |  |             return; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //可以先查询出每个党员的 自建群
 | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<String>> userCreatedGroups = queryUserCreatedGroups(customerId, indexPartyAblityCpcList); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> createTopicCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calCreateTopicCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> joinTopicCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calJoinTopicCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> shiftIssueCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calShiftIssueCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> shiftProjectCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calShiftProjectCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> joinThreeMeetsCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calJoinThreeMeetsCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> groupUserCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calgroupUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> groupActiveUserCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calGroupActiveUserCount(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, Integer>> groupTopicCountFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return calGroupTopicCount(customerId, monthId); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         CompletableFuture<Map<String, BigDecimal>> topicToIssueRatioFuture = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |             return caltopicToIssueRatio(customerId, monthId, indexPartyAblityCpcList, userCreatedGroups); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> createTopicCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> joinTopicCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> shiftIssueCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> shiftProjectCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> joinThreeMeetsCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> groupUserCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> groupActiveUserCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, Integer> groupTopicCountMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, BigDecimal> topicToIssueRatioMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |             //1、党员提出话题数
 | 
			
		
	
		
			
				
					|  |  |  |             createTopicCountMap = createTopicCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         }  catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员提出话题数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //2、党员参与话题数(支持、反对、评论、浏览)---目前只统计  党员评论话题次数之和
 | 
			
		
	
		
			
				
					|  |  |  |             joinTopicCountMap = joinTopicCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员参与话题数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //3、党员提出的话题转议题数
 | 
			
		
	
		
			
				
					|  |  |  |             shiftIssueCountMap = shiftIssueCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员提出的话题转议题数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //4、党员提出的议题转项目数
 | 
			
		
	
		
			
				
					|  |  |  |             shiftProjectCountMap = shiftProjectCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员提出的议题转项目数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //5、参加“三会一课”次数 默认0 :当前用户在本月内活动签到次数 限制活动分类编码100001 三会一课
 | 
			
		
	
		
			
				
					|  |  |  |             joinThreeMeetsCountMap = joinThreeMeetsCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【参加“三会一课”次数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //6、党员自建群群众人数 :和评价周期无关
 | 
			
		
	
		
			
				
					|  |  |  |             groupUserCountMap = groupUserCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员自建群群众人数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //7、党员自建群活跃群众人数
 | 
			
		
	
		
			
				
					|  |  |  |             groupActiveUserCountMap = groupActiveUserCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员自建群活跃群众人数】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //8、党员自建群活跃度——话题数:从话题表中统计党员自建群i的话题总数;对所有自建群话题数累加。
 | 
			
		
	
		
			
				
					|  |  |  |             groupTopicCountMap = groupTopicCountFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【党员自建群活跃度】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         try{ | 
			
		
	
		
			
				
					|  |  |  |             //9、自建群活跃度——议题转项目率
 | 
			
		
	
		
			
				
					|  |  |  |             topicToIssueRatioMap = topicToIssueRatioFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("党员相关-党建能力原始指标值【自建群活跃度】计算异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         List<FactIndexPartyAblityCpcMonthlyEntity> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         List<List<FactIndexPartyAblityCpcMonthlyEntity>> partionList = Lists.partition(indexPartyAblityCpcList, 200); | 
			
		
	
		
			
				
					|  |  |  |         List<CompletableFuture<List<FactIndexPartyAblityCpcMonthlyEntity>>> entityFutures = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         //2、计算实际值,更新
 | 
			
		
	
		
			
				
					|  |  |  |         for (List<FactIndexPartyAblityCpcMonthlyEntity> partList : partionList) { | 
			
		
	
		
			
				
					|  |  |  |             String quarterId = DateUtils.getQuarterId(monthId); | 
			
		
	
		
			
				
					|  |  |  |             String yearId = DateUtils.getYearId(monthId); | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalCreateTopicCountMap = createTopicCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalJoinTopicCountMap = joinTopicCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalShiftIssueCountMap = shiftIssueCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalShiftProjectCountMap = shiftProjectCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalJoinThreeMeetsCountMap = joinThreeMeetsCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalGroupUserCountMap = groupUserCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalGroupActiveUserCountMap = groupActiveUserCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, Integer> finalGroupTopicCountMap = groupTopicCountMap; | 
			
		
	
		
			
				
					|  |  |  |             Map<String, BigDecimal> finalTopicToIssueRatioMap = topicToIssueRatioMap; | 
			
		
	
		
			
				
					|  |  |  |             //目前平阴2100多个党员,200个一组,开一个线程
 | 
			
		
	
		
			
				
					|  |  |  |             CompletableFuture<List<FactIndexPartyAblityCpcMonthlyEntity>> future = CompletableFuture.supplyAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |                 return constructEntity(monthId, | 
			
		
	
		
			
				
					|  |  |  |                         quarterId, | 
			
		
	
		
			
				
					|  |  |  |                         yearId, | 
			
		
	
		
			
				
					|  |  |  |                         partList, | 
			
		
	
		
			
				
					|  |  |  |                         finalCreateTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalJoinTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalShiftIssueCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalShiftProjectCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalJoinThreeMeetsCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalGroupUserCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalGroupActiveUserCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalGroupTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                         finalTopicToIssueRatioMap); | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             entityFutures.add(future); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         for (CompletableFuture<List<FactIndexPartyAblityCpcMonthlyEntity>> entityFuture : entityFutures) { | 
			
		
	
		
			
				
					|  |  |  |             try { | 
			
		
	
		
			
				
					|  |  |  |                 List<FactIndexPartyAblityCpcMonthlyEntity> partList = entityFuture.get(); | 
			
		
	
		
			
				
					|  |  |  |                 list.addAll(partList); | 
			
		
	
		
			
				
					|  |  |  |             } catch (InterruptedException e) { | 
			
		
	
		
			
				
					|  |  |  |                 log.error("党员相关-党建能力原始指标构造异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |             } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |                 log.error("党员相关-党建能力原始指标构造异常:{}", ExceptionUtils.getErrorStackTrace(e)); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //3、删除之前统计过的、批插入批量插入
 | 
			
		
	
		
			
				
					|  |  |  |         factIndexPartyAblityCpcMonthlyService.delAndSavePartyAblityCpcMonthly(customerId, monthId, list); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private List<FactIndexPartyAblityCpcMonthlyEntity> constructEntity(String monthId, | 
			
		
	
		
			
				
					|  |  |  |                                                                        String quarterId, | 
			
		
	
		
			
				
					|  |  |  |                                                                        String yearId, | 
			
		
	
		
			
				
					|  |  |  |                                                                        List<FactIndexPartyAblityCpcMonthlyEntity> partList, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> createTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> joinTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> shiftIssueCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> shiftProjectCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> joinThreeMeetsCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> groupUserCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> groupActiveUserCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, Integer> groupTopicCountMap, | 
			
		
	
		
			
				
					|  |  |  |                                                                        Map<String, BigDecimal> topicToIssueRatioMap) { | 
			
		
	
		
			
				
					|  |  |  |         List<FactIndexPartyAblityCpcMonthlyEntity> resultList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         for (FactIndexPartyAblityCpcMonthlyEntity temp : partList) { | 
			
		
	
		
			
				
					|  |  |  |             FactIndexPartyAblityCpcMonthlyEntity indexPartyAblityCpcEntity = ConvertUtils.sourceToTarget(temp, FactIndexPartyAblityCpcMonthlyEntity.class); | 
			
		
	
		
			
				
					|  |  |  |             indexPartyAblityCpcEntity.setMonthId(monthId); | 
			
		
	
		
			
				
					|  |  |  |             indexPartyAblityCpcEntity.setQuarterId(quarterId); | 
			
		
	
		
			
				
					|  |  |  |             indexPartyAblityCpcEntity.setYearId(yearId); | 
			
		
	
		
			
				
					|  |  |  |             //1、党员提出话题数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(createTopicCountMap) && createTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setCreateTopicCount(createTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //2、党员参与话题数(支持、反对、评论、浏览)---目前只统计  党员评论话题次数之和
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(joinTopicCountMap) && joinTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setJoinTopicCount(joinTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //3、党员提出的话题转议题数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(shiftIssueCountMap) && shiftIssueCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setShiftIssueCount(shiftIssueCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //4、党员提出的议题转项目数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(shiftProjectCountMap) && shiftProjectCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setShiftProjectCount(shiftProjectCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //5、参加“三会一课”次数 目前没有此业务,默认0 : 当前用户在本月内活动签到次数 限制活动分类编码100001 三会一课
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(joinThreeMeetsCountMap) && joinThreeMeetsCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setJoinThreeMeetsCount(joinThreeMeetsCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //6、党员自建群群众人数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(groupUserCountMap) && groupUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setGroupUserCount(groupUserCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //7、党员自建群活跃群众人数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(groupActiveUserCountMap) && groupActiveUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setGroupActiveUserCount(groupActiveUserCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //8、党员自建群活跃度——话题数
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(groupTopicCountMap) && groupTopicCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setGroupTopicCount(groupTopicCountMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //9、自建群活跃度——议题转项目率
 | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isNotEmpty(topicToIssueRatioMap) && topicToIssueRatioMap.containsKey(indexPartyAblityCpcEntity.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 indexPartyAblityCpcEntity.setTopicToIssueRatio(topicToIssueRatioMap.get(indexPartyAblityCpcEntity.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             resultList.add(indexPartyAblityCpcEntity); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return resultList; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @param customerId | 
			
		
	
		
			
				
					|  |  |  |      * @param partyMemberList | 
			
		
	
	
		
			
				
					|  |  | @ -144,7 +382,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { | 
			
		
	
		
			
				
					|  |  |  |      **/ | 
			
		
	
		
			
				
					|  |  |  |     private Map<String, List<String>> queryUserCreatedGroups(String customerId, List<FactIndexPartyAblityCpcMonthlyEntity> partyMemberList) { | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<String>> map = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |         for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { | 
			
		
	
		
			
				
					|  |  |  |         /*for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { | 
			
		
	
		
			
				
					|  |  |  |             //查询当前党员建了多少个组
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> groupIdList=factOriginGroupMainDailyService.selectGroupIds(customerId,partyMember.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(groupIdList)) { | 
			
		
	
	
		
			
				
					|  |  | @ -153,6 +391,17 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 map.put(partyMember.getUserId(), groupIdList); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         }*/ | 
			
		
	
		
			
				
					|  |  |  |         //查询出所有的小组,按照组长
 | 
			
		
	
		
			
				
					|  |  |  |         List<UserGroupIdDTO> list = factOriginGroupMainDailyService.selectGroupAndLeader(customerId); | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<String>> userGroupIdMap = list.stream().collect(Collectors.toMap(UserGroupIdDTO::getUserId, UserGroupIdDTO::getGroupIdList)); | 
			
		
	
		
			
				
					|  |  |  |         for (FactIndexPartyAblityCpcMonthlyEntity partyMember : partyMemberList) { | 
			
		
	
		
			
				
					|  |  |  |             if (MapUtils.isEmpty(userGroupIdMap) || !userGroupIdMap.containsKey(partyMember.getUserId())) { | 
			
		
	
		
			
				
					|  |  |  |                 map.put(partyMember.getUserId(), new ArrayList<>()); | 
			
		
	
		
			
				
					|  |  |  |                 continue; | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |                 map.put(partyMember.getUserId(), userGroupIdMap.get(partyMember.getUserId())); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return map; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | @ -265,7 +514,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { | 
			
		
	
		
			
				
					|  |  |  |             //查询当前党员建了多少个组
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> groupIdList = userCreatedGroups.get(partyMember.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(groupIdList)) { | 
			
		
	
		
			
				
					|  |  |  |                 log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群群众人数】赋值0"); | 
			
		
	
		
			
				
					|  |  |  |                 // log.info("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群群众人数】赋值0");
 | 
			
		
	
		
			
				
					|  |  |  |                 map.put(partyMember.getUserId(), NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 continue; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
	
		
			
				
					|  |  | @ -311,7 +560,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { | 
			
		
	
		
			
				
					|  |  |  |             //1、查询当前党员建了多少个组
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> groupIdList = userCreatedGroups.get(partyMember.getUserId()); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(groupIdList)) { | 
			
		
	
		
			
				
					|  |  |  |                 log.warn("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群活跃群众人数】赋值0"); | 
			
		
	
		
			
				
					|  |  |  |                 // log.warn("当前党员userId="+partyMember.getUserId()+"没有创建过小组, 【党员相关-党员自建群活跃群众人数】赋值0");
 | 
			
		
	
		
			
				
					|  |  |  |                 map.put(partyMember.getUserId(), NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 continue; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
	
		
			
				
					|  |  | 
 |