|
@@ -1,6 +1,5 @@
|
|
|
package com.tzld.piaoquan.recommend.server.service.filter.strategy;
|
|
|
|
|
|
-import com.google.common.base.Stopwatch;
|
|
|
import com.tzld.piaoquan.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.piaoquan.recommend.server.service.filter.FilterParam;
|
|
|
import com.tzld.piaoquan.recommend.server.service.filter.FilterStrategy;
|
|
@@ -41,7 +40,6 @@ public class ViewedStrategy implements FilterStrategy {
|
|
|
|
|
|
@Override
|
|
|
public List<Long> filter(FilterParam param) {
|
|
|
- Stopwatch stopwatch = Stopwatch.createStarted();
|
|
|
String user = StringUtils.isNotBlank(param.getUid()) ? param.getUid() : param.getMid();
|
|
|
if (StringUtils.isBlank(user)) {
|
|
|
return param.getVideoIds();
|
|
@@ -77,11 +75,10 @@ public class ViewedStrategy implements FilterStrategy {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- log.info("ViewedStrategy filter cost: {}", stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(viewedVideoIds)) {
|
|
|
return param.getVideoIds();
|
|
|
}
|
|
|
-
|
|
|
return param.getVideoIds().stream()
|
|
|
.filter(vid -> !viewedVideoIds.contains(String.valueOf(vid)))
|
|
|
.collect(Collectors.toList());
|