wangqifan 3 yıl önce
ebeveyn
işleme
50b9978eef

+ 13 - 7
src/main/java/com/izouma/nineth/service/netease/TeamService.java

@@ -24,10 +24,7 @@ import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 @AllArgsConstructor
@@ -187,7 +184,7 @@ public class TeamService {
     }
 
     public Long getUnreadCount(String accid, String tid) {
-        Object object =  redisTemplate.opsForValue().get(RedisKeys.USER_CHECKOUT_TIME + accid + ":" + tid);
+        Object object = redisTemplate.opsForValue().get(RedisKeys.USER_CHECKOUT_TIME + accid + ":" + tid);
         Long unreadCount;
         if (object != null) {
             Long ts = Long.valueOf(object.toString());
@@ -218,8 +215,17 @@ public class TeamService {
         Long ownerId = Long.valueOf(accid);
         String collectionString = team.getCollection();
         if (StringUtils.isNotBlank(collectionString)) {
-            Long count = assetRepo.countNameLikeNotDestroyedAndOwner("%" + collectionString + "%", ownerId);
-            return count > 0;
+            List<String> collectionKeywords = Arrays.asList(collectionString.split(","));
+            boolean canJoin = false;
+            for (String keyword : collectionKeywords) {
+                if (StringUtils.isNotBlank(keyword)) {
+                    Long count = assetRepo.countNameLikeNotDestroyedAndOwner("%" + collectionString + "%", ownerId);
+                    if (count > 0) {
+                        canJoin = true;
+                    }
+                }
+            }
+            return canJoin;
         }
         return true;
     }