Bläddra i källkod

待发布文章提前拉取

wangyunpeng 1 månad sedan
förälder
incheckning
94a0984fe6
13 ändrade filer med 279 tillägg och 105 borttagningar
  1. 4 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java
  2. 63 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/entity/longArticle/PublishContentGzhWaiting.java
  3. 27 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/aigc/PublishArticleDataVO.java
  4. 37 9
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCWaitingPublishContentService.java
  5. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/aigc/PublishPlanRepository.java
  6. 13 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/longArticle/PublishContentGzhWaitingRepository.java
  7. 68 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java
  8. 8 70
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java
  9. 14 19
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java
  10. 5 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/XxlJobController.java
  11. 12 6
      long-article-recommend-service/src/main/resources/mapper/aigc/PublishContentMapper.xml
  12. 25 0
      long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml
  13. 1 1
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/FilterStrategyTest.java

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

@@ -103,4 +103,8 @@ public interface LongArticleBaseMapper {
     List<CategoryGroupFunnelExport> getCategoryMatchCount(Date start, Date end);
 
     List<CategoryGroupFunnelExport> getCategoryTitleAuditCount(Long start, Long end);
+
+    void batchInsertPublishContentGzhWaiting(List<PublishContentGzhWaiting> list);
+
+    void updatePublishContentGzhWaitingStatus(String planId, String accountId, List<String> contentIds, Integer status, Long updateTimestamp);
 }

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

@@ -0,0 +1,63 @@
+package com.tzld.longarticle.recommend.server.model.entity.longArticle;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.*;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Entity
+@Table(name = "publish_content_gzh_waiting")
+public class PublishContentGzhWaiting {
+
+
+    @Id
+    private String id;
+
+    @Column(name = "plan_id")
+    private String planId;
+
+    @Column(name = "publish_account_id")
+    private String publishAccountId;
+
+    @Column(name = "source_type")
+    private Integer sourceType;
+
+    @Column(name = "source_id")
+    private String sourceId;
+
+    @Column(name = "title")
+    private String title;
+
+    @Column(name = "create_timestamp")
+    private Long createTimestamp;
+
+    @Column(name = "content_pool_type")
+    private String contentPoolType;
+
+    @Column(name = "crawler_channel_content_id")
+    private String crawlerChannelContentId;
+
+    @Column(name = "crawler_link")
+    private String crawlerLink;
+
+    @Column(name = "crawler_title")
+    private String crawlerTitle;
+
+    @Column(name = "crawler_view_count")
+    private Integer crawlerViewCount;
+
+    @Column(name = "crawler_timestamp")
+    private Long crawlerTimestamp;
+
+    @Column(name = "status")
+    private Integer status;
+
+    @Column(name = "update_timestamp")
+    private Long updateTimestamp;
+
+}

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

@@ -0,0 +1,27 @@
+package com.tzld.longarticle.recommend.server.model.vo.aigc;
+
+import lombok.Data;
+
+@Data
+public class PublishArticleDataVO {
+    private String id;
+    private Integer sourceType;
+    private String sourceId;
+    private String title;
+    //    private String content;
+//    private String coverUrl;
+//    private List<String> imageUrls;
+    private Long createTimestamp;
+    //    private String producePlanName;
+    private String contentPoolType; // 内容池类别
+    private String crawlerChannelContentId; // 抓取内容channelContentId
+    private String crawlerLink;
+    private String crawlerTitle;
+    //    private String crawlerCoverUrl;
+    private Integer crawlerViewCount;
+    //    private Integer crawlerLikeCount;
+    private Long crawlerTimestamp;
+    //    private Long crawlerPublishTimestamp;
+//    private String crawlerAccountName;
+    private String filterReason;
+}

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

@@ -1,15 +1,20 @@
 package com.tzld.longarticle.recommend.server.remote.aigc;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
-import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallParam;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishContentGzhWaiting;
+import com.tzld.longarticle.recommend.server.repository.longArticle.PublishContentGzhWaitingRepository;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.*;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -19,6 +24,9 @@ import java.util.concurrent.TimeUnit;
 @Slf4j
 public class AIGCWaitingPublishContentService {
 
+    @Autowired
+    private PublishContentGzhWaitingRepository publishContentGzhWaitingRepository;
+
     private OkHttpClient client;
 
     @PostConstruct
@@ -33,10 +41,10 @@ public class AIGCWaitingPublishContentService {
     private static final String aigcGetAllContentUrl = "http://aigc-api.cybertogether.net/aigc/publish/content/gzhWaitingPublishContent";
 
 
-    public List<Content> getAllContent(RecallParam param) {
+    public List<Content> getAllContent(String planId, String accountId) {
         int retryTimes = 2;
         while (retryTimes > 0) {
-            List<Content> result = post(param);
+            List<Content> result = post(planId, accountId);
             if (Objects.nonNull(result)) {
                 return result;
             }
@@ -45,12 +53,12 @@ public class AIGCWaitingPublishContentService {
         return new ArrayList<>();
     }
 
-    public List<Content> post(RecallParam param) {
+    public List<Content> post(String planId, String accountId) {
         List<Content> result = null;
         JSONObject bodyParam = new JSONObject();
         JSONObject bodyParamParams = new JSONObject();
-        bodyParamParams.put("accountId", param.getAccountId());
-        bodyParamParams.put("planId", param.getPlanId());
+        bodyParamParams.put("accountId", accountId);
+        bodyParamParams.put("planId", planId);
         bodyParam.put("params", bodyParamParams);
         try {
             MediaType mediaType = MediaType.parse("application/json");
@@ -75,8 +83,28 @@ public class AIGCWaitingPublishContentService {
         return result;
     }
 
-    public Set<String> historyTitle() {
-        return Collections.emptySet();
+    public List<Content> getAllContentByDB(String planId, String accountId) {
+        List<PublishContentGzhWaiting> list = publishContentGzhWaitingRepository.getByPlanIdAndPublishAccountIdAndStatus(planId, accountId, 1);
+        if (CollectionUtil.isEmpty(list)) {
+            return getAllContent(planId, accountId);
+        }
+        List<Content> result = new ArrayList<>();
+        for (PublishContentGzhWaiting item : list) {
+            Content content = new Content();
+            content.setId(item.getId());
+            content.setSourceType(item.getSourceType());
+            content.setSourceId(item.getSourceId());
+            content.setTitle(item.getTitle());
+            content.setCreateTimestamp(item.getCreateTimestamp());
+            content.setContentPoolType(item.getContentPoolType());
+            content.setCrawlerChannelContentId(item.getCrawlerChannelContentId());
+            content.setCrawlerLink(item.getCrawlerLink());
+            content.setCrawlerTitle(item.getCrawlerTitle());
+            content.setCrawlerViewCount(item.getCrawlerViewCount());
+            content.setCrawlerTimestamp(item.getCrawlerTimestamp());
+            result.add(content);
+        }
+        return result;
     }
 
 }

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

@@ -12,4 +12,6 @@ public interface PublishPlanRepository extends JpaRepository<PublishPlan, String
     List<PublishPlan> findByIdIn(List<String> planIds);
 
     PublishPlan getById(String planId);
+
+    List<PublishPlan> getByChannelAndPlanStatus(Integer channel, Integer planStatus);
 }

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

@@ -0,0 +1,13 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.PublishContentGzhWaiting;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface PublishContentGzhWaitingRepository extends JpaRepository<PublishContentGzhWaiting, String> {
+
+    List<PublishContentGzhWaiting> getByIdIn(List<String> publishContentIds);
+
+    List<PublishContentGzhWaiting> getByPlanIdAndPublishAccountIdAndStatus(String planId, String accountId, Integer status);
+}

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

@@ -10,6 +10,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor;
 import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
 import com.tzld.longarticle.recommend.server.common.enums.FieshuTableColumnDataTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.ChannelEnum;
 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;
@@ -32,7 +33,9 @@ import com.tzld.longarticle.recommend.server.model.param.TitleHisCacheParam;
 import com.tzld.longarticle.recommend.server.model.vo.FeishuTableDTO;
 import com.tzld.longarticle.recommend.server.remote.ODPSManager;
 import com.tzld.longarticle.recommend.server.remote.aigc.AIGCProduceContentAuditService;
+import com.tzld.longarticle.recommend.server.remote.aigc.AIGCWaitingPublishContentService;
 import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanRepository;
+import com.tzld.longarticle.recommend.server.repository.aigc.PublishPlanRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.GetOffVideoCrawlerRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.LongArticlesVideoRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.*;
@@ -117,6 +120,12 @@ public class XxlJobService {
     private AccountRepository accountRepository;
     @Autowired
     private UserManagementService userManagementService;
+    @Autowired
+    private PublishPlanRepository publishPlanRepository;
+    @Autowired
+    private AIGCWaitingPublishContentService aigcWaitingPublishContentService;
+    @Autowired
+    private PublishContentGzhWaitingRepository publishContentGzhWaitingRepository;
 
     ExecutorService thread = new CommonThreadPoolExecutor(
             5,
@@ -965,4 +974,63 @@ public class XxlJobService {
         return ReturnT.SUCCESS;
     }
 
+    @XxlJob("syncGzhWaitingPublishContent")
+    public ReturnT<String> syncGzhWaitingPublishContent(String param) {
+        Long now = System.currentTimeMillis();
+        List<PublishPlan> planList = publishPlanRepository.getByChannelAndPlanStatus(ChannelEnum.wx.getVal(), 1);
+        for (PublishPlan plan : planList) {
+            List<PublishAccount> accountList = publishContentMapper.getPublishAccounts(plan.getId(), null);
+            for (PublishAccount account : accountList) {
+                List<Content> contentList = aigcWaitingPublishContentService.getAllContent(plan.getId(), account.getId());
+                if (CollectionUtil.isEmpty(contentList)) {
+                    continue;
+                }
+                List<String> contentIds = contentList.stream().map(Content::getId).collect(Collectors.toList());
+                // 不存在状态置0
+                longArticleBaseMapper.updatePublishContentGzhWaitingStatus(plan.getId(), account.getId(), contentIds, 0, now);
+                List<PublishContentGzhWaiting> existList = publishContentGzhWaitingRepository.getByIdIn(contentIds);
+                List<String> existContentIds = existList.stream().map(PublishContentGzhWaiting::getId).collect(Collectors.toList());
+                Map<String, PublishContentGzhWaiting> existMap = existList.stream().collect(
+                        Collectors.toMap(PublishContentGzhWaiting::getId, Function.identity()));
+                List<PublishContentGzhWaiting> saveList = new ArrayList<>();
+                for (Content content : contentList) {
+                    // 已存在更新
+                    if (existContentIds.contains(content.getId())) {
+                        PublishContentGzhWaiting existItem = existMap.get(content.getId());
+                        setPublishContentValue(existItem, content, plan.getId(), account.getId(), now);
+                        publishContentGzhWaitingRepository.save(existItem);
+                        continue;
+                    }
+                    // 新增
+                    PublishContentGzhWaiting item = new PublishContentGzhWaiting();
+                    setPublishContentValue(item, content, plan.getId(), account.getId(), now);
+                    saveList.add(item);
+                }
+                if (CollectionUtil.isNotEmpty(saveList)) {
+                    longArticleBaseMapper.batchInsertPublishContentGzhWaiting(saveList);
+                }
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    private void setPublishContentValue(PublishContentGzhWaiting item, Content content, String planId, String accountId,
+                                        Long updateTimestamp) {
+        item.setId(content.getId());
+        item.setPlanId(planId);
+        item.setPublishAccountId(accountId);
+        item.setSourceType(content.getSourceType());
+        item.setSourceId(content.getSourceId());
+        item.setTitle(content.getTitle());
+        item.setCreateTimestamp(content.getCreateTimestamp());
+        item.setContentPoolType(content.getContentPoolType());
+        item.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
+        item.setCrawlerLink(content.getCrawlerLink());
+        item.setCrawlerTitle(content.getCrawlerTitle());
+        item.setCrawlerViewCount(content.getCrawlerViewCount());
+        item.setCrawlerTimestamp(content.getCrawlerTimestamp());
+        item.setStatus(1);
+        item.setUpdateTimestamp(updateTimestamp);
+    }
+
 }

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

@@ -762,76 +762,11 @@ public class ArticleAuditService {
         List<PublishAccountTypeDTO> accountTypeList = publishContentMapper.getAccountTypeList(ghIds);
         Map<String, PublishAccountTypeDTO> accountTypeMap = accountTypeList.stream()
                 .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity()));
-//        List<PublishAccount> publishAccountList = publishAccountRepository.getAllByGhIdIn(ghIds);
-//        Map<String, PublishAccount> publishAccountMap = publishAccountList.stream().collect(Collectors.toMap(PublishAccount::getGhId, o -> o));
-//        // 获取发布内容
-//        List<PublishContentParam> publishContentParamList = list.stream().map(article -> {
-//            PublishContentParam item = new PublishContentParam();
-//            item.setTitle(article.getTitle());
-//            PublishAccount account = publishAccountMap.get(article.getGhId());
-//            if (Objects.nonNull(account)) {
-//                item.setPublishAccountId(account.getId());
-//                return item;
-//            }
-//            return null;
-//        }).filter(Objects::nonNull).collect(Collectors.toList());
-//        List<PublishContentDTO> publishContents = new ArrayList<>();
-//        for (List<PublishContentParam> partitions : Lists.partition(publishContentParamList, 100)) {
-//            publishContents.addAll(aigcBaseMapper.getPublishContentByTitle(partitions));
-//        }
-//        Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap = publishContents.stream()
-//                .filter(o -> Objects.nonNull(o.getPublishTimestamp()))
-//                .sorted(Comparator.comparingLong(PublishContentDTO::getPublishTimestamp))
-//                .collect(Collectors.groupingBy(PublishContentDTO::getPublishAccountId,
-//                        Collectors.groupingBy(PublishContentDTO::getTitle,
-//                                Collectors.toMap(PublishContentDTO::getPublishTimestamp, o -> o,
-//                                        (existing, replacement) -> replacement))));
-//        List<String> publishContentIds = publishContents.stream().map(PublishContentDTO::getId).collect(Collectors.toList());
-//        List<PublishGzhPushContentRelDTO> pushContentRelList = aigcBaseMapper.getPushContentRelByPublishContentIdIn(publishContentIds);
-//        Map<String, String> publishPushIdMap = pushContentRelList.stream()
-//                .collect(Collectors.toMap(PublishGzhPushContentRelDTO::getPublishContentId,
-//                        PublishGzhPushContentRelDTO::getPushId,
-//                        (o1, o2) -> o2));
-//        List<String> pushIds = pushContentRelList.stream().map(PublishGzhPushContentRelDTO::getPushId).collect(Collectors.toList());
-//        List<PublishGzhPushDTO> pushList = aigcBaseMapper.getPushByPushIdIn(pushIds);
-//        Map<String, PublishGzhPushDTO> pushDTOMap = pushList.stream()
-//                .collect(Collectors.toMap(PublishGzhPushDTO::getPushId, Function.identity()));
         for (ArticleDeleteListVO item : list) {
             PublishAccountTypeDTO accountTypeDTO = accountTypeMap.get(item.getGhId());
             if (Objects.nonNull(accountTypeDTO)) {
                 item.setAccountSourceType(accountTypeDTO.getAccountSourceName());
             }
-//            PublishAccount account = publishAccountMap.get(item.getGhId());
-//            if (Objects.isNull(account)) {
-//                continue;
-//            }
-//            Map<String, Map<Long, PublishContentDTO>> titleMap = publishContentMap.get(account.getId());
-//            if (Objects.isNull(titleMap)) {
-//                continue;
-//            }
-//            Map<Long, PublishContentDTO> publishTimeContentMap = titleMap.get(item.getTitle());
-//            if (Objects.isNull(publishTimeContentMap)) {
-//                continue;
-//            }
-//            PublishContentDTO publishContent = null;
-//            List<String> hisPublishTimeStrList = publishTimeContentMap.keySet().stream()
-//                    .map(o -> DateUtils.timestampToYMDStr(o / 1000, "yyyyMMdd")).collect(Collectors.toList());
-//            String publishTime = DateUtils.findNearestDate(hisPublishTimeStrList, item.getDateStr(), "yyyyMMdd");
-//            for (Map.Entry<Long, PublishContentDTO> entry : publishTimeContentMap.entrySet()) {
-//                String str = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
-//                if (publishTime.equals(str)) {
-//                    publishContent = entry.getValue();
-//                }
-//            }
-//            if (Objects.isNull(publishContent)) {
-//                continue;
-//            }
-//            String pushId = publishPushIdMap.get(publishContent.getId());
-//            PublishGzhPushDTO pushDTO = pushDTOMap.get(pushId);
-//            if (Objects.isNull(pushDTO)) {
-//                continue;
-//            }
-//            item.setPlanType(PushTypeEnum.from(pushDTO.getPushType()).getDescription());
         }
     }
 
@@ -877,8 +812,8 @@ public class ArticleAuditService {
         Map<String, String> pushAccountMap = pushList.stream()
                 .collect(Collectors.toMap(PublishGzhPushDTO::getPushId, PublishGzhPushDTO::getPublishAccountId));
         List<PublishAccount> publishAccountList = publishAccountRepository.getByIdIn(publishAccountIds);
-        Map<String, String> publishAccountMap = publishAccountList.stream()
-                .collect(Collectors.toMap(PublishAccount::getId, PublishAccount::getGhId));
+        Map<String, PublishAccount> publishAccountMap = publishAccountList.stream()
+                .collect(Collectors.toMap(PublishAccount::getId, Function.identity()));
         List<PublishGzhPushContentRelDTO> groupPushRelList = publishContentMapper.getGroupPushRelByPushIdIn(pushIds);
         List<String> publishContentIds = groupPushRelList.stream().map(PublishGzhPushContentRelDTO::getPublishContentId)
                 .collect(Collectors.toList());
@@ -890,8 +825,11 @@ public class ArticleAuditService {
             List<LongArticleAuditDelete> deleteList = new ArrayList<>();
             String groupPushMsgId = pushIdMap.get(push.getPushId());
             String publishAccountId = pushAccountMap.get(push.getPushId());
-            String ghId = publishAccountMap.get(publishAccountId);
-            if (notDeleteArticleAccountGhIds.contains(ghId)) {
+            PublishAccount publishAccount = publishAccountMap.get(publishAccountId);
+            if (notDeleteArticleAccountGhIds.contains(publishAccount.getGhId())) {
+                continue;
+            }
+            if (StringUtils.hasText(publishAccount.getRemark()) && publishAccount.getRemark().contains("服务号")) {
                 continue;
             }
             List<PublishGzhPushContentRelDTO> relList = groupPushRelMap.get(push.getPushId()).stream()
@@ -905,7 +843,7 @@ public class ArticleAuditService {
                     continue;
                 }
                 LongArticleAuditDelete delete = new LongArticleAuditDelete();
-                delete.setGhId(ghId);
+                delete.setGhId(publishAccount.getGhId());
                 delete.setMsgId(groupPushMsgId);
                 delete.setPushId(push.getPushId());
                 delete.setPushType(push.getPushType());

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

@@ -202,15 +202,16 @@ public class RecallService implements ApplicationContextAware {
 
     private List<Content> getAllContent(RecallParam param) {
         long t1 = System.currentTimeMillis();
-        List<Content> content = aigcWaitingPublishContentService.getAllContent(param);
+        List<Content> content = aigcWaitingPublishContentService.getAllContentByDB(param.getPlanId(), param.getAccountId());
         long t2 = System.currentTimeMillis();
         CostMonitor.logCost("Recall", "GetAllContents", t2 - t1);
         ContentCountMonitor.logCount("Recall", "GetAllContents", Objects.isNull(content) ? 0 : content.size());
 //            // 临时过滤文章视频不匹配content
 //            filterNotMatchContent(content);
         // 过滤仅保留审核通过content
-        filterAuditPassContent(content);
-        ContentCountMonitor.logCount("Recall", "Filter", Objects.isNull(content) ? 0 : content.size());
+        // 已通过aigc提前过滤视频审核通过 暂时取消判断
+//        filterAuditPassContent(content);
+//        ContentCountMonitor.logCount("Recall", "Filter", Objects.isNull(content) ? 0 : content.size());
         if (CollectionUtils.isEmpty(content)) {
             FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
                     "内容召回失败\n"
@@ -224,8 +225,8 @@ public class RecallService implements ApplicationContextAware {
         setTitleAvgViewCount(content, param.getGhId(), param.getType(), param.getStrategy());
         long t4 = System.currentTimeMillis();
         CostMonitor.logCost("Recall", "SetAvgViewCount", t4 - t3);
-        // 视频内容池查询抓取时间
-        setVideoContent(content);
+//        // 视频内容池查询抓取时间
+//        setVideoContent(content);
         return content;
     }
 
@@ -355,6 +356,7 @@ 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));
+        Account account = accountRepository.getByGhId(ghId);
         List<Content> newCacheSaveList = new ArrayList<>();
         Set<String> newCacheSourceIdSet = new HashSet<>();
         for (Content content : contentList) {
@@ -374,7 +376,7 @@ public class RecallService implements ApplicationContextAware {
                 content.setKimiSafeScore(cache.getKimiSafeScore());
                 content.setRootPublishTimestamp(cache.getRootPublishTimestamp());
                 content.setHisPublishArticleList(hisPublishArticleList);
-                setT0Data(content, ghId);
+                setT0Data(content, account);
             } else {
                 if (!newCacheSourceIdSet.contains(content.getSourceId())
                         && Arrays.asList(PublishPlanInputSourceTypesEnum.producePlan.getVal(),
@@ -667,11 +669,10 @@ public class RecallService implements ApplicationContextAware {
         return result;
     }
 
-    private void setT0Data(Content content, String ghId) {
+    private void setT0Data(Content content, Account account) {
         if (CollectionUtils.isEmpty(content.getHisPublishArticleList())) {
             return;
         }
-        Account account = accountRepository.getByGhId(ghId);
         int firstLevelSize = 0;
         int fissionSum = 0;
         int firstLevelSum = 0;
@@ -693,10 +694,10 @@ public class RecallService implements ApplicationContextAware {
             }
             if (CollectionUtils.isEmpty(article.getArticleDetailInfoList())) {
                 // 仅判断7.12以后发布文章
-                if (article.getPublishTimestamp() > 1720713600 && contentHisFeishuEnable) {
-                    log.error("历史表现裂变特征获取失败 ghId:{} accountName:{} itemIndex:{} title:{} date:{} wxsn:{}",
-                            article.getGhId(), article.getAccountName(), article.getItemIndex(), article.getTitle(),
-                            DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd"), article.getWxSn());
+//                if (article.getPublishTimestamp() > 1720713600 && contentHisFeishuEnable) {
+//                    log.error("历史表现裂变特征获取失败 ghId:{} accountName:{} itemIndex:{} title:{} date:{} wxsn:{}",
+//                            article.getGhId(), article.getAccountName(), article.getItemIndex(), article.getTitle(),
+//                            DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd"), article.getWxSn());
 //                    FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
 //                            "历史表现裂变特征获取失败\n"
 //                                    + "ghId: " + article.getGhId() + "\n"
@@ -705,7 +706,7 @@ public class RecallService implements ApplicationContextAware {
 //                                    + "标题: " + article.getTitle() + "\n"
 //                                    + "发布时间: " + DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd") + "\n"
 //                                    + "wxsn: " + article.getWxSn());
-                }
+//                }
                 continue;
             }
             int sumFirstLevel = 0;
@@ -785,10 +786,4 @@ public class RecallService implements ApplicationContextAware {
         }
     }
 
-    public static void main(String[] args) {
-        String url = "http://mp.weixin.qq.com/s?__biz=Mzg2ODk4MTg3OQ==&mid=2247488306&idx=1&sn=93ebadc5bc7161a0dee48355013d3bc4&chksm=cfb6c1cb2bcdd80dd16d5d604d741a0019ae791125265a042d26100ba21ddb9e5c643ecc2264&scene=126&sessionid=1679649075#rd";
-        String md5 = generateArticleUniqueMd5(url);
-        System.out.println("Generated md5: " + md5);
-    }
-
 }

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

@@ -122,4 +122,9 @@ public class XxlJobController {
         service.resetUserGroup(null);
     }
 
+    @GetMapping("/syncGzhWaitingPublishContent")
+    public void syncGzhWaitingPublishContent() {
+        service.syncGzhWaitingPublishContent(null);
+    }
+
 }

+ 12 - 6
long-article-recommend-service/src/main/resources/mapper/aigc/PublishContentMapper.xml

@@ -49,13 +49,19 @@
     <select id="getPublishAccounts"
             resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount">
         SELECT account.*
-        FROM publish_plan_account planAccount
-        join publish_account account on planAccount.account_id = account.id
-        left join publish_content content
+        FROM publish_account account
+        join publish_plan_account planAccount on planAccount.account_id = account.id
+        <if test="todayStart != null">
+            left join publish_content content
             on content.publish_account_id = planAccount.account_id
-           and content.plan_id = planAccount.plan_id
-           and content.publish_timestamp > #{todayStart}
-        WHERE planAccount.plan_id = #{planId} and content.id is null and planAccount.publish_open_flag = 1
+            and content.plan_id = planAccount.plan_id
+            and content.publish_timestamp > #{todayStart}
+        </if>
+        WHERE planAccount.plan_id = #{planId}
+        and planAccount.publish_open_flag = 1
+        <if test="todayStart != null">
+            and content.id is null
+        </if>
     </select>
     <select id="getSourceProduceContentByTitles"
             resultType="com.tzld.longarticle.recommend.server.model.dto.ProduceContentDTO">

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

@@ -423,4 +423,29 @@
                 group by ac.category) total on total.category = success.category
     </select>
 
+    <insert id="batchInsertPublishContentGzhWaiting">
+        insert into publish_content_gzh_waiting
+        (id, plan_id, publish_account_id, source_type, source_id, title, create_timestamp, content_pool_type,
+         crawler_channel_content_id, crawler_link, crawler_title, crawler_view_count, crawler_timestamp, status,
+         update_timestamp)
+        values
+        <foreach collection="list" item="item" separator=",">
+            (#{item.id}, #{item.planId}, #{item.publishAccountId}, #{item.sourceType}, #{item.sourceId}, #{item.title},
+             #{item.createTimestamp}, #{item.contentPoolType}, #{item.crawlerChannelContentId}, #{item.crawlerLink},
+             #{item.crawlerTitle}, #{item.crawlerViewCount}, #{item.crawlerTimestamp}, #{item.status}, #{item.updateTimestamp})
+        </foreach>
+    </insert>
+
+    <update id="updatePublishContentGzhWaitingStatus">
+        update publish_content_gzh_waiting
+        set status = #{status},
+            update_timestamp = #{updateTimestamp}
+        where plan_id = #{planId}
+        and publish_account_id = #{accountId}
+        and id not in
+        <foreach collection="contentIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+
 </mapper>

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

@@ -62,7 +62,7 @@ public class FilterStrategyTest {
         param.setAccountName("票圈最新消息");
         param.setAccountId("20231212144543068928298");
         param.setPlanId("20240724092832149199870");
-        List<Content> content = aigcWaitingPublishContentService.getAllContent(param);;
+        List<Content> content = aigcWaitingPublishContentService.getAllContent(param.getPlanId(), param.getAccountId());
         FilterParam filterParam = new FilterParam();
         filterParam.setAccountName(param.getAccountName());
         filterParam.setContents(content);