|
@@ -1,7 +1,5 @@
|
|
|
package com.tzld.longarticle.recommend.server.service.recall;
|
|
package com.tzld.longarticle.recommend.server.service.recall;
|
|
|
|
|
|
|
|
-import cn.hutool.core.io.resource.ResourceUtil;
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
|
|
import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
|
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
import com.tzld.longarticle.recommend.server.model.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.ContentHisPublishArticle;
|
|
import com.tzld.longarticle.recommend.server.model.ContentHisPublishArticle;
|
|
@@ -10,6 +8,7 @@ import com.tzld.longarticle.recommend.server.repository.aigc.CrawlerMetaArticleR
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.entity.aigc.CrawlerMetaArticle;
|
|
import com.tzld.longarticle.recommend.server.repository.entity.aigc.CrawlerMetaArticle;
|
|
|
import com.tzld.longarticle.recommend.server.repository.entity.crawler.Article;
|
|
import com.tzld.longarticle.recommend.server.repository.entity.crawler.Article;
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.service.AccountIndexAvgViewCountService;
|
|
|
import com.tzld.longarticle.recommend.server.service.recall.strategy.ColdStartBackupRecallStrategy;
|
|
import com.tzld.longarticle.recommend.server.service.recall.strategy.ColdStartBackupRecallStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.recall.strategy.DefaultRecallStrategy;
|
|
import com.tzld.longarticle.recommend.server.service.recall.strategy.DefaultRecallStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.AvgReadDTO;
|
|
import com.tzld.longarticle.recommend.server.service.score.AvgReadDTO;
|
|
@@ -45,12 +44,15 @@ public class RecallService implements ApplicationContextAware {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
CrawlerMetaArticleRepository crawlerMetaArticleRepository;
|
|
CrawlerMetaArticleRepository crawlerMetaArticleRepository;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private AIGCRemoteService aigcRemoteService;
|
|
|
|
|
|
|
+ AIGCRemoteService aigcRemoteService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ AccountIndexAvgViewCountService accountIndexAvgViewCountService;
|
|
|
|
|
|
|
|
private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
|
|
private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
|
|
|
private ApplicationContext applicationContext;
|
|
private ApplicationContext applicationContext;
|
|
|
private final ExecutorService pool = ThreadPoolFactory.recallPool();
|
|
private final ExecutorService pool = ThreadPoolFactory.recallPool();
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
public void init() {
|
|
public void init() {
|
|
|
Map<String, RecallStrategy> type = applicationContext.getBeansOfType(RecallStrategy.class);
|
|
Map<String, RecallStrategy> type = applicationContext.getBeansOfType(RecallStrategy.class);
|
|
@@ -176,8 +178,6 @@ public class RecallService implements ApplicationContextAware {
|
|
|
|
|
|
|
|
public void setTitleAvgViewCount(List<Content> contentList) {
|
|
public void setTitleAvgViewCount(List<Content> contentList) {
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
- String cardJSON = ResourceUtil.readUtf8Str("file/AccountInfo.json");
|
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(cardJSON);
|
|
|
|
|
|
|
|
|
|
List<String> titleList = contentList.stream().map(Content::getTitle).collect(Collectors.toList());
|
|
List<String> titleList = contentList.stream().map(Content::getTitle).collect(Collectors.toList());
|
|
|
List<String> crawlerTitleList = contentList.stream().map(Content::getCrawlerTitle).collect(Collectors.toList());
|
|
List<String> crawlerTitleList = contentList.stream().map(Content::getCrawlerTitle).collect(Collectors.toList());
|
|
@@ -214,7 +214,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
for (Article hisArticle : hisArticles) {
|
|
for (Article hisArticle : hisArticles) {
|
|
|
ContentHisPublishArticle article = new ContentHisPublishArticle();
|
|
ContentHisPublishArticle article = new ContentHisPublishArticle();
|
|
|
BeanUtils.copyProperties(hisArticle, article);
|
|
BeanUtils.copyProperties(hisArticle, article);
|
|
|
- AvgReadDTO dto = jsonObject.getObject(hisArticle.getGhId() + "_" + hisArticle.getItemIndex(), AvgReadDTO.class);
|
|
|
|
|
|
|
+ AvgReadDTO dto = accountIndexAvgViewCountService.getAvgReadDto(hisArticle.getGhId() + "_" + hisArticle.getItemIndex());
|
|
|
int avgViewCount = 0;
|
|
int avgViewCount = 0;
|
|
|
if (Objects.nonNull(dto)) {
|
|
if (Objects.nonNull(dto)) {
|
|
|
article.setInnerAccount(true);
|
|
article.setInnerAccount(true);
|