Bladeren bron

Merge branch 'master' into dev-xym-add-match-video

xueyiming 2 weken geleden
bovenliggende
commit
073a0c17f9
76 gewijzigde bestanden met toevoegingen van 1790 en 348 verwijderingen
  1. 32 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/aigc/MiniprogramUseTypeEnum.java
  2. 30 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/PublishSingleVideoSourceStatusEnum.java
  3. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/VideoPoolPlatformEnum.java
  4. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/recommend/RankStrategyEnum.java
  5. 10 4
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/AigcBaseMapper.java
  6. 7 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/PublishContentMapper.java
  7. 3 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/crawler/CrawlerBaseMapper.java
  8. 1 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/ArticleCategoryMapper.java
  9. 4 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java
  10. 15 7
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/VideoPoolAuditMapper.java
  11. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/Content.java
  12. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/ContentHisPublishArticle.java
  13. 9 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/aigc/IdPlatformDTO.java
  14. 12 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/crawler/ArticleDetailInfo.java
  15. 41 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/Account.java
  16. 3 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/AccountCategory.java
  17. 6 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/ArticleCategory.java
  18. 41 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/DatastatSortStrategy.java
  19. 34 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/IllegalArticles.java
  20. 3 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/PublishSingleVideoSource.java
  21. 90 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/VideoContentUnderstanding.java
  22. 43 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/VideoEndScreenTransformationTask.java
  23. 10 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoPoolAuditDataParam.java
  24. 3 2
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoPoolAuditListParam.java
  25. 10 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoSynopsisUpdateParam.java
  26. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ArticleVideoPoolSourceVO.java
  27. 27 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ContentEffectGroupBySourceExport.java
  28. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/NewSortStrategyExport.java
  29. 0 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/VideoAuditExport.java
  30. 11 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/VideoPoolAuditDataVO.java
  31. 3 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/DeepSeekApiService.java
  32. 5 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCProducePlanSaveService.java
  33. 29 26
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCWaitingPublishContentService.java
  34. 1 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleDetailInfoRepository.java
  35. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleRepository.java
  36. 2 2
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/AccountCategoryRepository.java
  37. 15 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/AccountRepository.java
  38. 8 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/ArticleCategoryRepository.java
  39. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/DatastatScoreRepository.java
  40. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/DatastatSortStrategyRepository.java
  41. 10 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/IllegalArticlesRepository.java
  42. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/LongArticleCrawlerVideoRepository.java
  43. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/PublishSingleVideoSourceRepository.java
  44. 13 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/VideoContentUnderstandingRepository.java
  45. 12 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/ArticleVideoPoolService.java
  46. 93 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java
  47. 6 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java
  48. 21 15
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleCategoryService.java
  49. 24 5
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticlePromotionService.java
  50. 11 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleVideoAuditService.java
  51. 494 86
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/DataDashboardService.java
  52. 7 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/RecommendService.java
  53. 135 63
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/VideoPoolAuditService.java
  54. 11 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/filter/strategy/ArticlePromotionStrategy.java
  55. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankParam.java
  56. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankStrategy.java
  57. 5 5
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/FwhColdStartRankStrategy.java
  58. 23 4
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV15Strategy.java
  59. 3 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV5Strategy.java
  60. 75 58
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java
  61. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/ScoreParam.java
  62. 5 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/CategoryStrategy.java
  63. 20 2
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/HisFissionDeWeightAvgReadSumRateStrategy.java
  64. 5 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/XxlJobController.java
  65. 7 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/DataDashboardController.java
  66. 18 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/VideoPoolAuditController.java
  67. 51 1
      long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml
  68. 32 0
      long-article-recommend-service/src/main/resources/mapper/aigc/PublishContentMapper.xml
  69. 14 1
      long-article-recommend-service/src/main/resources/mapper/crawler/CrawlerBaseMapper.xml
  70. 4 3
      long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleCategoryMapper.xml
  71. 46 22
      long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml
  72. 28 6
      long-article-recommend-service/src/main/resources/mapper/longArticle/VideoPoolAuditMapper.xml
  73. 43 4
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/ArticleVideoAuditTest.java
  74. 44 0
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/DataDashboardTest.java
  75. 1 2
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/RecommendTest.java
  76. 1 1
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/XxlJobTest.java

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

@@ -0,0 +1,32 @@
+package com.tzld.longarticle.recommend.server.common.enums.aigc;
+
+import lombok.Getter;
+
+@Getter
+public enum MiniprogramUseTypeEnum {
+    Default(1, "自然流"),
+    Touliu(2, "投流"),
+    Qiwei(3, "企微"),
+    Daitou(4, "代投"),
+    GzhDaixuan(5, "公众号合作代选"),
+    ;
+
+
+    private final int val;
+    private final String description;
+
+    MiniprogramUseTypeEnum(int val, String description) {
+        this.val = val;
+        this.description = description;
+    }
+
+    public static MiniprogramUseTypeEnum from(int val) {
+        for (MiniprogramUseTypeEnum typeEnum : MiniprogramUseTypeEnum.values()) {
+            if (typeEnum.getVal() == val) {
+                return typeEnum;
+            }
+        }
+
+        return Default;
+    }
+}

+ 30 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/PublishSingleVideoSourceStatusEnum.java

@@ -0,0 +1,30 @@
+package com.tzld.longarticle.recommend.server.common.enums.longArticle;
+
+import lombok.Getter;
+
+@Getter
+public enum PublishSingleVideoSourceStatusEnum {
+
+    DEFAULT(0, "初始"),
+    PROCESSING(1, "处理中"),
+    SUCCESS(2, "处理完成"),
+    FAIL(3, "处理失败"),
+    ;
+
+    private final int code;
+    private final String msg;
+
+    PublishSingleVideoSourceStatusEnum(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public static PublishSingleVideoSourceStatusEnum getByCode(int code) {
+        for (PublishSingleVideoSourceStatusEnum statusEnum : PublishSingleVideoSourceStatusEnum.values()) {
+            if (statusEnum.getCode() == code) {
+                return statusEnum;
+            }
+        }
+        return null;
+    }
+}

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

@@ -10,6 +10,7 @@ public enum VideoPoolPlatformEnum {
     GZH("gzh", "公众号视频"),
     HkSP("hksp", "好看视频"),
     SPH("sph", "视频号视频"),
+    TOUTIAO("toutiao", "头条视频"),
     ;
 
     private final String platform;

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/recommend/RankStrategyEnum.java

@@ -28,6 +28,7 @@ public enum RankStrategyEnum {
     LATE_STRATEGY("ArticleRankLate", "晚间策略", "lateRankStrategy"),
     RANDOM_STRATEGY("ArticleRankRandom", "随机策略", "randomRankStrategy"),
     DEFAULT_STRATEGY("ArticleRankV1", "默认策略", "defaultRankStrategy"),
+    FWH_STRATEGY("FwhStrategy", "服务号策略", "fwhColdStartRankStrategy"),
     ;
 
     private final String strategy;

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

@@ -1,11 +1,9 @@
 package com.tzld.longarticle.recommend.server.mapper.aigc;
 
-import com.tzld.longarticle.recommend.server.model.dto.ContentPoolTypeDTO;
-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.*;
 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.dto.aigc.IdPlatformDTO;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.*;
 import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
 import org.apache.ibatis.annotations.Mapper;
@@ -78,4 +76,12 @@ public interface AigcBaseMapper {
     List<IdChannelDTO> getIdChannelByContentId(List<String> idList);
 
     List<String> getTodaySpecialAdAccountNames(String dateStr);
+
+    Long getVideoPoolPlatformCrawlerCount(Long start, Long end, String platform);
+
+    Long getVideoPoolPlatformProduceCount(List<String> producePlanIds, Long start, Long end, String platform);
+
+    Long getVideoPoolPlatformProduceAuditPassCount(List<String> producePlanIds, List<Integer> auditStatus, Long start, Long end, String platform);
+
+    List<IdPlatformDTO> getIdPlatformByContentId(List<String> idList);
 }

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.mapper.aigc;
 
 import com.tzld.longarticle.recommend.server.model.dto.*;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.*;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.Account;
 import com.tzld.longarticle.recommend.server.model.param.MiniprogramTaskParam;
 import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
 import org.apache.ibatis.annotations.Mapper;
@@ -56,4 +57,10 @@ public interface PublishContentMapper {
     void updatePublishContentSingleMiniProgram(List<String> publishContentIds);
 
     void updatePublishContentStatus(String sourceId, Integer status, Integer oldStatus);
+
+    List<String> getPublishAccountIds();
+
+    List<Account> getAccountByIds(List<String> accountIds);
+
+    List<PublishPlanMiniprogramTask> getAccountMiniprogramTaskList(String id);
 }

+ 3 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/crawler/CrawlerBaseMapper.java

@@ -5,6 +5,7 @@ import com.tzld.longarticle.recommend.server.model.dto.GetOffVideos;
 import com.tzld.longarticle.recommend.server.model.dto.LongArticlesVideoDTO;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountCorrelation;
+import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesText;
@@ -46,4 +47,6 @@ public interface CrawlerBaseMapper {
 
     List<AccountAvgInfo> getAllByGhIdIn(Set<String> ghIdList);
 
+    List<Article> getByGhIdInAndPublishTimestampLessThanAndTypeEquals(List<String> ghIds, Long publishTimestamp, String type);
+
 }

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/ArticleCategoryMapper.java

@@ -20,5 +20,5 @@ public interface ArticleCategoryMapper {
 
     void updateDatastatScoreCategory(String title, String category);
 
-    List<PublishSingleVideoSource> getVideoPoolArticleCategoryDealList();
+    List<PublishSingleVideoSource> getVideoPoolArticleCategoryDealList(Integer version);
 }

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

@@ -89,4 +89,8 @@ public interface LongArticleBaseMapper {
     List<String> getPassContentIds();
 
     List<DatastatSortStrategy> getTopContent(String dateStr);
+
+    VideoEndScreenTransformationTask getVideoEndScreenTransformationTask(Long videoOriginId);
+
+    void saveVideoEndScreenTransformationTask(VideoEndScreenTransformationTask task);
 }

+ 15 - 7
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/VideoPoolAuditMapper.java

@@ -3,9 +3,11 @@ package com.tzld.longarticle.recommend.server.mapper.longArticle;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
 import com.tzld.longarticle.recommend.server.model.param.ListItemFilterOrderParam;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.ArticleTitleUpdateParam;
+import com.tzld.longarticle.recommend.server.model.param.videoAudit.VideoSynopsisUpdateParam;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.VideoTitleUpdateParam;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.Date;
 import java.util.List;
 
 @Mapper
@@ -21,14 +23,15 @@ public interface VideoPoolAuditMapper {
                                                          ListItemFilterOrderParam auditTimestamp,
                                                          int offset, Integer pageSize, String poolLevelDesc);
 
-    PublishSingleVideoSource articleVideoAuditNext(List<String> contentId, List<Integer> status,
-                                                   List<String> title, List<String> auditAccount,
-                                                   Integer flowPoolLevel, List<String> excludeContentIds);
+    List<PublishSingleVideoSource> articleVideoAuditNext(List<String> contentId, List<Integer> status,
+                                                         List<String> title, List<String> auditAccount,
+                                                         Integer flowPoolLevel, List<String> excludeContentIds,
+                                                         Integer limit);
 
-    List<PublishSingleVideoSource> articleVideoWatingAuditList(List<Integer> status,
-                                                               List<Integer> flowPoolLevels,
-                                                               List<String> excludeContentIds,
-                                                               Integer size);
+    List<PublishSingleVideoSource> articleVideoWaitingAuditList(List<Integer> status,
+                                                                List<Integer> flowPoolLevels,
+                                                                List<String> excludeContentIds,
+                                                                Integer size);
 
     List<String> searchFilterValueByItemName(String itemName, String searchKeyword);
 
@@ -36,4 +39,9 @@ public interface VideoPoolAuditMapper {
 
     void updateVideoTitle(VideoTitleUpdateParam param, Long updateTime);
 
+    void updateArticleSynopsis(VideoSynopsisUpdateParam param, Date updateTime);
+
+    List<PublishSingleVideoSource> articleVideoAuditCount(String accountName, Long start, Long end);
+
+    int articleVideoWaitingAuditCount();
 }

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/Content.java

@@ -47,6 +47,8 @@ public class Content {
     private Double t0FissionByFansSumAvg;
     private Double t0FissionByReadAvgSumAvg;
     private Double t0FissionDeWeightByReadAvgSumAvg;
+    private Double t0FissionHeadDeWeightByReadAvgSumAvg;
+    private Double t0FissionRecommendDeWeightByReadAvgSumAvg;
 
     private Map<String, Double> scoreMap;
     private double score;

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/ContentHisPublishArticle.java

@@ -12,6 +12,7 @@ public class ContentHisPublishArticle {
 
     private String ghId;
     private String accountName;
+    private String accountType;
     private String msgId;
     private String title;
     private Integer itemIndex;

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

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

+ 12 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/crawler/ArticleDetailInfo.java

@@ -41,10 +41,22 @@ public class ArticleDetailInfo implements Serializable {
     private Integer firstLevel;
     @Column(name = "fission_0")
     private Integer fission0;
+    @Column(name = "fission_0_head")
+    private Integer fission0Head;
+    @Column(name = "fission_0_recommend")
+    private Integer fission0Recommend;
     @Column(name = "fission_1")
     private Integer fission1;
+    @Column(name = "fission_1_head")
+    private Integer fission1Head;
+    @Column(name = "fission_1_recommend")
+    private Integer fission1Recommend;
     @Column(name = "fission_2")
     private Integer fission2;
+    @Column(name = "fission_2_head")
+    private Integer fission2Head;
+    @Column(name = "fission_2_recommend")
+    private Integer fission2Recommend;
 
     @Data
     public static class PK implements Serializable {

+ 41 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/Account.java

@@ -0,0 +1,41 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "account")
+public class Account {
+
+    @Id
+    @Column(name = "id")
+    private String id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "gh_id")
+    private String ghId;
+
+    @Column(name = "type")
+    private String type;
+
+    @Column(name = "status")
+    private Integer status;
+
+    @Column(name = "create_timestamp")
+    private Long createTimestamp;
+
+    @Column(name = "update_timestamp")
+    private Long updateTimestamp;
+
+}

+ 3 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/AccountCategory.java

@@ -26,6 +26,9 @@ public class AccountCategory {
     @Column(name = "status")
     private Integer status;
 
+    @Column(name = "version")
+    private Integer version;
+
     @Column(name = "create_timestamp")
     private Long createTimestamp;
 

+ 6 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/ArticleCategory.java

@@ -17,6 +17,9 @@ import javax.persistence.Table;
 public class ArticleCategory {
 
     @Id
+    @Column(name = "id")
+    private Long id;
+
     @Column(name = "produce_content_id")
     private String produceContentId;
 
@@ -47,6 +50,9 @@ public class ArticleCategory {
     @Column(name = "retry_times")
     private Integer retryTimes;
 
+    @Column(name = "version")
+    private Integer version;
+
     @Column(name = "create_timestamp")
     private Long createTimestamp;
 

+ 41 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/DatastatSortStrategy.java

@@ -39,7 +39,7 @@ public class DatastatSortStrategy implements Serializable {
     @Column(name = "strategy")
     private String strategy;
     @Column(name = "fans")
-    private long fans;
+    private Integer fans;
     @Column(name = "view_count")
     private Integer viewCount;
     @Column(name = "avg_view_count")
@@ -52,26 +52,62 @@ public class DatastatSortStrategy implements Serializable {
     private Integer firstLevel;
     @Column(name = "fission0")
     private Integer fission0;
+    @Column(name = "fission0_head")
+    private Integer fission0Head;
+    @Column(name = "fission0_recommend")
+    private Integer fission0Recommend;
     @Column(name = "fission1")
     private Integer fission1;
+    @Column(name = "fission1_head")
+    private Integer fission1Head;
+    @Column(name = "fission1_recommend")
+    private Integer fission1Recommend;
     @Column(name = "fission2")
     private Integer fission2;
+    @Column(name = "fission2_head")
+    private Integer fission2Head;
+    @Column(name = "fission2_recommend")
+    private Integer fission2Recommend;
     @Column(name = "second_first_level")
     private Integer secondFirstLevel;
     @Column(name = "second_fission0")
     private Integer secondFission0;
+    @Column(name = "second_fission0_head")
+    private Integer secondFission0Head;
+    @Column(name = "second_fission0_recommend")
+    private Integer secondFission0Recommend;
     @Column(name = "second_fission1")
     private Integer secondFission1;
+    @Column(name = "second_fission1_head")
+    private Integer secondFission1Head;
+    @Column(name = "second_fission1_recommend")
+    private Integer secondFission1Recommend;
     @Column(name = "second_fission2")
     private Integer secondFission2;
+    @Column(name = "second_fission2_head")
+    private Integer secondFission2Head;
+    @Column(name = "second_fission2_recommend")
+    private Integer secondFission2Recommend;
     @Column(name = "third_first_level")
     private Integer thirdFirstLevel;
     @Column(name = "third_fission0")
     private Integer thirdFission0;
+    @Column(name = "third_fission0_head")
+    private Integer thirdFission0Head;
+    @Column(name = "third_fission0_recommend")
+    private Integer thirdFission0Recommend;
     @Column(name = "third_fission1")
     private Integer thirdFission1;
+    @Column(name = "third_fission1_head")
+    private Integer thirdFission1Head;
+    @Column(name = "third_fission1_recommend")
+    private Integer thirdFission1Recommend;
     @Column(name = "third_fission2")
     private Integer thirdFission2;
+    @Column(name = "third_fission2_head")
+    private Integer thirdFission2Head;
+    @Column(name = "third_fission2_recommend")
+    private Integer thirdFission2Recommend;
     @Column(name = "read_rate")
     private Double readRate = 0.0;
     @Column(name = "read_fans_rate")
@@ -80,6 +116,10 @@ public class DatastatSortStrategy implements Serializable {
     private Double firstReadRate = 0.0;
     @Column(name = "fission0_first_rate")
     private Double fission0FirstRate = 0.0;
+    @Column(name = "fission0_head_first_rate")
+    private Double fission0HeadFirstRate = 0.0;
+    @Column(name = "fission0_recommend_first_rate")
+    private Double fission0RecommendFirstRate = 0.0;
     @Column(name = "fission1_fission0_rate")
     private Double fission1Fission0Rate = 0.0;
     @Column(name = "fission0_read_avg_rate")

+ 34 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/IllegalArticles.java

@@ -0,0 +1,34 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "illegal_articles")
+public class IllegalArticles {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id;
+    @Column(name = "gh_id")
+    private String ghId;
+    @Column(name = "account_name")
+    private String accountName;
+    @Column(name = "title")
+    private String title;
+    @Column(name = "wx_sn")
+    private String wxSn;
+    @Column(name = "publish_date")
+    private Date publishDate;
+    @Column(name = "illegal_reason")
+    private String illegalReason;
+    @Column(name = "root_source_id_list")
+    private String rootSourceIdList;
+}

+ 3 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/PublishSingleVideoSource.java

@@ -65,6 +65,9 @@ public class PublishSingleVideoSource {
     @Column(name = "bad_status")
     private Integer badStatus;
 
+    @Column(name = "status")
+    private Integer status;
+
     @Column(name = "publish_timestamp")
     private Long publishTimestamp;
 

+ 90 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/VideoContentUnderstanding.java

@@ -0,0 +1,90 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "video_content_understanding")
+public class VideoContentUnderstanding {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    @Column(name = "pq_audit_vid")
+    private Long pqAuditVid;
+
+    @Column(name = "content_trace_id")
+    private String contentTraceId;
+
+    @Column(name = "flow_pool_level")
+    private Integer flowPoolLevel;
+
+    @Column(name = "video_ori_title")
+    private String videoOriTitle;
+
+    @Column(name = "video_oss_path")
+    private String videoOssPath;
+
+    @Column(name = "upload_status")
+    private Integer uploadStatus;
+
+    @Column(name = "upload_status_ts")
+    private Date uploadStatusTs;
+
+    @Column(name = "file_name")
+    private String fileName;
+
+    @Column(name = "file_state")
+    private String fileState;
+
+    @Column(name = "file_expire_time")
+    private Date fileExpireTime;
+
+    @Column(name = "understanding_status")
+    private Integer understandingStatus;
+
+    @Column(name = "understanding_status_ts")
+    private Date understandingStatusTs;
+
+    @Column(name = "video_text")
+    private String videoText;
+
+    @Column(name = "summary_status")
+    private Integer summaryStatus;
+
+    @Column(name = "summary_status_ts")
+    private Date summaryStatusTs;
+
+    @Column(name = "summary_text")
+    private String summaryText;
+
+    @Column(name = "old_summary_text")
+    private String oldSummaryText;
+
+    @Column(name = "summary_text_update_account")
+    private String summaryTextUpdateAccount;
+
+    @Column(name = "summary_text_ts")
+    private Date summaryTextTs;
+
+    @Column(name = "rewrite_status")
+    private Integer rewriteStatus;
+
+    @Column(name = "rewrite_status_ts")
+    private Date rewriteStatusTs;
+
+    @Column(name = "article_text")
+    private String articleText;
+
+    @Column(name = "create_time")
+    private Date createTime;
+
+}

+ 43 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/VideoEndScreenTransformationTask.java

@@ -0,0 +1,43 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "video_end_screen_transformation_task")
+public class VideoEndScreenTransformationTask {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "task_id")
+    private Long TaskId;
+
+    @Column(name = "video_origin_type")
+    private String videoOriginType ;
+
+    @Column(name = "video_origin_id")
+    private Long videoOriginId;
+
+    @Column(name = "title")
+    private String title;
+
+    @Column(name = "oss_path")
+    private String ossPath;
+
+    @Column(name = "new_oss_path")
+    private String newOssPath;
+
+    @Column(name = "status")
+    private Integer status;
+
+    @Column(name = "status_update_timestamp")
+    private Date statusUpdateTimestamp;
+
+}

+ 10 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoPoolAuditDataParam.java

@@ -0,0 +1,10 @@
+package com.tzld.longarticle.recommend.server.model.param.videoAudit;
+
+import lombok.Data;
+
+@Data
+public class VideoPoolAuditDataParam {
+
+    private String auditAccountName;
+
+}

+ 3 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoPoolAuditListParam.java

@@ -13,7 +13,8 @@ public class VideoPoolAuditListParam {
     private List<String> auditAccount;
     private List<Integer> flowPoolLevel;
     private ListItemFilterOrderParam auditTimestamp;
+    private String auditAccountName;
 
-    private Integer pageNum = 1;
-    private Integer pageSize = 50;
+    private Integer pageNum;
+    private Integer pageSize;
 }

+ 10 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/VideoSynopsisUpdateParam.java

@@ -0,0 +1,10 @@
+package com.tzld.longarticle.recommend.server.model.param.videoAudit;
+
+import lombok.Data;
+
+@Data
+public class VideoSynopsisUpdateParam {
+    private String contentId;
+    private String synopsis;
+    private String updateAccount;
+}

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

@@ -13,6 +13,7 @@ public class ArticleVideoPoolSourceVO {
     private String sourceId;
     private String title;
     private String coverUrl;
+    private String synopsis;
 
     public static List<ArticleVideoPoolSourceVO> convertFromPublishSingleVideoSource(List<PublishSingleVideoSource> list) {
         return list.stream().map(publishSingleVideoSource -> {

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

@@ -0,0 +1,27 @@
+package com.tzld.longarticle.recommend.server.model.vo;
+
+import lombok.Data;
+
+@Data
+public class ContentEffectGroupBySourceExport {
+    private String dateStr;
+    private String type;
+    private String source;
+    private String isSameMiniprogram;
+    private Integer fansCount = 0;
+    private Integer publishContentCount = 0;
+    private Integer readCount = 0;
+    private Double readRate = 0.0;
+    private Integer firstLevel = 0;
+    private Integer miniprogram1FirstLevel = 0;
+    private Integer miniprogram2FirstLevel = 0;
+    private Double openRate = 0.0;
+    private Double miniprogram1OpenRate = 0.0;
+    private Double miniprogram2OpenRate = 0.0;
+    private Integer t0Fission = 0;
+    private Integer miniprogram1T0Fission = 0;
+    private Integer miniprogram2T0Fission = 0;
+    private Double t0FissionRate = 0.0;
+    private Double miniprogram1T0FissionRate = 0.0;
+    private Double miniprogram2T0FissionRate = 0.0;
+}

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

@@ -44,6 +44,8 @@ public class NewSortStrategyExport {
     private Double readFansRate = 0.0;
     private Double firstReadRate = 0.0;
     private Double fission0FirstRate = 0.0;
+    private Double fission0HeadFirstRate = 0.0;
+    private Double fission0RecommendFirstRate = 0.0;
     private Double fission1Fission0Rate = 0.0;
     private Double fission0ReadAvgRate = 0.0;
     //历史信息

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

@@ -13,8 +13,5 @@ public class VideoAuditExport {
     private Long videoAuditCount = 0L;
     private Long videoAuditPassCount = 0L;
     private Double articleAuditPassRate = 0.0;
-    private Long videoPoolAuditCount = 0L;
-    private Long videoPoolAuditPassCount = 0L;
-    private Double videoPoolAuditPassRate = 0.0;
 
 }

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

@@ -0,0 +1,11 @@
+package com.tzld.longarticle.recommend.server.model.vo;
+
+import lombok.Data;
+
+@Data
+public class VideoPoolAuditDataVO {
+    private String auditAccount;
+    private Integer auditCount;
+    private Integer auditPassCount;
+    private Integer waitingAuditCount;
+}

+ 3 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/DeepSeekApiService.java

@@ -25,9 +25,9 @@ public class DeepSeekApiService {
     @PostConstruct
     public void init() {
         client = new OkHttpClient().newBuilder()
-                .connectTimeout(15, TimeUnit.MINUTES)
-                .readTimeout(15, TimeUnit.MINUTES)
-                .writeTimeout(15, TimeUnit.MINUTES)
+                .connectTimeout(5, TimeUnit.MINUTES)
+                .readTimeout(5, TimeUnit.MINUTES)
+                .writeTimeout(5, TimeUnit.MINUTES)
                 .build();
     }
 

+ 5 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCProducePlanSaveService.java

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.remote.aigc;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.ProducePlanInputSourceTypeEnum;
 import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
 import com.tzld.longarticle.recommend.server.model.vo.aigc.ProducePlanDetailVO;
 import com.tzld.longarticle.recommend.server.model.vo.aigc.ProducePlanInputSourceParam;
@@ -39,6 +40,10 @@ public class AIGCProducePlanSaveService {
         newInputSource.setInputSourceModal(3);
         newInputSource.setInputSourceChannel(5);
         inputSources.add(newInputSource);
+        if (Objects.equals(inputSourceType, ProducePlanInputSourceTypeEnum.contentID.getVal())) {
+            detail.setDailyProduceNum(inputSources.size());
+            detail.setTotalProduceNum(inputSources.size());
+        }
 
         // 准备请求参数
         JSONObject payload = new JSONObject();

+ 29 - 26
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCWaitingPublishContentService.java

@@ -2,21 +2,15 @@ package com.tzld.longarticle.recommend.server.remote.aigc;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallParam;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.http.HttpEntity;
-import org.apache.http.StatusLine;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.util.EntityUtils;
+import okhttp3.*;
 import org.springframework.stereotype.Service;
 
-import java.nio.charset.StandardCharsets;
+import javax.annotation.PostConstruct;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author dyp
@@ -24,7 +18,18 @@ import java.util.*;
 @Service
 @Slf4j
 public class AIGCWaitingPublishContentService {
-    private final CloseableHttpClient client = HttpPoolFactory.aigcPool();
+
+    private OkHttpClient client;
+
+    @PostConstruct
+    public void init() {
+        client = new OkHttpClient().newBuilder()
+                .connectTimeout(5, TimeUnit.MINUTES)
+                .readTimeout(5, TimeUnit.MINUTES)
+                .writeTimeout(5, TimeUnit.MINUTES)
+                .build();
+    }
+
     private static final String aigcGetAllContentUrl = "http://aigc-api.cybertogether.net/aigc/publish/content/gzhWaitingPublishContent";
 
 
@@ -48,22 +53,20 @@ public class AIGCWaitingPublishContentService {
         bodyParamParams.put("planId", param.getPlanId());
         bodyParam.put("params", bodyParamParams);
         try {
-            HttpPost httpPost = new HttpPost(aigcGetAllContentUrl);
-            StringEntity stringEntity = new StringEntity(bodyParam.toJSONString(), StandardCharsets.UTF_8);
-            httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
-            httpPost.setEntity(stringEntity);
-            CloseableHttpResponse response = client.execute(httpPost);
-            StatusLine statusLine = response.getStatusLine();
-            if (statusLine.getStatusCode() == 200) {
-                HttpEntity responseEntity = response.getEntity();
-                if (Objects.nonNull(responseEntity)) {
-                    String responseBody = EntityUtils.toString(responseEntity, "UTF-8");
-                    // log.info("getAllContent AIGC返回的数据:{}", responseBody);
-                    JSONObject jsonObject = JSONObject.parseObject(responseBody);
-                    if (jsonObject.getInteger("code") == 0) {
-                        JSONArray data = jsonObject.getJSONArray("data");
-                        result = JSONArray.parseArray(data.toJSONString(), Content.class);
-                    }
+            MediaType mediaType = MediaType.parse("application/json");
+            RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(bodyParam));
+            Request request = new Request.Builder()
+                    .url(aigcGetAllContentUrl)
+                    .method("POST", body)
+                    .addHeader("Content-Type", "application/json;charset=UTF-8")
+                    .build();
+            Response response = client.newCall(request).execute();
+            if (response.isSuccessful()) {
+                String responseContent = response.body().string();
+                JSONObject jsonObject = JSONObject.parseObject(responseContent);
+                if (jsonObject.getInteger("code") == 0) {
+                    JSONArray data = jsonObject.getJSONArray("data");
+                    result = JSONArray.parseArray(data.toJSONString(), Content.class);
                 }
             }
         } catch (Exception e) {

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleDetailInfoRepository.java

@@ -9,5 +9,5 @@ import java.util.List;
 @Repository
 public interface ArticleDetailInfoRepository extends JpaRepository<ArticleDetailInfo, ArticleDetailInfo.PK> {
 
-    List<ArticleDetailInfo> getAllByWxSnIn(List<String> wxSnList);
+    List<ArticleDetailInfo> getByWxSnIn(List<String> wxSnList);
 }

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

@@ -21,6 +21,8 @@ public interface ArticleRepository extends JpaRepository<Article, String> {
 
     List<Article> getByGhIdInAndPublishTimestampBetweenAndTypeEquals(List<String> ghIds, Long publishTimestampStart, Long publishTimestampEnd, String type);
 
+    List<Article> getByPublishTimestampBetweenAndTypeEquals(Long publishTimestampStart, Long publishTimestampEnd, String type);
+
     List<Article> getByGhIdInAndPublishTimestampGreaterThanAndTypeEquals(List<String> ghIds, Long publishTimestamp, String type);
 
     List<Article> getByGhIdInAndPublishTimestampLessThanAndTypeEquals(List<String> ghIds, Long publishTimestamp, String type);

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

@@ -9,8 +9,8 @@ import java.util.List;
 @Repository
 public interface AccountCategoryRepository extends JpaRepository<AccountCategory, AccountCategory.PK> {
 
-    List<AccountCategory> getByGhIdAndStatus(String ghId, Integer status);
+    List<AccountCategory> getByGhIdAndStatusAndVersion(String ghId, Integer status, Integer version);
 
-    List<AccountCategory> getByStatus(Integer status);
+    List<AccountCategory> getByStatusAndVersion(Integer status, Integer version);
 
 }

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

@@ -0,0 +1,15 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.Account;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface AccountRepository extends JpaRepository<Account, String> {
+
+    List<Account> getByStatus(Integer status);
+
+    Account getByGhId(String ghId);
+}

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

@@ -9,15 +9,17 @@ import org.springframework.stereotype.Repository;
 import java.util.List;
 
 @Repository
-public interface ArticleCategoryRepository extends JpaRepository<ArticleCategory, String> {
+public interface ArticleCategoryRepository extends JpaRepository<ArticleCategory, Long> {
 
-    List<ArticleCategory> getByProduceContentIdIn(List<String> produceContentIds);
+    List<ArticleCategory> getByProduceContentIdInAndVersion(List<String> produceContentIds, Integer version);
 
-    List<ArticleCategory> getByStatus(Integer status);
+    ArticleCategory getByProduceContentIdAndVersion(String produceContentId, Integer version);
 
-    Page<ArticleCategory> getByStatus(Integer status, PageRequest pageRequest);
+    List<ArticleCategory> getByStatusAndVersion(Integer status, Integer version);
 
-    List<ArticleCategory> getAllByChannelContentIdIn(List<String> channelContentIds);
+    Page<ArticleCategory> getByStatusAndVersion(Integer status, Integer version, PageRequest pageRequest);
 
-    List<ArticleCategory> getByStatusAndRetryTimesLessThan(Integer status, Integer retryTimes);
+    List<ArticleCategory> getAllByChannelContentIdInAndVersion(List<String> channelContentIds, Integer version);
+
+    List<ArticleCategory> getByStatusAndRetryTimesLessThanAndVersion(Integer status, Integer retryTimes, Integer version);
 }

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

@@ -9,4 +9,6 @@ import java.util.List;
 @Repository
 public interface DatastatScoreRepository extends JpaRepository<DatastatScore, Long> {
     void deleteByDtIn(List<String> dateStrList);
+
+    List<DatastatScore> getBySourceIdIsNotNull();
 }

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

@@ -12,4 +12,5 @@ public interface DatastatSortStrategyRepository extends JpaRepository<DatastatSo
     List<DatastatSortStrategy> getByViewCountGreaterThanEqualAndReadRateGreaterThanEqualAndPositionIn(Integer viewCount,
                                                                                                       Double readRate,
                                                                                                       List<Integer> positionList);
+    List<DatastatSortStrategy> getByWxSnIn(List<String> wxSnList);
 }

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

@@ -0,0 +1,10 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.IllegalArticles;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface IllegalArticlesRepository extends JpaRepository<IllegalArticles, Long> {
+
+}

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

@@ -16,6 +16,8 @@ public interface LongArticleCrawlerVideoRepository extends JpaRepository<LongArt
 
     List<LongArticleCrawlerVideo> getByContentIdAndIsIllegal(String contentId, Integer isIllegal);
 
+    List<LongArticleCrawlerVideo> getByContentIdInAndIsIllegal(List<String> contentIds, Integer isIllegal);
+
     List<LongArticleCrawlerVideo> getByVideoOssPath(String ossPath);
 
     LongArticleCrawlerVideo getById(Long videoId);

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

@@ -27,4 +27,6 @@ public interface PublishSingleVideoSourceRepository extends JpaRepository<Publis
     List<PublishSingleVideoSource> getByVideoPoolAuditTimestampBetween(Long start, Long end);
 
     List<PublishSingleVideoSource> getByVideoPoolAuditTimestampBetweenAndPlatform(Long start, Long end, String platform);
+
+    List<PublishSingleVideoSource> getByVideoOssPathIn(List<String> videoOssPaths);
 }

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

@@ -0,0 +1,13 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface VideoContentUnderstandingRepository extends JpaRepository<VideoContentUnderstanding, Long> {
+
+    List<VideoContentUnderstanding> getByContentTraceIdInAndSummaryStatus(List<String> contentTraceIdList, Integer summaryStatus);
+}

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

@@ -1,11 +1,14 @@
 package com.tzld.longarticle.recommend.server.service;
 
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.VideoTitleReWriteEnum;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoTitleReWrite;
 import com.tzld.longarticle.recommend.server.model.param.ArticleVideoPoolSourceParam;
 import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoPoolSourceVO;
+import com.tzld.longarticle.recommend.server.repository.longArticle.VideoContentUnderstandingRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.VideoTitleReWriteRepository;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +25,8 @@ public class ArticleVideoPoolService {
     private LongArticleBaseMapper longArticleBaseMapper;
     @Autowired
     private VideoTitleReWriteRepository videoTitleReWriteRepository;
+    @Autowired
+    private VideoContentUnderstandingRepository synopsisRepository;
 
     public List<ArticleVideoPoolSourceVO> getSource(ArticleVideoPoolSourceParam param) {
         List<PublishSingleVideoSource> list = longArticleBaseMapper.getPublishSingleVideoSource(param);
@@ -31,16 +36,23 @@ public class ArticleVideoPoolService {
     private List<ArticleVideoPoolSourceVO> buildArticleVideoPoolSourceVOList(List<PublishSingleVideoSource> list) {
         List<ArticleVideoPoolSourceVO> result = ArticleVideoPoolSourceVO.convertFromPublishSingleVideoSource(list);
         List<String> contentTraceIdList = result.stream().map(ArticleVideoPoolSourceVO::getSourceId).collect(Collectors.toList());
+        // 获取改写后标题
         List<VideoTitleReWrite> videoTitleReWriteList = videoTitleReWriteRepository.getByContentTraceIdInAndStatus(
                 contentTraceIdList, VideoTitleReWriteEnum.AVAILABLE.getCode());
         Map<String, List<VideoTitleReWrite>> videoTitleReWriteMap = videoTitleReWriteList.stream()
                 .sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime()))
                 .collect(Collectors.groupingBy(VideoTitleReWrite::getContentTraceId));
+        // 获取简介
+        List<VideoContentUnderstanding> synopsisList = synopsisRepository.getByContentTraceIdInAndSummaryStatus(contentTraceIdList,
+                PublishSingleVideoSourceStatusEnum.SUCCESS.getCode());
+        Map<String, String> synopsisMap = synopsisList.stream()
+                .collect(Collectors.toMap(VideoContentUnderstanding::getContentTraceId, VideoContentUnderstanding::getSummaryText));
         for (ArticleVideoPoolSourceVO vo : result) {
             List<VideoTitleReWrite> reWriteList = videoTitleReWriteMap.get(vo.getSourceId());
             if (CollectionUtils.isNotEmpty(reWriteList)) {
                 vo.setTitle(reWriteList.get(reWriteList.size() - 1).getNewTitle());
             }
+            vo.setSynopsis(synopsisMap.get(vo.getSourceId()));
         }
         return result;
     }

+ 93 - 6
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor;
 import com.tzld.longarticle.recommend.server.common.enums.FieshuTableColumnDataTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.MiniprogramUseTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProduceContentAuditStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
@@ -20,10 +21,7 @@ import com.tzld.longarticle.recommend.server.mapper.growth.NewPushMessageCallbac
 import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
 import com.tzld.longarticle.recommend.server.model.dto.*;
 import com.tzld.longarticle.recommend.server.model.dto.aigc.BadCrawlerAccountDTO;
-import com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerPlan;
-import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan;
-import com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceReviewRecord;
-import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
+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.GetOffVideoCrawler;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.LongArticlesVideo;
@@ -110,6 +108,8 @@ public class XxlJobService {
     private ProducePlanRepository producePlanRepository;
     @Autowired
     private AIGCProduceContentAuditService aigcProduceContentAuditService;
+    @Autowired
+    private AccountRepository accountRepository;
 
     ExecutorService thread = new CommonThreadPoolExecutor(
             5,
@@ -121,6 +121,9 @@ public class XxlJobService {
 
     @ApolloJsonValue("${touliu.account.ghIds:[\"gh_93e00e187787\", \"gh_ac43e43b253b\", \"gh_68e7fdc09fe4\",\"gh_77f36c109fb1\", \"gh_b181786a6c8c\", \"gh_1ee2e1b39ccf\"]}")
     private List<String> touliuAccountGhIds;
+
+    @ApolloJsonValue("${notCheckPublishPlan:[\"20250325073241267857470\"]}")
+    private List<String> notCheckPublishPlan;
     @ApolloJsonValue("${cold.pool.produce.planId:[\"20240802021606053813696\", \"20240802080355355308981\",\n" +
             "\"20240805154433785506170\", \"20240805154359027876170\", \"20241024100016206421084\", " +
             "\"20241030070010871546586\"]}")
@@ -135,6 +138,9 @@ public class XxlJobService {
         String dateStr = DateUtils.getCurrentDateStr("yyyy-MM-dd");
         List<String> specialAdAccountNames = aigcBaseMapper.getTodaySpecialAdAccountNames(dateStr);
         for (NotPublishPlan publishPlan : notPublishPlan) {
+            if (notCheckPublishPlan.contains(publishPlan.getPlanId())) {
+                continue;
+            }
             long now = System.currentTimeMillis();
             int nowHour = DateUtils.getHourByTimestamp(now / 1000);
             int nowMinute = DateUtils.getMinuteByTimestamp(now / 1000);
@@ -806,14 +812,17 @@ public class XxlJobService {
             Map<String, Content> articlesWithHistory = recallService.getArticleWithHistory(paramList, type);
             for (String sourceId : sourceIdList) {
                 Content content = articlesWithHistory.get(sourceId);
-                if (Objects.nonNull(content) && CollectionUtils.isNotEmpty(content.getHisPublishArticleList())) {
+                if (Objects.nonNull(content)) {
                     ArticleTitleHisCache cache = sourceIdToCacheMap.get(sourceId);
-                    cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
+                    if (CollectionUtil.isNotEmpty(content.getHisPublishArticleList())) {
+                        cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
+                    }
                     if (CollectionUtil.isNotEmpty(content.getCategory())) {
                         cache.setCategory(JSONObject.toJSONString(content.getCategory()));
                     }
                     cache.setKimiSafeScore(content.getKimiSafeScore());
                     cache.setPlanId(content.getProducePlanId());
+                    cache.setRootPublishTimestamp(content.getRootPublishTimestamp());
                     cache.setUpdateTimestamp(System.currentTimeMillis());
                     articleTitleHisCacheRepository.save(cache);
                 }
@@ -843,4 +852,82 @@ public class XxlJobService {
         return ReturnT.SUCCESS;
     }
 
+    @XxlJob("refreshAccountJob")
+    public ReturnT<String> refreshAccount(String param) {
+        List<String> accountIds = publishContentMapper.getPublishAccountIds();
+        List<Account> accountList = publishContentMapper.getAccountByIds(accountIds);
+        List<Account> existsAccounts = accountRepository.findAll();
+        Map<String, Account> existsAccountMap = existsAccounts.stream().collect(
+                Collectors.toMap(Account::getId, Function.identity()));
+        List<String> existsAccountIds = existsAccounts.stream().map(Account::getId).collect(Collectors.toList());
+        Long now = System.currentTimeMillis();
+        Map<String, List<Integer>> accountNameMap = new HashMap<>();
+        for (Account account : accountList) {
+            String type = StringUtils.hasText(account.getType()) && account.getType().contains("买号") ? "买号" : "代运营";
+            // 投流判断
+            List<PublishPlanMiniprogramTask> miniprogramTaskList = publishContentMapper.getAccountMiniprogramTaskList(account.getId());
+            if (CollectionUtil.isNotEmpty(miniprogramTaskList)) {
+                List<Integer> useTypeList = miniprogramTaskList.stream().map(PublishPlanMiniprogramTask::getMiniprogramUseType)
+                        .distinct().collect(Collectors.toList());
+                for (Integer useType : useTypeList) {
+                    if (useType.equals(MiniprogramUseTypeEnum.Touliu.getVal())
+                            || useType.equals(MiniprogramUseTypeEnum.Daitou.getVal()))  {
+                        type = MiniprogramUseTypeEnum.from(useType).getDescription();
+                        break;
+                    }
+                }
+                if (useTypeList.size() > 1) {
+                    accountNameMap.put(account.getName(), useTypeList);
+                }
+            }
+            account.setType(type);
+            if (!existsAccountIds.contains(account.getId())) {
+                account.setStatus(1);
+                account.setCreateTimestamp(now);
+            } else {
+                Account existAccount = existsAccountMap.get(account.getId());
+                account.setStatus(existAccount.getStatus());
+                account.setCreateTimestamp(existAccount.getCreateTimestamp());
+            }
+            account.setUpdateTimestamp(now);
+            accountRepository.save(account);
+        }
+        sendRefreshAccountMsg(accountNameMap);
+        return ReturnT.SUCCESS;
+    }
+
+    private void sendRefreshAccountMsg(Map<String, List<Integer>> accountNameMap) {
+        if (CollectionUtil.isNotEmpty(accountNameMap)) {
+            List<FeishuTableDTO.Column> columns = buildRefreshAccountColumns();
+            List<JSONObject> rows = new ArrayList<>();
+            for (Map.Entry<String, List<Integer>> entry : accountNameMap.entrySet()) {
+                JSONObject row = new JSONObject();
+                row.put("account_name", entry.getKey());
+                List<String> useTypeList = entry.getValue().stream().map(MiniprogramUseTypeEnum::from)
+                        .map(MiniprogramUseTypeEnum::getDescription).collect(Collectors.toList());
+                row.put("ues_type", useTypeList);
+                rows.add(row);
+            }
+
+            FeishuTableDTO tableDTO = FeishuTableDTO.createTable("账号类型更新异常", columns, rows, true);
+            JSONObject content = JSONObject.parseObject(JSONObject.toJSONString(tableDTO));
+            JSONObject bodyParam = new JSONObject();
+            bodyParam.put("msg_type", "interactive");
+            bodyParam.put("card", content);
+            FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.DAILY.getRobotId(), bodyParam);
+        }
+    }
+
+    private List<FeishuTableDTO.Column> buildRefreshAccountColumns() {
+        List<FeishuTableDTO.Column> columns = new ArrayList<>();
+        FeishuTableDTO.Column planIdColumn = FeishuTableDTO.createFeishuColumns(
+                FieshuTableColumnDataTypeEnum.TEXT.getType(), "account_name", "账号名称", null);
+        columns.add(planIdColumn);
+        FeishuTableDTO.Column planNameColumn = FeishuTableDTO.createFeishuColumns(
+                FieshuTableColumnDataTypeEnum.TEXT.getType(), "ues_type", "用途类型列表", null);
+        columns.add(planNameColumn);
+
+        return columns;
+    }
+
 }

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.recommend;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor;
@@ -103,6 +104,8 @@ public class ArticleAuditService {
     @Autowired
     private DangerFaceRecognizeService dangerFaceRecognizeService;
 
+    @ApolloJsonValue("${notDeleteArticleAccountGhIds:[]}")
+    private List<String> notDeleteArticleAccountGhIds;
 
     @XxlJob("articleVideoAudit")
     public ReturnT<String> articleVideoAudit(String param) {
@@ -888,6 +891,9 @@ public class ArticleAuditService {
             String groupPushMsgId = pushIdMap.get(push.getPushId());
             String publishAccountId = pushAccountMap.get(push.getPushId());
             String ghId = publishAccountMap.get(publishAccountId);
+            if (notDeleteArticleAccountGhIds.contains(ghId)) {
+                continue;
+            }
             List<PublishGzhPushContentRelDTO> relList = groupPushRelMap.get(push.getPushId()).stream()
                     .sorted(Comparator.comparing(PublishGzhPushContentRelDTO::getId)).collect(Collectors.toList());
             Map<String, Integer> articleIndexMap = new HashMap<>();

+ 21 - 15
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleCategoryService.java

@@ -66,7 +66,10 @@ public class ArticleCategoryService {
             "\"20241030070010871546586\"]}")
     private static List<String> producePlanIds;
     @Value("${kimiCategoryPrompt:}")
-    private String kimiCategoryPrompt;
+    private String categoryPrompt;
+
+    @Value("${category.active.version:1}")
+    private Integer activeVersion;
 
     @ApolloJsonValue("${articlePromotionProduceConfig:{}}")
     private Map<String, Map<String, Map<String, String>>> produceConfig;
@@ -96,16 +99,16 @@ public class ArticleCategoryService {
         addPromotionArticleCategoryByProducePlan();
         // 视频内容池 添加品类处理任务
         addVideoPoolArticleCategory();
-        // 调用kimi进行内容分类
+        // 调用大模型进行内容分类
         dealArticleCategory();
     }
 
     private void dealArticleCategory() {
-        List<ArticleCategory> dealList = articleCategoryRepository.getByStatus(ArticleCategoryStatusEnum.WAITING.getCode());
+        List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.WAITING.getCode(), activeVersion);
         List<List<ArticleCategory>> partitionList = Lists.partition(dealList, 20);
         for (List<ArticleCategory> partition : partitionList) {
             List<String> partitionTitles = partition.stream().map(ArticleCategory::getTitle).distinct().collect(Collectors.toList());
-            String prompt = buildKimiPrompt(partitionTitles);
+            String prompt = buildCategoryPrompt(partitionTitles);
             KimiResult kimiResult = deepSeekApiService.requestOfficialApi(prompt, null, null, true);
             long now = System.currentTimeMillis();
             JSONObject obj = null;
@@ -117,7 +120,7 @@ public class ArticleCategoryService {
                 }
             }
             for (ArticleCategory articleCategory : partition) {
-                articleCategory.setKimiResult(kimiResult.getResponseStr());
+                articleCategory.setKimiResult(kimiResult.getResponseStr().trim());
                 articleCategory.setUpdateTimestamp(now);
                 if (kimiResult.isSuccess() && Objects.nonNull(obj) && obj.containsKey(articleCategory.getTitle())) {
                     articleCategory.setCategory(obj.getString(articleCategory.getTitle()));
@@ -148,7 +151,7 @@ public class ArticleCategoryService {
         for (ArticleCrawlerPlan crawlerPlan : articleCrawlerPlanList) {
             List<ProduceContentCrawlerVO> list = crawlerContentByPlanService.getCrawlerContentByPlan(crawlerPlan.getCrawlerPlanId(), producePlanIds);
             List<String> produceContentIds = list.stream().map(ProduceContentCrawlerVO::getProduceContentId).collect(Collectors.toList());
-            List<ArticleCategory> exists = articleCategoryRepository.getByProduceContentIdIn(produceContentIds);
+            List<ArticleCategory> exists = articleCategoryRepository.getByProduceContentIdInAndVersion(produceContentIds, activeVersion);
             List<String> existsIds = exists.stream().map(ArticleCategory::getProduceContentId).collect(Collectors.toList());
             list = list.stream().filter(o -> !existsIds.contains(o.getProduceContentId())).collect(Collectors.toList());
             long now = System.currentTimeMillis();
@@ -161,6 +164,7 @@ public class ArticleCategoryService {
                 item.setTitle(vo.getTitle());
                 item.setTitleMd5(Md5Util.encoderByMd5(vo.getTitle()));
                 item.setCreateTimestamp(now);
+                item.setVersion(activeVersion);
                 saveList.add(item);
             }
             if (CollectionUtils.isNotEmpty(saveList)) {
@@ -207,7 +211,7 @@ public class ArticleCategoryService {
             Map<String, ArticlePoolPromotionSource> sourceMap = sourceList.stream()
                     .collect(Collectors.toMap(ArticlePoolPromotionSource::getChannelContentId, Function.identity()));
             // 根据produceContentId查询category
-            List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatus(ArticleCategoryStatusEnum.SUCCESS.getCode());
+            List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.SUCCESS.getCode(), activeVersion);
             Map<String, ArticleCategory> categoryMap = articleCategoryList.stream()
                     .collect(Collectors.toMap(ArticleCategory::getProduceContentId, Function.identity()));
             Map<String, ArticleCategory> coldStartCategoryMap = articleCategoryList.stream()
@@ -228,7 +232,7 @@ public class ArticleCategoryService {
                 }
                 if (Objects.nonNull(category) && StringUtils.hasText(category.getCategory())) {
                     articleCategory.setCategory(category.getCategory());
-                    articleCategory.setKimiResult(category.getKimiResult());
+                    articleCategory.setKimiResult(category.getKimiResult().trim());
                     articleCategory.setStatus(ArticleCategoryStatusEnum.SUCCESS.getCode());
                 }
             }
@@ -239,7 +243,7 @@ public class ArticleCategoryService {
     private void addVideoPoolArticleCategory() {
         List<ArticleCategory> saveList = new ArrayList<>();
         // 查找所有待处理视频内容池内容
-        List<PublishSingleVideoSource> dealList = articleCategoryMapper.getVideoPoolArticleCategoryDealList();
+        List<PublishSingleVideoSource> dealList = articleCategoryMapper.getVideoPoolArticleCategoryDealList(activeVersion);
         if (CollectionUtils.isEmpty(dealList)) {
             return;
         }
@@ -250,6 +254,7 @@ public class ArticleCategoryService {
             item.setTitle(videoSource.getArticleTitle());
             item.setTitleMd5(Md5Util.encoderByMd5(videoSource.getArticleTitle()));
             item.setCreateTimestamp(now);
+            item.setVersion(activeVersion);
             saveList.add(item);
         }
         articleCategoryMapper.batchInsertArticleCategory(saveList);
@@ -261,7 +266,7 @@ public class ArticleCategoryService {
     private List<ArticleCategory> addArticleCategoryByProducePlan(List<String> producePlanIds) {
         List<ProducePlanExeRecord> produceContentList = aigcBaseMapper.getAllByProducePlanId(producePlanIds);
         List<String> channelContentIds = produceContentList.stream().map(ProducePlanExeRecord::getChannelContentId).distinct().collect(Collectors.toList());
-        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdIn(channelContentIds);
+        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdInAndVersion(channelContentIds, activeVersion);
         List<String> articleCategoryIds = articleCategoryList.stream().map(ArticleCategory::getChannelContentId).collect(Collectors.toList());
         List<ProduceContentCrawlerVO> list = produceContentList.stream().filter(o -> !articleCategoryIds.contains(o.getChannelContentId())).map(o -> {
             ProduceContentCrawlerVO item = new ProduceContentCrawlerVO();
@@ -288,14 +293,15 @@ public class ArticleCategoryService {
                 item.setTitle(title);
                 item.setTitleMd5(Md5Util.encoderByMd5(title));
                 item.setCreateTimestamp(now);
+                item.setVersion(activeVersion);
                 saveList.add(item);
             }
         }
         return saveList;
     }
 
-    private String buildKimiPrompt(List<String> titleList) {
-        StringBuilder prompt = new StringBuilder(kimiCategoryPrompt);
+    private String buildCategoryPrompt(List<String> titleList) {
+        StringBuilder prompt = new StringBuilder(categoryPrompt);
         prompt.append("\n");
         for (String title : titleList) {
             prompt.append(title).append("\n");
@@ -304,10 +310,10 @@ public class ArticleCategoryService {
     }
 
     public void articleCategoryJobRetry() {
-        List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndRetryTimesLessThan(ArticleCategoryStatusEnum.FAIL.getCode(), 3);
+        List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndRetryTimesLessThanAndVersion(ArticleCategoryStatusEnum.FAIL.getCode(), 3, activeVersion);
         for (ArticleCategory articleCategory : dealList) {
             List<String> partitionTitles = Collections.singletonList(articleCategory.getTitle());
-            String prompt = buildKimiPrompt(partitionTitles);
+            String prompt = buildCategoryPrompt(partitionTitles);
             KimiResult kimiResult = deepSeekApiService.requestOfficialApi(prompt, null, null, true);
             long now = System.currentTimeMillis();
             JSONObject obj = null;
@@ -318,7 +324,7 @@ public class ArticleCategoryService {
                     log.error(kimiResult.getResponse().getChoices().get(0).getMessage().getContent());
                 }
             }
-            articleCategory.setKimiResult(kimiResult.getResponseStr());
+            articleCategory.setKimiResult(kimiResult.getResponseStr().trim());
             articleCategory.setUpdateTimestamp(now);
             articleCategory.setRetryTimes(articleCategory.getRetryTimes() + 1);
             if (kimiResult.isSuccess() && Objects.nonNull(obj)) {

+ 24 - 5
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticlePromotionService.java

@@ -6,7 +6,9 @@ import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.CrawlerModeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.ProducePlanInputSourceTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticlePoolPromotionSourceStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
 import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
@@ -15,10 +17,7 @@ import com.tzld.longarticle.recommend.server.model.dto.CrawlerContent;
 import com.tzld.longarticle.recommend.server.model.dto.PublishContentDTO;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticlePoolPromotionSource;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
-import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoTitleReWrite;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
 import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
 import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
 import com.tzld.longarticle.recommend.server.model.vo.WxContentDetailResponse;
@@ -416,6 +415,7 @@ public class ArticlePromotionService {
         Map<String, Map<String, List<PublishSortLog>>> sortLogMap = sortLogList.stream()
                 .collect(Collectors.groupingBy(PublishSortLog::getGhId,
                         Collectors.groupingBy(PublishSortLog::getDateStr)));
+        int promotionNum = 0;
         for (DatastatSortStrategy data : promotionList) {
             List<PublishSortLog> logs = sortLogMap.get(data.getGhId()).get(data.getDateStr());
             if (CollectionUtils.isEmpty(logs)) {
@@ -448,7 +448,8 @@ public class ArticlePromotionService {
             upLevel.setUpLevelSource(singleVideoSource.getContentTraceId());
             upLevel.setContentTraceId("video" + UUID.randomUUID().toString().replace("-", ""));
             upLevel.setFlowPoolLevel(poolLevel);
-            publishSingleVideoSourceRepository.save(upLevel);
+            upLevel.setStatus(PublishSingleVideoSourceStatusEnum.DEFAULT.getCode());
+            upLevel = publishSingleVideoSourceRepository.save(upLevel);
 
             List<VideoTitleReWrite> videoTitleReWrites = videoTitleReWriteRepository.getByContentTraceId(singleVideoSource.getContentTraceId());
             if (CollectionUtils.isNotEmpty(videoTitleReWrites)) {
@@ -458,7 +459,25 @@ public class ArticlePromotionService {
                     videoTitleReWriteRepository.save(videoTitleReWrite);
                 }
             }
+
+            VideoEndScreenTransformationTask task = new VideoEndScreenTransformationTask();
+            task.setVideoOriginId(upLevel.getId());
+            task.setTitle(upLevel.getArticleTitle());
+            task.setOssPath(upLevel.getVideoOssPath());
+            longArticleBaseMapper.saveVideoEndScreenTransformationTask(task);
+
+            promotionNum++;
         }
+        ContentPoolEnum poolEnum = ContentPoolEnum.from(poolLevel);
+        sendFeishuJobFinishMessage(poolEnum.getDescription(), promotionNum);
+    }
+
+    private void sendFeishuJobFinishMessage(String accountNickName, Integer promotionNum) {
+        log.info("articleVideoPoolPromotion finish: 晋级任务:{}, 晋级数量:{}", accountNickName, promotionNum);
+        FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.DAILY.getRobotId(),
+                "【视频晋级任务完成】\n" +
+                        "晋级任务:" + accountNickName + "\n" +
+                        "晋级数量:" + promotionNum + "\n");
     }
 
     @XxlJob("topContentReSendJob")

+ 11 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleVideoAuditService.java

@@ -389,6 +389,10 @@ public class ArticleVideoAuditService {
     }
 
     public void addAudit(ArticleVideoAuditAddAuditParam param) {
+        LongArticleTitleAudit exists = titleAuditRepository.getByContentId(param.getContentId());
+        if (Objects.nonNull(exists)) {
+            return;
+        }
         ProducePlanExeRecord exeRecord = producePlanExeRecordRepository.getByPlanExeId(param.getContentId());
         List<String> auditUser = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j");
         Random random = new Random();
@@ -399,9 +403,13 @@ public class ArticleVideoAuditService {
             if (Objects.nonNull(exeRecord)) {
                 String channelContentId = exeRecord.getChannelContentId();
                 ArticlePoolPromotionSource source = articlePoolPromotionSourceRepository.getByChannelContentId(channelContentId);
-                if (Objects.nonNull(source) && source.getStatus() == 1 && source.getDeleted() == 0) {
-                    status = ArticleVideoAuditStatusEnum.PASS.getCode();
-                    auditAccount = "sys";
+                if (Objects.nonNull(source) && source.getStatus() == 1 && source.getDeleted() == 0
+                        && StringUtils.hasText(source.getRootProduceContentId())) {
+                    LongArticleTitleAudit titleAudit = titleAuditRepository.getByContentId(source.getRootProduceContentId());
+                    if (Objects.nonNull(titleAudit) && titleAudit.getStatus() == ArticleVideoAuditStatusEnum.PASS.getCode()) {
+                        status = ArticleVideoAuditStatusEnum.PASS.getCode();
+                        auditAccount = "sys";
+                    }
                 }
             }
         }

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

@@ -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());
+        }
+    }
+
 }

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

@@ -82,6 +82,12 @@ public class RecommendService {
         setStrategy(request, param);
 
         RecallResult recallResult = recallService.recall(convertToRecallParam(param));
+        if (CollectionUtils.isEmpty(recallResult.getData())) {
+            RecommendResponse response = new RecommendResponse();
+            response.setCode(0);
+            response.setMsg("success");
+            return response;
+        }
         long t2 = System.currentTimeMillis();
         CostMonitor.logCost("Recommend", "Recall", t2 - start);
         RankResult rankResult = rankService.rank(convertToRankParam(param, recallResult));
@@ -276,6 +282,7 @@ public class RecommendService {
         rankParam.setUserGroupIds(param.getUserGroupIds());
         rankParam.setType(param.getType());
         rankParam.setReplaceSimilarityAccount(param.getReplaceSimilarityAccount());
+        rankParam.setPlanId(param.getPlanId());
 
         return rankParam;
     }

+ 135 - 63
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/VideoPoolAuditService.java

@@ -5,15 +5,19 @@ import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoBadStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.longArticle.PublishSingleVideoSourceStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.VideoTitleReWriteEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.VideoPoolAuditMapper;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoContentUnderstanding;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoTitleReWrite;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.*;
+import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditDataVO;
 import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditListVO;
 import com.tzld.longarticle.recommend.server.repository.longArticle.PublishSingleVideoSourceRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.VideoContentUnderstandingRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.VideoTitleReWriteRepository;
 import com.tzld.longarticle.recommend.server.util.DateUtils;
 import com.tzld.longarticle.recommend.server.util.RedisUtil;
@@ -46,6 +50,8 @@ public class VideoPoolAuditService {
     private RedisUtil redisUtil;
     @Autowired
     private VideoTitleReWriteRepository videoTitleReWriteRepository;
+    @Autowired
+    private VideoContentUnderstandingRepository synopsisRepository;
 
     @Autowired
     private RedisTemplate<String, String> redisTemplate;
@@ -60,6 +66,10 @@ public class VideoPoolAuditService {
     private Map<String, Integer> dailyAuditPoolCount;
 
     public Page<VideoPoolAuditListVO> list(VideoPoolAuditListParam param) {
+        if (Objects.isNull(param.getPageNum()) || Objects.isNull(param.getPageSize())) {
+            param.setPageNum(1);
+            param.setPageSize(50);
+        }
         int offset = (param.getPageNum() - 1) * param.getPageSize();
         int count = videoPoolAuditMapper.articleVideoAuditListCount(param.getContentId(), param.getStatus(),
                 param.getTitle(), param.getAuditAccount(), param.getFlowPoolLevel(), param.getAuditTimestamp());
@@ -85,12 +95,17 @@ public class VideoPoolAuditService {
         Map<String, List<VideoTitleReWrite>> videoTitleReWriteMap = videoTitleReWriteList.stream()
                 .sorted((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime()))
                 .collect(Collectors.groupingBy(VideoTitleReWrite::getContentTraceId));
+        // 获取简介
+        List<VideoContentUnderstanding> synopsisList = synopsisRepository.getByContentTraceIdInAndSummaryStatus(contentTraceIdList,
+                PublishSingleVideoSourceStatusEnum.SUCCESS.getCode());
+        Map<String, String> synopsisMap = synopsisList.stream()
+                .collect(Collectors.toMap(VideoContentUnderstanding::getContentTraceId, VideoContentUnderstanding::getSummaryText));
         for (PublishSingleVideoSource item : list) {
             VideoPoolAuditListVO vo = new VideoPoolAuditListVO();
             vo.setContentId(item.getContentTraceId());
             vo.setTitle(item.getArticleTitle());
             vo.setStatus(item.getVideoPoolAuditStatus());
-//            vo.setSynopsis(item.getSummaryText());
+            vo.setSynopsis(synopsisMap.get(item.getContentTraceId()));
             vo.setFlowPoolLevel(ContentPoolEnum.from(item.getFlowPoolLevel()).getDescription());
             vo.setCrawlerTimestamp(item.getCrawlerTimestamp() * 1000);
             vo.setAuditAccount(item.getVideoPoolAuditAccount());
@@ -139,55 +154,80 @@ public class VideoPoolAuditService {
             return result; // 返回空结果
         }
         long now = System.currentTimeMillis();
-        String id;
-        PublishSingleVideoSource obj = null;
-        String inAuditListRedisKey = "video-pool-in-audit-list";
+        if (Objects.isNull(param.getPageSize())) {
+            param.setPageSize(1);
+        }
+        int limit = param.getPageSize();
+        List<PublishSingleVideoSource> objs = new ArrayList<>();
+        String inAuditListRedisKey = "video-pool-in-audit-list-" + param.getAuditAccountName();
         try {
             String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
             String auditQueueRedisKey = "video-pool-audit-queue-" + dateStr;
             // 从待审核队列中获取数据,如未获取到则从数据库查询一条
             Long size = redisTemplate.opsForZSet().size(auditQueueRedisKey);
-            if (Objects.isNull(size) || size == 0) {
-                List<String> entries = redisTemplate.opsForList().range(inAuditListRedisKey, 0, -1);
-                List<String> excludeContentIds = new ArrayList<>();
-                if (CollectionUtils.isNotEmpty(entries)) {
-                    excludeContentIds = entries.stream().map(o -> {
-                        JSONObject json = JSONObject.parseObject(o);
-                        return json.getString("id");
-                    }).collect(Collectors.toList());
-                }
-                obj = videoPoolAuditMapper.articleVideoAuditNext(param.getContentId(),
-                        param.getStatus(), param.getTitle(), param.getAuditAccount(), null, excludeContentIds);
-            } else {
+            if (Objects.nonNull(size) && size > 0) {
                 // 从待审核队列中获取数据, 如获取到的内容已审核,则重新获取
-                while (true) {
-                    Set<String> ids = redisTemplate.opsForZSet().reverseRangeByScore(auditQueueRedisKey, 0, 100, 0, 1);
-                    if (CollectionUtils.isNotEmpty(ids)) {
-                        id = ids.iterator().next();
-                        redisTemplate.opsForZSet().remove(auditQueueRedisKey, id);
-                        obj = videoSourceRepository.getByContentTraceId(id);
-                        if (obj.getVideoPoolAuditStatus() == ArticleVideoAuditStatusEnum.WAITING.getCode()) {
-                            break;
-                        }
-                    } else {
+                while (limit > 0) {
+                    Set<String> ids = redisTemplate.opsForZSet().reverseRangeByScore(auditQueueRedisKey, 0, 100, 0, limit);
+                    if (CollectionUtils.isEmpty(ids)) {
                         break;
                     }
+                    List<String> contentTraceIdList = new ArrayList<>(ids);
+                    List<PublishSingleVideoSource> checkList = videoSourceRepository.getByContentTraceIdIn(contentTraceIdList);
+                    if (CollectionUtils.isEmpty(checkList)) {
+                        break;
+                    }
+                    for (PublishSingleVideoSource videoSource : checkList) {
+                        redisTemplate.opsForZSet().remove(auditQueueRedisKey, videoSource.getContentTraceId());
+                        if (videoSource.getVideoPoolAuditStatus() == ArticleVideoAuditStatusEnum.WAITING.getCode()) {
+                            objs.add(videoSource);
+                            limit--;
+                        }
+                    }
                 }
             }
+            if (limit > 0) {
+                List<String> excludeContentIds = new ArrayList<>();
+                String auditAccountListKey = "video-pool-audit-account-list-" + dateStr;
+                Set<String> auditAccountList = redisTemplate.opsForSet().members(auditAccountListKey);
+                if (CollectionUtils.isNotEmpty(auditAccountList)) {
+                    for (String auditAccount : auditAccountList) {
+                        String inAuditAccountListRedisKey = "video-pool-in-audit-list-" + auditAccount;
+                        List<String> entries = redisTemplate.opsForList().range(inAuditAccountListRedisKey, 0, -1);
+                        if (CollectionUtils.isNotEmpty(entries)) {
+                            excludeContentIds.addAll(entries.stream().map(o -> {
+                                JSONObject json = JSONObject.parseObject(o);
+                                return json.getString("id");
+                            }).collect(Collectors.toList()));
+                        }
+                    }
+                }
+                objs.addAll(videoPoolAuditMapper.articleVideoAuditNext(param.getContentId(),
+                        param.getStatus(), param.getTitle(), param.getAuditAccount(), null,
+                        excludeContentIds, limit));
+            }
+            // 添加到超时队列
+            if (CollectionUtils.isNotEmpty(objs)) {
+                for (PublishSingleVideoSource obj : objs) {
+                    JSONObject json = new JSONObject();
+                    json.put("id", obj.getContentTraceId());
+                    json.put("timestamp", now + (120 * 60 * 1000));
+                    redisTemplate.opsForList().rightPush(inAuditListRedisKey, json.toJSONString());
+                    redisTemplate.expire(inAuditListRedisKey, 12, TimeUnit.HOURS);
+                }
+                String auditAccountListKey = "video-pool-audit-account-list-" + dateStr;
+                redisTemplate.opsForSet().add(auditAccountListKey, param.getAuditAccountName());
+                redisTemplate.expire(auditAccountListKey, 12, TimeUnit.HOURS);
+            }
         } finally {
             // 释放锁
             redisUtil.releaseLock(lockKey, requestId);
         }
-        if (Objects.isNull(obj)) {
+        if (CollectionUtils.isEmpty(objs)) {
             return result;
         }
-        // 添加到超时队列
-        JSONObject json = new JSONObject();
-        json.put("id", obj.getContentTraceId());
-        json.put("timestamp", now + (10 * 60 * 1000));
-        redisTemplate.opsForList().rightPush(inAuditListRedisKey, json.toJSONString());
         // 填充数据
-        List<VideoPoolAuditListVO> list = buildVideoPoolAuditListVO(Collections.singletonList(obj));
+        List<VideoPoolAuditListVO> list = buildVideoPoolAuditListVO(objs);
         result.setObjs(list);
         return result;
     }
@@ -256,6 +296,10 @@ public class VideoPoolAuditService {
         videoPoolAuditMapper.updateVideoTitle(param, now);
     }
 
+    public void updateArticleSynopsis(VideoSynopsisUpdateParam param) {
+        videoPoolAuditMapper.updateArticleSynopsis(param, new Date());
+    }
+
     @XxlJob("shuffleVideoPoolAuditGroup")
     public ReturnT<String> shuffleVideoPoolAuditGroup(String param) {
         List<String> auditUser = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j");
@@ -280,36 +324,42 @@ public class VideoPoolAuditService {
         try {
             Long now = System.currentTimeMillis();
             String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
-            String inAuditListRedisKey = "video-pool-in-audit-list";
             String auditQueueRedisKey = "video-pool-audit-queue-" + dateStr;
             // 判断是否审核超时,重新加入待审核队列
-            while (true) {
-                List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, 0);
-                if (CollectionUtils.isEmpty(inAuditList)) {
-                    break;
-                }
-                JSONObject firstObj = JSONObject.parseObject(inAuditList.get(0));
-                if (now > firstObj.getLong("timestamp")) {
-                    redisTemplate.opsForList().leftPop(inAuditListRedisKey);
-                    String id = firstObj.getString("id");
-                    PublishSingleVideoSource videoAudit = videoSourceRepository.getByContentTraceId(id);
-                    if (videoAudit.getVideoPoolAuditStatus() == ArticleVideoAuditStatusEnum.WAITING.getCode()) {
-                        ContentPoolEnum poolEnum = ContentPoolEnum.from(videoAudit.getFlowPoolLevel());
-                        redisTemplate.opsForZSet().add(auditQueueRedisKey, id, poolEnum.getWeight());
-                    }
-                } else {
-                    break;
-                }
-            }
+            String auditAccountListKey = "video-pool-audit-account-list-" + dateStr;
+            Set<String> auditAccountList = redisTemplate.opsForSet().members(auditAccountListKey);
             List<String> excludeContentIds = new ArrayList<>();
-            // 审核中列表获取,按内容池分组
-            List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, -1);
             Map<String, List<PublishSingleVideoSource>> inAuditListPoolCountMap = new HashMap<>();
-            if (CollectionUtils.isNotEmpty(inAuditList)) {
-                List<String> inAuditListIds = inAuditList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
-                List<PublishSingleVideoSource> auditQueueList = videoSourceRepository.getByContentTraceIdIn(new ArrayList<>(inAuditListIds));
-                inAuditListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
-                excludeContentIds.addAll(inAuditListIds);
+            if (CollectionUtils.isNotEmpty(auditAccountList)) {
+                for (String auditAccount : auditAccountList) {
+                    String inAuditListRedisKey = "video-pool-in-audit-list-" + auditAccount;
+                    while (true) {
+                        List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, 0);
+                        if (CollectionUtils.isEmpty(inAuditList)) {
+                            break;
+                        }
+                        JSONObject firstObj = JSONObject.parseObject(inAuditList.get(0));
+                        if (now > firstObj.getLong("timestamp")) {
+                            redisTemplate.opsForList().leftPop(inAuditListRedisKey);
+                            String id = firstObj.getString("id");
+                            PublishSingleVideoSource videoAudit = videoSourceRepository.getByContentTraceId(id);
+                            if (videoAudit.getVideoPoolAuditStatus() == ArticleVideoAuditStatusEnum.WAITING.getCode()) {
+                                ContentPoolEnum poolEnum = ContentPoolEnum.from(videoAudit.getFlowPoolLevel());
+                                redisTemplate.opsForZSet().add(auditQueueRedisKey, id, poolEnum.getWeight());
+                            }
+                        } else {
+                            break;
+                        }
+                    }
+                    // 审核中列表获取,按内容池分组
+                    List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, -1);
+                    if (CollectionUtils.isNotEmpty(inAuditList)) {
+                        List<String> inAuditListIds = inAuditList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
+                        List<PublishSingleVideoSource> auditQueueList = videoSourceRepository.getByContentTraceIdIn(new ArrayList<>(inAuditListIds));
+                        inAuditListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
+                        excludeContentIds.addAll(inAuditListIds);
+                    }
+                }
             }
             // 待审核列表获取,按内容池分组
             Set<String> auditQueueIds = redisTemplate.opsForZSet().rangeByScore(auditQueueRedisKey, 0, 100);
@@ -329,7 +379,7 @@ public class VideoPoolAuditService {
                     List<PublishSingleVideoSource> inAuditListPool = inAuditListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
                     int needCount = entry.getValue() - (totalCount + auditQueueList.size() + inAuditListPool.size());
                     if (needCount > 0) {
-                        List<PublishSingleVideoSource> addList = videoPoolAuditMapper.articleVideoWatingAuditList(
+                        List<PublishSingleVideoSource> addList = videoPoolAuditMapper.articleVideoWaitingAuditList(
                                 Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
                                 Arrays.asList(poolEnum.getValue()), excludeContentIds, needCount);
                         if (CollectionUtils.isNotEmpty(addList)) {
@@ -343,9 +393,9 @@ public class VideoPoolAuditService {
             }
             // 待发布内容不足添加
             Long auditQueueSize = redisTemplate.opsForZSet().size(auditQueueRedisKey);
-            if (Objects.isNull(auditQueueSize) || auditQueueSize < 20) {
-                List<PublishSingleVideoSource> list = videoPoolAuditMapper.articleVideoWatingAuditList(
-                        Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, excludeContentIds, 40);
+            if (Objects.isNull(auditQueueSize) || auditQueueSize < 100) {
+                List<PublishSingleVideoSource> list = videoPoolAuditMapper.articleVideoWaitingAuditList(
+                        Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()), null, excludeContentIds, 100);
                 if (CollectionUtils.isNotEmpty(list)) {
                     for (PublishSingleVideoSource item : list) {
                         ContentPoolEnum poolEnum = ContentPoolEnum.from(item.getFlowPoolLevel());
@@ -359,4 +409,26 @@ public class VideoPoolAuditService {
         }
         return ReturnT.SUCCESS;
     }
+
+    public VideoPoolAuditDataVO auditData(VideoPoolAuditDataParam param) {
+        String accountName = param.getAuditAccountName();
+        Long start = DateUtils.getTodayStart();
+        Long end = System.currentTimeMillis();
+        List<PublishSingleVideoSource> auditCount = videoPoolAuditMapper.articleVideoAuditCount(accountName, start, end);
+        int auditPassCount = auditCount.stream()
+                .filter(item -> item.getVideoPoolAuditStatus() == ArticleVideoAuditStatusEnum.PASS.getCode())
+                .collect(Collectors.toList()).size();
+        int waitingAuditCount = videoPoolAuditMapper.articleVideoWaitingAuditCount();
+        VideoPoolAuditDataVO result = new VideoPoolAuditDataVO();
+        result.setAuditAccount(accountName);
+        result.setAuditCount(auditCount.size());
+        result.setAuditPassCount(auditPassCount);
+        result.setWaitingAuditCount(waitingAuditCount);
+        return result;
+    }
+
+    public void getOff(VideoPoolAuditDataParam param) {
+        String inAuditListRedisKey = "video-pool-in-audit-list-" + param.getAuditAccountName();
+        redisTemplate.delete(inAuditListRedisKey);
+    }
 }

+ 11 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/filter/strategy/ArticlePromotionStrategy.java

@@ -29,9 +29,11 @@ public class ArticlePromotionStrategy implements FilterStrategy {
         List<String> result = new ArrayList<>();
         List<Content> contents = param.getContents();
         List<Content> filterContents = new ArrayList<>();
-        List<String> channelContentIds = contents.stream().map(Content::getCrawlerChannelContentId).collect(Collectors.toList());
-        List<ArticlePoolPromotionSource> promotionSourceList = repository.getByChannelContentIdInAndStatusAndDeleted(channelContentIds, 1, 0);
-        Map<String, ArticlePoolPromotionSource> promotionSourceMap = promotionSourceList.stream().collect(Collectors.toMap(ArticlePoolPromotionSource::getChannelContentId, a -> a));
+        List<ArticlePoolPromotionSource> promotionSourceList = repository.getByStatusAndDeleted(1, 0);
+        Map<String, ArticlePoolPromotionSource> promotionSourceMap = promotionSourceList.stream()
+                .collect(Collectors.toMap(ArticlePoolPromotionSource::getChannelContentId, a -> a));
+        Map<String, ArticlePoolPromotionSource> promotionTitleMap = promotionSourceList.stream()
+                .collect(Collectors.toMap(ArticlePoolPromotionSource::getChannelContentId, a -> a, (a, b) -> a));
         for (Content content : contents) {
             if (promotionSourceMap.containsKey(content.getCrawlerChannelContentId())) {
                 ArticlePoolPromotionSource promotionSource = promotionSourceMap.get(content.getCrawlerChannelContentId());
@@ -39,6 +41,12 @@ public class ArticlePromotionStrategy implements FilterStrategy {
                     content.setFilterReason("内容已晋级过滤");
                     filterContents.add(content);
                 }
+            } else if (promotionTitleMap.containsKey(content.getTitle())) {
+                ArticlePoolPromotionSource promotionSource = promotionTitleMap.get(content.getTitle());
+                if (!promotionSource.getLevel().equals(content.getContentPoolType())) {
+                    content.setFilterReason("内容已晋级过滤");
+                    filterContents.add(content);
+                }
             }
             if (!StringUtils.hasText(content.getFilterReason())) {
                 result.add(content.getId());

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankParam.java

@@ -12,6 +12,7 @@ import java.util.List;
 public class RankParam {
     private String ghId;
     private String accountName;
+    private String planId;
     private List<Content> contents;
     private List<Content> backup;
     private int size;

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankStrategy.java

@@ -65,6 +65,7 @@ public interface RankStrategy {
         scoreParam.setStrategy(param.getStrategy());
         scoreParam.setScene(param.getScene());
         scoreParam.setReplaceSimilarityAccount(param.getReplaceSimilarityAccount());
+        scoreParam.setPlanId(param.getPlanId());
         return scoreParam;
     }
 

+ 5 - 5
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/FwhColdStartRankStrategy.java

@@ -12,10 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author dyp
@@ -71,7 +68,10 @@ public class FwhColdStartRankStrategy implements RankStrategy {
 
         // 3 选文章
         List<Content> result = new ArrayList<>();
-        int size = param.getSize() * param.getUserGroupIds().size();
+        int size = param.getSize();
+        if (Objects.nonNull(param.getUserGroupIds())) {
+            size = param.getSize() * param.getUserGroupIds().size();
+        }
         result.addAll(contents.subList(0, Math.min(contents.size(), size)));
 
         return new RankResult(result);

+ 23 - 4
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV15Strategy.java

@@ -38,8 +38,8 @@ public class RankV15Strategy implements RankStrategy {
     @Autowired
     private StrategyIndexScoreWeightService weightService;
 
-    @ApolloJsonValue("${touliu.account.ghIds:[\"gh_93e00e187787\", \"gh_ac43e43b253b\", \"gh_68e7fdc09fe4\",\"gh_77f36c109fb1\", \"gh_b181786a6c8c\", \"gh_1ee2e1b39ccf\"]}")
-    private List<String> touliuAccountGhIds;
+    @ApolloJsonValue("${notAddFissionScoreAccount:[]}")
+    private List<String> notAddFissionScoreAccount;
 
     public RankResult rank(RankParam param) {
         List<Content> result = new ArrayList<>();
@@ -57,8 +57,27 @@ public class RankV15Strategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
             int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
-            if (contentPools[0].equals(item.getContent().getContentPoolType())
-                    || contentPools[1].equals(item.getContent().getContentPoolType())) {
+            if (contentPools[0].equals(item.getContent().getContentPoolType())) {
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
+                }
+                // 部分账号实验 不增加裂变分
+                if (!notAddFissionScoreAccount.contains(param.getAccountName())) {
+                    score += item.getScore(ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value());
+                }
+            } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
                 score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
                         ScoreStrategyEnum.SIMILARITY.value())

+ 3 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV5Strategy.java

@@ -2,7 +2,6 @@ package com.tzld.longarticle.recommend.server.service.recommend.rank.strategy;
 
 
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
-import com.tzld.longarticle.recommend.server.common.ContentCountMonitor;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
@@ -112,6 +111,9 @@ public class RankV5Strategy implements RankStrategy {
 
         // 头
         List<Content> pool1 = contentMap.get(contentPools[0]);
+        if (CollectionUtils.isNotEmpty(pool1)) {
+            pool1 = RankService.contentSourceTypeFilter(param.getStrategy(), pool1, 1);
+        }
         RankService.printSortLog(param.getStrategy(), param.getAccountName(), "头条", pool1);
         if (CollectionUtils.isNotEmpty(pool1)) {
             result.add(pool1.get(0));

+ 75 - 58
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java

@@ -20,6 +20,7 @@ import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseM
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.dto.ContentHisPublishArticle;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerMetaArticle;
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
@@ -30,6 +31,7 @@ import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
 import com.tzld.longarticle.recommend.server.model.param.TitleHisCacheParam;
 import com.tzld.longarticle.recommend.server.remote.aigc.AIGCWaitingPublishContentService;
 import com.tzld.longarticle.recommend.server.repository.aigc.CrawlerMetaArticleRepository;
+import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecordRepository;
 import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentRepository;
 import com.tzld.longarticle.recommend.server.repository.aigc.PublishPlanRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
@@ -112,6 +114,10 @@ public class RecallService implements ApplicationContextAware {
     AigcBaseMapper aigcBaseMapper;
     @Autowired
     PublishPlanRepository publishPlanRepository;
+    @Autowired
+    ProducePlanExeRecordRepository producePlanExeRecordRepository;
+    @Autowired
+    AccountRepository accountRepository;
 
     private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
     private ApplicationContext applicationContext;
@@ -123,6 +129,8 @@ public class RecallService implements ApplicationContextAware {
     private Boolean contentHisFeishuEnable;
     @Value("${morning.noon.fission.rate:0.64}")
     private double morningNoonFissionRate;
+    @Value("${category.active.version:1}")
+    private Integer activeVersion;
 
 
     @PostConstruct
@@ -275,7 +283,7 @@ public class RecallService implements ApplicationContextAware {
             return;
         }
         Map<String, Content> contentMap = contentList.stream()
-                .collect(Collectors.toMap(Content::getSourceId, Function.identity()));
+                .collect(Collectors.toMap(Content::getSourceId, Function.identity(), (a, b) -> a));
         List<PublishSingleVideoSource> sourceList = publishSingleVideoSourceRepository.getByContentTraceIdIn(contentTraceIds);
         Map<String, PublishSingleVideoSource> sourceMap = sourceList.stream()
                 .collect(Collectors.toMap(PublishSingleVideoSource::getContentTraceId, Function.identity()));
@@ -327,8 +335,6 @@ public class RecallService implements ApplicationContextAware {
         long start = System.currentTimeMillis();
         contentList.forEach(content -> content.setTitleMd5(Md5Util.encoderByMd5(content.getTitle())));
         List<String> sourceIdList = contentList.stream().map(Content::getSourceId).distinct().collect(Collectors.toList());
-        Map<String, Content> sourceIdToContentMap = contentList.stream().collect(
-                Collectors.toMap(Content::getSourceId, Function.identity(), (o1, o2) -> o2));
         // 根据sourceId查询数据库获取数据
         List<ArticleTitleHisCache> articleTitleHisCacheList = new ArrayList<>(sourceIdList.size());
         for (List<String> partition : Lists.partition(sourceIdList, 1000)) {
@@ -342,18 +348,6 @@ public class RecallService implements ApplicationContextAware {
         List<AccountCorrelation> accountCorrelationList = accountCorrelationRepository.findByGhIdAndStatus(ghId, 1);
         Map<String, Double> accountCorrelationMap = accountCorrelationList.stream().collect(
                 Collectors.toMap(AccountCorrelation::getRelGhId, AccountCorrelation::getCorrelation));
-        List<TitleHisCacheParam> paramList = sourceIdList.stream().map(sourceId -> {
-            Content content = sourceIdToContentMap.get(sourceId);
-            TitleHisCacheParam cacheParam = new TitleHisCacheParam();
-            cacheParam.setSourceId(sourceId);
-            cacheParam.setTitleMd5(content.getTitleMd5());
-            cacheParam.setTitle(content.getTitle());
-            cacheParam.setCrawlerTitle(content.getCrawlerTitle());
-            cacheParam.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
-            cacheParam.setCategory(content.getCategory());
-            return cacheParam;
-        }).collect(Collectors.toList());
-        Map<String, Content> articlesWithHistory = getArticleWithHistory(paramList, type);
         List<Content> newCacheSaveList = new ArrayList<>();
         Set<String> newCacheSourceIdSet = new HashSet<>();
         for (Content content : contentList) {
@@ -361,8 +355,10 @@ public class RecallService implements ApplicationContextAware {
                 ArticleTitleHisCache cache = articleTitleHisCacheMap.get(content.getSourceId());
                 List<ContentHisPublishArticle> hisPublishArticleList =
                         JSONArray.parseArray(cache.getHisPublishArticleList(), ContentHisPublishArticle.class);
-                for (ContentHisPublishArticle article : hisPublishArticleList) {
-                    article.setCorrelation(Optional.ofNullable(accountCorrelationMap.get(article.getGhId())).orElse(0.0));
+                if (CollectionUtils.isNotEmpty(hisPublishArticleList)) {
+                    for (ContentHisPublishArticle article : hisPublishArticleList) {
+                        article.setCorrelation(Optional.ofNullable(accountCorrelationMap.get(article.getGhId())).orElse(0.0));
+                    }
                 }
                 if (StringUtils.hasText(cache.getCategory())) {
                     content.setCategory(JSONArray.parseArray(cache.getCategory(), String.class));
@@ -371,21 +367,8 @@ public class RecallService implements ApplicationContextAware {
                 content.setKimiSafeScore(cache.getKimiSafeScore());
                 content.setRootPublishTimestamp(cache.getRootPublishTimestamp());
                 content.setHisPublishArticleList(hisPublishArticleList);
-                setT0Data(content);
-                continue;
-            }
-            if (articlesWithHistory.containsKey(content.getSourceId())) {
-                Content articleWithHistory = articlesWithHistory.get(content.getSourceId());
-                content.setHisPublishArticleList(articleWithHistory.getHisPublishArticleList());
-                if (CollectionUtils.isNotEmpty(articleWithHistory.getCategory())) {
-                    content.setCategory(articleWithHistory.getCategory());
-                }
-                content.setKimiSafeScore(articleWithHistory.getKimiSafeScore());
-                content.setRootPublishTimestamp(articleWithHistory.getRootPublishTimestamp());
-                for (ContentHisPublishArticle article : content.getHisPublishArticleList()) {
-                    article.setCorrelation(Optional.ofNullable(accountCorrelationMap.get(article.getGhId())).orElse(0.0));
-                }
-                setT0Data(content);
+                setT0Data(content, ghId);
+            } else {
                 if (!newCacheSourceIdSet.contains(content.getSourceId())) {
                     newCacheSaveList.add(content);
                     newCacheSourceIdSet.add(content.getSourceId());
@@ -404,9 +387,6 @@ public class RecallService implements ApplicationContextAware {
         List<ArticleTitleHisCache> cacheList = new ArrayList<>();
         try {
             for (Content content : saveList) {
-                if (CollectionUtils.isEmpty(content.getHisPublishArticleList())) {
-                    continue;
-                }
                 ArticleTitleHisCache cache = new ArticleTitleHisCache();
                 BeanUtils.copyProperties(content, cache);
                 cache.setType(type);
@@ -416,13 +396,12 @@ public class RecallService implements ApplicationContextAware {
                     cache.setCategory(JSONObject.toJSONString(content.getCategory()));
                 }
                 cache.setRootPublishTimestamp(content.getRootPublishTimestamp());
-                cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
+                if (CollectionUtils.isNotEmpty(content.getHisPublishArticleList())) {
+                    cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
+                }
                 cache.setCreateTimestamp(System.currentTimeMillis());
                 cacheList.add(cache);
             }
-            if (CollectionUtils.isEmpty(cacheList)) {
-                return;
-            }
             List<String> sourceIds = cacheList.stream().map(ArticleTitleHisCache::getSourceId).collect(Collectors.toList());
             List<ArticleTitleHisCache> existsList = articleTitleHisCacheRepository.getBySourceIdInAndType(sourceIds, type);
             Set<String> existsIds = existsList.stream().map(ArticleTitleHisCache::getSourceId).collect(Collectors.toSet());
@@ -446,9 +425,6 @@ public class RecallService implements ApplicationContextAware {
         for (List<String> titleMd5s : titleMd5Partition) {
             hisArticleList.addAll(articleMapper.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, type, 1));
         }
-        if (CollectionUtils.isEmpty(hisArticleList)) {
-            return result;
-        }
         Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
                 .collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
         Set<String> snList = hisArticleList.stream().map(Article::getWxSn).collect(Collectors.toSet());
@@ -464,8 +440,9 @@ public class RecallService implements ApplicationContextAware {
         Set<String> appMsgIds = hisArticleList.stream().map(Article::getAppMsgId).collect(Collectors.toSet());
         List<Article> firstIndexHisArticleList = articleMapper.getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(
                 ghIds, appMsgIds, 1, type, 1);
-        Map<String, Map<String, Article>> firstIndexHisArticleMap = firstIndexHisArticleList.stream()
-                .collect(Collectors.groupingBy(Article::getGhId, Collectors.toMap(Article::getAppMsgId, o -> o)));
+        Map<String, Map<String, Map<String, Article>>> firstIndexHisArticleMap = firstIndexHisArticleList.stream()
+                .collect(Collectors.groupingBy(Article::getGhId, Collectors.groupingBy(Article::getAppMsgId,
+                        Collectors.toMap(Article::getTitle, o -> o, (a, b) -> a))));
         // 获取发布账号 位置历史均值
         List<AccountAvgInfo> accountAvgInfoList = crawlerBaseMapper.getAllByGhIdIn(ghIds);
         Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap = accountAvgInfoList.stream()
@@ -476,7 +453,7 @@ public class RecallService implements ApplicationContextAware {
                 .filter(o -> "1".equals(o.getPosition()))
                 .filter(o -> Objects.nonNull(o.getReadAvg()) && o.getReadAvg() > 0 && o.getFans() > 1000)
                 .collect(Collectors.groupingBy(AccountAvgInfo::getGhId, Collectors.toMap(AccountAvgInfo::getUpdateTime, o -> o)));
-        List<AccountCategory> accountCategoryList = accountCategoryRepository.getByStatus(StatusEnum.ONE.getCode());
+        List<AccountCategory> accountCategoryList = accountCategoryRepository.getByStatusAndVersion(StatusEnum.ONE.getCode(), activeVersion);
         Map<String, JSONObject> accountCategoryMap = accountCategoryList.stream().filter(o -> StringUtils.hasText(o.getCategoryMap()))
                 .collect(Collectors.toMap(AccountCategory::getGhId, o -> JSONObject.parseObject(o.getCategoryMap())));
 
@@ -499,7 +476,7 @@ public class RecallService implements ApplicationContextAware {
                     .collect(Collectors.toMap(PublishContent::getId, Function.identity()));
         }
         // 根据produceContentId查询category
-        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatus(ArticleCategoryStatusEnum.SUCCESS.getCode());
+        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.SUCCESS.getCode(), activeVersion);
         Map<String, ArticleCategory> categoryMap = articleCategoryList.stream()
                 .collect(Collectors.toMap(ArticleCategory::getProduceContentId, Function.identity()));
         Map<String, ArticleCategory> coldStartCategoryMap = articleCategoryList.stream()
@@ -507,10 +484,17 @@ public class RecallService implements ApplicationContextAware {
                 .collect(Collectors.toMap(ArticleCategory::getChannelContentId, Function.identity(), (a, b) -> a));
         Map<String, ArticleCategory> titleCategoryMap = articleCategoryList.stream()
                 .collect(Collectors.toMap(ArticleCategory::getTitleMd5, Function.identity(), (a, b) -> a));
+        // 获取生成计划
+        List<ProducePlanExeRecord> planExeRecordList = producePlanExeRecordRepository.findByPlanExeIdIn(sourceIds);
+        Map<String, ProducePlanExeRecord> planExeRecordMap = planExeRecordList.stream()
+                .collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, Function.identity()));
         // 根据sourceId查询kimiSafeScore
         List<ProduceTaskAtom> safeScoreList = aigcBaseMapper.getProduceScoreByContentId(sourceIds);
         Map<String, ProduceTaskAtom> safeScoreMap = safeScoreList.stream().filter(o -> StringUtils.hasText(o.getOutput()))
-               .collect(Collectors.toMap(ProduceTaskAtom::getPlanExeId, o -> o));
+                .collect(Collectors.toMap(ProduceTaskAtom::getPlanExeId, o -> o));
+        List<Account> accountList = accountRepository.getByStatus(1);
+        Map<String, Account> accountMap = accountList.stream()
+                .collect(Collectors.toMap(Account::getGhId, Function.identity()));
 
         for (TitleHisCacheParam cacheParam : paramList) {
             Content res = new Content();
@@ -535,7 +519,11 @@ public class RecallService implements ApplicationContextAware {
                         res.setKimiSafeScore(safeScore);
                     }
                 }
-                res.setProducePlanId(atom.getPlanId());
+            }
+            // 设置生成计划
+            ProducePlanExeRecord exeRecord = planExeRecordMap.get(cacheParam.getSourceId());
+            if (Objects.nonNull(exeRecord)) {
+                res.setProducePlanId(exeRecord.getPlanId());
             }
             // 溯源查找源发布时间
             ArticlePoolPromotionSource source = sourceMap.get(cacheParam.getCrawlerChannelContentId());
@@ -588,6 +576,10 @@ public class RecallService implements ApplicationContextAware {
                 }
                 ContentHisPublishArticle article = new ContentHisPublishArticle();
                 BeanUtils.copyProperties(hisArticle, article);
+                Account account = accountMap.get(article.getGhId());
+                if (Objects.nonNull(account)) {
+                    article.setAccountType(account.getType());
+                }
                 article.setViewCount(hisArticle.getShowViewCount());
                 article.setWxSn(hisArticle.getWxSn());
                 article.setArticleDetailInfoList(articleDetailInfoMap.get(hisArticle.getWxSn()));
@@ -631,13 +623,16 @@ public class RecallService implements ApplicationContextAware {
                         article.setFans(firstIndexAvgInfo.getFans());
                     }
                 }
-                Map<String, Article> firstIndexArticle = firstIndexHisArticleMap.get(hisArticle.getGhId());
+                Map<String, Map<String, Article>> firstIndexArticle = firstIndexHisArticleMap.get(hisArticle.getGhId());
                 if (Objects.nonNull(firstIndexArticle) && firstIndexArticle.containsKey(hisArticle.getAppMsgId())) {
-                    Article firstArticle = firstIndexArticle.get(hisArticle.getAppMsgId());
-                    article.setFirstViewCount(firstArticle.getShowViewCount());
-                    if (Objects.nonNull(firstIndexAvgInfo) && Objects.nonNull(firstIndexAvgInfo.getReadAvg())
-                            && firstIndexAvgInfo.getReadAvg() > 0 && Objects.nonNull(firstArticle.getShowViewCount())) {
-                        article.setFirstViewCountRate((firstArticle.getShowViewCount() * 1.0) / firstIndexAvgInfo.getReadAvg());
+                    Map<String, Article> firstAppMsgIdArticle = firstIndexArticle.get(hisArticle.getAppMsgId());
+                    if (Objects.nonNull(firstAppMsgIdArticle) && firstAppMsgIdArticle.containsKey(hisArticle.getTitle())) {
+                        Article firstArticle = firstAppMsgIdArticle.get(hisArticle.getTitle());
+                        article.setFirstViewCount(firstArticle.getShowViewCount());
+                        if (Objects.nonNull(firstIndexAvgInfo) && Objects.nonNull(firstIndexAvgInfo.getReadAvg())
+                                && firstIndexAvgInfo.getReadAvg() > 0 && Objects.nonNull(firstArticle.getShowViewCount())) {
+                            article.setFirstViewCountRate((firstArticle.getShowViewCount() * 1.0) / firstIndexAvgInfo.getReadAvg());
+                        }
                     }
                 }
                 res.getHisPublishArticleList().add(article);
@@ -648,13 +643,16 @@ public class RecallService implements ApplicationContextAware {
         return result;
     }
 
-    private void setT0Data(Content content) {
+    private void setT0Data(Content content, String ghId) {
         if (CollectionUtils.isEmpty(content.getHisPublishArticleList())) {
             return;
         }
+        Account account = accountRepository.getByGhId(ghId);
         int firstLevelSize = 0;
         int fissionSum = 0;
         double fissionWeightSum = 0;
+        double fissionHeadWeightSum = 0;
+        double fissionRecommendWeightSum = 0;
         int fansSum = 0;
         int avgReadCountSum = 0;
         Double t0FissionByFansSum = 0.0;
@@ -664,6 +662,9 @@ public class RecallService implements ApplicationContextAware {
             if (article.getItemIndex() != 1 || !article.isInnerAccount()) {
                 continue;
             }
+            if (Objects.nonNull(account) && !account.getType().equals(article.getAccountType())) {
+                continue;
+            }
             if (CollectionUtils.isEmpty(article.getArticleDetailInfoList())) {
                 // 仅判断7.12以后发布文章
                 if (article.getPublishTimestamp() > 1720713600 && contentHisFeishuEnable) {
@@ -682,11 +683,21 @@ public class RecallService implements ApplicationContextAware {
                 continue;
             }
             int sumFission0 = 0;
+            int sumFission0Head = 0;
+            int sumFission0Recommend = 0;
             Date minDate = article.getArticleDetailInfoList().stream().map(ArticleDetailInfo::getRecallDt)
                     .min(Date::compareTo).orElse(new Date());
             for (ArticleDetailInfo articleDetailInfo : article.getArticleDetailInfoList()) {
-                if (articleDetailInfo.getRecallDt().equals(minDate) && Objects.nonNull(articleDetailInfo.getFission0())) {
-                    sumFission0 += articleDetailInfo.getFission0();
+                if (articleDetailInfo.getRecallDt().equals(minDate)) {
+                    if (Objects.nonNull(articleDetailInfo.getFission0())) {
+                        sumFission0 += articleDetailInfo.getFission0();
+                    }
+                    if (Objects.nonNull(articleDetailInfo.getFission0Head())) {
+                        sumFission0Head += articleDetailInfo.getFission0Head();
+                    }
+                    if (Objects.nonNull(articleDetailInfo.getFission0Recommend())) {
+                        sumFission0Recommend += articleDetailInfo.getFission0Recommend();
+                    }
                 }
             }
             if (sumFission0 == 0) {
@@ -709,8 +720,12 @@ public class RecallService implements ApplicationContextAware {
             int hour = DateUtils.getHourByTimestamp(article.getPublishTimestamp());
             if (hour >= 12) {
                 fissionWeightSum += sumFission0 / morningNoonFissionRate;
+                fissionHeadWeightSum += sumFission0Head / morningNoonFissionRate;
+                fissionRecommendWeightSum += sumFission0Recommend / morningNoonFissionRate;
             } else {
                 fissionWeightSum += sumFission0;
+                fissionHeadWeightSum += sumFission0Head;
+                fissionRecommendWeightSum += sumFission0Recommend;
             }
             firstLevelSize++;
         }
@@ -725,7 +740,9 @@ public class RecallService implements ApplicationContextAware {
                 content.setT0FissionByReadAvgSumAvg(fissionSum * 1.0 / avgReadCountSum);
             }
             if (avgReadCountSum > 0) {
-                content.setT0FissionDeWeightByReadAvgSumAvg(fissionWeightSum / avgReadCountSum);
+                content.setT0FissionDeWeightByReadAvgSumAvg(fissionWeightSum / (avgReadCountSum + 500));
+                content.setT0FissionHeadDeWeightByReadAvgSumAvg(fissionHeadWeightSum / (avgReadCountSum + 500));
+                content.setT0FissionRecommendDeWeightByReadAvgSumAvg(fissionRecommendWeightSum / (avgReadCountSum + 500));
             }
         }
     }

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/ScoreParam.java

@@ -18,6 +18,7 @@ import java.util.List;
 public class ScoreParam {
     private String ghId;
     private String accountName;
+    private String planId;
     private List<Content> contents;
     private String strategy;
     private String scene;

+ 5 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/CategoryStrategy.java

@@ -14,6 +14,7 @@ import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreParam;
 import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreStrategy;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
@@ -34,6 +35,8 @@ public class CategoryStrategy implements ScoreStrategy {
     @ApolloJsonValue("${accountCategoryWeightConfig:{}}")
     private Map<String, AccountCategoryWeightConfig[]> accountCategoryWeightConfigMap;
 
+    @Value("${category.active.version:1}")
+    private Integer activeVersion;
 
     @Override
     public List<Score> score(ScoreParam param) {
@@ -42,7 +45,8 @@ public class CategoryStrategy implements ScoreStrategy {
         if (CollectionUtils.isEmpty(param.getContents())) {
             return scores;
         }
-        List<AccountCategory> accountCategoryList = accountCategoryRepository.getByGhIdAndStatus(param.getGhId(), StatusEnum.ONE.getCode());
+        List<AccountCategory> accountCategoryList = accountCategoryRepository.getByGhIdAndStatusAndVersion(
+                param.getGhId(), StatusEnum.ONE.getCode(), activeVersion);
         if (CollectionUtils.isEmpty(accountCategoryList)) {
             return scores;
         }

+ 20 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/HisFissionDeWeightAvgReadSumRateStrategy.java

@@ -1,5 +1,6 @@
 package com.tzld.longarticle.recommend.server.service.recommend.score.strategy;
 
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.service.recommend.config.AccountIndexAvgViewCountService;
 import com.tzld.longarticle.recommend.server.service.recommend.score.Score;
@@ -12,6 +13,8 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 @Component
 @Slf4j
@@ -20,10 +23,13 @@ public class HisFissionDeWeightAvgReadSumRateStrategy implements ScoreStrategy {
     @Autowired
     AccountIndexAvgViewCountService accountIndexAvgViewCountService;
 
+    @ApolloJsonValue("${scoreFissionWeightConfig:{}}")
+    private Map<String, Map<String, Double>> scoreFissionWeightConfig;
+
     @Override
     public List<Score> score(ScoreParam param) {
-        long start = System.currentTimeMillis();
         List<Score> scores = new ArrayList<>();
+        Map<String, Double> scoreFissionWeightConfigMap = scoreFissionWeightConfig.get(param.getPlanId());
         for (Content content : param.getContents()) {
             if (CollectionUtils.isEmpty(content.getHisPublishArticleList())) {
                 continue;
@@ -31,7 +37,19 @@ public class HisFissionDeWeightAvgReadSumRateStrategy implements ScoreStrategy {
             Score score = new Score();
             score.setStrategy(this);
             score.setContentId(content.getId());
-            score.setScore(content.getT0FissionDeWeightByReadAvgSumAvg());
+            Double scoreValue = 0.0;
+            if (Objects.nonNull(scoreFissionWeightConfigMap)) {
+                if (Objects.nonNull(content.getT0FissionHeadDeWeightByReadAvgSumAvg())) {
+                    scoreValue += content.getT0FissionHeadDeWeightByReadAvgSumAvg() * scoreFissionWeightConfigMap.get("head");
+                }
+                if (Objects.nonNull(content.getT0FissionRecommendDeWeightByReadAvgSumAvg())) {
+                    scoreValue += content.getT0FissionRecommendDeWeightByReadAvgSumAvg() * scoreFissionWeightConfigMap.get("recommend");
+                }
+            }
+            if (scoreValue == 0.0) {
+                scoreValue = content.getT0FissionDeWeightByReadAvgSumAvg();
+            }
+            score.setScore(scoreValue);
             scores.add(score);
         }
         return scores;

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

@@ -107,4 +107,9 @@ public class XxlJobController {
         articlePromotionService.topContentReSend(null);
     }
 
+    @GetMapping("/refreshAccount")
+    public void refreshAccount() {
+        service.refreshAccount(null);
+    }
+
 }

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

@@ -78,4 +78,11 @@ public class DataDashboardController {
         }).start();
     }
 
+    @GetMapping("/export/contentEffectGroupBySource")
+    public void contentEffectGroupBySource(String dateStr) {
+        new Thread(() -> {
+            service.contentEffectGroupBySource(dateStr);
+        }).start();
+    }
+
 }

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.web.recommend;
 
 import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
 import com.tzld.longarticle.recommend.server.model.param.videoAudit.*;
+import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditDataVO;
 import com.tzld.longarticle.recommend.server.model.vo.VideoPoolAuditListVO;
 import com.tzld.longarticle.recommend.server.service.recommend.VideoPoolAuditService;
 import com.tzld.longarticle.recommend.server.util.page.Page;
@@ -29,6 +30,17 @@ public class VideoPoolAuditController {
         return CommonResponse.success(service.next(param));
     }
 
+    @PostMapping("/auditData")
+    public CommonResponse<VideoPoolAuditDataVO> articleVideoAuditData(@RequestBody VideoPoolAuditDataParam param) {
+        return CommonResponse.success(service.auditData(param));
+    }
+
+    @PostMapping("/getOff")
+    public CommonResponse<Void> getOff(@RequestBody VideoPoolAuditDataParam param) {
+        service.getOff(param);
+        return CommonResponse.success();
+    }
+
     @PostMapping("/auditArticle")
     public CommonResponse<Void> auditArticle(@RequestBody ArticleAuditParam param) {
         service.auditArticle(param);
@@ -52,6 +64,12 @@ public class VideoPoolAuditController {
         return CommonResponse.success();
     }
 
+    @PostMapping("/updateArticleSynopsis")
+    public CommonResponse<Void> updateArticleSynopsis(@RequestBody VideoSynopsisUpdateParam param) {
+        service.updateArticleSynopsis(param);
+        return CommonResponse.success();
+    }
+
     @GetMapping("/shuffleAuditGroup")
     public CommonResponse<Void> shuffleVideoPoolAuditGroup() {
         service.shuffleVideoPoolAuditGroup(null);

+ 51 - 1
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -114,7 +114,7 @@
 
     <select id="getProduceScoreByContentId"
             resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom">
-        select atom.plan_exe_id, atom.plan_id, atom.input, atom.output, record.audit_timestamp as createTimestamp
+        select atom.plan_exe_id, atom.input, atom.output, record.audit_timestamp as createTimestamp
         from produce_task_atom atom
         join produce_plan_exe_record record on atom.plan_exe_id = record.plan_exe_id
         join produce_plan_module_task task on task.task_id = atom.task_id
@@ -361,4 +361,54 @@
         where pgss.effective_date = #{dateStr}
     </select>
 
+    <select id="getVideoPoolPlatformCrawlerCount" resultType="java.lang.Long">
+        select count(1)
+        from crawler_content cc
+        join crawler_content_video_pool_relation ccvpr on cc.channel_content_id = ccvpr.channel_content_id
+        where ccvpr.platform = #{platform}
+        and cc.crawler_timestamp between #{start} and #{end}
+    </select>
+
+    <select id="getVideoPoolPlatformProduceCount" 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
+        join crawler_content_video_pool_relation ccvpr on cc.channel_content_id = ccvpr.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 ccvpr.platform = #{platform}
+    </select>
+
+    <select id="getVideoPoolPlatformProduceAuditPassCount" 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
+        join crawler_content_video_pool_relation ccvpr on cc.channel_content_id = ccvpr.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 ccvpr.platform = #{platform}
+    </select>
+
+    <select id="getIdPlatformByContentId"
+            resultType="com.tzld.longarticle.recommend.server.model.dto.aigc.IdPlatformDTO">
+        select pper.plan_exe_id as id, ccvpr.platform
+        from produce_plan_exe_record pper
+        join crawler_content cc on pper.channel_content_id = cc.channel_content_id
+        join crawler_content_video_pool_relation ccvpr on cc.channel_content_id = ccvpr.channel_content_id
+        where pper.plan_exe_id in
+        <foreach collection="idList" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

+ 32 - 0
long-article-recommend-service/src/main/resources/mapper/aigc/PublishContentMapper.xml

@@ -258,6 +258,7 @@
             #{item}
         </foreach>
     </update>
+
     <update id="updatePublishContentStatus">
         update publish_content
         set status = #{status}
@@ -265,4 +266,35 @@
         and status = #{oldStatus}
     </update>
 
+    <select id="getPublishAccountIds" resultType="java.lang.String">
+        select distinct ppa.account_id
+        from publish_plan_account ppa
+        join publish_plan pp on ppa.plan_id = pp.id
+        where pp.plan_status = 1 and pp.channel = 5 and ppa.publish_open_flag = 1 and pp.name not like '%自动回复%'
+    </select>
+
+    <select id="getAccountByIds"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.Account">
+        select pa.id, pa.name, pa.gh_id, wsgsa.group_source_name as type
+        from publish_account pa
+        left join wx_statistics_group_source_account wsgsa on pa.id = wsgsa.account_id
+        where pa.id in
+        <foreach collection="accountIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+
+    </select>
+
+    <select id="getAccountMiniprogramTaskList"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishPlanMiniprogramTask">
+        select ppmt.*
+        from publish_plan_miniprogram_task ppmt
+        join publish_plan_account ppa on ppmt.plan_id = ppa.plan_id
+        join publish_plan pp on ppa.plan_id = pp.id
+        where ppa.account_id = #{accountId}
+          and pp.plan_status = 1
+          and ppa.publish_open_flag = 1
+          and ppmt.account_ids like CONCAT("%", #{accountId}, "%")
+    </select>
+
 </mapper>

+ 14 - 1
long-article-recommend-service/src/main/resources/mapper/crawler/CrawlerBaseMapper.xml

@@ -69,7 +69,8 @@
 
     <select id="getAllByWxSnIn"
             resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.ArticleDetailInfo">
-        select wx_sn, recall_dt, first_level, fission_0
+        select wx_sn, recall_dt, first_level, fission_0, fission_0_head, fission_0_recommend, fission_1, fission_1_head,
+        fission_1_recommend, fission_2, fission_2_head, fission_2_recommend
         from long_articles_detail_info
         where wx_sn in
         <foreach collection="wxSnList" item="item" separator="," open="(" close=")">
@@ -87,4 +88,16 @@
         </foreach>
     </select>
 
+    <select id="getByGhIdInAndPublishTimestampLessThanAndTypeEquals"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
+        select ghId, accountName, ItemIndex, title, ContentUrl, wx_sn, publish_timestamp, show_view_count
+        from official_articles_v2
+        where ghId in
+        <foreach collection="ghIds" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+        and publish_timestamp &lt; #{publishTimestamp}
+        and type = #{type}
+    </select>
+
 </mapper>

+ 4 - 3
long-article-recommend-service/src/main/resources/mapper/longArticle/ArticleCategoryMapper.xml

@@ -5,11 +5,11 @@
     <insert id="batchInsertArticleCategory">
         INSERT INTO article_category
         (produce_content_id, channel_content_id, crawler_plan_id, title, title_md5, category,
-        kimi_result, status, create_timestamp)
+        kimi_result, status, create_timestamp, version)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.produceContentId}, #{item.channelContentId}, #{item.crawlerPlanId}, #{item.title}, #{item.titleMd5},
-            #{item.category}, #{item.kimiResult}, #{item.status}, #{item.createTimestamp})
+            #{item.category}, #{item.kimiResult}, #{item.status}, #{item.createTimestamp}, #{item.version})
         </foreach>
     </insert>
 
@@ -56,8 +56,9 @@
         from publish_single_video_source
         where bad_status = 0
           and audit_status = 1
+          and status = 2
           and content_trace_id not in (select produce_content_id
-                                       from article_category)
+                                       from article_category where version = #{version})
     </select>
 
 </mapper>

+ 46 - 22
long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml

@@ -18,9 +18,13 @@
         INSERT INTO datastat_sort_strategy
         (date_str, publish_time, account_mode, account_source, account_type, account_status, bussiness_type,
         account_name, strategy, fans, view_count, avg_view_count, first_view_count, first_avg_view_count,
-        first_level, fission0, fission1, fission2, second_first_level, second_fission0, second_fission1,
-        second_fission2, third_first_level, third_fission0, third_fission1, third_fission2,
-        read_rate, read_fans_rate, first_read_rate, fission0_first_rate, fission1_fission0_rate,
+        first_level, fission0, fission0_head, fission0_recommend, fission1, fission1_head, fission1_recommend, fission2,
+        fission2_head, fission2_recommend, second_first_level, second_fission0, second_fission0_head,
+        second_fission0_recommend, second_fission1, second_fission1_head, second_fission1_recommend,
+        second_fission2, second_fission2_head, second_fission2_recommend, third_first_level, third_fission0,
+        third_fission0_head, third_fission0_recommend, third_fission1, third_fission1_head, third_fission1_recommend,
+        third_fission2,third_fission2_head, third_fission2_recommend,
+        read_rate, read_fans_rate, first_read_rate, fission0_first_rate, fission0_head_first_rate, fission0_recommend_first_rate, fission1_fission0_rate,
         fission0_read_avg_rate, his_read_rate, his_first_read_rate, his_fission0_first_rate, position, gh_id, title,
         link, wx_sn, fission0_read_avg_100_rate, fission0_read_avg_500_rate, fission0_read_avg_1000_rate,
         crawler_plan_name, crawler_plan_tag, produce_plan_name, produce_plan_tag, publish_plan_name,
@@ -31,10 +35,17 @@
             (#{item.dateStr}, #{item.publishTime}, #{item.accountMode}, #{item.accountSource}, #{item.accountType},
             #{item.accountStatus}, #{item.businessType}, #{item.accountName}, #{item.strategy}, #{item.fans},
             #{item.viewCount}, #{item.avgViewCount}, #{item.firstViewCount}, #{item.firstAvgViewCount},
-            #{item.firstLevel}, #{item.fission0}, #{item.fission1}, #{item.fission2}, #{item.secondFirstLevel},
-            #{item.secondFission0}, #{item.secondFission1}, #{item.secondFission2}, #{item.thirdFirstLevel},
-            #{item.thirdFission0}, #{item.thirdFission1}, #{item.thirdFission2}, #{item.readRate},
-            #{item.readFansRate}, #{item.firstReadRate}, #{item.fission0FirstRate}, #{item.fission1Fission0Rate},
+            #{item.firstLevel}, #{item.fission0},#{item.fission0Head},#{item.fission0Recommend}, #{item.fission1},
+            #{item.fission1Head},#{item.fission1Recommend}, #{item.fission2},#{item.fission2Head},
+            #{item.fission2Recommend}, #{item.secondFirstLevel}, #{item.secondFission0},
+            #{item.secondFission0Head}, #{item.secondFission0Recommend}, #{item.secondFission1},
+            #{item.secondFission1Head}, #{item.secondFission1Recommend}, #{item.secondFission2},
+            #{item.secondFission2Head}, #{item.secondFission2Recommend}, #{item.thirdFirstLevel},
+            #{item.thirdFission0}, #{item.thirdFission0Head}, #{item.thirdFission0Recommend},
+            #{item.thirdFission1}, #{item.thirdFission1Head}, #{item.thirdFission1Recommend},
+            #{item.thirdFission2}, #{item.thirdFission2Head}, #{item.thirdFission2Recommend}, #{item.readRate},
+            #{item.readFansRate}, #{item.firstReadRate}, #{item.fission0FirstRate}, #{item.fission0HeadFirstRate},
+             #{item.fission0RecommendFirstRate}, #{item.fission1Fission0Rate},
             #{item.fission0ReadAvgRate}, #{item.hisReadRate}, #{item.hisFirstReadRate}, #{item.hisFission0FirstRate},
             #{item.position}, #{item.ghId}, #{item.title}, #{item.link},
             #{item.wxSn}, #{item.fission0ReadAvg100Rate}, #{item.fission0ReadAvg500Rate},
@@ -223,7 +234,7 @@
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
         select content_trace_id, article_title, cover_url, flow_pool_level
         from publish_single_video_source
-        where bad_status = 0 and audit_status = 1
+        where bad_status = 0 and audit_status = 1 and status = 2
         <if test="flowPoolLevel!= null ">
             and flow_pool_level = #{flowPoolLevel}
         </if>
@@ -236,12 +247,12 @@
     <insert id="batchInsertArticleTitleHisCache">
         insert into article_title_his_cache
         (source_id, type, title, title_md5, kimi_safe_score, channel_content_id, root_publish_timestamp, crawler_title,
-         category, his_publish_article_list, create_timestamp)
+         category, his_publish_article_list, create_timestamp, plan_id)
         values
         <foreach collection="list" item="item" separator=",">
             (#{item.sourceId}, #{item.type}, #{item.title}, #{item.titleMd5}, #{item.kimiSafeScore},
              #{item.channelContentId}, #{item.rootPublishTimestamp}, #{item.crawlerTitle}, #{item.category},
-             #{item.hisPublishArticleList}, #{item.createTimestamp})
+             #{item.hisPublishArticleList}, #{item.createTimestamp}, #{item.planId})
         </foreach>
     </insert>
 
@@ -311,18 +322,31 @@
 
     <select id="getTopContent"
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy">
-        select *
-        from datastat_sort_strategy
-        where date_str &lt; #{dateStr}
-          and type = 9
-          and read_rate > 1
-          and view_count > 10000
-          and position in (1, 2)
-          and title not in (select title from article_unsafe_title)
-          and first_level is not null
-          and strategy is not null
-        order by read_rate desc
-        limit 200
+        select dss.*
+        from datastat_sort_strategy dss
+                 join (select title, max(read_rate) as read_rate
+                       from datastat_sort_strategy
+                       where date_str &lt; #{dateStr}
+                         and type = 9
+                         and read_rate > 1
+                         and view_count > 10000
+                         and position in (1, 2)
+                         and title not in (select title from article_unsafe_title where status = 1)
+                         and first_level is not null
+                         and strategy is not null
+                       GROUP BY title) top on dss.title = top.title and dss.read_rate = top.read_rate
+    </select>
+
+    <select id="getVideoEndScreenTransformationTask"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.VideoEndScreenTransformationTask">
+        select * from video_end_screen_transformation_task where video_origin_id = #{videoOriginId}
     </select>
 
+    <insert id="saveVideoEndScreenTransformationTask">
+        insert into video_end_screen_transformation_task
+        (video_origin_id, title, oss_path)
+        values
+        (#{videoOriginId}, #{title}, #{ossPath})
+    </insert>
+
 </mapper>

+ 28 - 6
long-article-recommend-service/src/main/resources/mapper/longArticle/VideoPoolAuditMapper.xml

@@ -5,7 +5,7 @@
     <select id="articleVideoAuditListCount" resultType="java.lang.Integer">
         select count(content_trace_id)
         from publish_single_video_source
-        where bad_status in (0, 5) and audit_status = 1
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and video_pool_audit_status in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -60,7 +60,7 @@
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
         select *
         from publish_single_video_source
-        where bad_status in (0, 5) and audit_status = 1
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -127,7 +127,7 @@
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
         select *
         from publish_single_video_source
-        where bad_status in (0, 5) and audit_status = 1
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -162,7 +162,7 @@
             and flow_pool_level = #{flowPoolLevel}
         </if>
         order by crawler_timestamp desc
-        limit 1
+        limit #{limit}
     </select>
 
     <select id="searchFilterValueByItemName" resultType="java.lang.String">
@@ -203,11 +203,11 @@
         </choose>
     </select>
 
-    <select id="articleVideoWatingAuditList"
+    <select id="articleVideoWaitingAuditList"
             resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
         select *
         from publish_single_video_source
-        where bad_status in (0, 5) and audit_status = 1
+        where bad_status in (0, 5) and audit_status = 1 and status = 2
         <if test="status!= null and status.size() > 0">
             and `video_pool_audit_status` in
             <foreach collection="status" item="item" separator="," open="(" close=")">
@@ -248,5 +248,27 @@
         where content_trace_id = #{param.contentId}
     </update>
 
+    <update id="updateArticleSynopsis">
+        update video_content_understanding
+        set old_summary_text = summary_text,
+            summary_text = #{param.synopsis},
+            summary_text_update_account = #{param.updateAccount},
+            summary_text_ts = #{updateTime}
+        where content_trace_id = #{param.contentId}
+    </update>
+
+    <select id="articleVideoAuditCount" resultType="com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishSingleVideoSource">
+        select *
+        from publish_single_video_source
+        where bad_status in (0, 5)
+        and video_pool_audit_account = #{accountName}
+        and video_pool_audit_timestamp between #{start} and #{end}
+    </select>
+
+    <select id="articleVideoWaitingAuditCount" resultType="java.lang.Integer">
+        select count(1)
+        from publish_single_video_source
+        where bad_status = 0 and audit_status = 1 and status = 2 and video_pool_audit_status = 0
+    </select>
 
 </mapper>

+ 43 - 4
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/ArticleVideoAuditTest.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleCategoryStatusEnum;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
+import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleCategoryMapper;
 import com.tzld.longarticle.recommend.server.model.dto.kimi.KimiResult;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlan;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
@@ -15,9 +16,9 @@ import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecor
 import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.ArticleCategoryRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticleTitleAuditRepository;
-import com.tzld.longarticle.recommend.server.service.recommend.ArticleCategoryService;
 import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -32,6 +33,7 @@ import org.springframework.util.StringUtils;
 import javax.annotation.Resource;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -50,7 +52,7 @@ public class ArticleVideoAuditTest {
     @Resource
     private ProducePlanRepository producePlanRepository;
     @Resource
-    private ArticleCategoryService articleCategoryService;
+    private ArticleCategoryMapper articleCategoryMapper;
     @Autowired
     ArticleCategoryRepository articleCategoryRepository;
     @Autowired
@@ -83,8 +85,8 @@ public class ArticleVideoAuditTest {
 
     @Test
     public void ArticleCategoryTest() {
-        List<ArticleCategory> dealList = articleCategoryRepository.getByStatus(
-                ArticleCategoryStatusEnum.SUCCESS.getCode());
+        List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndVersion(
+                ArticleCategoryStatusEnum.SUCCESS.getCode(), 1);
         dealList = dealList.subList(0, 200);
         List<List<ArticleCategory>> partitionList = Lists.partition(dealList, 50);
         JSONArray result = new JSONArray();
@@ -177,4 +179,41 @@ public class ArticleVideoAuditTest {
         }
         return prompt.toString();
     }
+
+    @Test
+    public void articleCategoryAdd() {
+        List<ArticleCategory> oldList = articleCategoryRepository.getByStatusAndVersion(
+                ArticleCategoryStatusEnum.SUCCESS.getCode(), 1);
+        Map<String, ArticleCategory> oldMap = oldList.stream()
+                .filter(o -> !o.getProduceContentId().startsWith("video"))
+                .collect(Collectors.toMap(ArticleCategory::getProduceContentId, o -> o));
+        List<String> oldIds = oldList.stream().map(ArticleCategory::getProduceContentId)
+                .filter(o -> !o.startsWith("video"))
+                .collect(Collectors.toList());
+        List<ArticleCategory> newList = articleCategoryRepository.getByStatusAndVersion(
+                ArticleCategoryStatusEnum.SUCCESS.getCode(), 2);
+        List<String> newIds = newList.stream().map(ArticleCategory::getProduceContentId)
+               .filter(o ->!o.startsWith("video"))
+               .collect(Collectors.toList());
+        List<ArticleCategory> saveList = new ArrayList<>();
+        for (String oldId : oldIds) {
+            if (newIds.contains(oldId)) {
+                continue;
+            }
+            ArticleCategory articleCategory = oldMap.get(oldId);
+            articleCategory.setVersion(2);
+            articleCategory.setKimiResult(null);
+            articleCategory.setId(null);
+            articleCategory.setStatus(0);
+            articleCategory.setCategory(null);
+            articleCategory.setFailReason(null);
+            articleCategory.setRetryTimes(null);
+            articleCategory.setCreateTimestamp(System.currentTimeMillis());
+            saveList.add(articleCategory);
+        }
+
+        if (CollectionUtils.isNotEmpty(saveList)) {
+            articleCategoryMapper.batchInsertArticleCategory(saveList);
+        }
+    }
 }

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

@@ -1,8 +1,14 @@
 package com.tzld.longarticle.recommend.server;
 
 import com.alibaba.fastjson.JSONObject;
+import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleCategoryStatusEnum;
+import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleCategoryMapper;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.ArticleCategory;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatScore;
 import com.tzld.longarticle.recommend.server.model.vo.IntermediateIndicatorsExport;
 import com.tzld.longarticle.recommend.server.model.vo.NewSortStrategyExport;
+import com.tzld.longarticle.recommend.server.repository.longArticle.ArticleCategoryRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.DatastatScoreRepository;
 import com.tzld.longarticle.recommend.server.service.recommend.DataDashboardService;
 import com.tzld.longarticle.recommend.server.util.DateUtils;
 import com.tzld.longarticle.recommend.server.util.feishu.FeiShu;
@@ -14,6 +20,9 @@ import org.springframework.http.HttpHeaders;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 @SpringBootTest(classes = Application.class)
 @Slf4j
@@ -21,6 +30,12 @@ public class DataDashboardTest {
 
     @Resource
     DataDashboardService dataDashboardService;
+    @Resource
+    DatastatScoreRepository datastatScoreRepository;
+    @Resource
+    ArticleCategoryRepository articleCategoryRepository;
+    @Resource
+    ArticleCategoryMapper articleCategoryMapper;
 
     @Test
     public void test() {
@@ -63,4 +78,33 @@ public class DataDashboardTest {
         dataDashboardService.contentGroupFunnelExport(dateStrList);
     }
 
+    @Test
+    public void datastatScore() {
+        List<DatastatScore> scoreList = datastatScoreRepository.getBySourceIdIsNotNull();
+        List<ArticleCategory> categoryList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.SUCCESS.getCode(), 2);
+        Map<String, ArticleCategory> categoryMap = categoryList.stream().collect(Collectors.toMap(ArticleCategory::getProduceContentId, category -> category));
+        Map<String, ArticleCategory> titleMap = categoryList.stream().collect(Collectors.toMap(ArticleCategory::getTitle, category -> category, (a, b) -> a));
+        Map<String, List<DatastatScore>> scoreMap = scoreList.stream().collect(Collectors.groupingBy(DatastatScore::getTitle));
+        for (Map.Entry<String, List<DatastatScore>> entry : scoreMap.entrySet()) {
+            String title = entry.getKey();
+            List<DatastatScore> list = entry.getValue();
+            ArticleCategory category = null;
+            for (DatastatScore score : list) {
+                category = categoryMap.get(score.getSourceId());
+                if (Objects.nonNull(category)) {
+                    category = titleMap.get(score.getTitle());
+                    break;
+                }
+            }
+            if (Objects.isNull(category)) {
+                category = titleMap.get(title);
+            }
+            if (Objects.isNull(category)) {
+                log.error("category not exists");
+                continue;
+            }
+            articleCategoryMapper.updateArticleCategory(title, category.getCategory());
+        }
+    }
+
 }

File diff suppressed because it is too large
+ 1 - 2
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/RecommendTest.java


+ 1 - 1
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/XxlJobTest.java

@@ -71,7 +71,7 @@ public class XxlJobTest {
     public void articleCategoryTest() {
         List<ProducePlanExeRecord> produceContentList = aigcBaseMapper.getAllByProducePlanId(producePlanIds);
         List<String> channelContentIds = produceContentList.stream().map(ProducePlanExeRecord::getChannelContentId).distinct().collect(Collectors.toList());
-        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdIn(channelContentIds);
+        List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdInAndVersion(channelContentIds, 1);
         List<String>  articleCategoryIds = articleCategoryList.stream().map(ArticleCategory::getChannelContentId).collect(Collectors.toList());
         List<ProduceContentCrawlerVO> list = produceContentList.stream().filter(o -> !articleCategoryIds.contains(o.getChannelContentId())).map(o -> {
             ProduceContentCrawlerVO item = new ProduceContentCrawlerVO();

Some files were not shown because too many files changed in this diff