|
@@ -19,12 +19,14 @@ import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolE
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.RankStrategyEnum;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
|
|
|
+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.ContentPoolTypeDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.ProducePlanAuditCheckDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.aigc.IdChannelDTO;
|
|
|
+import com.tzld.longarticle.recommend.server.model.dto.aigc.IdPlatformDTO;
|
|
|
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;
|
|
@@ -50,7 +52,6 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.util.Pair;
|
|
|
import org.springframework.http.*;
|
|
@@ -107,6 +108,12 @@ public class DataDashboardService {
|
|
|
private LongArticleTitleAuditRepository longArticleTitleAuditRepository;
|
|
|
@Autowired
|
|
|
private PublishSingleVideoSourceRepository videoPoolRepository;
|
|
|
+ @Autowired
|
|
|
+ private CrawlerBaseMapper crawlerBaseMapper;
|
|
|
+ @Autowired
|
|
|
+ private LongArticlesRootSourceIdRepository rootSourceIdRepository;
|
|
|
+ @Autowired
|
|
|
+ private DatastatSortStrategyRepository datastatSortStrategyRepository;
|
|
|
|
|
|
@ApolloJsonValue("${export.account.ghId:[]}")
|
|
|
private static List<String> ghIdList;
|
|
@@ -186,7 +193,9 @@ public class DataDashboardService {
|
|
|
Pair.of("O", "0.00%"),
|
|
|
Pair.of("P", "0.00%"),
|
|
|
Pair.of("Q", "0.00%"),
|
|
|
- Pair.of("R", "0.00%")
|
|
|
+ Pair.of("R", "0.00%"),
|
|
|
+ Pair.of("S", "0.00%"),
|
|
|
+ Pair.of("T", "0.00%")
|
|
|
);
|
|
|
doSendFeishuSheet(dateStrList, sheetToken, sheetId, rowNum, rows, 2, styles, delDateStrList, null);
|
|
|
}
|
|
@@ -207,7 +216,7 @@ public class DataDashboardService {
|
|
|
Set<String> snList = articleList.stream().map(Article::getWxSn).collect(Collectors.toSet());
|
|
|
List<ArticleDetailInfo> articleDetailInfoList = new ArrayList<>();
|
|
|
for (List<String> partitions : Lists.partition(new ArrayList<>(snList), 1000)) {
|
|
|
- articleDetailInfoList.addAll(articleDetailInfoRepository.getAllByWxSnIn(partitions));
|
|
|
+ articleDetailInfoList.addAll(articleDetailInfoRepository.getByWxSnIn(partitions));
|
|
|
}
|
|
|
log.info("newSortStrategyData articleDetailInfoList finish");
|
|
|
Map<String, List<ArticleDetailInfo>> articleDetailInfoMap = articleDetailInfoList.stream()
|
|
@@ -241,6 +250,9 @@ public class DataDashboardService {
|
|
|
for (List<PublishContentParam> partitions : Lists.partition(publishContentParamList, 100)) {
|
|
|
publishContents.addAll(publishContentMapper.getPublishContentByTitle(partitions));
|
|
|
}
|
|
|
+ if (CollectionUtils.isEmpty(publishContents)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
log.info("newSortStrategyData publishContents finish");
|
|
|
Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap = publishContents.stream()
|
|
|
.filter(o -> Objects.nonNull(o.getPublishTimestamp()))
|
|
@@ -349,7 +361,7 @@ public class DataDashboardService {
|
|
|
List<ArticleDetailInfo> hisArticleDetailInfoList = new ArrayList<>();
|
|
|
List<List<String>> hisSnPartition = Lists.partition(new ArrayList<>(hisWxSnList), 1000);
|
|
|
for (List<String> sns : hisSnPartition) {
|
|
|
- hisArticleDetailInfoList.addAll(articleDetailInfoRepository.getAllByWxSnIn(sns));
|
|
|
+ hisArticleDetailInfoList.addAll(articleDetailInfoRepository.getByWxSnIn(sns));
|
|
|
}
|
|
|
log.info("newSortStrategyData hisArticleDetailInfoList finish");
|
|
|
Map<String, List<ArticleDetailInfo>> hisArticleDetailInfoMap = hisArticleDetailInfoList.stream()
|
|
@@ -621,49 +633,85 @@ public class DataDashboardService {
|
|
|
Date secondDate = articleDetailInfos.stream().map(ArticleDetailInfo::getRecallDt).filter(o -> o.after(minDate)).min(Date::compareTo).orElse(new Date());
|
|
|
Date thirdDate = articleDetailInfos.stream().map(ArticleDetailInfo::getRecallDt).filter(o -> o.after(secondDate)).min(Date::compareTo).orElse(new Date());
|
|
|
int sumFirstLevel = 0;
|
|
|
- int sumFission0 = 0;
|
|
|
- int sumFission1 = 0;
|
|
|
- int sumFission2 = 0;
|
|
|
+ int sumFission0 = 0, sumFission0Head = 0, sumFission0Recommend = 0;
|
|
|
+ int sumFission1 = 0, sumFission1Head = 0, sumFission1Recommend = 0;
|
|
|
+ int sumFission2 = 0, sumFission2Head = 0, sumFission2Recommend = 0;
|
|
|
int sumSecondFirstLevel = 0;
|
|
|
- int sumSecondFission0 = 0;
|
|
|
- int sumSecondFission1 = 0;
|
|
|
- int sumSecondFission2 = 0;
|
|
|
+ int sumSecondFission0 = 0, sumSecondFission0Head = 0, sumSecondFission0Recommend = 0;
|
|
|
+ int sumSecondFission1 = 0, sumSecondFission1Head = 0, sumSecondFission1Recommend = 0;
|
|
|
+ int sumSecondFission2 = 0, sumSecondFission2Head = 0, sumSecondFission2Recommend = 0;
|
|
|
int sumThirdFirstLevel = 0;
|
|
|
- int sumThirdFission0 = 0;
|
|
|
- int sumThirdFission1 = 0;
|
|
|
- int sumThirdFission2 = 0;
|
|
|
+ int sumThirdFission0 = 0, sumThirdFission0Head = 0, sumThirdFission0Recommend = 0;
|
|
|
+ int sumThirdFission1 = 0, sumThirdFission1Head = 0, sumThirdFission1Recommend = 0;
|
|
|
+ int sumThirdFission2 = 0, sumThirdFission2Head = 0, sumThirdFission2Recommend = 0;
|
|
|
for (ArticleDetailInfo articleDetailInfo : articleDetailInfos) {
|
|
|
if (articleDetailInfo.getRecallDt().equals(minDate)) {
|
|
|
sumFirstLevel += Optional.ofNullable(articleDetailInfo.getFirstLevel()).orElse(0);
|
|
|
sumFission0 += Optional.ofNullable(articleDetailInfo.getFission0()).orElse(0);
|
|
|
+ sumFission0Head += Optional.ofNullable(articleDetailInfo.getFission0Head()).orElse(0);
|
|
|
+ sumFission0Recommend += Optional.ofNullable(articleDetailInfo.getFission0Recommend()).orElse(0);
|
|
|
sumFission1 += Optional.ofNullable(articleDetailInfo.getFission1()).orElse(0);
|
|
|
+ sumFission1Head += Optional.ofNullable(articleDetailInfo.getFission1Head()).orElse(0);
|
|
|
+ sumFission1Recommend += Optional.ofNullable(articleDetailInfo.getFission1Recommend()).orElse(0);
|
|
|
sumFission2 += Optional.ofNullable(articleDetailInfo.getFission2()).orElse(0);
|
|
|
+ sumFission2Head += Optional.ofNullable(articleDetailInfo.getFission2Head()).orElse(0);
|
|
|
+ sumFission2Recommend += Optional.ofNullable(articleDetailInfo.getFission2Recommend()).orElse(0);
|
|
|
}
|
|
|
if (articleDetailInfo.getRecallDt().equals(secondDate)) {
|
|
|
sumSecondFirstLevel += Optional.ofNullable(articleDetailInfo.getFirstLevel()).orElse(0);
|
|
|
sumSecondFission0 += Optional.ofNullable(articleDetailInfo.getFission0()).orElse(0);
|
|
|
+ sumSecondFission0Head += Optional.ofNullable(articleDetailInfo.getFission0Head()).orElse(0);
|
|
|
+ sumSecondFission0Recommend += Optional.ofNullable(articleDetailInfo.getFission0Recommend()).orElse(0);
|
|
|
sumSecondFission1 += Optional.ofNullable(articleDetailInfo.getFission1()).orElse(0);
|
|
|
+ sumSecondFission1Head += Optional.ofNullable(articleDetailInfo.getFission1Head()).orElse(0);
|
|
|
+ sumSecondFission1Recommend += Optional.ofNullable(articleDetailInfo.getFission1Recommend()).orElse(0);
|
|
|
sumSecondFission2 += Optional.ofNullable(articleDetailInfo.getFission2()).orElse(0);
|
|
|
+ sumSecondFission2Head += Optional.ofNullable(articleDetailInfo.getFission2Head()).orElse(0);
|
|
|
+ sumSecondFission2Recommend += Optional.ofNullable(articleDetailInfo.getFission2Recommend()).orElse(0);
|
|
|
}
|
|
|
if (articleDetailInfo.getRecallDt().equals(thirdDate)) {
|
|
|
sumThirdFirstLevel += Optional.ofNullable(articleDetailInfo.getFirstLevel()).orElse(0);
|
|
|
sumThirdFission0 += Optional.ofNullable(articleDetailInfo.getFission0()).orElse(0);
|
|
|
+ sumThirdFission0Head += Optional.ofNullable(articleDetailInfo.getFission0Head()).orElse(0);
|
|
|
+ sumThirdFission0Recommend += Optional.ofNullable(articleDetailInfo.getFission0Recommend()).orElse(0);
|
|
|
sumThirdFission1 += Optional.ofNullable(articleDetailInfo.getFission1()).orElse(0);
|
|
|
+ sumThirdFission1Head += Optional.ofNullable(articleDetailInfo.getFission1Head()).orElse(0);
|
|
|
+ sumThirdFission1Recommend += Optional.ofNullable(articleDetailInfo.getFission1Recommend()).orElse(0);
|
|
|
sumThirdFission2 += Optional.ofNullable(articleDetailInfo.getFission2()).orElse(0);
|
|
|
+ sumThirdFission2Head += Optional.ofNullable(articleDetailInfo.getFission2Head()).orElse(0);
|
|
|
+ sumThirdFission2Recommend += Optional.ofNullable(articleDetailInfo.getFission2Recommend()).orElse(0);
|
|
|
}
|
|
|
}
|
|
|
obj.setFirstLevel(sumFirstLevel);
|
|
|
obj.setFission0(sumFission0);
|
|
|
+ obj.setFission0Head(sumFission0Head);
|
|
|
+ obj.setFission0Recommend(sumFission0Recommend);
|
|
|
obj.setFission1(sumFission1);
|
|
|
+ obj.setFission1Head(sumFission1Head);
|
|
|
+ obj.setFission1Recommend(sumFission1Recommend);
|
|
|
obj.setFission2(sumFission2);
|
|
|
+ obj.setFission2Head(sumFission2Head);
|
|
|
+ obj.setFission2Recommend(sumFission2Recommend);
|
|
|
obj.setSecondFirstLevel(sumSecondFirstLevel);
|
|
|
obj.setSecondFission0(sumSecondFission0);
|
|
|
+ obj.setSecondFission0Head(sumSecondFission0Head);
|
|
|
+ obj.setSecondFission0Recommend(sumSecondFission0Recommend);
|
|
|
obj.setSecondFission1(sumSecondFission1);
|
|
|
+ obj.setSecondFission1Head(sumSecondFission1Head);
|
|
|
+ obj.setSecondFission1Recommend(sumSecondFission1Recommend);
|
|
|
obj.setSecondFission2(sumSecondFission2);
|
|
|
+ obj.setSecondFission2Head(sumSecondFission2Head);
|
|
|
+ obj.setSecondFission2Recommend(sumSecondFission2Recommend);
|
|
|
obj.setThirdFirstLevel(sumThirdFirstLevel);
|
|
|
obj.setThirdFission0(sumThirdFission0);
|
|
|
+ obj.setThirdFission0Head(sumThirdFission0Head);
|
|
|
+ obj.setThirdFission0Recommend(sumThirdFission0Recommend);
|
|
|
obj.setThirdFission1(sumThirdFission1);
|
|
|
+ obj.setThirdFission1Head(sumThirdFission1Head);
|
|
|
+ obj.setThirdFission1Recommend(sumThirdFission1Recommend);
|
|
|
obj.setThirdFission2(sumThirdFission2);
|
|
|
+ obj.setThirdFission2Head(sumThirdFission2Head);
|
|
|
+ obj.setThirdFission2Recommend(sumThirdFission2Recommend);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -699,8 +747,16 @@ public class DataDashboardService {
|
|
|
obj.setReadFansRate((article.getShowViewCount() * 1.0) / avgInfo.getFans());
|
|
|
}
|
|
|
}
|
|
|
- if (Objects.nonNull(obj.getFirstLevel()) && obj.getFirstLevel() > 0 && Objects.nonNull(obj.getFission0())) {
|
|
|
- obj.setFission0FirstRate((obj.getFission0() * 1.0) / obj.getFirstLevel());
|
|
|
+ if (Objects.nonNull(obj.getFirstLevel()) && obj.getFirstLevel() > 0) {
|
|
|
+ if (Objects.nonNull(obj.getFission0())) {
|
|
|
+ obj.setFission0FirstRate((obj.getFission0() * 1.0) / obj.getFirstLevel());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(obj.getFission0Head())) {
|
|
|
+ obj.setFission0HeadFirstRate((obj.getFission0Head() * 1.0) / obj.getFirstLevel());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(obj.getFission0Recommend())) {
|
|
|
+ obj.setFission0RecommendFirstRate((obj.getFission0Recommend() * 1.0) / obj.getFirstLevel());
|
|
|
+ }
|
|
|
}
|
|
|
if (article.getShowViewCount() > 0 && Objects.nonNull(obj.getFirstLevel())) {
|
|
|
obj.setFirstReadRate((obj.getFirstLevel() * 1.0) / article.getShowViewCount());
|
|
@@ -1051,7 +1107,7 @@ public class DataDashboardService {
|
|
|
.collect(Collectors.groupingBy(AccountAvgInfo::getGhId, Collectors.groupingBy(AccountAvgInfo::getUpdateTime,
|
|
|
Collectors.toMap(AccountAvgInfo::getPosition, o -> o))));
|
|
|
List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
|
|
|
- List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampLessThanAndTypeEquals(ghIds, dateEnd, ArticleTypeEnum.QUNFA.getVal());
|
|
|
+ List<Article> articleList = crawlerBaseMapper.getByGhIdInAndPublishTimestampLessThanAndTypeEquals(ghIds, dateEnd, ArticleTypeEnum.QUNFA.getVal());
|
|
|
Map<String, Article> articleMap = articleList.stream().collect(Collectors.toMap(Article::getWxSn, o -> o));
|
|
|
List<Article> todayPublish = articleList.stream().filter(o -> o.getPublishTimestamp() > dateStart).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(todayPublish)) {
|
|
@@ -1061,7 +1117,7 @@ public class DataDashboardService {
|
|
|
List<String> wxSnList = articleList.stream().map(Article::getWxSn).distinct().collect(Collectors.toList());
|
|
|
List<ArticleDetailInfo> articleDetailInfoList = new ArrayList<>();
|
|
|
for (List<String> partitions : Lists.partition(wxSnList, 1000)) {
|
|
|
- articleDetailInfoList.addAll(articleDetailInfoRepository.getAllByWxSnIn(partitions));
|
|
|
+ articleDetailInfoList.addAll(crawlerBaseMapper.getAllByWxSnIn(partitions));
|
|
|
}
|
|
|
Map<String, List<ArticleDetailInfo>> articleDetailInfoMap = articleDetailInfoList.stream()
|
|
|
.collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
|
|
@@ -1430,7 +1486,7 @@ public class DataDashboardService {
|
|
|
double score = 0.0;
|
|
|
if (Objects.nonNull(log.getScore())) {
|
|
|
JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
- if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
+ if (Objects.nonNull(scoreMap) && scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
}
|
|
|
}
|
|
@@ -1499,7 +1555,7 @@ public class DataDashboardService {
|
|
|
double score = 0.0;
|
|
|
if (Objects.nonNull(log.getScore())) {
|
|
|
JSONObject scoreMap = JSONObject.parseObject(log.getScoreMap());
|
|
|
- if (scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
+ if (Objects.nonNull(scoreMap) && scoreMap.containsKey("SimilarityStrategy")) {
|
|
|
score = scoreMap.getDoubleValue("SimilarityStrategy");
|
|
|
}
|
|
|
}
|
|
@@ -1723,6 +1779,9 @@ public class DataDashboardService {
|
|
|
item.setStrategy(publishSortLog.getStrategy());
|
|
|
item.setScore(Double.valueOf(publishSortLog.getScore()));
|
|
|
JSONObject scoreMap = JSONObject.parseObject(publishSortLog.getScoreMap());
|
|
|
+ if (Objects.isNull(scoreMap)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
item.setHisFissionFansRateRateStrategy(scoreMap.getDoubleValue("HisFissionFansRateRateStrategy"));
|
|
|
item.setHisFissionAvgReadRateRateStrategy(scoreMap.getDoubleValue("HisFissionAvgReadRateRateStrategy"));
|
|
|
item.setPublishTimesStrategy(scoreMap.getDoubleValue("PublishTimesStrategy"));
|
|
@@ -2098,19 +2157,19 @@ public class DataDashboardService {
|
|
|
Map<String, List<LongArticleCrawlerVideo>> crawlerVideoMap = crawlerVideoList.stream()
|
|
|
.collect(Collectors.groupingBy(LongArticleCrawlerVideo::getContentId));
|
|
|
List<String> contentIds = auditList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
- List<ContentPoolTypeDTO> poolTypeDTOS = aigcBaseMapper.getContentPoolType(contentIds);
|
|
|
+ List<ContentPoolTypeDTO> poolTypeDTOS = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(contentIds)) {
|
|
|
+ poolTypeDTOS = aigcBaseMapper.getContentPoolType(contentIds);
|
|
|
+ }
|
|
|
Map<String, ContentPoolTypeDTO> poolTypeMap = poolTypeDTOS.stream().collect(Collectors.toMap(ContentPoolTypeDTO::getContentId, o -> o));
|
|
|
Map<String, VideoAuditExport> map = new HashMap<>();
|
|
|
- waitingAuditPoolTypeMap.keySet().forEach(key -> {
|
|
|
+ ContentPoolEnum[] poolEnums = {ContentPoolEnum.autoArticlePoolLevel1, ContentPoolEnum.autoArticlePoolLevel3, ContentPoolEnum.autoArticlePoolLevel4};
|
|
|
+ for (ContentPoolEnum contentPool : poolEnums) {
|
|
|
VideoAuditExport videoAuditExport = new VideoAuditExport();
|
|
|
videoAuditExport.setDateStr(dateStr);
|
|
|
- videoAuditExport.setPoolType(key);
|
|
|
- map.put(key, videoAuditExport);
|
|
|
- });
|
|
|
- List<PublishSingleVideoSource> videoPoolAuditList = videoPoolRepository.getByVideoPoolAuditTimestampBetween(
|
|
|
- timestamp, timestamp + 86400000);
|
|
|
- Map<Integer, List<PublishSingleVideoSource>> videoPoolAuditMap = videoPoolAuditList.stream()
|
|
|
- .collect(Collectors.groupingBy(PublishSingleVideoSource::getFlowPoolLevel));
|
|
|
+ videoAuditExport.setPoolType(contentPool.getContentPool());
|
|
|
+ map.put(contentPool.getContentPool(), videoAuditExport);
|
|
|
+ }
|
|
|
for (LongArticleTitleAudit titleAudit : auditList) {
|
|
|
ContentPoolTypeDTO poolTypeDTO = poolTypeMap.get(titleAudit.getContentId());
|
|
|
if (!map.containsKey(poolTypeDTO.getPoolType())) {
|
|
@@ -2145,17 +2204,6 @@ public class DataDashboardService {
|
|
|
if (CollectionUtils.isNotEmpty(watingAuditList)) {
|
|
|
videoAuditExport.setWaitingAuditCount(watingAuditList.size());
|
|
|
}
|
|
|
- List<PublishSingleVideoSource> videoPoolList = videoPoolAuditMap.get(poolEnum.getValue());
|
|
|
- if (CollectionUtils.isNotEmpty(videoPoolList)) {
|
|
|
- long videoPoolAuditCount = videoPoolList.size();
|
|
|
- long videoPoolAuditPassCount = videoPoolList.stream()
|
|
|
- .filter(o -> o.getVideoPoolAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
- videoAuditExport.setVideoPoolAuditCount(videoPoolAuditCount);
|
|
|
- videoAuditExport.setVideoPoolAuditPassCount(videoPoolAuditPassCount);
|
|
|
- if (videoPoolAuditCount > 0) {
|
|
|
- videoAuditExport.setVideoPoolAuditPassRate(videoPoolAuditPassCount * 1.0 / videoPoolAuditCount);
|
|
|
- }
|
|
|
- }
|
|
|
result.add(videoAuditExport);
|
|
|
}
|
|
|
// sum
|
|
@@ -2165,9 +2213,6 @@ public class DataDashboardService {
|
|
|
long videoAuditCount = crawlerVideoList.size();
|
|
|
long videoAuditPassCount = crawlerVideoList.stream()
|
|
|
.filter(o -> o.getStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
- long videoPoolAuditCount = videoPoolAuditList.size();
|
|
|
- long videoPoolAuditPassCount = videoPoolAuditList.stream()
|
|
|
- .filter(o -> o.getVideoPoolAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
VideoAuditExport sum = new VideoAuditExport();
|
|
|
sum.setDateStr(dateStr);
|
|
|
sum.setPoolType("SUM");
|
|
@@ -2179,11 +2224,6 @@ public class DataDashboardService {
|
|
|
if (sum.getVideoAuditCount() > 0) {
|
|
|
sum.setArticleAuditPassRate(sum.getArticleAuditPassCount() * 1.0 / sum.getArticleAuditCount());
|
|
|
}
|
|
|
- sum.setVideoPoolAuditCount(videoPoolAuditCount);
|
|
|
- sum.setVideoPoolAuditPassCount(videoPoolAuditPassCount);
|
|
|
- if (sum.getVideoPoolAuditCount() > 0) {
|
|
|
- sum.setVideoPoolAuditPassRate(sum.getVideoPoolAuditPassCount() * 1.0 / sum.getVideoPoolAuditCount());
|
|
|
- }
|
|
|
result.add(sum);
|
|
|
result.sort(Comparator.comparing(VideoAuditExport::getPoolType));
|
|
|
return result;
|
|
@@ -2393,7 +2433,8 @@ public class DataDashboardService {
|
|
|
Pair.of("头条文章", "#B1E8FC"),
|
|
|
Pair.of("公众号视频", "#F8E6AB"),
|
|
|
Pair.of("好看视频", "#A9EFE6"),
|
|
|
- Pair.of("视频号视频", "#FDE2E2")))
|
|
|
+ Pair.of("视频号视频", "#FDE2E2"),
|
|
|
+ Pair.of("头条视频", "#ECE2FE")))
|
|
|
);
|
|
|
doSendFeishuSheet(dateStrList, dailyDetailSheetToken, "6aW60b", rowNum, rows,
|
|
|
3, styles, null, thank);
|
|
@@ -2405,11 +2446,20 @@ public class DataDashboardService {
|
|
|
Long end = start + 86400000;
|
|
|
Date dateStart = DateUtils.getStartDateOfDay(start / 1000);
|
|
|
Date dateEnd = DateUtils.getStartDateOfDay(end / 1000);
|
|
|
+ List<String> producePlanIds = aigcBaseMapper.getProducePlanId();
|
|
|
+ List<String> crawlerPlanIds = aigcBaseMapper.getCrawlerPlanByProducePlanIds(producePlanIds);
|
|
|
+ // 匹配
|
|
|
+ List<String> matchSuccessIdList = longArticleBaseMapper.getMatchSuccessContentId(dateStart, dateEnd);
|
|
|
+ List<String> matchIdList = longArticleBaseMapper.getMatchContentId(dateStart, dateEnd);
|
|
|
+ // 视频审核
|
|
|
+ List<LongArticleTitleAudit> videoAuditPassList = longArticleTitleAuditRepository.getByStatusAndAuditTimestampBetween(
|
|
|
+ 1, start, end);
|
|
|
+ List<LongArticleTitleAudit> videoAuditList = longArticleTitleAuditRepository.getByAuditTimestampBetween(start, end);
|
|
|
+ List<String> videoAuditPassIdList = videoAuditPassList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
+ List<String> videoAuditIdList = videoAuditList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
// 文章
|
|
|
List<ChannelEnum> channelList = Arrays.asList(ChannelEnum.wx, ChannelEnum.toutiao);
|
|
|
for (ChannelEnum channel : channelList) {
|
|
|
- List<String> producePlanIds = aigcBaseMapper.getProducePlanId();
|
|
|
- List<String> crawlerPlanIds = aigcBaseMapper.getCrawlerPlanByProducePlanIds(producePlanIds);
|
|
|
Long crawlerCount = aigcBaseMapper.getCrawlerContentCountByCrawlerPlanIdsAndChannel(crawlerPlanIds, start, end, channel.getVal());
|
|
|
Long produceCount = aigcBaseMapper.getProduceContentCountByProducePlanIdsAndChannel(producePlanIds, start, end, channel.getVal());
|
|
|
List<Integer> auditStatus = new ArrayList<>();
|
|
@@ -2417,30 +2467,22 @@ public class DataDashboardService {
|
|
|
Long produceAuditPassCount = aigcBaseMapper.getProduceAuditPassCountByProducePlanIdsAndChannel(producePlanIds, auditStatus, start, end, channel.getVal());
|
|
|
auditStatus.add(2);
|
|
|
Long produceAuditCount = aigcBaseMapper.getProduceAuditPassCountByProducePlanIdsAndChannel(producePlanIds, auditStatus, start, end, channel.getVal());
|
|
|
- List<String> matchSuccessIdList = longArticleBaseMapper.getMatchSuccessContentId(dateStart, dateEnd);
|
|
|
List<IdChannelDTO> matchSuccessList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(matchSuccessIdList)) {
|
|
|
matchSuccessList = aigcBaseMapper.getIdChannelByContentId(matchSuccessIdList);
|
|
|
}
|
|
|
- List<String> matchIdList = longArticleBaseMapper.getMatchContentId(dateStart, dateEnd);
|
|
|
List<IdChannelDTO> matchList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(matchIdList)) {
|
|
|
matchList = aigcBaseMapper.getIdChannelByContentId(matchIdList);
|
|
|
}
|
|
|
- List<LongArticleTitleAudit> videoAuditPassList = longArticleTitleAuditRepository.getByStatusAndAuditTimestampBetween(
|
|
|
- 1, start, end);
|
|
|
- List<String> videoAuditPassIdList = videoAuditPassList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
List<IdChannelDTO> videoAuditPassIdChannelList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(videoAuditPassIdList)) {
|
|
|
videoAuditPassIdChannelList = aigcBaseMapper.getIdChannelByContentId(videoAuditPassIdList);
|
|
|
}
|
|
|
- List<LongArticleTitleAudit> videoAuditList = longArticleTitleAuditRepository.getByAuditTimestampBetween(start, end);
|
|
|
- List<String> videoAuditIdList = videoAuditList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
List<IdChannelDTO> videoAuditIdChannelList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(videoAuditIdList)) {
|
|
|
videoAuditIdChannelList = aigcBaseMapper.getIdChannelByContentId(videoAuditIdList);
|
|
|
}
|
|
|
-
|
|
|
ContentGroupFunnelExport item = ContentGroupFunnelExport.getDefault();
|
|
|
item.setDateStr(dateStr);
|
|
|
item.setType("文章");
|
|
@@ -2468,19 +2510,45 @@ public class DataDashboardService {
|
|
|
result.add(item);
|
|
|
}
|
|
|
// 视频
|
|
|
- List<VideoPoolPlatformEnum> videoPoolType = Arrays.asList(VideoPoolPlatformEnum.GZH, VideoPoolPlatformEnum.HkSP, VideoPoolPlatformEnum.SPH);
|
|
|
+ List<VideoPoolPlatformEnum> videoPoolType = Arrays.asList(VideoPoolPlatformEnum.GZH, VideoPoolPlatformEnum.HkSP,
|
|
|
+ VideoPoolPlatformEnum.SPH, VideoPoolPlatformEnum.TOUTIAO);
|
|
|
for (VideoPoolPlatformEnum videoType : videoPoolType) {
|
|
|
- List<PublishSingleVideoSource> videoPoolCrawlerCount = videoPoolRepository.getByCrawlerTimestampBetweenAndPlatformAndBadStatus(
|
|
|
- start / 1000, end / 1000, videoType.getPlatform(), ArticleVideoBadStatusEnum.TITLE_DEFAULT_STATUS.getCode());
|
|
|
- List<PublishSingleVideoSource> videoPoolPQAuditCount = videoPoolRepository.getByAuditTimestampBetweenAndPlatform(
|
|
|
- start / 1000, end / 1000, videoType.getPlatform());
|
|
|
- List<PublishSingleVideoSource> videoPoolAuditList = videoPoolRepository.getByVideoPoolAuditTimestampBetweenAndPlatform(
|
|
|
- start, end, videoType.getPlatform());
|
|
|
ContentGroupFunnelExport item = ContentGroupFunnelExport.getDefault();
|
|
|
item.setDateStr(dateStr);
|
|
|
item.setType("视频");
|
|
|
item.setSource(videoType.getDescription());
|
|
|
- item.setCrawlerCount((long) videoPoolCrawlerCount.size());
|
|
|
+ long videoPoolCrawlerCount = aigcBaseMapper.getVideoPoolPlatformCrawlerCount(start, end, videoType.getPlatform());
|
|
|
+ item.setCrawlerCount(videoPoolCrawlerCount);
|
|
|
+ Long produceCount = aigcBaseMapper.getVideoPoolPlatformProduceCount(producePlanIds, start, end, videoType.getPlatform());
|
|
|
+ item.setProduceCount(produceCount);
|
|
|
+ if (item.getCrawlerCount() > 0) {
|
|
|
+ item.setProduceRate(item.getProduceCount() * 1.0 / item.getCrawlerCount());
|
|
|
+ }
|
|
|
+ List<Integer> auditStatus = new ArrayList<>();
|
|
|
+ auditStatus.add(1);
|
|
|
+ Long produceAuditPassCount = aigcBaseMapper.getVideoPoolPlatformProduceAuditPassCount(producePlanIds, auditStatus, start, end, videoType.getPlatform());
|
|
|
+ auditStatus.add(2);
|
|
|
+ Long produceAuditCount = aigcBaseMapper.getVideoPoolPlatformProduceAuditPassCount(producePlanIds, auditStatus, start, end, videoType.getPlatform());
|
|
|
+ item.setProduceAuditCount(produceAuditCount);
|
|
|
+ item.setProduceAuditPassCount(produceAuditPassCount);
|
|
|
+ if (produceAuditCount > 0) {
|
|
|
+ item.setProduceAuditPassRate(produceAuditPassCount * 1.0 / produceAuditCount);
|
|
|
+ }
|
|
|
+ List<IdPlatformDTO> matchSuccessList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(matchSuccessIdList)) {
|
|
|
+ matchSuccessList = aigcBaseMapper.getIdPlatformByContentId(matchSuccessIdList);
|
|
|
+ }
|
|
|
+ List<IdPlatformDTO> matchList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(matchIdList)) {
|
|
|
+ matchList = aigcBaseMapper.getIdPlatformByContentId(matchIdList);
|
|
|
+ }
|
|
|
+ item.setMatchCount(matchList.stream().filter(o -> o.getPlatform().equals(videoType.getPlatform())).count());
|
|
|
+ item.setMatchSuccessCount(matchSuccessList.stream().filter(o -> o.getPlatform().equals(videoType.getPlatform())).count());
|
|
|
+ if (item.getMatchCount() > 0) {
|
|
|
+ item.setMatchSuccessRate(item.getMatchSuccessCount() * 1.0 / item.getMatchCount());
|
|
|
+ }
|
|
|
+ List<PublishSingleVideoSource> videoPoolPQAuditCount = videoPoolRepository.getByAuditTimestampBetweenAndPlatform(
|
|
|
+ start / 1000, end / 1000, videoType.getPlatform());
|
|
|
item.setVideoPoolPQAuditCount((long) videoPoolPQAuditCount.size());
|
|
|
long videoPoolPQAuditPassCount = videoPoolPQAuditCount.stream()
|
|
|
.filter(o -> o.getAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
@@ -2488,32 +2556,372 @@ public class DataDashboardService {
|
|
|
if (item.getVideoPoolPQAuditCount() > 0) {
|
|
|
item.setVideoPoolPQAuditPassRate(videoPoolPQAuditPassCount * 1.0 / item.getVideoPoolPQAuditCount());
|
|
|
}
|
|
|
- item.setVideoAuditCount((long) videoPoolAuditList.size());
|
|
|
- long videoPoolAuditPassCount = videoPoolAuditList.stream()
|
|
|
- .filter(o -> o.getVideoPoolAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
- item.setVideoAuditPassCount(videoPoolAuditPassCount);
|
|
|
+ List<IdPlatformDTO> videoAuditPassIdPlatformList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(videoAuditPassIdList)) {
|
|
|
+ videoAuditPassIdPlatformList = aigcBaseMapper.getIdPlatformByContentId(videoAuditPassIdList);
|
|
|
+ }
|
|
|
+ List<IdPlatformDTO> videoAuditIdPlatformList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(videoAuditIdList)) {
|
|
|
+ videoAuditIdPlatformList = aigcBaseMapper.getIdPlatformByContentId(videoAuditIdList);
|
|
|
+ }
|
|
|
+ item.setVideoAuditCount(videoAuditIdPlatformList.stream().filter(o -> o.getPlatform().equals(videoType.getPlatform())).count());
|
|
|
+ item.setVideoAuditPassCount(videoAuditPassIdPlatformList.stream().filter(o -> o.getPlatform().equals(videoType.getPlatform())).count());
|
|
|
if (item.getVideoAuditCount() > 0) {
|
|
|
- item.setVideoAuditPassRate(videoPoolAuditPassCount * 1.0 / item.getVideoAuditCount());
|
|
|
+ item.setVideoAuditPassRate(item.getVideoAuditPassCount() * 1.0 / item.getVideoAuditCount());
|
|
|
}
|
|
|
result.add(item);
|
|
|
}
|
|
|
// sum
|
|
|
- ContentFunnelExport sum = buildContentFunnelExport(dateStr);
|
|
|
- ContentGroupFunnelExport groupSum = new ContentGroupFunnelExport();
|
|
|
- BeanUtils.copyProperties(sum, groupSum);
|
|
|
- groupSum.setType("SUM");
|
|
|
- groupSum.setSource("SUM");
|
|
|
- if (sum.getCrawlerCount() > 0) {
|
|
|
- groupSum.setProduceRate(sum.getProduceCount() * 1.0 / sum.getCrawlerCount());
|
|
|
- }
|
|
|
- groupSum.setCrawlerCount(sum.getCrawlerCount() + sum.getVideoPoolCrawlerCount());
|
|
|
- groupSum.setVideoAuditCount(sum.getVideoAuditCount() + sum.getVideoPoolAuditCount());
|
|
|
- groupSum.setVideoAuditPassCount(sum.getVideoAuditPassCount() + sum.getVideoPoolAuditPassCount());
|
|
|
- if (groupSum.getVideoAuditCount() > 0) {
|
|
|
- groupSum.setVideoAuditPassRate(groupSum.getVideoAuditPassCount() * 1.0 / groupSum.getVideoAuditCount());
|
|
|
- }
|
|
|
- result.add(groupSum);
|
|
|
+ result.add(buildContentFunnelGroupSum(dateStr, result));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private ContentGroupFunnelExport buildContentFunnelGroupSum(String dateStr, List<ContentGroupFunnelExport> result) {
|
|
|
+ ContentGroupFunnelExport sum = ContentGroupFunnelExport.getDefault();
|
|
|
+ sum.setType("SUM");
|
|
|
+ sum.setSource("SUM");
|
|
|
+ sum.setDateStr(dateStr);
|
|
|
+ for (ContentGroupFunnelExport contentGroupFunnelExport : result) {
|
|
|
+ sum.setCrawlerCount(sum.getCrawlerCount() + contentGroupFunnelExport.getCrawlerCount());
|
|
|
+ sum.setProduceCount(sum.getProduceCount() + contentGroupFunnelExport.getProduceCount());
|
|
|
+ if (sum.getCrawlerCount() > 0) {
|
|
|
+ sum.setProduceRate(sum.getProduceCount() * 1.0 / sum.getCrawlerCount());
|
|
|
+ }
|
|
|
+ sum.setProduceAuditCount(sum.getProduceAuditCount() + contentGroupFunnelExport.getProduceAuditCount());
|
|
|
+ sum.setProduceAuditPassCount(sum.getProduceAuditPassCount() + contentGroupFunnelExport.getProduceAuditPassCount());
|
|
|
+ if (sum.getProduceAuditCount() > 0) {
|
|
|
+ sum.setProduceAuditPassRate(sum.getProduceAuditPassCount() * 1.0 / sum.getProduceAuditCount());
|
|
|
+ }
|
|
|
+ sum.setMatchCount(sum.getMatchCount() + contentGroupFunnelExport.getMatchCount());
|
|
|
+ sum.setMatchSuccessCount(sum.getMatchSuccessCount() + contentGroupFunnelExport.getMatchSuccessCount());
|
|
|
+ if (sum.getMatchCount() > 0) {
|
|
|
+ sum.setMatchSuccessRate(sum.getMatchSuccessCount() * 1.0 / sum.getMatchCount());
|
|
|
+ }
|
|
|
+ sum.setVideoAuditCount(sum.getVideoAuditCount() + contentGroupFunnelExport.getVideoAuditCount());
|
|
|
+ sum.setVideoAuditPassCount(sum.getVideoAuditPassCount() + contentGroupFunnelExport.getVideoAuditPassCount());
|
|
|
+ if (sum.getVideoAuditCount() > 0) {
|
|
|
+ sum.setVideoAuditPassRate(sum.getVideoAuditPassCount() * 1.0 / sum.getVideoAuditCount());
|
|
|
+ }
|
|
|
+ sum.setVideoPoolPQAuditCount(sum.getVideoPoolPQAuditCount() + contentGroupFunnelExport.getVideoPoolPQAuditCount());
|
|
|
+ sum.setVideoPoolPQAuditPassCount(sum.getVideoPoolPQAuditPassCount() + contentGroupFunnelExport.getVideoPoolPQAuditPassCount());
|
|
|
+ if (sum.getVideoPoolPQAuditCount() > 0) {
|
|
|
+ sum.setVideoPoolPQAuditPassRate(sum.getVideoPoolPQAuditPassCount() * 1.0 / sum.getVideoPoolPQAuditCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @XxlJob("contentEffectGroupBySourceExport")
|
|
|
+ public ReturnT<String> contentEffectGroupBySourceJob(String param) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(null, null, 1);
|
|
|
+ contentEffectGroupBySource(dateStrList);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentEffectGroupBySource(String dateStr) {
|
|
|
+ if (!StringUtils.hasText(dateStr)) {
|
|
|
+ dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 1);
|
|
|
+ }
|
|
|
+ contentEffectGroupBySource(Collections.singletonList(dateStr));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentEffectGroupBySource(List<String> dateStrList) {
|
|
|
+ List<ContentEffectGroupBySourceExport> exportList = new ArrayList<>();
|
|
|
+ dateStrList = Lists.reverse(dateStrList);
|
|
|
+ for (String dateStr : dateStrList) {
|
|
|
+ exportList.addAll(buildContentEffectGroupBySourceExport(dateStr));
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isEmpty(exportList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int rowNum = exportList.size();
|
|
|
+ List<List<Object>> rows = new ArrayList<>();
|
|
|
+ Field[] fields = ContentEffectGroupBySourceExport.class.getDeclaredFields();
|
|
|
+ for (ContentEffectGroupBySourceExport datum : exportList) {
|
|
|
+ List<Object> rowDatas = new ArrayList<>();
|
|
|
+ rows.add(rowDatas);
|
|
|
+
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ try {
|
|
|
+ rowDatas.add(field.get(datum));
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ log.error("获取值出错:{}", field.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Pair<String, String>> styles = Arrays
|
|
|
+ .asList(
|
|
|
+ Pair.of("H", "0.00%"),
|
|
|
+ Pair.of("L", "0.00%"),
|
|
|
+ Pair.of("M", "0.00%"),
|
|
|
+ Pair.of("N", "0.00%"),
|
|
|
+ Pair.of("R", "0.00%"),
|
|
|
+ Pair.of("S", "0.00%"),
|
|
|
+ Pair.of("T", "0.00%")
|
|
|
+ );
|
|
|
+ List<Pair<String, List<Pair<String, String>>>> thank = Arrays
|
|
|
+ .asList(
|
|
|
+ Pair.of("B", Arrays.asList(
|
|
|
+ Pair.of("SUM", "#BACEFD"),
|
|
|
+ Pair.of("文章", "#FED4A4"),
|
|
|
+ Pair.of("视频", "#B1E8FC"),
|
|
|
+ Pair.of("文章SUM", "#F8E6AB"),
|
|
|
+ Pair.of("视频SUM", "#A9EFE6"))),
|
|
|
+ Pair.of("C", Arrays.asList(
|
|
|
+ Pair.of("SUM", "#BACEFD"),
|
|
|
+ Pair.of("公众号文章", "#FED4A4"),
|
|
|
+ Pair.of("头条文章", "#B1E8FC"),
|
|
|
+ Pair.of("公众号视频", "#F8E6AB"),
|
|
|
+ Pair.of("好看视频", "#A9EFE6"),
|
|
|
+ Pair.of("视频号视频", "#FDE2E2"),
|
|
|
+ Pair.of("头条视频", "#ECE2FE"),
|
|
|
+ Pair.of("文章SUM", "#D9F5D6"),
|
|
|
+ Pair.of("视频SUM", "#F8DEF8"))),
|
|
|
+ Pair.of("D", Arrays.asList(
|
|
|
+ Pair.of("SUM", "#BACEFD"),
|
|
|
+ Pair.of("相同", "#FED4A4"),
|
|
|
+ Pair.of("不同", "#B1E8FC")))
|
|
|
+ );
|
|
|
+ doSendFeishuSheet(dateStrList, dailyDetailSheetToken, "qvxJsD", rowNum, rows,
|
|
|
+ 2, styles, null, thank);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ContentEffectGroupBySourceExport> buildContentEffectGroupBySourceExport(String dateStr) {
|
|
|
+ List<ContentEffectGroupBySourceExport> result = buildContentEffectGroupBySource(dateStr);
|
|
|
+ Long start = DateUtils.getStartOfDay(dateStr, "yyyyMMdd");
|
|
|
+ Long end = start + 86400;
|
|
|
+ List<Article> articleList = articleRepository.getByPublishTimestampBetweenAndTypeEquals(start, end, ArticleTypeEnum.QUNFA.getVal());
|
|
|
+ List<String> wxSnList = articleList.stream().map(Article::getWxSn).collect(Collectors.toList());
|
|
|
+ List<ArticleDetailInfo> articleDetailInfoList = new ArrayList<>();
|
|
|
+ for (List<String> partitions : Lists.partition(wxSnList, 1000)) {
|
|
|
+ articleDetailInfoList.addAll(articleDetailInfoRepository.getByWxSnIn(partitions));
|
|
|
+ }
|
|
|
+ List<DatastatSortStrategy> datastatSortStrategyList = datastatSortStrategyRepository.getByWxSnIn(wxSnList);
|
|
|
+ Map<String, DatastatSortStrategy> datastatSortStrategyMap = datastatSortStrategyList.stream()
|
|
|
+ .collect(Collectors.toMap(DatastatSortStrategy::getWxSn, Function.identity()));
|
|
|
+ Map<String, List<ArticleDetailInfo>> articleDetailInfoMap = articleDetailInfoList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
|
|
|
+ // 获取rootSourceId
|
|
|
+ Map<String, List<String>> rootSourceIdMap = new HashMap<>();
|
|
|
+ List<String> rootSourceIdList = new ArrayList<>();
|
|
|
+ for (Article article : articleList) {
|
|
|
+ List<String> rootSourceIds = JSONArray.parseArray(article.getRootSourceIdList(), String.class);
|
|
|
+ rootSourceIdMap.put(article.getWxSn(), rootSourceIds);
|
|
|
+ rootSourceIdList.addAll(rootSourceIds);
|
|
|
+ }
|
|
|
+ List<LongArticlesRootSourceId> longArticlesRootSourceIdList = rootSourceIdRepository.getByRootSourceIdIn(rootSourceIdList);
|
|
|
+ Map<String, LongArticlesRootSourceId> longArticlesRootSourceIdMap = longArticlesRootSourceIdList.stream()
|
|
|
+ .collect(Collectors.toMap(LongArticlesRootSourceId::getRootSourceId, Function.identity()));
|
|
|
+ // 获取视频
|
|
|
+ List<String> contentIdList = longArticlesRootSourceIdList.stream().map(LongArticlesRootSourceId::getContentId).distinct().collect(Collectors.toList());
|
|
|
+ List<LongArticleCrawlerVideo> longArticleCrawlerVideoList = crawlerVideoRepository.getByContentIdInAndIsIllegal(contentIdList, 0);
|
|
|
+ Map<String, List<LongArticleCrawlerVideo>> longArticleCrawlerVideoMap = longArticleCrawlerVideoList.stream()
|
|
|
+ .collect(Collectors.groupingBy(LongArticleCrawlerVideo::getContentId));
|
|
|
+ for (Article article : articleList) {
|
|
|
+ boolean isVideo = false;
|
|
|
+ boolean isSameMiniProgram = false;
|
|
|
+ String source = "";
|
|
|
+ List<String> rootSourceIds = rootSourceIdMap.get(article.getWxSn());
|
|
|
+ if (CollectionUtil.isNotEmpty(rootSourceIds)) {
|
|
|
+ List<LongArticlesRootSourceId> rootSourceIdItemList = new ArrayList<>();
|
|
|
+ for (String rootSourceId : rootSourceIds) {
|
|
|
+ LongArticlesRootSourceId longArticlesRootSourceId = longArticlesRootSourceIdMap.get(rootSourceId);
|
|
|
+ if (Objects.isNull(longArticlesRootSourceId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ rootSourceIdItemList.add(longArticlesRootSourceId);
|
|
|
+ }
|
|
|
+ String contentId = rootSourceIdItemList.get(0).getContentId();
|
|
|
+ List<LongArticleCrawlerVideo> crawlerVideoList = longArticleCrawlerVideoMap.get(contentId);
|
|
|
+ List<String> videoOssPaths = crawlerVideoList.stream().map(LongArticleCrawlerVideo::getVideoOssPath)
|
|
|
+ .filter(StringUtils::hasText).collect(Collectors.toList());
|
|
|
+ List<PublishSingleVideoSource> singleVideoSources = videoPoolRepository.getByVideoOssPathIn(videoOssPaths);
|
|
|
+ if (CollectionUtil.isNotEmpty(singleVideoSources)) {
|
|
|
+ isVideo = true;
|
|
|
+ source = VideoPoolPlatformEnum.from(singleVideoSources.get(0).getPlatform()).getDescription();
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(crawlerVideoList) && crawlerVideoList.size() == 1) {
|
|
|
+ isSameMiniProgram = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ArticleDetailInfo> detailInfoList = articleDetailInfoMap.get(article.getWxSn());
|
|
|
+ DatastatSortStrategy datastatSortStrategy = datastatSortStrategyMap.get(article.getWxSn());
|
|
|
+ if (isVideo) {
|
|
|
+ addContentEffectGroupBySourceRate(article, "视频", source, isSameMiniProgram, result, detailInfoList,
|
|
|
+ datastatSortStrategy);
|
|
|
+ } else {
|
|
|
+ addContentEffectGroupBySourceRate(article, "文章", source, isSameMiniProgram, result, detailInfoList,
|
|
|
+ datastatSortStrategy);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (ContentEffectGroupBySourceExport export : result) {
|
|
|
+ setContentEffectGroupBySourceRate(export);
|
|
|
+ }
|
|
|
+
|
|
|
+ result.add(buildContentEffectGroupBySourceSum(dateStr, result));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addContentEffectGroupBySourceRate(Article article, String type, String source,
|
|
|
+ boolean isSameMiniProgram,
|
|
|
+ List<ContentEffectGroupBySourceExport> result,
|
|
|
+ List<ArticleDetailInfo> detailInfoList,
|
|
|
+ DatastatSortStrategy datastatSortStrategy) {
|
|
|
+ if (Objects.isNull(datastatSortStrategy)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ("文章".equals(type) && "".equals(source)) {
|
|
|
+ source = getArticleSource(datastatSortStrategy);
|
|
|
+ }
|
|
|
+ for (ContentEffectGroupBySourceExport export : result) {
|
|
|
+ if ((export.getType().contains("SUM") && export.getType().contains(type)) || export.getType().equals(type)) {
|
|
|
+ if ((export.getIsSameMiniprogram().equals("相同") && isSameMiniProgram)
|
|
|
+ || (export.getIsSameMiniprogram().equals("不同") && !isSameMiniProgram)
|
|
|
+ || export.getIsSameMiniprogram().equals("SUM")) {
|
|
|
+ if (export.getSource().contains("SUM") || export.getSource().equals(source)) {
|
|
|
+ if (Objects.nonNull(datastatSortStrategy.getFans())) {
|
|
|
+ export.setFansCount(export.getFansCount() + datastatSortStrategy.getFans());
|
|
|
+ }
|
|
|
+ export.setPublishContentCount(export.getPublishContentCount() + 1);
|
|
|
+ export.setReadCount(export.getReadCount() + article.getShowViewCount());
|
|
|
+ if (CollectionUtil.isNotEmpty(detailInfoList)) {
|
|
|
+ int totalFirstLevel = 0;
|
|
|
+ int totalT0Fission = 0;
|
|
|
+ int card1FirstLevel = 0;
|
|
|
+ int card1T0Fission = 0;
|
|
|
+ int card2FirstLevel = 0;
|
|
|
+ int card2T0Fission = 0;
|
|
|
+ for (ArticleDetailInfo articleDetailInfo : detailInfoList) {
|
|
|
+ if (Objects.isNull(articleDetailInfo.getFirstLevel())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (articleDetailInfo.getVideoIndex() == 1) {
|
|
|
+ card1FirstLevel += articleDetailInfo.getFirstLevel();
|
|
|
+ if (Objects.nonNull(articleDetailInfo.getFission0())) {
|
|
|
+ card1T0Fission += articleDetailInfo.getFission0();
|
|
|
+ }
|
|
|
+ } else if (articleDetailInfo.getVideoIndex() == 2) {
|
|
|
+ card2FirstLevel += articleDetailInfo.getFirstLevel();
|
|
|
+ if (Objects.nonNull(articleDetailInfo.getFission0())) {
|
|
|
+ card2T0Fission += articleDetailInfo.getFission0();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totalFirstLevel += articleDetailInfo.getFirstLevel();
|
|
|
+ if (Objects.nonNull(articleDetailInfo.getFission0())) {
|
|
|
+ totalT0Fission += articleDetailInfo.getFission0();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ export.setFirstLevel(export.getFirstLevel() + totalFirstLevel);
|
|
|
+ export.setMiniprogram1FirstLevel(export.getMiniprogram1FirstLevel() + card1FirstLevel);
|
|
|
+ export.setMiniprogram2FirstLevel(export.getMiniprogram2FirstLevel() + card2FirstLevel);
|
|
|
+ export.setT0Fission(export.getT0Fission() + totalT0Fission);
|
|
|
+ export.setMiniprogram1T0Fission(export.getMiniprogram1T0Fission() + card1T0Fission);
|
|
|
+ export.setMiniprogram2T0Fission(export.getMiniprogram2T0Fission() + card2T0Fission);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getArticleSource(DatastatSortStrategy datastatSortStrategy) {
|
|
|
+ if (StringUtils.hasText(datastatSortStrategy.getProducePlanName())
|
|
|
+ && datastatSortStrategy.getProducePlanName().contains("头条")) {
|
|
|
+ return "头条文章";
|
|
|
+ } else {
|
|
|
+ return "公众号文章";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<ContentEffectGroupBySourceExport> buildContentEffectGroupBySource(String dateStr) {
|
|
|
+ List<ContentEffectGroupBySourceExport> result = new ArrayList<>();
|
|
|
+ List<String> isSameMiniprogram = Arrays.asList("相同", "不同", "SUM");
|
|
|
+ List<String> articleSource = Arrays.asList("公众号文章", "头条文章");
|
|
|
+ List<String> videoSource = Arrays.asList("公众号视频", "好看视频", "视频号视频", "头条视频");
|
|
|
+ for (String source : articleSource) {
|
|
|
+ for (String same : isSameMiniprogram) {
|
|
|
+ ContentEffectGroupBySourceExport item = new ContentEffectGroupBySourceExport();
|
|
|
+ item.setDateStr(dateStr);
|
|
|
+ item.setType("文章");
|
|
|
+ item.setSource(source);
|
|
|
+ item.setIsSameMiniprogram(same);
|
|
|
+ result.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String same : isSameMiniprogram) {
|
|
|
+ ContentEffectGroupBySourceExport item = new ContentEffectGroupBySourceExport();
|
|
|
+ item.setDateStr(dateStr);
|
|
|
+ item.setType("文章SUM");
|
|
|
+ item.setSource("文章SUM");
|
|
|
+ item.setIsSameMiniprogram(same);
|
|
|
+ result.add(item);
|
|
|
+ }
|
|
|
+ for (String source : videoSource) {
|
|
|
+ ContentEffectGroupBySourceExport item = new ContentEffectGroupBySourceExport();
|
|
|
+ item.setDateStr(dateStr);
|
|
|
+ item.setType("视频");
|
|
|
+ item.setSource(source);
|
|
|
+ item.setIsSameMiniprogram("SUM");
|
|
|
+ result.add(item);
|
|
|
+ }
|
|
|
+ ContentEffectGroupBySourceExport item = new ContentEffectGroupBySourceExport();
|
|
|
+ item.setDateStr(dateStr);
|
|
|
+ item.setType("视频SUM");
|
|
|
+ item.setSource("视频SUM");
|
|
|
+ item.setIsSameMiniprogram("SUM");
|
|
|
+ result.add(item);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ContentEffectGroupBySourceExport buildContentEffectGroupBySourceSum(String dateStr, List<ContentEffectGroupBySourceExport> resultList) {
|
|
|
+ ContentEffectGroupBySourceExport sum = new ContentEffectGroupBySourceExport();
|
|
|
+ sum.setDateStr(dateStr);
|
|
|
+ sum.setType("SUM");
|
|
|
+ sum.setSource("SUM");
|
|
|
+ sum.setIsSameMiniprogram("SUM");
|
|
|
+ for (ContentEffectGroupBySourceExport export : resultList) {
|
|
|
+ if (export.getType().contains("SUM")
|
|
|
+ || (export.getType().equals("文章") && export.getIsSameMiniprogram().equals("SUM"))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ sum.setFansCount(sum.getFansCount() + export.getFansCount());
|
|
|
+ sum.setPublishContentCount(sum.getPublishContentCount() + export.getPublishContentCount());
|
|
|
+ sum.setReadCount(sum.getReadCount() + export.getReadCount());
|
|
|
+ sum.setFirstLevel(sum.getFirstLevel() + export.getFirstLevel());
|
|
|
+ sum.setMiniprogram1FirstLevel(sum.getMiniprogram1FirstLevel() + export.getMiniprogram1FirstLevel());
|
|
|
+ sum.setMiniprogram2FirstLevel(sum.getMiniprogram2FirstLevel() + export.getMiniprogram2FirstLevel());
|
|
|
+ sum.setT0Fission(sum.getT0Fission() + export.getT0Fission());
|
|
|
+ sum.setMiniprogram1T0Fission(sum.getMiniprogram1T0Fission() + export.getMiniprogram1T0Fission());
|
|
|
+ sum.setMiniprogram2T0Fission(sum.getMiniprogram2T0Fission() + export.getMiniprogram2T0Fission());
|
|
|
+ setContentEffectGroupBySourceRate(sum);
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setContentEffectGroupBySourceRate(ContentEffectGroupBySourceExport export) {
|
|
|
+ if (Objects.nonNull(export.getFansCount()) && export.getFansCount() > 0) {
|
|
|
+ export.setReadRate(export.getReadCount() * 1.0 / export.getFansCount());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(export.getReadCount()) && export.getReadCount() > 0) {
|
|
|
+ export.setOpenRate(export.getFirstLevel() * 1.0 / export.getReadCount());
|
|
|
+ export.setMiniprogram1OpenRate(export.getMiniprogram1FirstLevel() * 1.0 / export.getReadCount());
|
|
|
+ export.setMiniprogram2OpenRate(export.getMiniprogram2FirstLevel() * 1.0 / export.getReadCount());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(export.getFirstLevel()) && export.getFirstLevel() > 0) {
|
|
|
+ export.setT0FissionRate(export.getT0Fission() * 1.0 / export.getFirstLevel());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(export.getMiniprogram1FirstLevel()) && export.getMiniprogram1FirstLevel() > 0) {
|
|
|
+ export.setMiniprogram1T0FissionRate(export.getMiniprogram1T0Fission() * 1.0 / export.getMiniprogram1FirstLevel());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(export.getMiniprogram2FirstLevel()) && export.getMiniprogram2FirstLevel() > 0) {
|
|
|
+ export.setMiniprogram2T0FissionRate(export.getMiniprogram2T0Fission() * 1.0 / export.getMiniprogram2FirstLevel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|