|
@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.recall;
|
|
|
import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.ContentHisPublishArticle;
|
|
|
+import com.tzld.longarticle.recommend.server.remote.AIGCRemoteService;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.CrawlerMetaArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.entity.aigc.CrawlerMetaArticle;
|
|
@@ -39,6 +40,8 @@ public class RecallService implements ApplicationContextAware {
|
|
|
ArticleRepository articleRepository;
|
|
|
@Autowired
|
|
|
CrawlerMetaArticleRepository crawlerMetaArticleRepository;
|
|
|
+ @Autowired
|
|
|
+ private AIGCRemoteService aigcRemoteService;
|
|
|
|
|
|
private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
|
|
|
private ApplicationContext applicationContext;
|
|
@@ -58,6 +61,8 @@ public class RecallService implements ApplicationContextAware {
|
|
|
List<RecallStrategy> strategies = getRecallStrategy(param);
|
|
|
log.info("RecallStrategy {}", JSONUtils.toJson(CommonCollectionUtils.toList(strategies,
|
|
|
s -> s.getClass().getSimpleName())));
|
|
|
+ List<Content> content = getAllContent(param);
|
|
|
+ param.setContent(content);
|
|
|
CountDownLatch cdl = new CountDownLatch(strategies.size());
|
|
|
List<Future<RecallResult.RecallData>> recallResultFutures = new ArrayList<>();
|
|
|
for (final RecallStrategy strategy : strategies) {
|
|
@@ -102,6 +107,15 @@ public class RecallService implements ApplicationContextAware {
|
|
|
this.applicationContext = applicationContext;
|
|
|
}
|
|
|
|
|
|
+ private List<Content> getAllContent(RecallParam param) {
|
|
|
+ List<Content> content = aigcRemoteService.getAllContent(param);
|
|
|
+ // 标题历史均值
|
|
|
+ setTitleAvgViewCount(content);
|
|
|
+ // category 查询
|
|
|
+ setContentCategory(content);
|
|
|
+ return content;
|
|
|
+ }
|
|
|
+
|
|
|
public void setContentCategory(List<Content> contentList) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
List<String> channelContentIds = contentList.stream().map(Content::getCrawlerChannelContentId).collect(Collectors.toList());
|