| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -267,7 +267,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Set<String> ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> gridIds = issues.stream().map(IssueDTO::getGridId).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> gridIds = issues.stream().map(IssueDTO::getGridId).distinct().collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        CommonGridIdListFormDTO gridIdList = new CommonGridIdListFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        gridIdList.setGridIds(gridIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<GridVotableCountResultDTO> votableCountResult = resiGroupFeignClient.votableCounts(gridIdList); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -287,9 +287,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                notExistedIds.addAll(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                notExistedIds.removeAll(statisiticalIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //交集
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Set<String> existedIds = new HashSet<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                existedIds.addAll(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                existedIds.retainAll(statisiticalIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Set<String> existedIds = new HashSet<>(statisiticalIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //更新
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //对ids进行更新 - 从缓存中拿取
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<IssueVoteStatisticalDTO> listToUpdate = new ArrayList<>(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -304,8 +303,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (notExistedIds.size() > NumConstant.ZERO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //新增
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IssueVoteStatisticalDTO> toInsert = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IssueAttitudeCountResultDTO> summaryList = issueVoteDetailDao.getVotingSummaryList(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Map<String,String> issueGridMap = issues.stream().collect(Collectors.toMap(IssueDTO::getId,IssueDTO::getGridId,(o, n) -> o)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<IssueAttitudeCountResultDTO> summaryList = issueVoteDetailDao.getVotingSummaryList(notExistedIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Map<String, List<IssueAttitudeCountResultDTO>> summaryMap = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            summaryList.stream().collect(Collectors.groupingBy(IssueAttitudeCountResultDTO::getIssueId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    for (Map.Entry<String, List<IssueAttitudeCountResultDTO>> entry : summaryMap.entrySet()) { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -322,19 +321,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            if (StringUtils.equals(ModuleConstants.ISSUE_VOTING_ATTITUDE_SUPPORT, v.get(0).getAttitude())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                obj.setSupportCount(v.get(0).getCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                obj.setOppositionCount(NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                obj.setOppositionCount(v.get(0).getCount()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                obj.setSupportCount(NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        obj.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(entry.getKey()))).orElse(NumConstant.ZERO)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        toInsert.add(obj); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Set<String> setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					               /*     Set<String> setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Set<String> issuesNeverVotedIds = new HashSet<String>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    issuesNeverVotedIds.addAll(ids); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -372,30 +367,27 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 批量插入
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    baseDao.insertBatch(summary); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    baseDao.insertBatch(toInsert); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         else if (ids.size() < statisiticalIds.size()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          //}
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         //else if (ids.size() < statisiticalIds.size()) {
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //统计数大于议题数,数据出错
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //找出多余数据,删除
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //差集
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Set<String> redundantIds = new HashSet<String>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            redundantIds.addAll(statisiticalIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            redundantIds.removeAll(ids); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //Set<String> redundantIds = new HashSet<String>();
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //redundantIds.addAll(statisiticalIds);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //redundantIds.removeAll(ids);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //将redundantIds的议题统计信息删除
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //因为statisiticalIds是通过ids查询出,因此不会出现这种情况
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //数据吻合,全部更新
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<IssueVoteStatisticalDTO> listToUpdate = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String,List<IssueDTO>> gridIssueMap = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                issues.stream().collect(Collectors.groupingBy(IssueDTO::getGridId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                setVotableCountsAndUpdateCache(listToUpdate,issues,votableCountMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //  listToUpdate批量更新
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -517,9 +509,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                IssueVoteStatisticalDTO vote = new IssueVoteStatisticalDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                vote.setIssueId(issue.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                VoteRedisFormDTO cache = issueVoteDetailRedis.getVoteStatistical(issue.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(null == cache) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                VoteRedisFormDTO cache = Optional.ofNullable(issueVoteDetailRedis.getVoteStatistical(issue.getId())).orElse(issueVoteDetailDao.selectInfo4Cache(issue.getId())  ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(null == cache) continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                vote.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                vote.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |