|
@@ -151,7 +151,7 @@ public class ArticleService {
|
|
|
crawlerBaseMapper.updateArticleAigcId(wxSn, publishContentId, channelContentId);
|
|
|
// 查找记录根记录
|
|
|
long start = System.currentTimeMillis();
|
|
|
- RootPublishContentVO result = getRootPublishContent(channelContentId, null, publishContentId, 0);
|
|
|
+ RootPublishContentVO result = getRootPublishContent(channelContentId, null, publishContentId, null, 0);
|
|
|
log.info("syncAigcIdByWxSn getRootPublishContent finish cost:{}", System.currentTimeMillis() - start);
|
|
|
// 更新source root publish_content_id
|
|
|
crawlerBaseMapper.updateArticleSourceRootId(wxSn, result.getSourcePublishContentId(), result.getRootPublishContentId());
|
|
@@ -191,23 +191,16 @@ public class ArticleService {
|
|
|
public RootPublishContentVO getRootPublishContent(String channelContentId,
|
|
|
String sourcePublishContentId,
|
|
|
String rootPublishContentId,
|
|
|
+ String rootProduceContentId,
|
|
|
int times) {
|
|
|
RootPublishContentVO result = new RootPublishContentVO();
|
|
|
result.setChannelContentId(channelContentId);
|
|
|
result.setSourcePublishContentId(sourcePublishContentId);
|
|
|
result.setRootPublishContentId(rootPublishContentId);
|
|
|
+ result.setRootProduceContentId(rootProduceContentId);
|
|
|
if (times > 20) {
|
|
|
return result;
|
|
|
}
|
|
|
- List<Article> articleList = articleRepository.getByChannelContentIdAndRootPublishContentIdIsNotNull(channelContentId);
|
|
|
- if (CollectionUtils.isNotEmpty(articleList)) {
|
|
|
- if (!StringUtils.hasText(sourcePublishContentId)) {
|
|
|
- result.setSourcePublishContentId(articleList.get(0).getSourcePublishContentId());
|
|
|
- }
|
|
|
- result.setRootPublishContentId(articleList.get(0).getRootPublishContentId());
|
|
|
- return result;
|
|
|
- }
|
|
|
- result.setRootPublishContentId(rootPublishContentId);
|
|
|
CrawlerContent crawlerContent = aigcBaseMapper.getCrawlerContentByChannelContentId(channelContentId);
|
|
|
if (Objects.isNull(crawlerContent) || !StringUtils.hasText(crawlerContent.getGhId())) {
|
|
|
return result;
|
|
@@ -256,7 +249,8 @@ public class ArticleService {
|
|
|
if (channelContentId.equals(crawlerContent.getChannelContentId())) {
|
|
|
return result;
|
|
|
} else {
|
|
|
- result = getRootPublishContent(channelContentId, result.getSourcePublishContentId(), result.getRootPublishContentId(), ++times);
|
|
|
+ result = getRootPublishContent(channelContentId, result.getSourcePublishContentId(),
|
|
|
+ result.getRootPublishContentId(), result.getRootProduceContentId(), ++times);
|
|
|
if (!channelContentId.equals(result.getChannelContentId())) {
|
|
|
result.getMidChannelContentIds().add(channelContentId);
|
|
|
}
|
|
@@ -266,15 +260,16 @@ public class ArticleService {
|
|
|
|
|
|
public void articlePromotionTraceability(String channelContentId) {
|
|
|
// 查找待处理任务
|
|
|
- List<ArticlePoolPromotionSource> tasks;
|
|
|
+ List<ArticlePoolPromotionSource> tasks = new ArrayList<>();
|
|
|
if (StringUtils.hasText(channelContentId)) {
|
|
|
- tasks = articlePoolPromotionSourceRepository.getByChannelContentId(channelContentId);
|
|
|
+ ArticlePoolPromotionSource item = articlePoolPromotionSourceRepository.getByChannelContentId(channelContentId);
|
|
|
+ tasks.add(item);
|
|
|
} else {
|
|
|
tasks = articlePoolPromotionSourceRepository.getByStatus(0);
|
|
|
}
|
|
|
for (ArticlePoolPromotionSource task : tasks) {
|
|
|
// 溯源
|
|
|
- RootPublishContentVO source = getRootPublishContent(task.getChannelContentId(), null, null, 0);
|
|
|
+ RootPublishContentVO source = getRootPublishContent(task.getChannelContentId(), null, null, null, 0);
|
|
|
// 更新
|
|
|
if (StringUtils.hasText(source.getRootProduceContentId())) {
|
|
|
task.setStatus(1);
|
|
@@ -284,16 +279,23 @@ public class ArticleService {
|
|
|
task.setUpdateTimestamp(System.currentTimeMillis());
|
|
|
articlePoolPromotionSourceRepository.save(task);
|
|
|
// 保存中间环节 晋级溯源
|
|
|
- List<ArticlePoolPromotionSource> insertList = new ArrayList<>();
|
|
|
for (String midChannelContentId : source.getMidChannelContentIds()) {
|
|
|
ArticlePoolPromotionSource item = new ArticlePoolPromotionSource();
|
|
|
BeanUtils.copyProperties(task, item);
|
|
|
+ ArticlePoolPromotionSource dto = articlePoolPromotionSourceRepository.getByChannelContentId(midChannelContentId);
|
|
|
+ if (Objects.nonNull(dto)) {
|
|
|
+ BeanUtils.copyProperties(dto, item);
|
|
|
+ item.setRootProduceContentId(task.getRootProduceContentId());
|
|
|
+ item.setStatus(task.getStatus());
|
|
|
+ item.setDeleted(task.getDeleted());
|
|
|
+ item.setLevel(task.getLevel());
|
|
|
+ item.setUpdateTimestamp(task.getUpdateTimestamp());
|
|
|
+ }
|
|
|
item.setChannelContentId(midChannelContentId);
|
|
|
- item.setCreateTimestamp(item.getUpdateTimestamp());
|
|
|
- insertList.add(item);
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(insertList)) {
|
|
|
- longArticleBaseMapper.batchInsertArticlePoolPromotionSource(insertList);
|
|
|
+ if (Objects.isNull(item.getCreateTimestamp())) {
|
|
|
+ item.setCreateTimestamp(item.getUpdateTimestamp());
|
|
|
+ }
|
|
|
+ articlePoolPromotionSourceRepository.save(item);
|
|
|
}
|
|
|
longArticleBaseMapper.updateRootProduceContentLevel(task.getRootProduceContentId(), task.getLevel());
|
|
|
} else {
|