Browse Source

MOD: VideoCityFilterService

sunxy 1 year ago
parent
commit
43c4e891ae

+ 7 - 18
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/filter/VideoCityFilterService.java

@@ -97,24 +97,13 @@ public class VideoCityFilterService {
             return videoIds;
         }
 
-        videoIds.removeIf(videoId -> {
-            if (videoId == null || videoId <= 0L) {
-                return true;
-            }
-            for (Long tagId : tagIdList) {
-                if (tagId == null || tagId <= 0L) {
-                    continue;
-                }
-                Set<Long> videosByTag = videoTagCache.get(cityCode);
-                if (videosByTag == null || videosByTag.isEmpty()) {
-                    continue;
-                }
-                if (videosByTag.contains(videoId)) {
-                    return false;
-                }
-            }
-            return true;
-        });
+        Set<Long> riskCityVideoIdSet = videoTagCache.get(cityCode);
+        if (riskCityVideoIdSet == null || riskCityVideoIdSet.isEmpty()) {
+            return videoIds;
+        }
+
+        videoIds.removeIf(riskCityVideoIdSet::contains);
+
         return videoIds;
     }