|
@@ -96,6 +96,8 @@ public class DataDashboardService {
|
|
|
private LongArticleTitleAuditRepository titleAuditRepository;
|
|
|
@Autowired
|
|
|
private LongArticleCrawlerVideoRepository crawlerVideoRepository;
|
|
|
+ @Autowired
|
|
|
+ private LongArticleTitleAuditRepository longArticleTitleAuditRepository;
|
|
|
|
|
|
@ApolloJsonValue("${export.account.ghId:[]}")
|
|
|
private static List<String> ghIdList;
|
|
@@ -2010,7 +2012,7 @@ public class DataDashboardService {
|
|
|
List<LongArticleTitleAudit> auditList = titleAuditRepository.getByAuditTimestampBetween(timestamp, timestamp + 86400000);
|
|
|
List<LongArticleCrawlerVideo> crawlerVideoList = crawlerVideoRepository.getByAuditTimestampBetween(timestamp, timestamp + 86400000);
|
|
|
Map<String, List<LongArticleCrawlerVideo>> crawlerVideoMap = crawlerVideoList.stream()
|
|
|
- .collect(Collectors.groupingBy(LongArticleCrawlerVideo::getContentId));
|
|
|
+ .collect(Collectors.groupingBy(LongArticleCrawlerVideo::getContentId));
|
|
|
List<String> contentIds = auditList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
List<ContentPoolTypeDTO> poolTypeDTOS = aigcBaseMapper.getContentPoolType(contentIds);
|
|
|
Map<String, ContentPoolTypeDTO> poolTypeMap = poolTypeDTOS.stream().collect(Collectors.toMap(ContentPoolTypeDTO::getContentId, o -> o));
|
|
@@ -2034,7 +2036,7 @@ public class DataDashboardService {
|
|
|
}
|
|
|
videoAuditExport.setVideoAuditCount(videoAuditExport.getVideoAuditCount() + videoList.size());
|
|
|
long videoAuditPassCount = videoList.stream()
|
|
|
- .filter(o -> o.getStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
+ .filter(o -> o.getStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
|
|
|
videoAuditExport.setVideoAuditPassCount(videoAuditExport.getVideoAuditPassCount() + videoAuditPassCount);
|
|
|
}
|
|
|
for (Map.Entry<String, VideoAuditExport> entry : map.entrySet()) {
|
|
@@ -2061,4 +2063,93 @@ public class DataDashboardService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @XxlJob("contentFunnelExport")
|
|
|
+ public ReturnT<String> contentFunnelExportJob(String param) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(null, null, 1);
|
|
|
+ contentFunnelExport(dateStrList);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentFunnelExport(String dateStr) {
|
|
|
+ if (!StringUtils.hasText(dateStr)) {
|
|
|
+ dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 1);
|
|
|
+ }
|
|
|
+ contentFunnelExport(Collections.singletonList(dateStr));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentFunnelExport(List<String> dateStrList) {
|
|
|
+ List<ContentFunnelExport> exportList = new ArrayList<>();
|
|
|
+ dateStrList = Lists.reverse(dateStrList);
|
|
|
+ for (String dateStr : dateStrList) {
|
|
|
+ exportList.add(buildContentFunnelExport(dateStr));
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isEmpty(exportList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int rowNum = exportList.size();
|
|
|
+ List<List<Object>> rows = new ArrayList<>();
|
|
|
+ Field[] fields = ContentFunnelExport.class.getDeclaredFields();
|
|
|
+ for (ContentFunnelExport 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ doSendFeishuSheet(dateStrList, dailyDetailSheetToken, "qEipyL", rowNum, rows,
|
|
|
+ 2, null, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ContentFunnelExport buildContentFunnelExport(String dateStr) {
|
|
|
+ ContentFunnelExport result = new ContentFunnelExport();
|
|
|
+ Long start = DateUtils.getStartOfDay(dateStr, "yyyyMMdd") * 1000;
|
|
|
+ Long end = start + 86400000;
|
|
|
+ List<String> producePlanIds = aigcBaseMapper.getProducePlanId();
|
|
|
+ List<String> crawlerPlanIds = aigcBaseMapper.getCrawlerPlanByProducePlanIds(producePlanIds);
|
|
|
+ Long crawlerCount = aigcBaseMapper.getCrawlerContentCountByCrawlerPlanIds(crawlerPlanIds, start, end);
|
|
|
+ Long planCrawlerCount = 0L;
|
|
|
+ List<String> crawlerSuccessPlanIds = aigcBaseMapper.getCrawlerSuccessPlanByCrawlerPlanIds(crawlerPlanIds, start, end);
|
|
|
+ List<CrawlerPlan> crawlerPlanList = aigcBaseMapper.getCrawlerPlanByPlanIds(crawlerSuccessPlanIds);
|
|
|
+ for (CrawlerPlan crawlerPlan : crawlerPlanList) {
|
|
|
+ JSONObject crawlerModeValue = JSONObject.parseObject(crawlerPlan.getCrawlerModeValue());
|
|
|
+ if (crawlerModeValue == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject sourceModeValues = crawlerModeValue.getJSONObject("sourceModeValues");
|
|
|
+ if (sourceModeValues == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONArray inputModeValues = sourceModeValues.getJSONArray("inputModeValues");
|
|
|
+ if (inputModeValues == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ planCrawlerCount += inputModeValues.size();
|
|
|
+ }
|
|
|
+ Long produceCount = aigcBaseMapper.getProduceContentCountByProducePlanIds(producePlanIds, start, end);
|
|
|
+ Long produceAuditPassCount = aigcBaseMapper.getProduceAuditPassCountByProducePlanIds(producePlanIds, start, end);
|
|
|
+ Date dateStart = DateUtils.getStartDateOfDay(start / 1000);
|
|
|
+ Date dateEnd = DateUtils.getStartDateOfDay(end / 1000);
|
|
|
+ Long matchSuccessCount = longArticleBaseMapper.countMatchSuccessCount(dateStart, dateEnd);
|
|
|
+ Long videoAuditPassCount = longArticleTitleAuditRepository.countByStatusAndAuditTimestampBetween(
|
|
|
+ 1, start, end);
|
|
|
+
|
|
|
+ result.setDateStr(dateStr);
|
|
|
+ result.setPlanCrawlerCount(planCrawlerCount);
|
|
|
+ result.setCrawlerCount(crawlerCount);
|
|
|
+ result.setProduceCount(produceCount);
|
|
|
+ result.setProduceAuditPassCount(produceAuditPassCount);
|
|
|
+ result.setMatchSuccessCount(matchSuccessCount);
|
|
|
+ result.setVideoAuditPassCount(videoAuditPassCount);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|