|  | @@ -16,21 +16,16 @@ import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
											
												
													
														|  |  import com.yonge.toolset.base.exception.BizException;
 |  |  import com.yonge.toolset.base.exception.BizException;
 | 
											
												
													
														|  |  import com.yonge.toolset.utils.date.DateUtil;
 |  |  import com.yonge.toolset.utils.date.DateUtil;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  | -import org.redisson.api.RBucket;
 |  | 
 | 
											
												
													
														|  | -import org.redisson.api.RLock;
 |  | 
 | 
											
												
													
														|  | -import org.redisson.api.RedissonClient;
 |  | 
 | 
											
												
													
														|  |  import org.slf4j.Logger;
 |  |  import org.slf4j.Logger;
 | 
											
												
													
														|  |  import org.slf4j.LoggerFactory;
 |  |  import org.slf4j.LoggerFactory;
 | 
											
												
													
														|  |  import org.springframework.beans.BeanUtils;
 |  |  import org.springframework.beans.BeanUtils;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.data.redis.core.RedisTemplate;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  import org.springframework.util.CollectionUtils;
 |  |  import org.springframework.util.CollectionUtils;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import javax.annotation.Resource;
 |  |  import javax.annotation.Resource;
 | 
											
												
													
														|  |  import java.util.*;
 |  |  import java.util.*;
 | 
											
												
													
														|  | -import java.util.concurrent.TimeUnit;
 |  | 
 | 
											
												
													
														|  | -import java.util.function.BiConsumer;
 |  | 
 | 
											
												
													
														|  | -import java.util.function.Consumer;
 |  | 
 | 
											
												
													
														|  |  import java.util.stream.Collectors;
 |  |  import java.util.stream.Collectors;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
										
											
												
													
														|  | @@ -63,7 +58,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  |      private MusicSheetAccompanimentService musicSheetAccompanimentService;
 |  |      private MusicSheetAccompanimentService musicSheetAccompanimentService;
 | 
											
												
													
														|  |      @Resource
 |  |      @Resource
 | 
											
												
													
														|  | -    private RedissonClient redissonClient;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private RedisTemplate<String,Object> redisTemplate;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      private String QUIT_ROOM_SUCCESS = "quitRoomSuccess:";
 |  |      private String QUIT_ROOM_SUCCESS = "quitRoomSuccess:";
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -192,17 +187,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
 | 
											
												
													
														|  |          log.info("quitRoomSuccess: roomId={}, userId={}", roomId, userId);
 |  |          log.info("quitRoomSuccess: roomId={}, userId={}", roomId, userId);
 | 
											
												
													
														|  |          //防止幂等
 |  |          //防止幂等
 | 
											
												
													
														|  |          StringBuffer sb  = new StringBuffer(QUIT_ROOM_SUCCESS).append(roomId).append(userId);
 |  |          StringBuffer sb  = new StringBuffer(QUIT_ROOM_SUCCESS).append(roomId).append(userId);
 | 
											
												
													
														|  | -        RLock lock = redissonClient.getLock(sb.toString());
 |  | 
 | 
											
												
													
														|  | -        try {
 |  | 
 | 
											
												
													
														|  | -            lock.tryLock(2,TimeUnit.SECONDS);
 |  | 
 | 
											
												
													
														|  | -            RBucket<Long> bucket = redissonClient.getBucket(sb.toString());
 |  | 
 | 
											
												
													
														|  | -            if (redissonClient.getBucket(sb.toString()).isExists()){
 |  | 
 | 
											
												
													
														|  | -                log.info("quitRoomSuccess break: roomId={}, userId={}", roomId, userId);
 |  | 
 | 
											
												
													
														|  | -                return;
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | -            bucket.set(userId,1, TimeUnit.SECONDS);
 |  | 
 | 
											
												
													
														|  | -        }finally {
 |  | 
 | 
											
												
													
														|  | -            lock.unlock();
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (!redisTemplate.opsForValue().setIfAbsent(sb.toString(),userId)){
 | 
											
												
													
														|  | 
 |  | +            log.info("quitRoomSuccess break: roomId={}, userId={}", roomId, userId);
 | 
											
												
													
														|  | 
 |  | +            return;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getDao().findByRidAndUid(roomId, userId);
 |  |          ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getDao().findByRidAndUid(roomId, userId);
 | 
											
												
													
														|  |          if(Objects.isNull(roomMember)){
 |  |          if(Objects.isNull(roomMember)){
 |