|
@@ -24,10 +24,12 @@ import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
@@ -191,6 +193,7 @@ public class ArticleService {
|
|
|
String rootPublishContentId,
|
|
|
int times) {
|
|
|
RootPublishContentVO result = new RootPublishContentVO();
|
|
|
+ result.setChannelContentId(channelContentId);
|
|
|
result.setSourcePublishContentId(sourcePublishContentId);
|
|
|
result.setRootPublishContentId(rootPublishContentId);
|
|
|
if (times > 20) {
|
|
@@ -253,7 +256,11 @@ public class ArticleService {
|
|
|
if (channelContentId.equals(crawlerContent.getChannelContentId())) {
|
|
|
return result;
|
|
|
} else {
|
|
|
- return getRootPublishContent(channelContentId, result.getSourcePublishContentId(), result.getRootPublishContentId(), ++times);
|
|
|
+ result = getRootPublishContent(channelContentId, result.getSourcePublishContentId(), result.getRootPublishContentId(), ++times);
|
|
|
+ if (!channelContentId.equals(result.getChannelContentId())) {
|
|
|
+ result.getMidChannelContentIds().add(channelContentId);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -276,6 +283,18 @@ public class ArticleService {
|
|
|
task.setRootPublishContentId(source.getRootPublishContentId());
|
|
|
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);
|
|
|
+ item.setChannelContentId(midChannelContentId);
|
|
|
+ item.setCreateTimestamp(item.getUpdateTimestamp());
|
|
|
+ insertList.add(item);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(insertList)) {
|
|
|
+ longArticleBaseMapper.batchInsertArticlePoolPromotionSource(insertList);
|
|
|
+ }
|
|
|
longArticleBaseMapper.updateRootProduceContentLevel(task.getRootProduceContentId(), task.getLevel());
|
|
|
} else {
|
|
|
task.setDeleted(1);
|