| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -38,6 +38,7 @@ import com.epmet.modules.group.dao.ResiGroupDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.dao.ResiGroupStatisticalDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.entity.ResiGroupEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.entity.ResiGroupStatisticalEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.redis.ResiGroupRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.member.dao.ResiGroupMemberDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.member.entity.ResiGroupMemberEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.member.redis.ResiGroupMemberRedis; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -53,6 +54,8 @@ import com.epmet.modules.topic.service.ResiTopicService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.utils.ModuleConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.constant.MemberStateConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.constant.TopicConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -110,6 +113,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiTopicOperationService resiTopicOperationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiGroupRedis resiGroupRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private final Log logger = LogFactory.getLog(getClass()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -247,9 +253,10 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            logger.error(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5.更新群缓存信息,话题数量+1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        updCacheGroupStatisticalInfo(resiTopicPublishFormDTO.getGroupId(),ModuleConstant.PLUS_OPERATION,NumConstant.ONE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //5.群组信息,更新latestTopicPublishDate字段
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //6.群组信息,更新latestTopicPublishDate字段
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupEntity group2Update = new ResiGroupEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        group2Update.setId(resiTopicPublishFormDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        group2Update.setLatestTopicPublishDate(currentTime); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -395,6 +402,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resiGroupStatisticalDao.updateById(statistical2Update); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 5.更新组缓存信息,话题数量-1
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        updCacheGroupStatisticalInfo(topic.getGroupId(),ModuleConstant.MINUS_OPERATION,NumConstant.ONE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -447,6 +456,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resiGroupStatisticalDao.updateById(statistical2Update); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4.更新组缓存信息,总话题数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        updCacheGroupStatisticalInfo(topic.getGroupId(),ModuleConstant.PLUS_OPERATION,topicIds.size()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -523,8 +535,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setTopicImgs(attachmentUrls); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3.拿取用户信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiTopicDTO topic = get(topicId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupEntity group = resiGroupDao.selectById(topic.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupMemberInfoRedisDTO memberRedis = | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -564,12 +574,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result<ResiTopicDetailResultDTO>().ok(resultDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -803,4 +807,44 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 更新组统计缓存信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param groupId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Param operation "+":plus    "-":minus | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author wangc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Date 2020.04.14 23:31 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void updCacheGroupStatisticalInfo(String groupId,String operation,Integer quantity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupInfoRedisDTO groupCache = | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resiGroupRedis.get(groupId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(groupCache != null && StringUtils.isNotBlank(groupCache.getGroupId())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ResiGroupStatisticalInfoRedisDTO statisticalCache =  groupCache.getGroupStatisticalInfo(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(null != statisticalCache){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(StringUtils.equals(ModuleConstant.PLUS_OPERATION,operation)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    statisticalCache.setTotalTopics( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            null == statisticalCache.getTotalTopics() ? quantity : statisticalCache.getTotalTopics() + quantity | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else if(StringUtils.equals(ModuleConstant.MINUS_OPERATION,operation)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    statisticalCache.setTotalTopics( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            null == statisticalCache.getTotalTopics() ? quantity : statisticalCache.getTotalTopics() - quantity | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                groupCache.setGroupStatisticalInfo(statisticalCache); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //没有相应的群组缓存信息   TODO 从数据库查找存进缓存
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resiGroupRedis.set(groupCache); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //没有相应的群组缓存信息   TODO 从数据库查找存进缓存
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |