Kaynağa Gözat

long_articles_root_source_id数据表变更

wangyunpeng 7 ay önce
ebeveyn
işleme
d8879e66c5

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

@@ -1,5 +1,6 @@
 package com.tzld.longarticle.recommend.server.mapper.longArticle;
 
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId;
 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.entity.longArticle.ArticlePoolPromotionSource;
@@ -29,4 +30,6 @@ public interface LongArticleBaseMapper {
 
     List<DatastatSortStrategy> getArticlePromotion(Integer viewCount, Double viewCountRate,
                                                    Integer fans, String dateStr, List<Integer> positions);
+
+    void batchInsertLongArticlesRootSourceId(List<LongArticlesRootSourceId> list);
 }

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

@@ -0,0 +1,50 @@
+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 = "long_articles_root_source_id")
+public class LongArticlesRootSourceId {
+
+    @Id
+    @Column(name = "root_source_id")
+    private String rootSourceId;
+
+    @Column(name = "account_name")
+    private String accountName;
+
+    @Column(name = "gh_id")
+    private String ghId;
+
+    @Column(name = "article_title")
+    private String articleTitle;
+
+    @Column(name = "request_time")
+    private Long requestTime;
+
+    @Column(name = "trace_id")
+    private String traceId;
+
+    @Column(name = "push_type")
+    private Integer pushType;
+
+    @Column(name = "video_id")
+    private Long videoId;
+
+    @Column(name = "content_id")
+    private String contentId;
+
+    @Column(name = "oss_name")
+    private String ossName;
+
+}

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

@@ -0,0 +1,15 @@
+package com.tzld.longarticle.recommend.server.repository.longArticle;
+
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface LongArticlesRootSourceIdRepository extends JpaRepository<LongArticlesRootSourceId, String> {
+
+    List<LongArticlesRootSourceId> getByRootSourceIdIn(List<String> rootSourceIds);
+
+    int countByTraceId(String traceId);
+}

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

@@ -13,12 +13,13 @@ import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotI
 import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.growth.NewPushMessageCallbackMapper;
+import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
 import com.tzld.longarticle.recommend.server.model.dto.AccountTypeFansDTO;
 import com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
 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.LongArticlesRootSourceId;
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesRootSourceId;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.LongArticlesVideo;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.GetOffVideoArticle;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesMatchVideo;
@@ -26,7 +27,7 @@ import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticl
 import com.tzld.longarticle.recommend.server.model.param.ArticleFindSourceParam;
 import com.tzld.longarticle.recommend.server.remote.ODPSManager;
 import com.tzld.longarticle.recommend.server.repository.crawler.GetOffVideoCrawlerRepository;
-import com.tzld.longarticle.recommend.server.repository.crawler.LongArticlesRootSourceIdRepository;
+import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticlesRootSourceIdRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.LongArticlesVideoRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.GetOffVideoArticleRepository;
 import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticlesMatchVideoRepository;
@@ -62,6 +63,8 @@ public class XxlJobService {
     @Autowired
     private CrawlerBaseMapper crawlerBaseMapper;
     @Autowired
+    private LongArticleBaseMapper longArticleBaseMapper;
+    @Autowired
     private GetOffVideoCrawlerRepository getOffVideoCrawlerRepository;
     @Autowired
     private LongArticlesVideoRepository longArticlesVideoRepository;
@@ -225,7 +228,7 @@ public class XxlJobService {
                 saveList.removeIf(item -> item.getRootSourceId().equals(existItem.getRootSourceId()));
             }
             if (CollectionUtil.isNotEmpty(saveList)) {
-                crawlerBaseMapper.batchInsertLongArticlesRootSourceId(saveList);
+                longArticleBaseMapper.batchInsertLongArticlesRootSourceId(saveList);
             }
         }
     }

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

@@ -102,4 +102,14 @@
         </foreach>
     </select>
 
+    <insert id="batchInsertLongArticlesRootSourceId">
+        INSERT INTO long_articles_root_source_id (root_source_id, account_name, gh_id, article_title, request_time,
+        trace_id, push_type, video_id)
+        VALUES
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.rootSourceId}, #{item.accountName}, #{item.ghId}, #{item.articleTitle}, #{item.requestTime},
+            #{item.traceId}, #{item.pushType}, #{item.videoId})
+        </foreach>
+    </insert>
+
 </mapper>