Explorar el Código

自动回复策略实验

Joe hace 7 meses
padre
commit
19096dc11f
Se han modificado 15 ficheros con 1918 adiciones y 201 borrados
  1. 4 1
      long-article-recommend-service/pom.xml
  2. 156 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/ArticleInfo.java
  3. 3 157
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/BucketDataParam.java
  4. 10 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/MsgData.java
  5. 74 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/SmallPageUrlDetail.java
  6. 34 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/mapper/crawler/AlgGhAutoreplyVideoRankDataMapper.java
  7. 3 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/mapper/crawler/CgiReplyBucketDataMapper.java
  8. 115 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/AlgGhAutoreplyVideoRankData.java
  9. 910 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/AlgGhAutoreplyVideoRankDataExample.java
  10. 77 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/cgi/TouLiuHttpClientService.java
  11. 198 27
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/strategy/reply/impl/BuckStrategyV1.java
  12. 5 1
      long-article-recommend-service/src/main/resources/application-dev.yml
  13. 1 1
      long-article-recommend-service/src/main/resources/generatorCgiConfig.xml
  14. 315 0
      long-article-recommend-service/src/main/resources/mapper/crawler/AlgGhAutoreplyVideoRankDataMapper.xml
  15. 13 13
      long-article-recommend-service/src/main/resources/mapper/crawler/CgiReplyBucketDataMapper.xml

+ 4 - 1
long-article-recommend-service/pom.xml

@@ -122,7 +122,10 @@
             <version>1.4.2</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
+        </dependency>
     </dependencies>
 
 

+ 156 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/ArticleInfo.java

@@ -0,0 +1,156 @@
+package com.tzld.longarticle.recommend.server.model.cgi;
+
+import java.util.List;
+
+public class ArticleInfo {
+
+    private String publishContentId;
+
+    private String title;
+
+    private String content;
+
+    private String coverUrl;
+
+    private List<String> imageUrls;
+
+    private Long createTimestamp;
+
+    private String producePlanName;
+
+    private String crawlerChannelContentId;
+
+    private String crawlerLink;
+
+    private String crawlerTitle;
+
+    private String crawlerCoverUrl;
+
+    private Integer crawlerViewCount;
+
+    private Integer crawlerLikeCount;
+
+    private Long crawlerPublishTimestamp;
+
+    private String crawlerAccountName;
+
+    public String getPublishContentId() {
+        return publishContentId;
+    }
+
+    public void setPublishContentId(String publishContentId) {
+        this.publishContentId = publishContentId;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getCoverUrl() {
+        return coverUrl;
+    }
+
+    public void setCoverUrl(String coverUrl) {
+        this.coverUrl = coverUrl;
+    }
+
+    public List<String> getImageUrls() {
+        return imageUrls;
+    }
+
+    public void setImageUrls(List<String> imageUrls) {
+        this.imageUrls = imageUrls;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    public String getProducePlanName() {
+        return producePlanName;
+    }
+
+    public void setProducePlanName(String producePlanName) {
+        this.producePlanName = producePlanName;
+    }
+
+    public String getCrawlerChannelContentId() {
+        return crawlerChannelContentId;
+    }
+
+    public void setCrawlerChannelContentId(String crawlerChannelContentId) {
+        this.crawlerChannelContentId = crawlerChannelContentId;
+    }
+
+    public String getCrawlerLink() {
+        return crawlerLink;
+    }
+
+    public void setCrawlerLink(String crawlerLink) {
+        this.crawlerLink = crawlerLink;
+    }
+
+    public String getCrawlerTitle() {
+        return crawlerTitle;
+    }
+
+    public void setCrawlerTitle(String crawlerTitle) {
+        this.crawlerTitle = crawlerTitle;
+    }
+
+    public String getCrawlerCoverUrl() {
+        return crawlerCoverUrl;
+    }
+
+    public void setCrawlerCoverUrl(String crawlerCoverUrl) {
+        this.crawlerCoverUrl = crawlerCoverUrl;
+    }
+
+    public Integer getCrawlerViewCount() {
+        return crawlerViewCount;
+    }
+
+    public void setCrawlerViewCount(Integer crawlerViewCount) {
+        this.crawlerViewCount = crawlerViewCount;
+    }
+
+    public Integer getCrawlerLikeCount() {
+        return crawlerLikeCount;
+    }
+
+    public void setCrawlerLikeCount(Integer crawlerLikeCount) {
+        this.crawlerLikeCount = crawlerLikeCount;
+    }
+
+    public Long getCrawlerPublishTimestamp() {
+        return crawlerPublishTimestamp;
+    }
+
+    public void setCrawlerPublishTimestamp(Long crawlerPublishTimestamp) {
+        this.crawlerPublishTimestamp = crawlerPublishTimestamp;
+    }
+
+    public String getCrawlerAccountName() {
+        return crawlerAccountName;
+    }
+
+    public void setCrawlerAccountName(String crawlerAccountName) {
+        this.crawlerAccountName = crawlerAccountName;
+    }
+}

+ 3 - 157
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/BucketDataParam.java

@@ -14,7 +14,7 @@ public class BucketDataParam {
 
     private String planId;
 
-    private List<Article> articleList;
+    private List<ArticleInfo> articleList;
 
     public Long getAccountId() {
         return accountId;
@@ -56,165 +56,11 @@ public class BucketDataParam {
         this.planId = planId;
     }
 
-    public List<Article> getArticleList() {
+    public List<ArticleInfo> getArticleList() {
         return articleList;
     }
 
-    public void setArticleList(List<Article> articleList) {
+    public void setArticleList(List<ArticleInfo> articleList) {
         this.articleList = articleList;
     }
 }
-
-
-class Article{
-
-    private String publishContentId;
-
-    private String title;
-
-    private String content;
-
-    private String coverUrl;
-
-    private List<String> imageUrls;
-
-    private Long createTimestamp;
-
-    private String producePlanName;
-
-    private String crawlerChannelContentId;
-
-    private String crawlerLink;
-
-    private String crawlerTitle;
-
-    private String crawlerCoverUrl;
-
-    private Integer crawlerViewCount;
-
-    private Integer crawlerLikeCount;
-
-    private Long crawlerPublishTimestamp;
-
-    private String crawlerAccountName;
-
-    public String getPublishContentId() {
-        return publishContentId;
-    }
-
-    public void setPublishContentId(String publishContentId) {
-        this.publishContentId = publishContentId;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public String getCoverUrl() {
-        return coverUrl;
-    }
-
-    public void setCoverUrl(String coverUrl) {
-        this.coverUrl = coverUrl;
-    }
-
-    public List<String> getImageUrls() {
-        return imageUrls;
-    }
-
-    public void setImageUrls(List<String> imageUrls) {
-        this.imageUrls = imageUrls;
-    }
-
-    public Long getCreateTimestamp() {
-        return createTimestamp;
-    }
-
-    public void setCreateTimestamp(Long createTimestamp) {
-        this.createTimestamp = createTimestamp;
-    }
-
-    public String getProducePlanName() {
-        return producePlanName;
-    }
-
-    public void setProducePlanName(String producePlanName) {
-        this.producePlanName = producePlanName;
-    }
-
-    public String getCrawlerChannelContentId() {
-        return crawlerChannelContentId;
-    }
-
-    public void setCrawlerChannelContentId(String crawlerChannelContentId) {
-        this.crawlerChannelContentId = crawlerChannelContentId;
-    }
-
-    public String getCrawlerLink() {
-        return crawlerLink;
-    }
-
-    public void setCrawlerLink(String crawlerLink) {
-        this.crawlerLink = crawlerLink;
-    }
-
-    public String getCrawlerTitle() {
-        return crawlerTitle;
-    }
-
-    public void setCrawlerTitle(String crawlerTitle) {
-        this.crawlerTitle = crawlerTitle;
-    }
-
-    public String getCrawlerCoverUrl() {
-        return crawlerCoverUrl;
-    }
-
-    public void setCrawlerCoverUrl(String crawlerCoverUrl) {
-        this.crawlerCoverUrl = crawlerCoverUrl;
-    }
-
-    public Integer getCrawlerViewCount() {
-        return crawlerViewCount;
-    }
-
-    public void setCrawlerViewCount(Integer crawlerViewCount) {
-        this.crawlerViewCount = crawlerViewCount;
-    }
-
-    public Integer getCrawlerLikeCount() {
-        return crawlerLikeCount;
-    }
-
-    public void setCrawlerLikeCount(Integer crawlerLikeCount) {
-        this.crawlerLikeCount = crawlerLikeCount;
-    }
-
-    public Long getCrawlerPublishTimestamp() {
-        return crawlerPublishTimestamp;
-    }
-
-    public void setCrawlerPublishTimestamp(Long crawlerPublishTimestamp) {
-        this.crawlerPublishTimestamp = crawlerPublishTimestamp;
-    }
-
-    public String getCrawlerAccountName() {
-        return crawlerAccountName;
-    }
-
-    public void setCrawlerAccountName(String crawlerAccountName) {
-        this.crawlerAccountName = crawlerAccountName;
-    }
-}

+ 10 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/MsgData.java

@@ -20,6 +20,8 @@ public class MsgData {
 
     private String newsDescription;
 
+//    private Integer sort;
+
     public Integer getMsgType() {
         return msgType;
     }
@@ -91,4 +93,12 @@ public class MsgData {
     public void setNewsDescription(String newsDescription) {
         this.newsDescription = newsDescription;
     }
+
+//    public Integer getSort() {
+//        return sort;
+//    }
+//
+//    public void setSort(Integer sort) {
+//        this.sort = sort;
+//    }
 }

+ 74 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/cgi/SmallPageUrlDetail.java

@@ -0,0 +1,74 @@
+package com.tzld.longarticle.recommend.server.model.cgi;
+
+public class SmallPageUrlDetail {
+
+    private Long id;
+
+    private Long videoId;
+
+    private String putScene;
+
+    private String channel;
+
+    private String remark;
+
+    private String url;
+
+    private String rootSourceId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
+    public String getPutScene() {
+        return putScene;
+    }
+
+    public void setPutScene(String putScene) {
+        this.putScene = putScene;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRootSourceId() {
+        return rootSourceId;
+    }
+
+    public void setRootSourceId(String rootSourceId) {
+        this.rootSourceId = rootSourceId;
+    }
+}

+ 34 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/mapper/crawler/AlgGhAutoreplyVideoRankDataMapper.java

@@ -0,0 +1,34 @@
+package com.tzld.longarticle.recommend.server.repository.mapper.crawler;
+
+import com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData;
+import com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankDataExample;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+@Mapper
+public interface AlgGhAutoreplyVideoRankDataMapper {
+    long countByExample(AlgGhAutoreplyVideoRankDataExample example);
+
+    int deleteByExample(AlgGhAutoreplyVideoRankDataExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(AlgGhAutoreplyVideoRankData row);
+
+    int insertSelective(AlgGhAutoreplyVideoRankData row);
+
+    List<AlgGhAutoreplyVideoRankData> selectByExample(AlgGhAutoreplyVideoRankDataExample example);
+
+    AlgGhAutoreplyVideoRankData selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("row") AlgGhAutoreplyVideoRankData row, @Param("example") AlgGhAutoreplyVideoRankDataExample example);
+
+    int updateByExample(@Param("row") AlgGhAutoreplyVideoRankData row, @Param("example") AlgGhAutoreplyVideoRankDataExample example);
+
+    int updateByPrimaryKeySelective(AlgGhAutoreplyVideoRankData row);
+
+    int updateByPrimaryKey(AlgGhAutoreplyVideoRankData row);
+
+    String selectLatestDtVersionByStrategyKey(String strategyKey);
+}

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

@@ -3,8 +3,10 @@ package com.tzld.longarticle.recommend.server.repository.mapper.crawler;
 import com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketData;
 import com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketDataExample;
 import java.util.List;
-import org.apache.ibatis.annotations.Param;
 
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+@Mapper
 public interface CgiReplyBucketDataMapper {
     long countByExample(CgiReplyBucketDataExample example);
 

+ 115 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/AlgGhAutoreplyVideoRankData.java

@@ -0,0 +1,115 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+import java.util.Date;
+
+public class AlgGhAutoreplyVideoRankData {
+    private Long id;
+
+    private String strategyKey;
+
+    private String dtVersion;
+
+    private String ghId;
+
+    private Integer sort;
+
+    private Long videoId;
+
+    private String title;
+
+    private String coverUrl;
+
+    private Integer isDelete;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getStrategyKey() {
+        return strategyKey;
+    }
+
+    public void setStrategyKey(String strategyKey) {
+        this.strategyKey = strategyKey == null ? null : strategyKey.trim();
+    }
+
+    public String getDtVersion() {
+        return dtVersion;
+    }
+
+    public void setDtVersion(String dtVersion) {
+        this.dtVersion = dtVersion == null ? null : dtVersion.trim();
+    }
+
+    public String getGhId() {
+        return ghId;
+    }
+
+    public void setGhId(String ghId) {
+        this.ghId = ghId == null ? null : ghId.trim();
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title == null ? null : title.trim();
+    }
+
+    public String getCoverUrl() {
+        return coverUrl;
+    }
+
+    public void setCoverUrl(String coverUrl) {
+        this.coverUrl = coverUrl == null ? null : coverUrl.trim();
+    }
+
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 910 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/AlgGhAutoreplyVideoRankDataExample.java

@@ -0,0 +1,910 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class AlgGhAutoreplyVideoRankDataExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    public AlgGhAutoreplyVideoRankDataExample() {
+        oredCriteria = new ArrayList<>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyIsNull() {
+            addCriterion("strategy_key is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyIsNotNull() {
+            addCriterion("strategy_key is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyEqualTo(String value) {
+            addCriterion("strategy_key =", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyNotEqualTo(String value) {
+            addCriterion("strategy_key <>", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyGreaterThan(String value) {
+            addCriterion("strategy_key >", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyGreaterThanOrEqualTo(String value) {
+            addCriterion("strategy_key >=", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyLessThan(String value) {
+            addCriterion("strategy_key <", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyLessThanOrEqualTo(String value) {
+            addCriterion("strategy_key <=", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyLike(String value) {
+            addCriterion("strategy_key like", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyNotLike(String value) {
+            addCriterion("strategy_key not like", value, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyIn(List<String> values) {
+            addCriterion("strategy_key in", values, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyNotIn(List<String> values) {
+            addCriterion("strategy_key not in", values, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyBetween(String value1, String value2) {
+            addCriterion("strategy_key between", value1, value2, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andStrategyKeyNotBetween(String value1, String value2) {
+            addCriterion("strategy_key not between", value1, value2, "strategyKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionIsNull() {
+            addCriterion("dt_version is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionIsNotNull() {
+            addCriterion("dt_version is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionEqualTo(String value) {
+            addCriterion("dt_version =", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionNotEqualTo(String value) {
+            addCriterion("dt_version <>", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionGreaterThan(String value) {
+            addCriterion("dt_version >", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionGreaterThanOrEqualTo(String value) {
+            addCriterion("dt_version >=", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionLessThan(String value) {
+            addCriterion("dt_version <", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionLessThanOrEqualTo(String value) {
+            addCriterion("dt_version <=", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionLike(String value) {
+            addCriterion("dt_version like", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionNotLike(String value) {
+            addCriterion("dt_version not like", value, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionIn(List<String> values) {
+            addCriterion("dt_version in", values, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionNotIn(List<String> values) {
+            addCriterion("dt_version not in", values, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionBetween(String value1, String value2) {
+            addCriterion("dt_version between", value1, value2, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtVersionNotBetween(String value1, String value2) {
+            addCriterion("dt_version not between", value1, value2, "dtVersion");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIsNull() {
+            addCriterion("gh_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIsNotNull() {
+            addCriterion("gh_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdEqualTo(String value) {
+            addCriterion("gh_id =", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotEqualTo(String value) {
+            addCriterion("gh_id <>", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdGreaterThan(String value) {
+            addCriterion("gh_id >", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdGreaterThanOrEqualTo(String value) {
+            addCriterion("gh_id >=", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLessThan(String value) {
+            addCriterion("gh_id <", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLessThanOrEqualTo(String value) {
+            addCriterion("gh_id <=", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdLike(String value) {
+            addCriterion("gh_id like", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotLike(String value) {
+            addCriterion("gh_id not like", value, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdIn(List<String> values) {
+            addCriterion("gh_id in", values, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotIn(List<String> values) {
+            addCriterion("gh_id not in", values, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdBetween(String value1, String value2) {
+            addCriterion("gh_id between", value1, value2, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGhIdNotBetween(String value1, String value2) {
+            addCriterion("gh_id not between", value1, value2, "ghId");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortIsNull() {
+            addCriterion("sort is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortIsNotNull() {
+            addCriterion("sort is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortEqualTo(Integer value) {
+            addCriterion("sort =", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortNotEqualTo(Integer value) {
+            addCriterion("sort <>", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortGreaterThan(Integer value) {
+            addCriterion("sort >", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortGreaterThanOrEqualTo(Integer value) {
+            addCriterion("sort >=", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortLessThan(Integer value) {
+            addCriterion("sort <", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortLessThanOrEqualTo(Integer value) {
+            addCriterion("sort <=", value, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortIn(List<Integer> values) {
+            addCriterion("sort in", values, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortNotIn(List<Integer> values) {
+            addCriterion("sort not in", values, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortBetween(Integer value1, Integer value2) {
+            addCriterion("sort between", value1, value2, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andSortNotBetween(Integer value1, Integer value2) {
+            addCriterion("sort not between", value1, value2, "sort");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNull() {
+            addCriterion("video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNotNull() {
+            addCriterion("video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdEqualTo(Long value) {
+            addCriterion("video_id =", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotEqualTo(Long value) {
+            addCriterion("video_id <>", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThan(Long value) {
+            addCriterion("video_id >", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id >=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThan(Long value) {
+            addCriterion("video_id <", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThanOrEqualTo(Long value) {
+            addCriterion("video_id <=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIn(List<Long> values) {
+            addCriterion("video_id in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotIn(List<Long> values) {
+            addCriterion("video_id not in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdBetween(Long value1, Long value2) {
+            addCriterion("video_id between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotBetween(Long value1, Long value2) {
+            addCriterion("video_id not between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIsNull() {
+            addCriterion("title is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIsNotNull() {
+            addCriterion("title is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleEqualTo(String value) {
+            addCriterion("title =", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotEqualTo(String value) {
+            addCriterion("title <>", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleGreaterThan(String value) {
+            addCriterion("title >", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleGreaterThanOrEqualTo(String value) {
+            addCriterion("title >=", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLessThan(String value) {
+            addCriterion("title <", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLessThanOrEqualTo(String value) {
+            addCriterion("title <=", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLike(String value) {
+            addCriterion("title like", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotLike(String value) {
+            addCriterion("title not like", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIn(List<String> values) {
+            addCriterion("title in", values, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotIn(List<String> values) {
+            addCriterion("title not in", values, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleBetween(String value1, String value2) {
+            addCriterion("title between", value1, value2, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotBetween(String value1, String value2) {
+            addCriterion("title not between", value1, value2, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlIsNull() {
+            addCriterion("cover_url is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlIsNotNull() {
+            addCriterion("cover_url is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlEqualTo(String value) {
+            addCriterion("cover_url =", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlNotEqualTo(String value) {
+            addCriterion("cover_url <>", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlGreaterThan(String value) {
+            addCriterion("cover_url >", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlGreaterThanOrEqualTo(String value) {
+            addCriterion("cover_url >=", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlLessThan(String value) {
+            addCriterion("cover_url <", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlLessThanOrEqualTo(String value) {
+            addCriterion("cover_url <=", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlLike(String value) {
+            addCriterion("cover_url like", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlNotLike(String value) {
+            addCriterion("cover_url not like", value, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlIn(List<String> values) {
+            addCriterion("cover_url in", values, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlNotIn(List<String> values) {
+            addCriterion("cover_url not in", values, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlBetween(String value1, String value2) {
+            addCriterion("cover_url between", value1, value2, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverUrlNotBetween(String value1, String value2) {
+            addCriterion("cover_url not between", value1, value2, "coverUrl");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNull() {
+            addCriterion("is_delete is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNotNull() {
+            addCriterion("is_delete is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteEqualTo(Integer value) {
+            addCriterion("is_delete =", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotEqualTo(Integer value) {
+            addCriterion("is_delete <>", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThan(Integer value) {
+            addCriterion("is_delete >", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_delete >=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThan(Integer value) {
+            addCriterion("is_delete <", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThanOrEqualTo(Integer value) {
+            addCriterion("is_delete <=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIn(List<Integer> values) {
+            addCriterion("is_delete in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotIn(List<Integer> values) {
+            addCriterion("is_delete not in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete not between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNull() {
+            addCriterion("update_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNotNull() {
+            addCriterion("update_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeEqualTo(Date value) {
+            addCriterion("update_time =", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotEqualTo(Date value) {
+            addCriterion("update_time <>", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThan(Date value) {
+            addCriterion("update_time >", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("update_time >=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThan(Date value) {
+            addCriterion("update_time <", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("update_time <=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIn(List<Date> values) {
+            addCriterion("update_time in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotIn(List<Date> values) {
+            addCriterion("update_time not in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
+            addCriterion("update_time between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("update_time not between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 77 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/cgi/TouLiuHttpClientService.java

@@ -0,0 +1,77 @@
+package com.tzld.longarticle.recommend.server.service.cgi;
+
+import com.alibaba.fastjson.JSON;
+import com.tzld.longarticle.recommend.server.model.cgi.GroupData;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.web.reactive.function.BodyInserters;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.core.publisher.Mono;
+
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class TouLiuHttpClientService {
+
+//    private final WebClient webClient;
+//
+//    public HttpClientService(String baseUrl) {
+//        this.webClient = WebClient.builder()
+//                .baseUrl(baseUrl)
+//                .build();
+//    }
+
+    public String sendAdFlowAddRequest(String baseUrl, String videoId, String putTypeOne,
+                                       String putTypeTwo, String putTypeThree, String putCarrierId) {
+        WebClient webClient = WebClient.builder()
+                .baseUrl(baseUrl)
+                .build();
+        UUID uuid = UUID.randomUUID();
+        // 构建请求体  
+        String jsonBody = "{" +
+                "\"videoId\":\"" + videoId + "\"," +
+                "\"putScene\":\"" + "touliu" + "\"," +
+                "\"channel\":\"" + "tencent" + "\"," +
+                "\"remark\":\"" + "自动" + "\"," +
+                "\"putTypeOne\":\"" + putTypeOne + "\"," +
+                "\"putTypeTwo\":\"" + putTypeTwo + "\"," +
+                "\"putTypeThree\":\"" + putTypeThree + "\"," +
+                "\"putCarrierId\":\"" + putCarrierId + "\"," +
+                "\"path\":\"" + "pages/category" + "\"," +
+                "\"requestParam\":{" +
+                "\"jumpPage\":\"" + "pages/user-videos?id=" + videoId + "&fromGzh=1&rootShareId=" + uuid + "&shareId=" + uuid + "&rootSourceId=[rootSourceId]" + "\"" +
+                "}" +
+                "}";
+
+        // 发送POST请求  
+        Mono<String> result = webClient.post()
+                .uri("/ad/put/flow/add/tencent")
+                .contentType(MediaType.APPLICATION_JSON)
+                .body(BodyInserters.fromValue(jsonBody))
+                .retrieve()
+                .bodyToMono(String.class);
+        return result.block();
+    }
+
+    public List<GroupData> sendPenGongBaseRequest(String ghId) {
+        WebClient webClient = WebClient.builder()
+                .baseUrl("http://47.99.132.47:8813")
+                .build();
+        // 构建请求体
+        String jsonBody = "{\"ghId\": \"" + ghId + "\"}";
+
+        // 发送POST请求
+        Mono<String> result = webClient.post()
+                .uri("/VideoRank")
+                .contentType(MediaType.APPLICATION_JSON)
+                .body(BodyInserters.fromValue(jsonBody))
+                .retrieve()
+                .bodyToMono(String.class);
+        String block = result.block();
+        return JSON.parseArray(block, GroupData.class);
+    }
+
+    // 注意:在实际使用时,你还需要导入相关类和处理异常,以及添加@Service注解到你的服务类上  
+    // 另外,请确保MediaType已正确导入,它来自org.springframework.http包  
+}

+ 198 - 27
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/strategy/reply/impl/BuckStrategyV1.java

@@ -1,57 +1,228 @@
 package com.tzld.longarticle.recommend.server.service.strategy.reply.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.common.enums.cgi.ReplyStrategyServiceEnum;
-import com.tzld.longarticle.recommend.server.model.cgi.BucketDataParam;
-import com.tzld.longarticle.recommend.server.model.cgi.ReplyBucketData;
+import com.tzld.longarticle.recommend.server.model.cgi.*;
+import com.tzld.longarticle.recommend.server.repository.mapper.crawler.AlgGhAutoreplyVideoRankDataMapper;
+import com.tzld.longarticle.recommend.server.repository.mapper.crawler.CgiReplyBucketDataMapper;
+import com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData;
+import com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankDataExample;
+import com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketData;
+import com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketDataExample;
+import com.tzld.longarticle.recommend.server.service.cgi.TouLiuHttpClientService;
 import com.tzld.longarticle.recommend.server.service.strategy.reply.ReplyStrategyService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
 @Service
 public class BuckStrategyV1 implements ReplyStrategyService {
 
     /**
      * 实验分桶数量
      */
-    private static final Integer bucketNum = 10;
+//    private static final Integer bucketNum = 10;
 
     /**
      * 分桶实验策略,key为策略,arr为对应桶
-     * {"base":[0,1,2,3,4,5],"bucketV1":[6,7,8,9]}
+     * {"base":[0,1,2,3],"stg0909-base":[4,5],"stg0909-explore1":[6,7,8],"stg0909-explore2":[9]}
+     * {"stg0909-base":[5,6],"stg0909-explore1":[7,8],"stg0909-explore2":[9]}
      */
-    private static final String bucketStrategyConfig = "{\n" +
-            "    \"base\": [\n" +
-            "        0,\n" +
-            "        1,\n" +
-            "        2,\n" +
-            "        3,\n" +
-            "        4,\n" +
-            "        5\n" +
-            "    ],\n" +
-            "    \"bucketV1\": [\n" +
-            "        6,\n" +
-            "        7,\n" +
-            "        8,\n" +
-            "        9\n" +
-            "    ]\n" +
-            "}";
+    private static final String bucketStrategyConfig = "{\"stg0909-base\":[5,6],\"stg0909-explore1\":[7,8],\"stg0909-explore2\":[9]}";
 
     /**
      * 自动回复使用小程序Id
      */
-    private static final String SMALL_APP_Id = "gh_1ee2e1b39ccf";
+    private static final String SMALL_APP_Id = "wxbdd2a2e93d9a6e25";
+
+    private static final String CDN_URL = "https://rescdn.piaoquantv.com/";
+
+    private static final String GET_SMALL_PAGE_URL = "https://testapi.piaoquantv.com";
+
+    @Autowired
+    private AlgGhAutoreplyVideoRankDataMapper algGhAutoreplyVideoRankDataMapper;
+    @Autowired
+    private CgiReplyBucketDataMapper cgiReplyBucketDataMapper;
+    @Autowired
+    private TouLiuHttpClientService httpClientService;
 
     @Override
     public ReplyBucketData getResult(BucketDataParam bucketDataParam) {
-        // 1 处理文章数据
+        // 0 获取策略key
+        JSONObject bucketStrategyConfigJsonObject = JSON.parseObject(bucketStrategyConfig);
+        Set<String> keyedSet = bucketStrategyConfigJsonObject.keySet();
+        // 1 处理文章--算法引擎--排序文章数据
+//        getWenzhangData();
+        // 2 处理小程序--读取离线数据表--获取策略排序小程序数据
+        List<CgiReplyBucketData> smallDataCgiReplyList = readStrategyOrderSmallData(keyedSet);
+        // 2.1 获取小程序落地页地址 http调用
+        smallDataCgiReplyList = setSmallPageUrl(smallDataCgiReplyList);
+        log.info(JSON.toJSONString(smallDataCgiReplyList));
+        // 3 入库读表
+        insertSmallData(smallDataCgiReplyList, keyedSet);
+        // 4 组装分桶数据
+        return getReplyBucketData(bucketStrategyConfigJsonObject, keyedSet, bucketDataParam.getGhId());
+    }
+
+    private ReplyBucketData getReplyBucketData(JSONObject bucketStrategyConfigJsonObject, Set<String> keyedSet, String ghId) {
+        // 策略小程序数据
+        ReplyBucketData replyBucketData = new ReplyBucketData();
+        List<GroupData> groupDataList = new ArrayList<>();
+        for (String key : keyedSet) {
+            CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
+            cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key).andGhIdEqualTo(ghId);
+            cgiReplyBucketDataExample.setOrderByClause("sort");
+            List<CgiReplyBucketData> cgiReplyBucketData = cgiReplyBucketDataMapper.selectByExample(cgiReplyBucketDataExample);
+            if (CollectionUtils.isEmpty(cgiReplyBucketData)) {
+                CgiReplyBucketDataExample cgiReplyBucketDataExampleNull = new CgiReplyBucketDataExample();
+                cgiReplyBucketDataExampleNull.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key).andGhIdEqualTo("default");
+                cgiReplyBucketDataExampleNull.setOrderByClause("sort");
+                cgiReplyBucketData = cgiReplyBucketDataMapper.selectByExample(cgiReplyBucketDataExampleNull);
+            }
+            if (CollectionUtils.isEmpty(cgiReplyBucketData)) {
+                log.error("getReplyBucketData get data is null,key:" + key);
+                return null;
+            }
 
-        // 2 处理小程序数据
+            List<Integer> groupList = bucketStrategyConfigJsonObject.getJSONArray(key).toJavaList(Integer.class);
+            for (Integer group : groupList) {
+                GroupData groupData = new GroupData();
+                groupData.setGroupIndex(group);
+                List<MsgData> msgDataList = new ArrayList<>();
+                for (CgiReplyBucketData cgiReplyBucketDatum : cgiReplyBucketData) {
+                    MsgData msgData = new MsgData();
+                    BeanUtils.copyProperties(cgiReplyBucketDatum, msgData);
+                    if (cgiReplyBucketDatum.getMsgType().equals(1)) {
+                        msgData.setMiniAppId(SMALL_APP_Id);
+                    }
+                    msgDataList.add(msgData);
+                }
+                groupData.setMsgDataList(msgDataList);
+                groupDataList.add(groupData);
+            }
+        }
+        // 获取人工实验数据
+        List<GroupData> groupDataBaseList = httpClientService.sendPenGongBaseRequest(ghId);
+        if (!CollectionUtils.isEmpty(groupDataBaseList)) {
+            GroupData groupData = groupDataBaseList.get(0);
+            List<MsgData> msgDataList = groupData.getMsgDataList();
+            List<MsgData> changwenBase = msgDataList.stream().filter(x -> x.getMsgType().equals(2)).collect(Collectors.toList());
+            if (CollectionUtils.isEmpty(changwenBase)) {
+                log.error("get base changwenBase is null,data:" + JSON.toJSONString(msgDataList));
+            } else {
+                // 策略拼接base数据
+                for (GroupData data : groupDataList) {
+                    List<MsgData> msgDataList1 = data.getMsgDataList();
+                    MsgData msgData = changwenBase.get(0);
+//                    msgData.setSort(3);
+                    msgDataList1.add(msgData);
+                }
+            }
+            // 补充人工数据
+            groupDataList.addAll(groupDataBaseList);
+        } else {
+            log.error("get base data is null,ghId:" + ghId);
+        }
+        // groupDataList排序
+        replyBucketData.setGroupList(groupDataList.stream().sorted(Comparator.comparingInt(GroupData::getGroupIndex)).collect(Collectors.toList()));
+        return replyBucketData;
+    }
+
+
+    private void insertSmallData(List<CgiReplyBucketData> smallDataCgiReplyList, Set<String> keyedSet) {
+        if (CollectionUtils.isEmpty(smallDataCgiReplyList)) {
+            return;
+        }
+        for (String key : keyedSet) {
+            if ("base".equals(key)) {
+                continue;
+            }
+            List<CgiReplyBucketData> collect = smallDataCgiReplyList.stream().filter(x -> x.getStrategy().equals(key)).collect(Collectors.toList());
+            if (CollectionUtils.isEmpty(collect)) {
+                log.error("insertSmallData 算法排序数据异常,data:" + JSON.toJSONString(smallDataCgiReplyList));
+                continue;
+            }
+            // 清上个版本的策略数据
+            CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
+            cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andMsgTypeEqualTo(1).andStrategyEqualTo(key);
+            List<CgiReplyBucketData> cgiReplyBucketData1 = cgiReplyBucketDataMapper.selectByExample(cgiReplyBucketDataExample);
+            for (CgiReplyBucketData cgiReplyBucketData : cgiReplyBucketData1) {
+                cgiReplyBucketData.setIsDelete(1);
+                cgiReplyBucketDataMapper.updateByPrimaryKeySelective(cgiReplyBucketData);
+            }
+            // 入库
+            for (CgiReplyBucketData cgiReplyBucketData : collect) {
+                cgiReplyBucketDataMapper.insertSelective(cgiReplyBucketData);
+            }
+        }
+    }
 
-        // 2.1 获取小程序落地页地址 http调用 判断如果库里有复用
+    private List<CgiReplyBucketData> setSmallPageUrl(List<CgiReplyBucketData> smallDataCgiReplyList) {
+        if (CollectionUtils.isEmpty(smallDataCgiReplyList)) {
+            return smallDataCgiReplyList;
+        }
+        for (CgiReplyBucketData cgiReplyBucketData : smallDataCgiReplyList) {
+            String response = httpClientService.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, cgiReplyBucketData.getMiniVideoId() + "", "公众号", "自动回复小程序", "位置" + cgiReplyBucketData.getSort(), SMALL_APP_Id);
+            JSONObject jsonObject = JSON.parseObject(response);
+            if (jsonObject.getInteger("code").equals(0)) {
+                SmallPageUrlDetail smallPageUrlDetail = jsonObject.getObject("data", SmallPageUrlDetail.class);
+                cgiReplyBucketData.setPagePathUrlId(smallPageUrlDetail.getId());
+                cgiReplyBucketData.setMiniPagePath(smallPageUrlDetail.getUrl());
+            } else {
+                return null;
+            }
+        }
+        return smallDataCgiReplyList;
+    }
 
-        // 3 入库读表 组装数据
+    private List<CgiReplyBucketData> readStrategyOrderSmallData(Set<String> keyedSet) {
+        List<CgiReplyBucketData> result = new ArrayList<>();
+        for (String key : keyedSet) {
+            if ("base".equals(key)) {
+                // base作为人工控制
+                continue;
+            }
+            // 获取最新dt的策略
+            String dtVersion = algGhAutoreplyVideoRankDataMapper.selectLatestDtVersionByStrategyKey(key);
+            // 判断当前的dtVersion是否已经处理过了
+            CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
+            cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andStrategyDtEqualTo(dtVersion).andStrategyEqualTo(key);
+            long count = cgiReplyBucketDataMapper.countByExample(cgiReplyBucketDataExample);
+            if (count != 0) {
+                // 说明已处理过该dtVersion数据
+                continue;
+            }
+            // 获取最新dt数据
+            List<AlgGhAutoreplyVideoRankData> dtVserSionStrategyData = getDtVersionStrategyData(key, dtVersion);
+            result.addAll(dtVserSionStrategyData.stream().map(x -> {
+                CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
+                cgiReplyBucketData.setStrategy(key);
+                cgiReplyBucketData.setSort(x.getSort());
+                cgiReplyBucketData.setStrategyDt(x.getDtVersion());
+                cgiReplyBucketData.setGhId(x.getGhId());
+                cgiReplyBucketData.setMsgType(1);
+                cgiReplyBucketData.setTitle(x.getTitle());
+                cgiReplyBucketData.setCoverUrl(CDN_URL + x.getCoverUrl());
+                cgiReplyBucketData.setMiniAppId(SMALL_APP_Id);
+                cgiReplyBucketData.setMiniVideoId(x.getVideoId());
+                return cgiReplyBucketData;
+            }).collect(Collectors.toList()));
+        }
+        // 获取最新数据版本
+        return CollectionUtils.isEmpty(result) ? null : result;
+    }
 
-        // 4 返回
-        return null;
+    private List<AlgGhAutoreplyVideoRankData> getDtVersionStrategyData(String key, String dtVersion) {
+        AlgGhAutoreplyVideoRankDataExample algGhAutoreplyVideoRankDataExample = new AlgGhAutoreplyVideoRankDataExample();
+        algGhAutoreplyVideoRankDataExample.createCriteria().andIsDeleteEqualTo(0).andDtVersionEqualTo(dtVersion).andStrategyKeyEqualTo(key);
+        return algGhAutoreplyVideoRankDataMapper.selectByExample(algGhAutoreplyVideoRankDataExample);
     }
 
     @Override

+ 5 - 1
long-article-recommend-service/src/main/resources/application-dev.yml

@@ -15,7 +15,11 @@ spring:
 #        min-idle: 0
   datasource:
     crawler:
-      jdbc-url: jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+#      jdbc-url: jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+#      username: crawler
+#      password: crawler123456@
+      # 测试库
+      jdbc-url: jdbc:mysql://rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
       username: crawler
       password: crawler123456@
       driver-class-name: com.mysql.jdbc.Driver

+ 1 - 1
long-article-recommend-service/src/main/resources/generatorCgiConfig.xml

@@ -33,7 +33,7 @@
             <property name="enableSubPackages" value="true" />
         </javaClientGenerator>
 
-        <table schema="mybatis" tableName="cgi_reply_bucket_data" >
+        <table schema="mybatis" tableName="alg_gh_autoreply_video_rank_data" >
             <generatedKey column="id" sqlStatement="mysql" identity="true" />
         </table>
 

+ 315 - 0
long-article-recommend-service/src/main/resources/mapper/crawler/AlgGhAutoreplyVideoRankDataMapper.xml

@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.longarticle.recommend.server.repository.mapper.crawler.AlgGhAutoreplyVideoRankDataMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="strategy_key" jdbcType="VARCHAR" property="strategyKey" />
+    <result column="dt_version" jdbcType="VARCHAR" property="dtVersion" />
+    <result column="gh_id" jdbcType="VARCHAR" property="ghId" />
+    <result column="sort" jdbcType="INTEGER" property="sort" />
+    <result column="video_id" jdbcType="BIGINT" property="videoId" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="cover_url" jdbcType="VARCHAR" property="coverUrl" />
+    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, strategy_key, dt_version, gh_id, sort, video_id, title, cover_url, is_delete, 
+    create_time, update_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankDataExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from alg_gh_autoreply_video_rank_data
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from alg_gh_autoreply_video_rank_data
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from alg_gh_autoreply_video_rank_data
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankDataExample">
+    delete from alg_gh_autoreply_video_rank_data
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into alg_gh_autoreply_video_rank_data (strategy_key, dt_version, gh_id, 
+      sort, video_id, title, 
+      cover_url, is_delete, create_time, 
+      update_time)
+    values (#{strategyKey,jdbcType=VARCHAR}, #{dtVersion,jdbcType=VARCHAR}, #{ghId,jdbcType=VARCHAR}, 
+      #{sort,jdbcType=INTEGER}, #{videoId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, 
+      #{coverUrl,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into alg_gh_autoreply_video_rank_data
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="strategyKey != null">
+        strategy_key,
+      </if>
+      <if test="dtVersion != null">
+        dt_version,
+      </if>
+      <if test="ghId != null">
+        gh_id,
+      </if>
+      <if test="sort != null">
+        sort,
+      </if>
+      <if test="videoId != null">
+        video_id,
+      </if>
+      <if test="title != null">
+        title,
+      </if>
+      <if test="coverUrl != null">
+        cover_url,
+      </if>
+      <if test="isDelete != null">
+        is_delete,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="strategyKey != null">
+        #{strategyKey,jdbcType=VARCHAR},
+      </if>
+      <if test="dtVersion != null">
+        #{dtVersion,jdbcType=VARCHAR},
+      </if>
+      <if test="ghId != null">
+        #{ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="sort != null">
+        #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="videoId != null">
+        #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="title != null">
+        #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="coverUrl != null">
+        #{coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        #{isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankDataExample" resultType="java.lang.Long">
+    select count(*) from alg_gh_autoreply_video_rank_data
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update alg_gh_autoreply_video_rank_data
+    <set>
+      <if test="row.id != null">
+        id = #{row.id,jdbcType=BIGINT},
+      </if>
+      <if test="row.strategyKey != null">
+        strategy_key = #{row.strategyKey,jdbcType=VARCHAR},
+      </if>
+      <if test="row.dtVersion != null">
+        dt_version = #{row.dtVersion,jdbcType=VARCHAR},
+      </if>
+      <if test="row.ghId != null">
+        gh_id = #{row.ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="row.sort != null">
+        sort = #{row.sort,jdbcType=INTEGER},
+      </if>
+      <if test="row.videoId != null">
+        video_id = #{row.videoId,jdbcType=BIGINT},
+      </if>
+      <if test="row.title != null">
+        title = #{row.title,jdbcType=VARCHAR},
+      </if>
+      <if test="row.coverUrl != null">
+        cover_url = #{row.coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="row.isDelete != null">
+        is_delete = #{row.isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="row.createTime != null">
+        create_time = #{row.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="row.updateTime != null">
+        update_time = #{row.updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="example != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update alg_gh_autoreply_video_rank_data
+    set id = #{row.id,jdbcType=BIGINT},
+      strategy_key = #{row.strategyKey,jdbcType=VARCHAR},
+      dt_version = #{row.dtVersion,jdbcType=VARCHAR},
+      gh_id = #{row.ghId,jdbcType=VARCHAR},
+      sort = #{row.sort,jdbcType=INTEGER},
+      video_id = #{row.videoId,jdbcType=BIGINT},
+      title = #{row.title,jdbcType=VARCHAR},
+      cover_url = #{row.coverUrl,jdbcType=VARCHAR},
+      is_delete = #{row.isDelete,jdbcType=INTEGER},
+      create_time = #{row.createTime,jdbcType=TIMESTAMP},
+      update_time = #{row.updateTime,jdbcType=TIMESTAMP}
+    <if test="example != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData">
+    update alg_gh_autoreply_video_rank_data
+    <set>
+      <if test="strategyKey != null">
+        strategy_key = #{strategyKey,jdbcType=VARCHAR},
+      </if>
+      <if test="dtVersion != null">
+        dt_version = #{dtVersion,jdbcType=VARCHAR},
+      </if>
+      <if test="ghId != null">
+        gh_id = #{ghId,jdbcType=VARCHAR},
+      </if>
+      <if test="sort != null">
+        sort = #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="videoId != null">
+        video_id = #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="title != null">
+        title = #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="coverUrl != null">
+        cover_url = #{coverUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        is_delete = #{isDelete,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.longarticle.recommend.server.repository.model.AlgGhAutoreplyVideoRankData">
+    update alg_gh_autoreply_video_rank_data
+    set strategy_key = #{strategyKey,jdbcType=VARCHAR},
+      dt_version = #{dtVersion,jdbcType=VARCHAR},
+      gh_id = #{ghId,jdbcType=VARCHAR},
+      sort = #{sort,jdbcType=INTEGER},
+      video_id = #{videoId,jdbcType=BIGINT},
+      title = #{title,jdbcType=VARCHAR},
+      cover_url = #{coverUrl,jdbcType=VARCHAR},
+      is_delete = #{isDelete,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
+  <select id="selectLatestDtVersionByStrategyKey" resultType="string" parameterType="string">
+    SELECT dt_version
+    FROM alg_gh_autoreply_video_rank_data
+    WHERE strategy_key = #{strategyKey}
+    GROUP BY dt_version
+    ORDER BY dt_version DESC
+      LIMIT 1
+  </select>
+</mapper>

+ 13 - 13
long-article-recommend-service/src/main/resources/mapper/crawler/CgiReplyBucketDataMapper.xml

@@ -79,8 +79,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, strategy, sort, strategy_dt, gh_id, msg_type, title, cover_url, mini_app_id, 
-    mini_page_path, mini_video_id, page_path_url_id, news_publish_content_id, plan_id, 
+    id, strategy, sort, strategy_dt, gh_id, msg_type, title, cover_url, mini_app_id,
+    mini_page_path, mini_video_id, page_path_url_id, news_publish_content_id, plan_id,
     is_delete, create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketDataExample" resultMap="BaseResultMap">
@@ -98,7 +98,7 @@
     </if>
   </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from cgi_reply_bucket_data
     where id = #{id,jdbcType=BIGINT}
@@ -117,17 +117,17 @@
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
       SELECT LAST_INSERT_ID()
     </selectKey>
-    insert into cgi_reply_bucket_data (strategy, sort, strategy_dt, 
-      gh_id, msg_type, title, 
-      cover_url, mini_app_id, mini_page_path, 
-      mini_video_id, page_path_url_id, news_publish_content_id, 
-      plan_id, is_delete, create_time, 
+    insert into cgi_reply_bucket_data (strategy, sort, strategy_dt,
+      gh_id, msg_type, title,
+      cover_url, mini_app_id, mini_page_path,
+      mini_video_id, page_path_url_id, news_publish_content_id,
+      plan_id, is_delete, create_time,
       update_time)
-    values (#{strategy,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{strategyDt,jdbcType=VARCHAR}, 
-      #{ghId,jdbcType=VARCHAR}, #{msgType,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, 
-      #{coverUrl,jdbcType=VARCHAR}, #{miniAppId,jdbcType=VARCHAR}, #{miniPagePath,jdbcType=VARCHAR}, 
-      #{miniVideoId,jdbcType=BIGINT}, #{pagePathUrlId,jdbcType=BIGINT}, #{newsPublishContentId,jdbcType=VARCHAR}, 
-      #{planId,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+    values (#{strategy,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{strategyDt,jdbcType=VARCHAR},
+      #{ghId,jdbcType=VARCHAR}, #{msgType,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
+      #{coverUrl,jdbcType=VARCHAR}, #{miniAppId,jdbcType=VARCHAR}, #{miniPagePath,jdbcType=VARCHAR},
+      #{miniVideoId,jdbcType=BIGINT}, #{pagePathUrlId,jdbcType=BIGINT}, #{newsPublishContentId,jdbcType=VARCHAR},
+      #{planId,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
       #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.CgiReplyBucketData">