Browse Source

Merge branch 'wyp/0303-contentGroupFunnel' of Server/long-article-recommend into master

wangyunpeng 4 months ago
parent
commit
3662bac3c2
13 changed files with 417 additions and 1 deletions
  1. 44 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/aigc/ChannelEnum.java
  2. 2 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/VideoPoolPlatformEnum.java
  3. 11 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/AigcBaseMapper.java
  4. 4 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java
  5. 9 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/aigc/IdChannelDTO.java
  6. 62 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ContentGroupFunnelExport.java
  7. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/LongArticleTitleAuditRepository.java
  8. 6 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/PublishSingleVideoSourceRepository.java
  9. 189 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/DataDashboardService.java
  10. 7 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/DataDashboardController.java
  11. 63 0
      long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml
  12. 12 0
      long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml
  13. 6 0
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/DataDashboardTest.java

+ 44 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/aigc/ChannelEnum.java

@@ -0,0 +1,44 @@
+package com.tzld.longarticle.recommend.server.common.enums.aigc;
+
+
+import lombok.Getter;
+
+@Getter
+public enum ChannelEnum {
+    point(-1, "内容点"),
+    xhs(1, "小红书"),
+    douyin(2, "抖音"),
+    pinterest(3, "pinterest"),
+    reddit(4, "reddit"),
+    wx(5, "公众号"),
+    toutiao(6, "头条"),
+    kuaishou(7, "快手"),
+    bilibili(8, "哔哩哔哩"),
+    wxVideoPlatform(9, "视频号"),
+    piaoquan(10, "票圈"),
+    baidu(11, "百度"),
+    algorithm(12, "算法内容库"),
+    work_wx(13, "企业微信"),
+
+    other(999, "其他");
+
+    private final int val;
+    private final String description;
+
+    ChannelEnum(int val, String description) {
+        this.val = val;
+        this.description = description;
+    }
+
+    public static ChannelEnum from(int val) {
+        for (ChannelEnum channelEnum : ChannelEnum.values()) {
+            if (channelEnum.getVal() == val) {
+                return channelEnum;
+            }
+        }
+
+        return other;
+    }
+
+
+}

+ 2 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/VideoPoolPlatformEnum.java

@@ -7,8 +7,9 @@ import java.util.Objects;
 @Getter
 public enum VideoPoolPlatformEnum {
 
-    GZH("gzh", "公众号"),
+    GZH("gzh", "公众号视频"),
     HkSP("hksp", "好看视频"),
+    SPH("sph", "视频号视频"),
     ;
 
     private final String platform;

+ 11 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/AigcBaseMapper.java

@@ -5,6 +5,7 @@ import com.tzld.longarticle.recommend.server.model.dto.CrawlerContent;
 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.aigc.BadCrawlerAccountDTO;
+import com.tzld.longarticle.recommend.server.model.dto.aigc.IdChannelDTO;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.*;
 import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
 import org.apache.ibatis.annotations.Mapper;
@@ -50,6 +51,14 @@ public interface AigcBaseMapper {
 
     Long getProduceAuditPassCountByProducePlanIds(List<String> producePlanIds, List<Integer> auditStatus, Long start, Long end);
 
+    Long getCrawlerContentCountByCrawlerPlanIdsAndChannel(List<String> crawlerPlanIds, Long start, Long end, Integer channel);
+
+    List<String> getCrawlerSuccessPlanByCrawlerPlanIdsAndChannel(List<String> crawlerPlanIds, Long start, Long end, Integer channel);
+
+    Long getProduceContentCountByProducePlanIdsAndChannel(List<String> producePlanIds, Long start, Long end, Integer channel);
+
+    Long getProduceAuditPassCountByProducePlanIdsAndChannel(List<String> producePlanIds, List<Integer> auditStatus, Long start, Long end, Integer channel);
+
     Long getProduceAuditPassCountByProducePlanIds(List<String> producePlanIds, Long start, Long end);
 
     List<String> getPlanExeIdByAccountName(List<String> accountNames);
@@ -65,4 +74,6 @@ public interface AigcBaseMapper {
     List<IdNameVO<String>> articleVideoAuditPlanFilterValue(List<String> planIds, String searchKeyword);
 
     List<String> getProduceContentTitleByPlanId(String planId);
+
+    List<IdChannelDTO> getIdChannelByContentId(List<String> idList);
 }

+ 4 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java

@@ -78,8 +78,12 @@ public interface LongArticleBaseMapper {
 
     Long countMatchSuccessCount(Date start, Date end);
 
+    List<String> getMatchSuccessContentId(Date start, Date end);
+
     Long countMatchCount(Date start, Date end);
 
+    List<String>  getMatchContentId(Date start, Date end);
+
     void batchInsertLongArticleAuditDelete(List<LongArticleAuditDelete> deleteList);
 
     List<String> getPassContentIds();

+ 9 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/aigc/IdChannelDTO.java

@@ -0,0 +1,9 @@
+package com.tzld.longarticle.recommend.server.model.dto.aigc;
+
+import lombok.Data;
+
+@Data
+public class IdChannelDTO {
+    private String id;
+    private Integer channel;
+}

+ 62 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ContentGroupFunnelExport.java

@@ -0,0 +1,62 @@
+package com.tzld.longarticle.recommend.server.model.vo;
+
+import lombok.Data;
+
+@Data
+public class ContentGroupFunnelExport {
+
+    private String dateStr;
+    private String type;
+    private Long planCrawlerCount;
+    private Long crawlerCount;
+    private Long produceCount;
+    private Long produceAuditPassCount;
+    private Long produceAuditCount;
+    private Double produceAuditPassRate;
+    private Long matchSuccessCount;
+    private Long matchCount;
+    private Double matchSuccessRate;
+    private Long videoAuditPassCount;
+    private Long videoAuditCount;
+    private Double videoAuditPassRate;
+    private Double articleAuditPassRate;
+    private Long videoPoolCrawlerCount;
+    private Long videoPoolPQAuditCount;
+    private Long videoPoolPQAuditPassCount;
+    private Double videoPoolPQAuditPassRate;
+    private Long videoPoolAuditCount;
+    private Long videoPoolAuditPassCount;
+    private Double videoPoolAuditPassRate;
+    private Double videoPoolCrawlerAuditPassRate;
+
+    public static ContentGroupFunnelExport getArticleDefault() {
+        ContentGroupFunnelExport export = new ContentGroupFunnelExport();
+        export.setProduceAuditCount(0L);
+        export.setCrawlerCount(0L);
+        export.setProduceCount(0L);
+        export.setProduceAuditPassCount(0L);
+        export.setProduceAuditCount(0L);
+        export.setProduceAuditPassRate(0.0);
+        export.setMatchSuccessCount(0L);
+        export.setMatchCount(0L);
+        export.setMatchSuccessRate(0.0);
+        export.setVideoAuditPassCount(0L);
+        export.setVideoAuditCount(0L);
+        export.setVideoAuditPassRate(0.0);
+        export.setArticleAuditPassRate(0.0);
+        return export;
+    }
+
+    public static ContentGroupFunnelExport getVideoDefault() {
+        ContentGroupFunnelExport export = new ContentGroupFunnelExport();
+        export.setVideoPoolCrawlerCount(0L);
+        export.setVideoPoolPQAuditCount(0L);
+        export.setVideoPoolPQAuditPassCount(0L);
+        export.setVideoPoolPQAuditPassRate(0.0);
+        export.setVideoPoolAuditCount(0L);
+        export.setVideoPoolAuditPassCount(0L);
+        export.setVideoPoolAuditPassRate(0.0);
+        export.setVideoPoolCrawlerAuditPassRate(0.0);
+        return export;
+    }
+}

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/LongArticleTitleAuditRepository.java

@@ -19,6 +19,8 @@ public interface LongArticleTitleAuditRepository extends JpaRepository<LongArtic
 
     long countByStatusAndAuditTimestampBetween(Integer status, Long start, Long end);
 
+    List<LongArticleTitleAudit> getByStatusAndAuditTimestampBetween(Integer status, Long start, Long end);
+
     List<LongArticleTitleAudit> getByContentIdIn(List<String> sourceIds);
 
     List<LongArticleTitleAudit> getByAuditTimestampBetween(Long start, Long end);

+ 6 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/PublishSingleVideoSourceRepository.java

@@ -18,7 +18,13 @@ public interface PublishSingleVideoSourceRepository extends JpaRepository<Publis
 
     List<PublishSingleVideoSource> getByCrawlerTimestampBetween(Long start, Long end);
 
+    List<PublishSingleVideoSource> getByCrawlerTimestampBetweenAndPlatform(Long start, Long end, String platform);
+
     List<PublishSingleVideoSource> getByAuditTimestampBetween(Long start, Long end);
 
+    List<PublishSingleVideoSource> getByAuditTimestampBetweenAndPlatform(Long start, Long end, String platform);
+
     List<PublishSingleVideoSource> getByVideoPoolAuditTimestampBetween(Long start, Long end);
+
+    List<PublishSingleVideoSource> getByVideoPoolAuditTimestampBetweenAndPlatform(Long start, Long end, String platform);
 }

+ 189 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/DataDashboardService.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.google.common.collect.Lists;
 import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.ChannelEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProduceContentAuditStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
@@ -22,6 +23,7 @@ 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.entity.aigc.*;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
@@ -47,6 +49,7 @@ 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.*;
@@ -2295,4 +2298,190 @@ public class DataDashboardService {
         return result;
     }
 
+    @XxlJob("contentGroupFunnelExport")
+    public ReturnT<String> contentGroupFunnelExportJob(String param) {
+        List<String> dateStrList = DateUtils.getBeforeDays(null, null, 1);
+        contentGroupFunnelExport(dateStrList);
+        return ReturnT.SUCCESS;
+    }
+
+    public void contentGroupFunnelExport(String dateStr) {
+        if (!StringUtils.hasText(dateStr)) {
+            dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 1);
+        }
+        contentGroupFunnelExport(Collections.singletonList(dateStr));
+    }
+
+    public void contentGroupFunnelExport(List<String> dateStrList) {
+        List<ContentGroupFunnelExport> exportList = new ArrayList<>();
+        dateStrList = Lists.reverse(dateStrList);
+        for (String dateStr : dateStrList) {
+            exportList.addAll(buildContentGroupFunnelExport(dateStr));
+        }
+        if (CollectionUtil.isEmpty(exportList)) {
+            return;
+        }
+        int rowNum = exportList.size();
+        List<List<Object>> rows = new ArrayList<>();
+        Field[] fields = ContentGroupFunnelExport.class.getDeclaredFields();
+        for (ContentGroupFunnelExport 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("K", "0.00%"),
+                        Pair.of("N", "0.00%"),
+                        Pair.of("O", "0.00%"),
+                        Pair.of("S", "0.00%"),
+                        Pair.of("V", "0.00%"),
+                        Pair.of("W", "0.00%")
+                );
+        doSendFeishuSheet(dateStrList, dailyDetailSheetToken, "tP33UK", rowNum, rows,
+                2, styles, null);
+    }
+
+    private List<ContentGroupFunnelExport> buildContentGroupFunnelExport(String dateStr) {
+        List<ContentGroupFunnelExport> result = new ArrayList<>();
+        Long start = DateUtils.getStartOfDay(dateStr, "yyyyMMdd") * 1000;
+        Long end = start + 86400000;
+        Date dateStart = DateUtils.getStartDateOfDay(start / 1000);
+        Date dateEnd = DateUtils.getStartDateOfDay(end / 1000);
+        // sum
+        ContentFunnelExport sum = buildContentFunnelExport(dateStr);
+        ContentGroupFunnelExport groupSum = new ContentGroupFunnelExport();
+        BeanUtils.copyProperties(sum, groupSum);
+        groupSum.setType("SUM");
+        result.add(groupSum);
+        // 文章
+        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 planCrawlerCount = 0L;
+            List<String> crawlerSuccessPlanIds = aigcBaseMapper.getCrawlerSuccessPlanByCrawlerPlanIdsAndChannel(crawlerPlanIds, start, end, channel.getVal());
+            if (CollectionUtils.isNotEmpty(crawlerSuccessPlanIds)) {
+                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.getProduceContentCountByProducePlanIdsAndChannel(producePlanIds, start, end, channel.getVal());
+            List<Integer> auditStatus = new ArrayList<>();
+            auditStatus.add(1);
+            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.getArticleDefault();
+            item.setDateStr(dateStr);
+            item.setType(channel.getDescription() + "文章");
+            item.setPlanCrawlerCount(planCrawlerCount);
+            item.setCrawlerCount(crawlerCount);
+            item.setProduceCount(produceCount);
+            item.setProduceAuditPassCount(produceAuditPassCount);
+            item.setProduceAuditCount(produceAuditCount);
+            if (produceAuditCount > 0) {
+                item.setProduceAuditPassRate(produceAuditPassCount * 1.0 / produceAuditCount);
+            }
+            item.setMatchSuccessCount(matchSuccessList.stream().filter(o -> o.getChannel().equals(channel.getVal())).count());
+            item.setMatchCount(matchList.stream().filter(o -> o.getChannel().equals(channel.getVal())).count());
+            if (item.getMatchCount() > 0) {
+                item.setMatchSuccessRate(item.getMatchSuccessCount() * 1.0 / item.getMatchCount());
+            }
+            item.setVideoAuditPassCount(videoAuditPassIdChannelList.stream().filter(o -> o.getChannel().equals(channel.getVal())).count());
+            item.setVideoAuditCount(videoAuditIdChannelList.stream().filter(o -> o.getChannel().equals(channel.getVal())).count());
+            if (item.getVideoAuditCount() > 0) {
+                item.setVideoAuditPassRate(item.getVideoAuditPassCount() * 1.0 / item.getVideoAuditCount());
+            }
+            if (item.getProduceCount() > 0) {
+                item.setArticleAuditPassRate(item.getVideoAuditPassCount() * 1.0 / item.getProduceCount());
+            }
+            result.add(item);
+        }
+        // 视频
+        List<VideoPoolPlatformEnum> videoPoolType = Arrays.asList(VideoPoolPlatformEnum.GZH, VideoPoolPlatformEnum.HkSP, VideoPoolPlatformEnum.SPH);
+        for (VideoPoolPlatformEnum videoType : videoPoolType) {
+            List<PublishSingleVideoSource> videoPoolCrawlerCount = videoPoolRepository.getByCrawlerTimestampBetweenAndPlatform(
+                    start / 1000, end / 1000, videoType.getPlatform());
+            List<PublishSingleVideoSource> videoPoolPQAuditCount = videoPoolRepository.getByAuditTimestampBetweenAndPlatform(
+                    start / 1000, end / 1000, videoType.getPlatform());
+            List<PublishSingleVideoSource> videoPoolAuditList = videoPoolRepository.getByVideoPoolAuditTimestampBetweenAndPlatform(
+                    start, end, videoType.getPlatform());
+
+            ContentGroupFunnelExport item = ContentGroupFunnelExport.getVideoDefault();
+            item.setDateStr(dateStr);
+            item.setType(videoType.getDescription());
+            item.setVideoPoolCrawlerCount((long) videoPoolCrawlerCount.size());
+            item.setVideoPoolPQAuditCount((long) videoPoolPQAuditCount.size());
+            long videoPoolPQAuditPassCount = videoPoolPQAuditCount.stream()
+                    .filter(o -> o.getAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
+            item.setVideoPoolPQAuditPassCount(videoPoolPQAuditPassCount);
+            if (item.getVideoPoolPQAuditCount() > 0) {
+                item.setVideoPoolPQAuditPassRate(videoPoolPQAuditPassCount * 1.0 / item.getVideoPoolPQAuditCount());
+            }
+            item.setVideoPoolAuditCount((long) videoPoolAuditList.size());
+            long videoPoolAuditPassCount = videoPoolAuditList.stream()
+                    .filter(o -> o.getVideoPoolAuditStatus().equals(ProduceContentAuditStatusEnum.pass.getVal())).count();
+            item.setVideoPoolAuditPassCount(videoPoolAuditPassCount);
+            if (item.getVideoPoolAuditCount() > 0) {
+                item.setVideoPoolAuditPassRate(videoPoolAuditPassCount * 1.0 / item.getVideoPoolAuditCount());
+            }
+            if (item.getVideoPoolCrawlerCount() > 0) {
+                item.setVideoPoolCrawlerAuditPassRate(videoPoolAuditPassCount * 1.0 / item.getVideoPoolCrawlerCount());
+            }
+            result.add(item);
+        }
+        return result;
+    }
+
 }

+ 7 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/DataDashboardController.java

@@ -64,6 +64,13 @@ public class DataDashboardController {
         }).start();
     }
 
+    @GetMapping("/export/contentGroupFunnel")
+    public void contentGroupFunnelExport(String dateStr) {
+        new Thread(() -> {
+            service.contentGroupFunnelExport(dateStr);
+        }).start();
+    }
+
     @GetMapping("/export/dailySafeScore")
     public void dailySafeScore(String dateStr) {
         new Thread(() -> {

+ 63 - 0
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -166,6 +166,18 @@
         and create_timestamp between #{start} and #{end}
     </select>
 
+    <select id="getCrawlerContentCountByCrawlerPlanIdsAndChannel" resultType="java.lang.Long">
+        select count(1)
+        from crawler_plan_result_rel cprr
+        join crawler_content cc on cprr.channel_source_id = cc.channel_content_id
+        where cprr.plan_id in
+        <foreach collection="crawlerPlanIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and cprr.create_timestamp between #{start} and #{end}
+        and cc.channel = #{channel}
+    </select>
+
     <select id="getCrawlerSuccessPlanByCrawlerPlanIds" resultType="java.lang.String">
         select distinct plan_id
         from crawler_plan_result_rel
@@ -176,6 +188,18 @@
         and create_timestamp between #{start} and #{end}
     </select>
 
+    <select id="getCrawlerSuccessPlanByCrawlerPlanIdsAndChannel" resultType="java.lang.String">
+        select distinct cprr.plan_id
+        from crawler_plan_result_rel cprr
+        join crawler_content cc on cprr.channel_source_id = cc.channel_content_id
+        where cprr.plan_id in
+        <foreach collection="crawlerPlanIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and cprr.create_timestamp between #{start} and #{end}
+        and cc.channel = #{channel}
+    </select>
+
     <select id="getProduceContentCountByProducePlanIds" resultType="java.lang.Long">
         select count(1)
         from produce_plan_exe_record
@@ -186,6 +210,18 @@
         and produce_timestamp between #{start} and #{end}
     </select>
 
+    <select id="getProduceContentCountByProducePlanIdsAndChannel" resultType="java.lang.Long">
+        select count(1)
+        from produce_plan_exe_record pper
+        join crawler_content cc on pper.channel_content_id = cc.channel_content_id
+        where pper.plan_id in
+        <foreach collection="producePlanIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and pper.produce_timestamp between #{start} and #{end}
+        and cc.channel = #{channel}
+    </select>
+
     <select id="getProduceAuditPassCountByProducePlanIds" resultType="java.lang.Long">
         select count(1)
         from produce_plan_exe_record
@@ -200,6 +236,22 @@
         and audit_timestamp between #{start} and #{end}
     </select>
 
+    <select id="getProduceAuditPassCountByProducePlanIdsAndChannel" resultType="java.lang.Long">
+        select count(1)
+        from produce_plan_exe_record pper
+        join crawler_content cc on pper.channel_content_id = cc.channel_content_id
+        where pper.plan_id in
+        <foreach collection="producePlanIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and pper.audit_status in
+        <foreach collection="auditStatus" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and pper.audit_timestamp between #{start} and #{end}
+        and cc.channel = #{channel}
+    </select>
+
     <select id="getPlanExeIdByAccountName" resultType="java.lang.String">
         select plan_exe_id
         from produce_plan_exe_record
@@ -290,4 +342,15 @@
           and output.produce_module_type = 3
     </select>
 
+    <select id="getIdChannelByContentId"
+            resultType="com.tzld.longarticle.recommend.server.model.dto.aigc.IdChannelDTO">
+        select pper.plan_exe_id as id, cc.channel
+        from produce_plan_exe_record pper
+        join crawler_content cc on pper.channel_content_id = cc.channel_content_id
+        where pper.plan_exe_id in
+        <foreach collection="idList" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

+ 12 - 0
long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml

@@ -277,12 +277,24 @@
         where start_processing_time between #{start} and #{end} and result_status = 1
     </select>
 
+    <select id="getMatchSuccessContentId" resultType="java.lang.String">
+        select content_id
+        from long_articles_text
+        where start_processing_time between #{start} and #{end} and result_status = 1
+    </select>
+
     <select id="countMatchCount" resultType="java.lang.Long">
         select count(content_id)
         from long_articles_text
         where start_processing_time between #{start} and #{end}
     </select>
 
+    <select id="getMatchContentId" resultType="java.lang.String">
+        select content_id
+        from long_articles_text
+        where start_processing_time between #{start} and #{end}
+    </select>
+
     <select id="getPassContentIds" resultType="java.lang.String">
         select content_id from long_articles_title_audit where status = 1 limit 100
     </select>

+ 6 - 0
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/DataDashboardTest.java

@@ -57,4 +57,10 @@ public class DataDashboardTest {
         dataDashboardService.contentFunnelExport(dateStrList);
     }
 
+    @Test
+    public void contentGroupFunnelExport() {
+        List<String> dateStrList = DateUtils.getBeforeDays(null, null, 40);
+        dataDashboardService.contentGroupFunnelExport(dateStrList);
+    }
+
 }