|
@@ -1,6 +1,5 @@
|
|
|
package com.tzld.longarticle.recommend.server.service.recommend.filter.strategy;
|
|
package com.tzld.longarticle.recommend.server.service.recommend.filter.strategy;
|
|
|
|
|
|
|
|
-import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
|
|
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
|
import com.tzld.longarticle.recommend.server.remote.ArticleListRemoteService;
|
|
import com.tzld.longarticle.recommend.server.remote.ArticleListRemoteService;
|
|
@@ -13,10 +12,10 @@ import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -34,7 +33,8 @@ public class HistoryTitleStrategy implements FilterStrategy {
|
|
|
private static final List<Integer> firstSecondIndex = Arrays.asList(1, 2);
|
|
private static final List<Integer> firstSecondIndex = Arrays.asList(1, 2);
|
|
|
private static final List<Integer> allIndex = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
|
|
private static final List<Integer> allIndex = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
|
|
|
|
|
|
|
|
- private final ExecutorService pool = ThreadPoolFactory.deDuplicatePool();
|
|
|
|
|
|
|
+ @Value("${filter.history-title-filter-first-day:60}")
|
|
|
|
|
+ private Integer historyTitleFilterFirstDay;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public FilterResult filter(FilterParam param) {
|
|
public FilterResult filter(FilterParam param) {
|
|
@@ -43,7 +43,7 @@ public class HistoryTitleStrategy implements FilterStrategy {
|
|
|
List<Content> filterContents = new ArrayList<>();
|
|
List<Content> filterContents = new ArrayList<>();
|
|
|
List<Article> allArticleList = articleListRemoteService.articleList(param.getGhId(), allIndex, param.getType());
|
|
List<Article> allArticleList = articleListRemoteService.articleList(param.getGhId(), allIndex, param.getType());
|
|
|
List<String> allTitleList = allArticleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
|
|
List<String> allTitleList = allArticleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
|
|
|
- Long publishTimestampFilter = DateUtils.getBeforeDayStart(60);
|
|
|
|
|
|
|
+ Long publishTimestampFilter = DateUtils.getBeforeDayStart(historyTitleFilterFirstDay);
|
|
|
List<String> firstSecondTitleList = allArticleList.stream()
|
|
List<String> firstSecondTitleList = allArticleList.stream()
|
|
|
.filter(article -> firstSecondIndex.contains(article.getItemIndex())
|
|
.filter(article -> firstSecondIndex.contains(article.getItemIndex())
|
|
|
&& article.getPublishTimestamp() > publishTimestampFilter)
|
|
&& article.getPublishTimestamp() > publishTimestampFilter)
|