|
@@ -3,7 +3,9 @@ package com.tzld.longarticle.recommend.server.service.filter;
|
|
|
import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
import com.tzld.longarticle.recommend.server.service.ServiceBeanFactory;
|
|
|
-import com.tzld.longarticle.recommend.server.service.filter.strategy.*;
|
|
|
+import com.tzld.longarticle.recommend.server.service.filter.strategy.BadStrategy;
|
|
|
+import com.tzld.longarticle.recommend.server.service.filter.strategy.HistoryTitleStrategy;
|
|
|
+import com.tzld.longarticle.recommend.server.service.filter.strategy.SensitiveStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.JSONUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -11,7 +13,9 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Future;
|
|
@@ -54,12 +58,18 @@ public class FilterService {
|
|
|
|
|
|
List<List<String>> contentIdsList = new ArrayList<>();
|
|
|
List<Content> filterContents = new ArrayList<>();
|
|
|
+ Set<String> filterContentIds = new HashSet<>();
|
|
|
for (Future<FilterResult> f : futures) {
|
|
|
try {
|
|
|
FilterResult filterResult = f.get();
|
|
|
contentIdsList.add(filterResult.getContentIds());
|
|
|
if (CollectionUtils.isNotEmpty(filterResult.getFilterContent())) {
|
|
|
- filterContents.addAll(filterResult.getFilterContent());
|
|
|
+ for (Content content : filterResult.getFilterContent()) {
|
|
|
+ if (!filterContentIds.contains(content.getId())) {
|
|
|
+ filterContentIds.add(content.getId());
|
|
|
+ filterContents.add(content);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("future get error ", e);
|