浏览代码

Merge branch 'master' into wyp/1029-rootId

# Conflicts:
#	long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java
wangyunpeng 8 月之前
父节点
当前提交
621343ce12
共有 32 个文件被更改,包括 1170 次插入66 次删除
  1. 1 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/HttpPoolFactory.java
  2. 0 32
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/StaffEnum.java
  3. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/recommend/ScoreStrategyEnum.java
  4. 30 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/crawler/ReplyStaffMapper.java
  5. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/Content.java
  6. 12 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/vo/ReportUvVo.java
  7. 65 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ReplyStaff.java
  8. 580 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ReplyStaffExample.java
  9. 50 4
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java
  10. 4 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/ThirdPartyService.java
  11. 50 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/impl/ThirdPartyServiceImpl.java
  12. 13 7
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/impl/WeComServiceImpl.java
  13. 17 18
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/DataDashboardService.java
  14. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/FwhColdStartRankStrategy.java
  15. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/InfiniteRankStrategy.java
  16. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/LateRankStrategy.java
  17. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV10Strategy.java
  18. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV11Strategy.java
  19. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV12Strategy.java
  20. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV13Strategy.java
  21. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV14Strategy.java
  22. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV3Strategy.java
  23. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV4Strategy.java
  24. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV5Strategy.java
  25. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV7Strategy.java
  26. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV8Strategy.java
  27. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV9Strategy.java
  28. 1 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/ScoreService.java
  29. 60 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/CrawlerDaysDecreaseStrategy.java
  30. 36 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/util/DateUtils.java
  31. 7 4
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/ThirdPartyController.java
  32. 228 0
      long-article-recommend-service/src/main/resources/mapper/crawler/ReplyStaffMapper.xml

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

@@ -11,7 +11,7 @@ public final class HttpPoolFactory {
             HttpClientFactory.create(1000, 1000, 200, 200, 0, 1000);
 
     private static CloseableHttpClient AIGC =
-            HttpClientFactory.create(30000, 30000, 200, 200, 0, 30000);
+            HttpClientFactory.create(60000, 60000, 200, 200, 0, 60000);
 
     private static CloseableHttpClient NLP =
             HttpClientFactory.create(15000, 15000, 200, 200, 0, 15000);

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

@@ -1,32 +0,0 @@
-package com.tzld.longarticle.recommend.server.common.enums;
-
-import java.util.Objects;
-
-public enum StaffEnum {
-
-    STAFF_ENUM_1("XinYi", "精彩内容分享官"),
-    STAFF_ENUM_2("SongYi", "精彩内容推荐官"),
-    STAFF_ENUM_3("17512006748", "精彩视频福利官"),
-    STAFF_ENUM_4("18810931977", "美好内容发送官"),
-    STAFF_ENUM_5("15146364945", "史趣探秘—分享官"),
-    STAFF_ENUM_6("lky", "品百味人生-九姑娘");
-
-    StaffEnum(String userId, String name) {
-        this.userId = userId;
-        this.name = name;
-
-    }
-
-    public final String userId;
-    public final String name;
-
-    public static String getName(String userId) {
-        for (StaffEnum staffEnum : StaffEnum.values()) {
-            if (Objects.equals(staffEnum.userId, userId)) {
-                return staffEnum.name;
-            }
-        }
-        return null;
-    }
-
-}

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

@@ -17,6 +17,7 @@ public enum ScoreStrategyEnum {
     VIEW_COUNT_RATE("ViewCountRateStrategy"),
     VIEW_COUNT("ViewCountStrategy"),
     VIEW_MULTIPLIER("ViewMultiplierStrategy"),
+    CRAWLER_DAYS_DECREASE_STRATEGY("CrawlerDaysDecreaseStrategy"),
     ;
 
     private final String value;

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

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

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

@@ -28,6 +28,7 @@ public class Content {
     private String crawlerTitle;
     private String crawlerCoverUrl;
     private Integer crawlerViewCount;
+    private Long crawlerTimestamp;
 //    private Integer crawlerLikeCount;
 //    private Long crawlerPublishTimestamp;
 //    private String crawlerAccountName;

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

@@ -0,0 +1,12 @@
+package com.tzld.longarticle.recommend.server.model.vo;
+
+import lombok.Data;
+
+@Data
+public class ReportUvVo {
+
+    private String ghId;
+
+    private Long uv;
+
+}

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

@@ -0,0 +1,65 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+import java.util.Date;
+
+public class ReplyStaff {
+    private Long id;
+
+    private String userId;
+
+    private String name;
+
+    private Integer isDelete;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId == null ? null : userId.trim();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name == null ? null : name.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;
+    }
+}

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

@@ -0,0 +1,580 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class ReplyStaffExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    public ReplyStaffExample() {
+        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 andUserIdIsNull() {
+            addCriterion("user_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNotNull() {
+            addCriterion("user_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdEqualTo(String value) {
+            addCriterion("user_id =", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotEqualTo(String value) {
+            addCriterion("user_id <>", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThan(String value) {
+            addCriterion("user_id >", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThanOrEqualTo(String value) {
+            addCriterion("user_id >=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThan(String value) {
+            addCriterion("user_id <", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThanOrEqualTo(String value) {
+            addCriterion("user_id <=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLike(String value) {
+            addCriterion("user_id like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotLike(String value) {
+            addCriterion("user_id not like", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIn(List<String> values) {
+            addCriterion("user_id in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotIn(List<String> values) {
+            addCriterion("user_id not in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdBetween(String value1, String value2) {
+            addCriterion("user_id between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotBetween(String value1, String value2) {
+            addCriterion("user_id not between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIsNull() {
+            addCriterion("name is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIsNotNull() {
+            addCriterion("name is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameEqualTo(String value) {
+            addCriterion("name =", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotEqualTo(String value) {
+            addCriterion("name <>", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameGreaterThan(String value) {
+            addCriterion("name >", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameGreaterThanOrEqualTo(String value) {
+            addCriterion("name >=", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLessThan(String value) {
+            addCriterion("name <", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLessThanOrEqualTo(String value) {
+            addCriterion("name <=", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLike(String value) {
+            addCriterion("name like", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotLike(String value) {
+            addCriterion("name not like", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIn(List<String> values) {
+            addCriterion("name in", values, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotIn(List<String> values) {
+            addCriterion("name not in", values, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameBetween(String value1, String value2) {
+            addCriterion("name between", value1, value2, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotBetween(String value1, String value2) {
+            addCriterion("name not between", value1, value2, "name");
+            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);
+        }
+    }
+}

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.aliyun.odps.data.Record;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
@@ -20,6 +21,7 @@ import com.tzld.longarticle.recommend.server.model.entity.longArticle.GetOffVide
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesMatchVideo;
 import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticlesReadRate;
 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.crawler.LongArticlesVideoRepository;
@@ -40,10 +42,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.tzld.longarticle.recommend.server.common.constant.TimeConstant.MILLISECOND_DAY;
@@ -72,6 +71,8 @@ public class XxlJobService {
     @Autowired
     private PushMessageCallbackMapper pushMessageCallbackMapper;
     @Autowired
+    private ODPSManager odpsManager;
+    @Autowired
     private ArticleService articleService;
 
     @ApolloJsonValue("${touliu.account.ghIds:[\"gh_93e00e187787\", \"gh_ac43e43b253b\", \"gh_68e7fdc09fe4\",\"gh_77f36c109fb1\", \"gh_b181786a6c8c\", \"gh_1ee2e1b39ccf\"]}")
@@ -332,6 +333,51 @@ public class XxlJobService {
         return ReturnT.SUCCESS;
     }
 
+    @XxlJob("delPushMessageCallbackJob")
+    public ReturnT<String> delPushMessageCallbackJob(String param) {
+        Calendar calendar = Calendar.getInstance();
+        Long beforeDayStart = DateUtils.getBeforeDayStart(7);
+        Date startDay = new Date(beforeDayStart * 1000);
+        if (StringUtils.hasText(param)) {
+            startDay = DateUtils.getDate(param);
+        }
+        for (int i = 0; i < 30; i++) {
+            // 计算当前遍历日期
+            Date currentStartDate = (Date) startDay.clone();
+            calendar.setTime(currentStartDate);
+            calendar.add(Calendar.DAY_OF_MONTH, -i); // 向前推i天
+
+            // 生成开始时间和结束时间
+            Date startTime = calendar.getTime(); // 开始时间
+            calendar.set(Calendar.HOUR_OF_DAY, 23);
+            calendar.set(Calendar.MINUTE, 59);
+            calendar.set(Calendar.SECOND, 59);
+            Date endTime = calendar.getTime(); // 结束时间
+
+            PushMessageCallbackExample example = new PushMessageCallbackExample();
+            example.createCriteria().andCreateTimeBetween(startTime, endTime);
+            long mysqlCount = pushMessageCallbackMapper.countByExample(example);
+            if (mysqlCount == 0) {
+                break;
+            }
+            String pt = DateUtils.getDateString(startTime.getTime());
+            String sql = String.format("SELECT count(*) FROM push_message_callback WHERE pt = %s;", pt);
+            List<Record> recordList = odpsManager.query(sql);
+            if (CollectionUtil.isEmpty(recordList)) {
+                LarkRobotUtil.sendMessage("查询hive失败" + pt);
+                return ReturnT.FAIL;
+            }
+            Long hiveCount = recordList.get(0).getBigint(0);
+            if (Math.abs(mysqlCount - hiveCount) > 0) {
+                LarkRobotUtil.sendMessage("数量异常" + pt + "\n mysql数量:" + mysqlCount + "\n hive数量:" + hiveCount);
+                return ReturnT.FAIL;
+            }
+            pushMessageCallbackMapper.deleteByExample(example);
+        }
+        return ReturnT.SUCCESS;
+    }
+
+
     @XxlJob("syncArticleRootPublishId")
     public ReturnT<String> syncArticleRootPublishId(String param) {
         ArticleFindSourceParam findSourceParam = new ArticleFindSourceParam();

+ 4 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/ThirdPartyService.java

@@ -4,6 +4,7 @@ import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
 import com.tzld.longarticle.recommend.server.model.param.CallbackParam;
 import com.tzld.longarticle.recommend.server.model.param.PushMessageParam;
 import com.tzld.longarticle.recommend.server.model.vo.PushMessageVo;
+import com.tzld.longarticle.recommend.server.model.vo.ReportUvVo;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -11,4 +12,7 @@ import java.util.List;
 @Service
 public interface ThirdPartyService {
     CommonResponse<List<PushMessageVo>> getPushMessage(PushMessageParam param);
+
+
+    CommonResponse<List<ReportUvVo>> getReportUv(String date, String accessToken);
 }

+ 50 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/impl/ThirdPartyServiceImpl.java

@@ -1,6 +1,8 @@
 package com.tzld.longarticle.recommend.server.service.exterior.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.aliyun.odps.data.Record;
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.longarticle.recommend.server.common.enums.SecretEnum;
 import com.tzld.longarticle.recommend.server.common.enums.cgi.ReplyStrategyServiceEnum;
 import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
@@ -12,9 +14,12 @@ import com.tzld.longarticle.recommend.server.model.cgi.MsgData;
 import com.tzld.longarticle.recommend.server.model.cgi.ReplyBucketData;
 import com.tzld.longarticle.recommend.server.model.param.PushMessageParam;
 import com.tzld.longarticle.recommend.server.model.vo.PushMessageVo;
+import com.tzld.longarticle.recommend.server.model.vo.ReportUvVo;
 import com.tzld.longarticle.recommend.server.service.exterior.AccessTokenService;
 import com.tzld.longarticle.recommend.server.service.exterior.ThirdPartyService;
 import com.tzld.longarticle.recommend.server.service.strategy.reply.ReplyStrategyService;
+import com.tzld.longarticle.recommend.server.util.DateUtils;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -22,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import com.tzld.longarticle.recommend.server.remote.ODPSManager;
 
 import javax.annotation.PostConstruct;
 import java.util.ArrayList;
@@ -38,6 +44,12 @@ public class ThirdPartyServiceImpl implements ThirdPartyService {
     @Autowired
     private AccessTokenService accessTokenService;
 
+    @Autowired
+    private ODPSManager odpsManager;
+
+    @ApolloJsonValue("${canViewReportDate:2024-10-31}")
+    private String canViewReportDate;
+
     private Map<String, ReplyStrategyService> strategyServiceMap;
 
     @PostConstruct
@@ -85,6 +97,44 @@ public class ThirdPartyServiceImpl implements ThirdPartyService {
         return CommonResponse.success(pushMessageVoList);
     }
 
+    @Override
+    public CommonResponse<List<ReportUvVo>> getReportUv(String date, String accessToken) {
+        if (StringUtils.isEmpty(date) || !DateUtils.isValidDate(date) || StringUtils.isEmpty(accessToken)) {
+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "参数错误");
+        }
+        if (!accessTokenService.validateAccessToken(accessToken)) {
+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "accessToken错误或者已失效");
+        }
+        SecretEnum secretEnum = accessTokenService.getSecretEnum(accessToken);
+        if (secretEnum == null) {
+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "获取secret失败");
+        }
+        if (!DateUtils.isValidDate(canViewReportDate)) {
+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "系统异常");
+        }
+        String channel = secretEnum.channel;
+        long targetTime = DateUtils.dateStrToTimestamp(date, "yyyy-MM-dd");
+        long limitTime = DateUtils.dateStrToTimestamp(canViewReportDate, "yyyy-MM-dd");
+        if (targetTime > limitTime) {
+            return CommonResponse.create(500, "数据不存在");
+        }
+        String dt = date.replace("-", "").substring(0, 8);
+        String sql = String.format("SELECT * FROM alg_growth_3rd_gh_reply_uv_report WHERE dt = %s AND channel = '%s';",
+                dt, channel);
+        List<ReportUvVo> res = new ArrayList<>();
+        List<Record> recordList = odpsManager.query(sql);
+        if (CollectionUtils.isEmpty(recordList)) {
+            return CommonResponse.success(res);
+        }
+        for (Record record : recordList) {
+            ReportUvVo reportUvVo = new ReportUvVo();
+            reportUvVo.setGhId(record.getString(0));
+            reportUvVo.setUv(record.getBigint(1));
+            res.add(reportUvVo);
+        }
+        return CommonResponse.success(res);
+    }
+
     private ReplyBucketData getPushMessageData(PushMessageParam param, String channel) {
         log.info("strategyServiceMap={}", JSON.toJSONString(strategyServiceMap));
         for (Map.Entry<String, ReplyStrategyService> stringReplyStrategyServiceEntry : strategyServiceMap.entrySet()) {

+ 13 - 7
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/impl/WeComServiceImpl.java

@@ -1,31 +1,28 @@
 package com.tzld.longarticle.recommend.server.service.exterior.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.tzld.longarticle.recommend.server.common.enums.StaffEnum;
 import com.tzld.longarticle.recommend.server.common.enums.cgi.ReplyStrategyServiceEnum;
 import com.tzld.longarticle.recommend.server.common.response.CommonResponse;
 import com.tzld.longarticle.recommend.server.common.response.ExceptionCodeEnum;
-import com.tzld.longarticle.recommend.server.model.bo.MiniData;
+import com.tzld.longarticle.recommend.server.mapper.crawler.ReplyStaffMapper;
 import com.tzld.longarticle.recommend.server.model.cgi.BucketDataParam;
 import com.tzld.longarticle.recommend.server.model.cgi.GroupData;
 import com.tzld.longarticle.recommend.server.model.cgi.MsgData;
 import com.tzld.longarticle.recommend.server.model.cgi.ReplyBucketData;
-import com.tzld.longarticle.recommend.server.model.param.PushMessageParam;
 import com.tzld.longarticle.recommend.server.model.param.WeComPushMessageParam;
-import com.tzld.longarticle.recommend.server.model.vo.PushMessageVo;
 import com.tzld.longarticle.recommend.server.model.vo.WeComPushMessageVo;
+import com.tzld.longarticle.recommend.server.repository.model.ReplyStaff;
+import com.tzld.longarticle.recommend.server.repository.model.ReplyStaffExample;
 import com.tzld.longarticle.recommend.server.service.exterior.WeComService;
 import com.tzld.longarticle.recommend.server.service.strategy.reply.ReplyStrategyService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.PostConstruct;
-import java.io.UnsupportedEncodingException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
@@ -43,6 +40,9 @@ public class WeComServiceImpl implements WeComService {
     @Autowired
     private ApplicationContext applicationContext;
 
+    @Autowired
+    private ReplyStaffMapper replyStaffMapper;
+
     private Map<String, ReplyStrategyService> strategyServiceMap;
 
     @PostConstruct
@@ -62,7 +62,13 @@ public class WeComServiceImpl implements WeComService {
         if (CollectionUtils.isEmpty(groupList)) {
             return CommonResponse.create(500, "数据异常");
         }
-        String name = StaffEnum.getName(param.getUserId());
+        ReplyStaffExample example = new ReplyStaffExample();
+        example.createCriteria().andUserIdEqualTo(param.getUserId()).andIsDeleteEqualTo(0);
+        List<ReplyStaff> replyStaffs = replyStaffMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(replyStaffs)) {
+            return CommonResponse.create(ExceptionCodeEnum.PARAM_ERROR, "用户查询不到");
+        }
+        String name = replyStaffs.get(0).getName();
         for (GroupData groupData : groupList) {
             if (CollectionUtils.isEmpty(groupData.getMsgDataList())) {
                 continue;

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

@@ -189,6 +189,7 @@ public class DataDashboardService {
         }
         log.info("newSortStrategyData publishContents finish");
         Map<String, Map<String, Map<Long, PublishContent>>> publishContentMap = publishContents.stream()
+                .filter(o -> Objects.nonNull(o.getPublishTimestamp()))
                 .sorted(Comparator.comparingLong(PublishContent::getPublishTimestamp)).collect(
                         Collectors.groupingBy(PublishContent::getPublishAccountId,
                                 Collectors.groupingBy(PublishContent::getTitle,
@@ -365,16 +366,13 @@ public class DataDashboardService {
             return;
         }
         PublishContent publishContent = null;
+        List<String> hisPublishTimeStrList = publishTimeContentMap.keySet().stream()
+                .map(o -> DateUtils.timestampToYMDStr(o / 1000, "yyyyMMdd")).collect(Collectors.toList());
+        String publishTime = DateUtils.findNearestDate(hisPublishTimeStrList, date, "yyyyMMdd");
         for (Map.Entry<Long, PublishContent> entry : publishTimeContentMap.entrySet()) {
-            String publishTime = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
-            if (publishTime.equals(date)) {
-                if (Objects.nonNull(publishContent)) {
-                    if (publishContent.getPublishTimestamp() < entry.getValue().getPublishTimestamp()) {
-                        publishContent = entry.getValue();
-                    }
-                } else {
-                    publishContent = entry.getValue();
-                }
+            String str = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
+            if (publishTime.equals(str)) {
+                publishContent = entry.getValue();
             }
         }
         if (Objects.isNull(publishContent)) {
@@ -847,7 +845,8 @@ public class DataDashboardService {
         }
         Map<String, List<ArticleDetailInfo>> articleDetailInfoMap = articleDetailInfoList.stream()
                 .collect(Collectors.groupingBy(ArticleDetailInfo::getWxSn));
-        List<PublishSortLog> publishSortLogList = publishSortLogRepository.findByDateStrGreaterThanEqual(dateStr);
+        String lessDateStr = DateUtils.getBeforeDayStr(dateStr, "yyyyMMdd", 7);
+        List<PublishSortLog> publishSortLogList = publishSortLogRepository.findByDateStrGreaterThanEqual(lessDateStr);
         Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap = publishSortLogList.stream()
                 .collect(Collectors.groupingBy(PublishSortLog::getGhId,
                         Collectors.groupingBy(PublishSortLog::getDateStr, Collectors.toMap(
@@ -910,16 +909,16 @@ public class DataDashboardService {
     }
 
     private boolean checkIsAigcPublish(Article article,
-                                       Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap
-    ) {
-        String publishDateStr = DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyyMMdd");
+                                       Map<String, Map<String, Map<Integer, PublishSortLog>>> publishSortLogMap) {
         Map<String, Map<Integer, PublishSortLog>> dateSortMap = publishSortLogMap.get(article.getGhId());
         if (Objects.nonNull(dateSortMap)) {
-            Map<Integer, PublishSortLog> indexMap = dateSortMap.get(publishDateStr);
-            if (Objects.nonNull(indexMap)) {
-                PublishSortLog log = indexMap.get(article.getItemIndex());
-                if (Objects.nonNull(log) && log.getTitle().equals(article.getTitle())) {
-                    return true;
+            for (String dateStr : dateSortMap.keySet()) {
+                Map<Integer, PublishSortLog> indexMap = dateSortMap.get(dateStr);
+                if (Objects.nonNull(indexMap)) {
+                    PublishSortLog log = indexMap.get(article.getItemIndex());
+                    if (Objects.nonNull(log) && log.getTitle().equals(article.getTitle())) {
+                        return true;
+                    }
                 }
             }
         }

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

@@ -58,6 +58,7 @@ public class FwhColdStartRankStrategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             item.setScore(score);

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

@@ -49,6 +49,7 @@ public class InfiniteRankStrategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -49,6 +49,7 @@ public class LateRankStrategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -65,6 +65,7 @@ public class RankV10Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -85,6 +85,7 @@ public class RankV11Strategy implements RankStrategy {
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
                         ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -85,6 +85,7 @@ public class RankV12Strategy implements RankStrategy {
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
                         ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -86,6 +86,7 @@ public class RankV13Strategy implements RankStrategy {
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
                         ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -86,6 +86,7 @@ public class RankV14Strategy implements RankStrategy {
                         * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
                         ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -64,6 +64,7 @@ public class RankV3Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -64,6 +64,7 @@ public class RankV4Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -74,6 +74,7 @@ public class RankV5Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -65,6 +65,7 @@ public class RankV7Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -68,6 +68,7 @@ public class RankV8Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -65,6 +65,7 @@ public class RankV9Strategy implements RankStrategy {
                         + item.getScore(ScoreStrategyEnum.CATEGORY.value())
                         + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
                         + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
                         + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);

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

@@ -91,6 +91,7 @@ public class ScoreService implements ApplicationContextAware {
 
     private List<ScoreStrategy> getScoreStrategy(ScoreParam param) {
         List<ScoreStrategy> strategies = new ArrayList<>();
+        strategies.add(strategyMap.get(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value()));
         if (!similarityStopStrategies.contains(param.getStrategy())) {
             strategies.add(strategyMap.get(ScoreStrategyEnum.SIMILARITY.value()));
         }

+ 60 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/CrawlerDaysDecreaseStrategy.java

@@ -0,0 +1,60 @@
+package com.tzld.longarticle.recommend.server.service.recommend.score.strategy;
+
+import com.tzld.longarticle.recommend.server.model.dto.Content;
+import com.tzld.longarticle.recommend.server.service.recommend.config.AccountContentPoolConfigService;
+import com.tzld.longarticle.recommend.server.service.recommend.score.Score;
+import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreParam;
+import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreStrategy;
+import com.tzld.longarticle.recommend.server.util.DateUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 抓取时间超过60天的文章,分数减少
+ */
+@Component
+@Slf4j
+public class CrawlerDaysDecreaseStrategy implements ScoreStrategy {
+
+    @Autowired
+    private AccountContentPoolConfigService accountContentPoolConfigService;
+
+    @Override
+    public List<Score> score(ScoreParam param) {
+        List<Score> scores = new ArrayList<>();
+        if (CollectionUtils.isEmpty(param.getContents())) {
+            return scores;
+        }
+        long now = DateUtils.getTodayStart();
+        for (Content content : param.getContents()) {
+            String[] contentPools = accountContentPoolConfigService.getContentPools(param.getAccountName());
+            if (!contentPools[2].equals(content.getContentPoolType())) {
+                continue;
+            }
+            Score score = new Score();
+            score.setStrategy(this);
+            score.setContentId(content.getId());
+            score.setScore(getContentScore(content, now));
+            scores.add(score);
+        }
+        return scores;
+    }
+
+    private Double getContentScore(Content content, long now) {
+        double maxReleaseScore = -0.15;
+        double minScoreDays = 7;
+        double maxScoreDays = 60.0;
+        int days = (int) ((now - content.getCrawlerTimestamp()) / 86400000);
+        if (days < minScoreDays) {
+            return 0.0;
+        }
+        double scoreDays = Math.min(maxScoreDays, Math.max(minScoreDays, days));
+        return maxReleaseScore * ((scoreDays - minScoreDays) / maxScoreDays);
+    }
+
+}

+ 36 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/util/DateUtils.java

@@ -8,6 +8,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
 
@@ -75,6 +76,19 @@ public final class DateUtils {
         return dateTime.toEpochSecond(zone.getRules().getOffset(dateTime));
     }
 
+    public static boolean isValidDate(String dateString) {
+        // 定义日期格式
+        DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        try {
+            // 尝试解析日期字符串
+            LocalDate date = LocalDate.parse(dateString, dateFormatter);
+            return true; // 如果解析成功,返回 true
+        } catch (DateTimeParseException e) {
+            return false; // 如果解析失败,返回 false
+        }
+    }
+
     public static String timestampToYMDStr(Long timestamp, String format) {
 
         // 定义北京时区
@@ -247,4 +261,26 @@ public final class DateUtils {
         calendar.add(Calendar.DAY_OF_MONTH, -days);
         return calendar.getTime().getTime() / 1000;
     }
+
+    public static String getBeforeDayStr(String dateStr, String format, int days) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
+        LocalDate date = LocalDate.parse(dateStr, formatter);
+        date = date.minusDays(days);
+        return date.format(formatter);
+    }
+
+    public static String getDateString(Long timestamp) {
+        // 创建日期时间格式化器
+        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyyMMdd");
+        // 将时间戳转换为 LocalDateTime
+        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
+        // 格式化日期时间并返回
+        return dateTime.format(dateFormat);
+    }
+
+    public static Date getDate(String dateString) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate localDate = LocalDate.parse(dateString, formatter);
+        return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
+    }
 }

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

@@ -6,14 +6,12 @@ import com.tzld.longarticle.recommend.server.model.param.CallbackParam;
 import com.tzld.longarticle.recommend.server.model.param.PushMessageParam;
 import com.tzld.longarticle.recommend.server.model.vo.AccessTokenVo;
 import com.tzld.longarticle.recommend.server.model.vo.PushMessageVo;
+import com.tzld.longarticle.recommend.server.model.vo.ReportUvVo;
 import com.tzld.longarticle.recommend.server.mq.MessageCallbackProducer;
 import com.tzld.longarticle.recommend.server.service.exterior.AccessTokenService;
 import com.tzld.longarticle.recommend.server.service.exterior.ThirdPartyService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -44,4 +42,9 @@ public class ThirdPartyController {
     public CommonResponse<Void> pushMessageCallback(@RequestBody CallbackParam param) {
         return messageCallbackProducer.sendMessage(param);
     }
+
+    @GetMapping("/report/uv")
+    public CommonResponse<List<ReportUvVo>> getReportUv(@RequestParam String date, @RequestParam String accessToken) {
+        return thirdPartyService.getReportUv(date, accessToken);
+    }
 }

+ 228 - 0
long-article-recommend-service/src/main/resources/mapper/crawler/ReplyStaffMapper.xml

@@ -0,0 +1,228 @@
+<?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.mapper.crawler.ReplyStaffMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.longarticle.recommend.server.repository.model.ReplyStaff">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="user_id" jdbcType="VARCHAR" property="userId" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <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, user_id, name, is_delete, create_time, update_time
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ReplyStaffExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from reply_staff
+    <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 reply_staff
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from reply_staff
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ReplyStaffExample">
+    delete from reply_staff
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.ReplyStaff">
+    insert into reply_staff (id, user_id, name, 
+      is_delete, create_time, update_time
+      )
+    values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
+      #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ReplyStaff">
+    insert into reply_staff
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="name != null">
+        name,
+      </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="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,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.ReplyStaffExample" resultType="java.lang.Long">
+    select count(*) from reply_staff
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update reply_staff
+    <set>
+      <if test="row.id != null">
+        id = #{row.id,jdbcType=BIGINT},
+      </if>
+      <if test="row.userId != null">
+        user_id = #{row.userId,jdbcType=VARCHAR},
+      </if>
+      <if test="row.name != null">
+        name = #{row.name,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 reply_staff
+    set id = #{row.id,jdbcType=BIGINT},
+      user_id = #{row.userId,jdbcType=VARCHAR},
+      name = #{row.name,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.ReplyStaff">
+    update reply_staff
+    <set>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        name = #{name,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.ReplyStaff">
+    update reply_staff
+    set user_id = #{userId,jdbcType=VARCHAR},
+      name = #{name,jdbcType=VARCHAR},
+      is_delete = #{isDelete,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>