|
@@ -12,6 +12,7 @@ import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolE
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO;
|
|
|
+import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.*;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
@@ -198,20 +199,20 @@ public class DataDashboardService {
|
|
|
}
|
|
|
return null;
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- List<PublishContent> publishContents = new ArrayList<>();
|
|
|
+ List<PublishContentDTO> publishContents = new ArrayList<>();
|
|
|
for (List<PublishContentParam> partitions : Lists.partition(publishContentParamList, 100)) {
|
|
|
publishContents.addAll(aigcBaseMapper.getPublishContentByTitle(partitions));
|
|
|
}
|
|
|
log.info("newSortStrategyData publishContents finish");
|
|
|
- Map<String, Map<String, Map<Long, PublishContent>>> publishContentMap = publishContents.stream()
|
|
|
+ Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap = publishContents.stream()
|
|
|
.filter(o -> Objects.nonNull(o.getPublishTimestamp()))
|
|
|
- .sorted(Comparator.comparingLong(PublishContent::getPublishTimestamp)).collect(
|
|
|
- Collectors.groupingBy(PublishContent::getPublishAccountId,
|
|
|
- Collectors.groupingBy(PublishContent::getTitle,
|
|
|
- Collectors.toMap(PublishContent::getPublishTimestamp, o -> o,
|
|
|
+ .sorted(Comparator.comparingLong(PublishContentDTO::getPublishTimestamp)).collect(
|
|
|
+ Collectors.groupingBy(PublishContentDTO::getPublishAccountId,
|
|
|
+ Collectors.groupingBy(PublishContentDTO::getTitle,
|
|
|
+ Collectors.toMap(PublishContentDTO::getPublishTimestamp, o -> o,
|
|
|
(existing, replacement) -> replacement))));
|
|
|
// 获取发布内容排版
|
|
|
- List<String> publishContentIds = publishContents.stream().map(PublishContent::getId).collect(Collectors.toList());
|
|
|
+ List<String> publishContentIds = publishContents.stream().map(PublishContentDTO::getId).collect(Collectors.toList());
|
|
|
List<PublishContentLayout> publishContentLayoutList = new ArrayList<>();
|
|
|
for (List<String> partitions : Lists.partition(publishContentIds, 1000)) {
|
|
|
publishContentLayoutList.addAll(publishContentLayOutRepository.findByPublishContentIdIn(partitions));
|
|
@@ -221,7 +222,7 @@ public class DataDashboardService {
|
|
|
.collect(Collectors.toMap(PublishContentLayout::getPublishContentId, o -> o,
|
|
|
(existing, replacement) -> replacement));
|
|
|
//获取发布计划
|
|
|
- List<String> publishPlanIds = publishContents.stream().map(PublishContent::getPlanId).distinct()
|
|
|
+ List<String> publishPlanIds = publishContents.stream().map(PublishContentDTO::getPlanId).distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
List<PublishPlan> publishPlanList = publishPlanRepository.findByIdIn(publishPlanIds);
|
|
|
log.info("newSortStrategyData publishPlanList finish");
|
|
@@ -230,7 +231,7 @@ public class DataDashboardService {
|
|
|
// 获取生成记录
|
|
|
List<String> contentSourceIds = publishContents.stream()
|
|
|
.filter(o -> Arrays.asList(1, 2).contains(o.getSourceType()))
|
|
|
- .map(PublishContent::getSourceId).distinct().collect(Collectors.toList());
|
|
|
+ .map(PublishContentDTO::getSourceId).distinct().collect(Collectors.toList());
|
|
|
List<ProducePlanExeRecord> planExeRecordList = new ArrayList<>();
|
|
|
for (List<String> partitions : Lists.partition(contentSourceIds, 1000)) {
|
|
|
planExeRecordList.addAll(producePlanExeRecordRepository.findByPlanExeIdIn(partitions));
|
|
@@ -251,7 +252,7 @@ public class DataDashboardService {
|
|
|
Map<String, List<ProducePlanInputSource>> inputSourceMap = inputSourceList.stream()
|
|
|
.collect(Collectors.groupingBy(ProducePlanInputSource::getPlanId));
|
|
|
// 获取抓取内容关联
|
|
|
- List<String> crawlerChannelContentIds = publishContents.stream().map(PublishContent::getCrawlerChannelContentId)
|
|
|
+ List<String> crawlerChannelContentIds = publishContents.stream().map(PublishContentDTO::getCrawlerChannelContentId)
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
List<CrawlerPlanResultRel> resultRelList = aigcBaseMapper.getCrawlerPlanRelByChannelContentIds(crawlerChannelContentIds);
|
|
|
log.info("newSortStrategyData resultRelList finish");
|
|
@@ -267,7 +268,7 @@ public class DataDashboardService {
|
|
|
// 获取小程序任务
|
|
|
List<MiniprogramTaskParam> miniprogramTaskParamList = new ArrayList<>();
|
|
|
Set<String> distinct = new HashSet<>();
|
|
|
- for (PublishContent publishContent : publishContents) {
|
|
|
+ for (PublishContentDTO publishContent : publishContents) {
|
|
|
String key = publishContent.getPlanId() + publishContent.getPublishAccountId();
|
|
|
if (distinct.contains(key)) {
|
|
|
continue;
|
|
@@ -365,7 +366,7 @@ public class DataDashboardService {
|
|
|
|
|
|
private void setObjAigcInfo(Article article, NewSortStrategyExport obj, String date,
|
|
|
Map<String, PublishAccount> publishAccountMap,
|
|
|
- Map<String, Map<String, Map<Long, PublishContent>>> publishContentMap,
|
|
|
+ Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap,
|
|
|
Map<String, PublishContentLayout> publishContentLayoutMap,
|
|
|
Map<String, PublishPlan> publishPlanMap,
|
|
|
Map<String, List<PublishPlanMiniprogramTask>> miniprogramTaskMap,
|
|
@@ -376,19 +377,19 @@ public class DataDashboardService {
|
|
|
Map<String, CrawlerPlan> crawlerPlanMap,
|
|
|
Map<String, ProducePlan> sourceTitlePlanMap) {
|
|
|
PublishAccount publishAccount = publishAccountMap.get(article.getGhId());
|
|
|
- Map<String, Map<Long, PublishContent>> titleContentMap = publishContentMap.get(publishAccount.getId());
|
|
|
+ Map<String, Map<Long, PublishContentDTO>> titleContentMap = publishContentMap.get(publishAccount.getId());
|
|
|
if (Objects.isNull(titleContentMap)) {
|
|
|
return;
|
|
|
}
|
|
|
- Map<Long, PublishContent> publishTimeContentMap = titleContentMap.get(article.getTitle());
|
|
|
+ Map<Long, PublishContentDTO> publishTimeContentMap = titleContentMap.get(article.getTitle());
|
|
|
if (Objects.isNull(publishTimeContentMap) || publishTimeContentMap.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- PublishContent publishContent = null;
|
|
|
+ PublishContentDTO publishContent = null;
|
|
|
List<String> hisPublishTimeStrList = publishTimeContentMap.keySet().stream()
|
|
|
.map(o -> DateUtils.timestampToYMDStr(o / 1000, "yyyyMMdd")).collect(Collectors.toList());
|
|
|
String publishTime = DateUtils.findNearestDate(hisPublishTimeStrList, date, "yyyyMMdd");
|
|
|
- for (Map.Entry<Long, PublishContent> entry : publishTimeContentMap.entrySet()) {
|
|
|
+ for (Map.Entry<Long, PublishContentDTO> entry : publishTimeContentMap.entrySet()) {
|
|
|
String str = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
|
|
|
if (publishTime.equals(str)) {
|
|
|
publishContent = entry.getValue();
|
|
@@ -1434,11 +1435,11 @@ public class DataDashboardService {
|
|
|
Collectors.toMap(Article::getItemIndex, o -> o,
|
|
|
(existing, replacement) -> replacement))));
|
|
|
List<String> titleList = articleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
|
|
|
- List<PublishContent> hisPublishList = new ArrayList<>();
|
|
|
+ List<PublishContentDTO> hisPublishList = new ArrayList<>();
|
|
|
for (List<String> partitions : Lists.partition(new ArrayList<>(titleList), 100)) {
|
|
|
hisPublishList.addAll(aigcBaseMapper.getHisPublishByTitles(partitions));
|
|
|
}
|
|
|
- Map<String, List<PublishContent>> hisPublishMap = hisPublishList.stream().collect(Collectors.groupingBy(PublishContent::getTitle));
|
|
|
+ Map<String, List<PublishContentDTO>> hisPublishMap = hisPublishList.stream().collect(Collectors.groupingBy(PublishContentDTO::getTitle));
|
|
|
String ymd = DateUtils.timestampToYMDStr(minTimestamp - 86400 * 7, "yyyy-MM-dd");
|
|
|
List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.getAllByUpdateTimeGreaterThanEqual(ymd);
|
|
|
Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoMap = accountAvgInfoList.stream()
|
|
@@ -1505,10 +1506,10 @@ public class DataDashboardService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<PublishContent> hisPublish = hisPublishMap.get(article.getTitle());
|
|
|
+ List<PublishContentDTO> hisPublish = hisPublishMap.get(article.getTitle());
|
|
|
if (CollectionUtils.isNotEmpty(hisPublish)) {
|
|
|
long hisMinDate = hisPublish.stream().filter(o -> Objects.nonNull(o.getPublishTimestamp()))
|
|
|
- .mapToLong(PublishContent::getPublishTimestamp).min().orElse(0);
|
|
|
+ .mapToLong(PublishContentDTO::getPublishTimestamp).min().orElse(0);
|
|
|
int explorationInterval = (int) ((article.getPublishTimestamp() - (hisMinDate / 1000)) / 86400);
|
|
|
item.setFirstExplorationIntervalAvg(explorationInterval);
|
|
|
}
|