|
@@ -5,16 +5,20 @@ import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
|
+import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.CrawlerContent;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContentOutput;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticlePoolPromotionSource;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.ArticleFindSourceParam;
|
|
|
+import com.tzld.longarticle.recommend.server.model.vo.RootPublishContentVO;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentOutputRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.longArticle.ArticlePoolPromotionSourceRepository;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.config.AccountIndexAvgViewCountService;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
|
|
@@ -51,6 +55,10 @@ public class ArticleService {
|
|
|
AigcBaseMapper aigcBaseMapper;
|
|
|
@Autowired
|
|
|
CrawlerBaseMapper crawlerBaseMapper;
|
|
|
+ @Autowired
|
|
|
+ LongArticleBaseMapper longArticleBaseMapper;
|
|
|
+ @Autowired
|
|
|
+ ArticlePoolPromotionSourceRepository articlePoolPromotionSourceRepository;
|
|
|
|
|
|
private final static ExecutorService pool = new CommonThreadPoolExecutor(
|
|
|
32,
|
|
@@ -141,7 +149,7 @@ public class ArticleService {
|
|
|
crawlerBaseMapper.updateArticleAigcId(wxSn, publishContentId, channelContentId);
|
|
|
// 查找记录根记录
|
|
|
long start = System.currentTimeMillis();
|
|
|
- Article result = getRootPublishContent(channelContentId, null, publishContentId, 0);
|
|
|
+ RootPublishContentVO result = getRootPublishContent(channelContentId, null, publishContentId, 0);
|
|
|
log.info("syncAigcIdByWxSn getRootPublishContent finish cost:{}", System.currentTimeMillis() - start);
|
|
|
// 更新source root publish_content_id
|
|
|
crawlerBaseMapper.updateArticleSourceRootId(wxSn, result.getSourcePublishContentId(), result.getRootPublishContentId());
|
|
@@ -178,9 +186,11 @@ public class ArticleService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public Article getRootPublishContent(String channelContentId, String sourcePublishContentId, String rootPublishContentId,
|
|
|
- int times) {
|
|
|
- Article result = new Article();
|
|
|
+ public RootPublishContentVO getRootPublishContent(String channelContentId,
|
|
|
+ String sourcePublishContentId,
|
|
|
+ String rootPublishContentId,
|
|
|
+ int times) {
|
|
|
+ RootPublishContentVO result = new RootPublishContentVO();
|
|
|
result.setSourcePublishContentId(sourcePublishContentId);
|
|
|
result.setRootPublishContentId(rootPublishContentId);
|
|
|
if (times > 20) {
|
|
@@ -223,6 +233,7 @@ public class ArticleService {
|
|
|
result.setSourcePublishContentId(publishContent.getId());
|
|
|
}
|
|
|
result.setRootPublishContentId(publishContent.getId());
|
|
|
+ result.setRootProduceContentId(publishContent.getSourceId());
|
|
|
channelContentId = publishContent.getCrawlerChannelContentId();
|
|
|
} else {
|
|
|
for (String aTitle : titles) {
|
|
@@ -233,6 +244,7 @@ public class ArticleService {
|
|
|
result.setSourcePublishContentId(publishContent.getId());
|
|
|
}
|
|
|
result.setRootPublishContentId(publishContent.getId());
|
|
|
+ result.setRootProduceContentId(publishContent.getSourceId());
|
|
|
channelContentId = publishContent.getCrawlerChannelContentId();
|
|
|
break;
|
|
|
}
|
|
@@ -245,4 +257,30 @@ public class ArticleService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void articlePromotionTraceability(String channelContentId) {
|
|
|
+ // 查找待处理任务
|
|
|
+ List<ArticlePoolPromotionSource> tasks;
|
|
|
+ if (StringUtils.hasText(channelContentId)) {
|
|
|
+ tasks = articlePoolPromotionSourceRepository.getByChannelContentId(channelContentId);
|
|
|
+ } else {
|
|
|
+ tasks = articlePoolPromotionSourceRepository.getByStatus(0);
|
|
|
+ }
|
|
|
+ for (ArticlePoolPromotionSource task : tasks) {
|
|
|
+ // 溯源
|
|
|
+ RootPublishContentVO source = getRootPublishContent(task.getChannelContentId(), null, null, 0);
|
|
|
+ // 更新
|
|
|
+ if (StringUtils.hasText(source.getRootProduceContentId())) {
|
|
|
+ task.setStatus(1);
|
|
|
+ task.setSourcePublishContentId(source.getSourcePublishContentId());
|
|
|
+ task.setRootProduceContentId(source.getRootProduceContentId());
|
|
|
+ task.setRootPublishContentId(source.getRootPublishContentId());
|
|
|
+ task.setUpdateTimestamp(System.currentTimeMillis());
|
|
|
+ articlePoolPromotionSourceRepository.save(task);
|
|
|
+ longArticleBaseMapper.updateRootProduceContentLevel(task.getRootProduceContentId(), task.getLevel());
|
|
|
+ } else {
|
|
|
+ task.setDeleted(1);
|
|
|
+ articlePoolPromotionSourceRepository.save(task);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|