|
@@ -1,5 +1,6 @@
|
|
|
package com.tzld.piaoquan.recommend.server.service.filter.strategy;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
import com.google.common.cache.CacheLoader;
|
|
@@ -105,11 +106,15 @@ public class GeneralSpiderStrategy implements FilterStrategy {
|
|
|
return param.getVideoIds();
|
|
|
}
|
|
|
|
|
|
+ log.info("generalSpiderStrategy filter param {}", JSON.toJSONString(param));
|
|
|
+
|
|
|
// vid -> uid
|
|
|
List<String> keys = param.getVideoIds().stream()
|
|
|
.map(id -> String.format(keyFormat, id))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
+ log.info("generalSpiderStrategy filter keys {}", JSON.toJSONString(keys));
|
|
|
+
|
|
|
List<String> uids = redisTemplate.opsForValue().multiGet(keys);
|
|
|
List<Long> cacheMissVideoIds = new ArrayList<>();
|
|
|
Map<Long, String> vid2UidMap = new HashMap<>();
|
|
@@ -153,10 +158,14 @@ public class GeneralSpiderStrategy implements FilterStrategy {
|
|
|
//不过滤的视频
|
|
|
Set<Long> data = generalSpiderExcludeVideoCache.getUnchecked(generalSpiderExcludeVideoCacheKey);
|
|
|
|
|
|
+
|
|
|
+ log.info("generalSpiderStrategy filter generalSpiderUserIds = {} data = {}", JSON.toJSONString(generalSpiderUserIds), JSON.toJSONString(data));
|
|
|
+
|
|
|
List<Long> videoIds = param.getVideoIds().stream()
|
|
|
.filter(l -> data.contains(l)
|
|
|
|| (vid2UidMap.containsKey(l) && !generalSpiderUserIds.contains(vid2UidMap.get(l))))
|
|
|
.collect(Collectors.toList());
|
|
|
+ log.info("generalSpiderStrategy filter videoIds = {}", JSON.toJSONString(videoIds));
|
|
|
|
|
|
return videoIds;
|
|
|
}
|