|
@@ -318,82 +318,11 @@ public class DataDashboardService {
|
|
|
}
|
|
|
setObjAvgInfo(article, obj, avgInfo);
|
|
|
setObjHisRateInfo(article, obj, hisArticleMap, accountAvgInfoIndexMap, hisArticleDetailInfoMap);
|
|
|
- result.add(obj);
|
|
|
// aigc 数据
|
|
|
- PublishAccount publishAccount = publishAccountMap.get(article.getGhId());
|
|
|
- Map<String, Map<Long, PublishContent>> titleContentMap = publishContentMap.get(publishAccount.getId());
|
|
|
- if (Objects.isNull(titleContentMap)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- Map<Long, PublishContent> publishTimeContentMap = titleContentMap.get(article.getTitle());
|
|
|
- if (Objects.isNull(publishTimeContentMap) || publishTimeContentMap.isEmpty()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- PublishContent publishContent = null;
|
|
|
- for (Map.Entry<Long, PublishContent> entry : publishTimeContentMap.entrySet()) {
|
|
|
- String publishTime = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
|
|
|
- if (publishTime.equals(date)) {
|
|
|
- if (Objects.nonNull(publishContent)) {
|
|
|
- if (publishContent.getPublishTimestamp() < entry.getValue().getPublishTimestamp()) {
|
|
|
- publishContent = entry.getValue();
|
|
|
- }
|
|
|
- } else {
|
|
|
- publishContent = entry.getValue();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (Objects.isNull(publishContent)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- PublishContentLayout layout = publishContentLayoutMap.get(publishContent.getId());
|
|
|
- List<ProduceAuditLayoutContentObjVO> layoutList = JSON.parseArray(layout.getContent(), ProduceAuditLayoutContentObjVO.class);
|
|
|
- if (CollectionUtil.isNotEmpty(layoutList)) {
|
|
|
- long miniProgramNum = layoutList.stream().filter(o -> o.getType() == 4).count();
|
|
|
- obj.setPublishMiniProgramNum((int) miniProgramNum);
|
|
|
- }
|
|
|
- PublishPlan publishPlan = publishPlanMap.get(publishContent.getPlanId());
|
|
|
- obj.setPublishPlanName(publishPlan.getName());
|
|
|
- // 插入小程序任务
|
|
|
- List<PublishPlanMiniprogramTask> miniprogramTasks = miniprogramTaskMap.get(publishPlan.getId());
|
|
|
- if (CollectionUtil.isNotEmpty(miniprogramTasks)) {
|
|
|
- miniprogramTasks = miniprogramTasks.stream()
|
|
|
- .filter(o -> o.getAccountIds().contains(publishAccount.getId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (CollectionUtil.isNotEmpty(miniprogramTasks)) {
|
|
|
- obj.setPublishMiniProgramInsertStrategy(miniprogramTasks.get(0).getStrategy());
|
|
|
- obj.setPublishMiniProgramInsertUseType(miniprogramTasks.get(0).getMiniprogramUseType() == 1 ? "自然流" : "投流");
|
|
|
- }
|
|
|
- }
|
|
|
- List<ProducePlanInputSource> producePlanInputSourceList = new ArrayList<>();
|
|
|
- if (Arrays.asList(1, 2).contains(publishContent.getSourceType())) {
|
|
|
- ProducePlanExeRecord record = planExeRecordMap.get(publishContent.getSourceId());
|
|
|
- if (Objects.nonNull(record)) {
|
|
|
- ProducePlan producePlan = producePlanMap.get(record.getPlanId());
|
|
|
- obj.setProducePlanName(producePlan.getName());
|
|
|
- obj.setProducePlanTag(producePlan.getPlanTag());
|
|
|
- }
|
|
|
- producePlanInputSourceList = inputSourceMap.get(record.getPlanId());
|
|
|
- }
|
|
|
- List<CrawlerPlanResultRel> crawlerPlanRelList = resultRelMap.get(publishContent.getCrawlerChannelContentId());
|
|
|
- if (CollectionUtil.isNotEmpty(crawlerPlanRelList) && CollectionUtil.isNotEmpty(producePlanInputSourceList)) {
|
|
|
- List<String> inputSourceValues = producePlanInputSourceList.stream()
|
|
|
- .map(ProducePlanInputSource::getInputSourceValue).collect(Collectors.toList());
|
|
|
- List<CrawlerPlan> crawlerPlanItemList = new ArrayList<>();
|
|
|
- for (CrawlerPlanResultRel crawlerPlanResultRel : crawlerPlanRelList) {
|
|
|
- crawlerPlanItemList.add(crawlerPlanMap.get(crawlerPlanResultRel.getPlanId()));
|
|
|
- }
|
|
|
- for (CrawlerPlan crawlerPlan : crawlerPlanItemList) {
|
|
|
- if (inputSourceValues.contains(crawlerPlan.getId())) {
|
|
|
- obj.setCrawlerPlanName(crawlerPlan.getName());
|
|
|
- obj.setCrawlerPlanTag(crawlerPlan.getPlanTag());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ProducePlan sourceProducePlan = sourceTitlePlanMap.get(article.getTitle());
|
|
|
- if (Objects.nonNull(sourceProducePlan)) {
|
|
|
- obj.setSourceProducePlanName(sourceProducePlan.getName());
|
|
|
- }
|
|
|
+ setObjAigcInfo(article, obj, date, publishAccountMap, publishContentMap, publishContentLayoutMap,
|
|
|
+ publishPlanMap, miniprogramTaskMap, planExeRecordMap, producePlanMap, inputSourceMap,
|
|
|
+ resultRelMap, crawlerPlanMap, sourceTitlePlanMap);
|
|
|
+ result.add(obj);
|
|
|
}
|
|
|
log.info("newSortStrategyData buildData finish");
|
|
|
result.sort(Comparator.comparing(NewSortStrategyExport::getDateStr).reversed()
|
|
@@ -414,6 +343,94 @@ public class DataDashboardService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private void setObjAigcInfo(Article article, NewSortStrategyExport obj, String date,
|
|
|
+ Map<String, PublishAccount> publishAccountMap,
|
|
|
+ Map<String, Map<String, Map<Long, PublishContent>>> publishContentMap,
|
|
|
+ Map<String, PublishContentLayout> publishContentLayoutMap,
|
|
|
+ Map<String, PublishPlan> publishPlanMap,
|
|
|
+ Map<String, List<PublishPlanMiniprogramTask>> miniprogramTaskMap,
|
|
|
+ Map<String, ProducePlanExeRecord> planExeRecordMap,
|
|
|
+ Map<String, ProducePlan> producePlanMap,
|
|
|
+ Map<String, List<ProducePlanInputSource>> inputSourceMap,
|
|
|
+ Map<String, List<CrawlerPlanResultRel>> resultRelMap,
|
|
|
+ Map<String, CrawlerPlan> crawlerPlanMap,
|
|
|
+ Map<String, ProducePlan> sourceTitlePlanMap) {
|
|
|
+ PublishAccount publishAccount = publishAccountMap.get(article.getGhId());
|
|
|
+ Map<String, Map<Long, PublishContent>> titleContentMap = publishContentMap.get(publishAccount.getId());
|
|
|
+ if (Objects.isNull(titleContentMap)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<Long, PublishContent> publishTimeContentMap = titleContentMap.get(article.getTitle());
|
|
|
+ if (Objects.isNull(publishTimeContentMap) || publishTimeContentMap.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ PublishContent publishContent = null;
|
|
|
+ for (Map.Entry<Long, PublishContent> entry : publishTimeContentMap.entrySet()) {
|
|
|
+ String publishTime = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
|
|
|
+ if (publishTime.equals(date)) {
|
|
|
+ if (Objects.nonNull(publishContent)) {
|
|
|
+ if (publishContent.getPublishTimestamp() < entry.getValue().getPublishTimestamp()) {
|
|
|
+ publishContent = entry.getValue();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ publishContent = entry.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Objects.isNull(publishContent)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ PublishContentLayout layout = publishContentLayoutMap.get(publishContent.getId());
|
|
|
+ List<ProduceAuditLayoutContentObjVO> layoutList = JSON.parseArray(layout.getContent(), ProduceAuditLayoutContentObjVO.class);
|
|
|
+ if (CollectionUtil.isNotEmpty(layoutList)) {
|
|
|
+ long miniProgramNum = layoutList.stream().filter(o -> o.getType() == 4).count();
|
|
|
+ obj.setPublishMiniProgramNum((int) miniProgramNum);
|
|
|
+ }
|
|
|
+ PublishPlan publishPlan = publishPlanMap.get(publishContent.getPlanId());
|
|
|
+ obj.setPublishPlanName(publishPlan.getName());
|
|
|
+ // 插入小程序任务
|
|
|
+ List<PublishPlanMiniprogramTask> miniprogramTasks = miniprogramTaskMap.get(publishPlan.getId());
|
|
|
+ if (CollectionUtil.isNotEmpty(miniprogramTasks)) {
|
|
|
+ miniprogramTasks = miniprogramTasks.stream()
|
|
|
+ .filter(o -> o.getAccountIds().contains(publishAccount.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(miniprogramTasks)) {
|
|
|
+ obj.setPublishMiniProgramInsertStrategy(miniprogramTasks.get(0).getStrategy());
|
|
|
+ obj.setPublishMiniProgramInsertUseType(miniprogramTasks.get(0).getMiniprogramUseType() == 1 ? "自然流" : "投流");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ProducePlanInputSource> producePlanInputSourceList = new ArrayList<>();
|
|
|
+ if (Arrays.asList(1, 2).contains(publishContent.getSourceType())) {
|
|
|
+ ProducePlanExeRecord record = planExeRecordMap.get(publishContent.getSourceId());
|
|
|
+ if (Objects.nonNull(record)) {
|
|
|
+ ProducePlan producePlan = producePlanMap.get(record.getPlanId());
|
|
|
+ obj.setProducePlanName(producePlan.getName());
|
|
|
+ obj.setProducePlanTag(producePlan.getPlanTag());
|
|
|
+ }
|
|
|
+ producePlanInputSourceList = inputSourceMap.get(record.getPlanId());
|
|
|
+ }
|
|
|
+ List<CrawlerPlanResultRel> crawlerPlanRelList = resultRelMap.get(publishContent.getCrawlerChannelContentId());
|
|
|
+ if (CollectionUtil.isNotEmpty(crawlerPlanRelList) && CollectionUtil.isNotEmpty(producePlanInputSourceList)) {
|
|
|
+ List<String> inputSourceValues = producePlanInputSourceList.stream()
|
|
|
+ .map(ProducePlanInputSource::getInputSourceValue).collect(Collectors.toList());
|
|
|
+ List<CrawlerPlan> crawlerPlanItemList = new ArrayList<>();
|
|
|
+ for (CrawlerPlanResultRel crawlerPlanResultRel : crawlerPlanRelList) {
|
|
|
+ crawlerPlanItemList.add(crawlerPlanMap.get(crawlerPlanResultRel.getPlanId()));
|
|
|
+ }
|
|
|
+ for (CrawlerPlan crawlerPlan : crawlerPlanItemList) {
|
|
|
+ if (inputSourceValues.contains(crawlerPlan.getId())) {
|
|
|
+ obj.setCrawlerPlanName(crawlerPlan.getName());
|
|
|
+ obj.setCrawlerPlanTag(crawlerPlan.getPlanTag());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ProducePlan sourceProducePlan = sourceTitlePlanMap.get(article.getTitle());
|
|
|
+ if (Objects.nonNull(sourceProducePlan)) {
|
|
|
+ obj.setSourceProducePlanName(sourceProducePlan.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void setObjHisRateInfo(Article article, NewSortStrategyExport obj,
|
|
|
Map<String, List<Article>> hisArticleMap,
|
|
|
Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
|
|
@@ -934,6 +951,9 @@ public class DataDashboardService {
|
|
|
item.setPromotionRateL4((item.getPromotionCountL4() * 1.0) / item.getActualArticleReleaseCount());
|
|
|
}
|
|
|
}
|
|
|
+ if (Objects.isNull(data.getSecondFirstLevel())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
item.setT1DayFirstLayerUV(item.getT1DayFirstLayerUV() + data.getSecondFirstLevel());
|
|
|
item.setT1DayT0FissionUV(item.getT1DayT0FissionUV() + data.getSecondFission0());
|
|
|
item.setT2DayFirstLayerUV(item.getT2DayFirstLayerUV() + data.getThirdFirstLevel());
|
|
@@ -945,14 +965,14 @@ public class DataDashboardService {
|
|
|
item.setT1DayViewCount(item.getViewCount());
|
|
|
item.setT2DayViewCount(item.getViewCount());
|
|
|
double t1DayAverageViewToBaseRatio = item.getT1DayAverageViewToBaseRatio();
|
|
|
- if (data.getViewCount() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getViewCount() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t1DayViewToBaseRatio = data.getViewCount() / data.getAvgViewCount();
|
|
|
t1DayAverageViewToBaseRatio = (t1DayAverageViewToBaseRatio * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t1DayViewToBaseRatio) / item.getActualArticleReleaseCount();
|
|
|
}
|
|
|
item.setT1DayAverageViewToBaseRatio(t1DayAverageViewToBaseRatio);
|
|
|
double t1DayAverageMiniAppOpenRate = item.getT1DayAverageMiniAppOpenRate();
|
|
|
- if (data.getSecondFirstLevel() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getSecondFirstLevel() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t1DayMiniAppOpenRate = data.getSecondFirstLevel() / data.getAvgViewCount();
|
|
|
t1DayAverageMiniAppOpenRate = (t1DayAverageMiniAppOpenRate * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t1DayMiniAppOpenRate) / item.getActualArticleReleaseCount();
|
|
@@ -966,21 +986,21 @@ public class DataDashboardService {
|
|
|
}
|
|
|
item.setT1DayAverageT0FissionRate(t1DayAverageT0FissionRate);
|
|
|
double t1DayAverageFirstLayerFissionToViewBaseRatio = item.getT1DayAverageFirstLayerFissionToViewBaseRatio();
|
|
|
- if (data.getSecondFission0() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getSecondFission0() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t1DayFirstLayerFissionToViewBaseRatio = data.getSecondFission0() / data.getAvgViewCount();
|
|
|
t1DayAverageFirstLayerFissionToViewBaseRatio = (t1DayAverageFirstLayerFissionToViewBaseRatio * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t1DayFirstLayerFissionToViewBaseRatio) / item.getActualArticleReleaseCount();
|
|
|
}
|
|
|
item.setT1DayAverageFirstLayerFissionToViewBaseRatio(t1DayAverageFirstLayerFissionToViewBaseRatio);
|
|
|
double t2DayAverageViewToBaseRatio = item.getT2DayAverageViewToBaseRatio();
|
|
|
- if (data.getViewCount() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getViewCount() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t2DayViewToBaseRatio = data.getViewCount() / data.getAvgViewCount();
|
|
|
t2DayAverageViewToBaseRatio = (t2DayAverageViewToBaseRatio * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t2DayViewToBaseRatio) / item.getActualArticleReleaseCount();
|
|
|
}
|
|
|
item.setT2DayAverageViewToBaseRatio(t2DayAverageViewToBaseRatio);
|
|
|
double t2DayAverageMiniAppOpenRate = item.getT2DayAverageMiniAppOpenRate();
|
|
|
- if (data.getThirdFirstLevel() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getThirdFirstLevel() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t2DayMiniAppOpenRate = data.getThirdFirstLevel() / data.getAvgViewCount();
|
|
|
t2DayAverageMiniAppOpenRate = (t2DayAverageMiniAppOpenRate * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t2DayMiniAppOpenRate) / item.getActualArticleReleaseCount();
|
|
@@ -994,7 +1014,7 @@ public class DataDashboardService {
|
|
|
}
|
|
|
item.setT2DayAverageT0FissionRate(t2DayAverageT0FissionRate);
|
|
|
double t2DayAverageFirstLayerFissionToViewBaseRatio = item.getT2DayAverageFirstLayerFissionToViewBaseRatio();
|
|
|
- if (data.getThirdFission0() > 0 && data.getAvgViewCount() > 0) {
|
|
|
+ if (data.getThirdFission0() > 0 && Objects.nonNull(data.getAvgViewCount()) && data.getAvgViewCount() > 0) {
|
|
|
double t2DayFirstLayerFissionToViewBaseRatio = data.getThirdFission0() / data.getAvgViewCount();
|
|
|
t2DayAverageFirstLayerFissionToViewBaseRatio = (t2DayAverageFirstLayerFissionToViewBaseRatio * (item.getActualArticleReleaseCount() - 1)
|
|
|
+ t2DayFirstLayerFissionToViewBaseRatio) / item.getActualArticleReleaseCount();
|
|
@@ -1144,10 +1164,15 @@ public class DataDashboardService {
|
|
|
|
|
|
private void setPublishPerformance(IntermediateIndicatorsExport item, NewSortStrategyExport data,
|
|
|
Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap) {
|
|
|
+ if (Objects.isNull(data.getFirstLevel())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
item.setViewCount(item.getViewCount() + data.getViewCount());
|
|
|
item.setFirstLayerUV(item.getFirstLayerUV() + data.getFirstLevel());
|
|
|
item.setT0FissionUV(item.getT0FissionUV() + data.getFission0());
|
|
|
- item.setViewBase(item.getViewBase() + data.getAvgViewCount());
|
|
|
+ if (Objects.nonNull(data.getAvgViewCount())) {
|
|
|
+ item.setViewBase(item.getViewBase() + data.getAvgViewCount());
|
|
|
+ }
|
|
|
if (item.getViewBase() > 0 && item.getViewCount() > 0) {
|
|
|
item.setViewToBaseRatio(item.getViewCount() / (double) item.getViewBase());
|
|
|
}
|
|
@@ -1204,7 +1229,9 @@ public class DataDashboardService {
|
|
|
ghIds.add(article.getGhId());
|
|
|
AccountAvgInfo accountAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
|
|
|
article.getUpdateTime(), article.getItemIndex());
|
|
|
- item.setFansCount(item.getFansCount() + accountAvgInfo.getFans());
|
|
|
+ if (Objects.nonNull(accountAvgInfo)) {
|
|
|
+ item.setFansCount(item.getFansCount() + accountAvgInfo.getFans());
|
|
|
+ }
|
|
|
}
|
|
|
if (4 == poolLevel) {
|
|
|
item.setActualReleaseCountL4(item.getActualReleaseCountL4() + 1);
|