Explorar el Código

Merge branch 'wyp/1022-scoreIndexWeight' of Server/long-article-recommend into master

wangyunpeng hace 8 meses
padre
commit
048f8080cd
Se han modificado 20 ficheros con 343 adiciones y 259 borrados
  1. 31 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/ScoreStrategyEnum.java
  2. 26 8
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/StrategyIndexScoreWeightService.java
  3. 3 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/RankStrategy.java
  4. 5 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/DefaultRankStrategy.java
  5. 11 11
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/FwhColdStartRankStrategy.java
  6. 6 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/LateRankStrategy.java
  7. 12 12
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV10Strategy.java
  8. 30 29
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV11Strategy.java
  9. 30 29
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV12Strategy.java
  10. 30 29
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV13Strategy.java
  11. 30 29
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV14Strategy.java
  12. 5 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV2Strategy.java
  13. 11 11
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV3Strategy.java
  14. 11 11
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV4Strategy.java
  15. 19 11
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV5Strategy.java
  16. 12 12
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV7Strategy.java
  17. 15 15
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV8Strategy.java
  18. 12 12
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/rank/strategy/RankV9Strategy.java
  19. 19 19
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/score/ScoreService.java
  20. 25 0
      long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/ScoreStrategyTest.java

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

@@ -0,0 +1,31 @@
+package com.tzld.longarticle.recommend.server.common.enums;
+
+public enum ScoreStrategyEnum {
+    ACCOUNT_PRE_DISTRIBUTE("AccountPreDistributeStrategy"),
+    CATEGORY("CategoryStrategy"),
+    CONTENT_POOL("ContentPoolStrategy"),
+    FLOW_CTL_DECREASE("FlowCtlDecreaseStrategy"),
+    HIS_FISSION_AVG_READ_RATE_CORRELATION_RATE("HisFissionAvgReadRateCorrelationRateStrategy"),
+    HIS_FISSION_AVG_READ_RATE_RATE("HisFissionAvgReadRateRateStrategy"),
+    HIS_FISSION_AVG_READ_SUM_RATE("HisFissionAvgReadSumRateStrategy"),
+    HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE("HisFissionDeWeightAvgReadSumRateStrategy"),
+    HIS_FISSION_FANS_RATE_RATE("HisFissionFansRateRateStrategy"),
+    HIS_FISSION_FANS_SUM_RATE("HisFissionFansSumRateStrategy"),
+    PUBLISH_TIMES("PublishTimesStrategy"),
+    SIMILARITY("SimilarityStrategy"),
+    VIEW_COUNT_RATE_CORRELATION("ViewCountRateCorrelationStrategy"),
+    VIEW_COUNT_RATE("ViewCountRateStrategy"),
+    VIEW_COUNT("ViewCountStrategy"),
+    VIEW_MULTIPLIER("ViewMultiplierStrategy"),
+    ;
+
+    private final String value;
+
+    ScoreStrategyEnum(String value) {
+        this.value = value;
+    }
+
+    public String value() {
+        return value;
+    }
+}

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

@@ -11,18 +11,36 @@ import java.util.Objects;
 @Slf4j
 public class StrategyIndexScoreWeightService {
 
-    @ApolloJsonValue("${strategyIndexScoreWeightConfig:{}}")
-    private Map<String, Map<String, Map<String, Double>>> strategyIndexScoreWeightMap;
+    @ApolloJsonValue("${strategyAccountIndexScoreWeightConfig:{}}")
+    private Map<String, Map<String, Map<String, Map<String, Double>>>> strategyAccountIndexScoreWeightMap;
 
-    public double getWeight(String strategy, Integer index, String score) {
+    public double getWeight(String strategy, String ghId, Integer index, String score) {
         Double weight = 1.0;
-        Map<String, Map<String, Double>> indexMap = strategyIndexScoreWeightMap.get(strategy);
-        if (Objects.nonNull(indexMap)) {
-            Map<String, Double> scoreMap = indexMap.get(String.valueOf(index));
-            if (Objects.nonNull(scoreMap) && scoreMap.containsKey(score)) {
-                weight = scoreMap.get(score);
+        Map<String, Map<String, Map<String, Double>>> accountMap = strategyAccountIndexScoreWeightMap.get(strategy);
+        if (Objects.nonNull(accountMap)) {
+            if (!accountMap.containsKey(ghId)) {
+                ghId = "default";
+            }
+            Map<String, Map<String, Double>> indexMap = accountMap.get(ghId);
+            if (Objects.nonNull(indexMap)) {
+                Map<String, Double> scoreMap = indexMap.get(String.valueOf(index));
+                if (Objects.nonNull(scoreMap) && scoreMap.containsKey(score)) {
+                    weight = scoreMap.get(score);
+                }
             }
         }
         return weight;
     }
+
+    public int getIndex(String contentPoolType, String[] contentPools) {
+        int index;
+        if (contentPoolType.equals(contentPools[0])) {
+            index = 1;
+        } else if (contentPoolType.equals(contentPools[1])) {
+            index = 2;
+        } else {
+            index = 3;
+        }
+        return index;
+    }
 }

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

@@ -3,10 +3,10 @@ package com.tzld.longarticle.recommend.server.service.rank;
 
 import com.tzld.longarticle.recommend.server.common.enums.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.common.enums.FeishuRobotIdEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.service.score.ScoreParam;
-import com.tzld.longarticle.recommend.server.service.score.strategy.SimilarityStrategy;
 import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
 import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
 import org.apache.commons.collections4.CollectionUtils;
@@ -89,8 +89,8 @@ public interface RankStrategy {
 
     static boolean SimilarityScoreZero(List<RankItem> items, RankParam param, List<Article> articleList) {
         if (CollectionUtils.isNotEmpty(items)
-                && items.get(0).getScoreMap().containsKey(SimilarityStrategy.class.getSimpleName())
-                && items.get(0).getScoreMap().get(SimilarityStrategy.class.getSimpleName()) == 0) {
+                && items.get(0).getScoreMap().containsKey(ScoreStrategyEnum.SIMILARITY.value())
+                && items.get(0).getScoreMap().get(ScoreStrategyEnum.SIMILARITY.value()) == 0) {
                 FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
                         "内容评分为0\n"
                                 + "ghId: " + param.getGhId() + "\n"

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -12,8 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankResult;
 import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.SimilarityStrategy;
-import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountStrategy;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import com.tzld.longarticle.recommend.server.util.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -67,8 +66,8 @@ public class DefaultRankStrategy implements RankStrategy {
                 List<RankItem> data = itemMap.get(contentPools[i]);
                 if (CollectionUtils.isNotEmpty(data)) {
                     Collections.sort(data, (o1, o2) -> -Double.compare(
-                            o1.getScore(ViewCountStrategy.class.getSimpleName()),
-                            o2.getScore(ViewCountStrategy.class.getSimpleName())));
+                            o1.getScore(ScoreStrategyEnum.VIEW_COUNT.value()),
+                            o2.getScore(ScoreStrategyEnum.VIEW_COUNT.value())));
                     sortedItems.addAll(data);
                 }
             } else {
@@ -76,8 +75,8 @@ public class DefaultRankStrategy implements RankStrategy {
                 List<RankItem> data = itemMap.get(contentPools[i]);
                 if (CollectionUtils.isNotEmpty(data)) {
                     Collections.sort(data, (o1, o2) -> -Double.compare(
-                            o1.getScore(SimilarityStrategy.class.getSimpleName()),
-                            o2.getScore(SimilarityStrategy.class.getSimpleName())));
+                            o1.getScore(ScoreStrategyEnum.SIMILARITY.value()),
+                            o2.getScore(ScoreStrategyEnum.SIMILARITY.value())));
                     sortedItems.addAll(data);
                 }
             }

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

@@ -1,6 +1,7 @@
 package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.service.AccountContentPoolConfigService;
 import com.tzld.longarticle.recommend.server.service.rank.RankItem;
@@ -9,7 +10,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankResult;
 import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,18 +47,18 @@ public class FwhColdStartRankStrategy implements RankStrategy {
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())
                     || contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             item.setScore(score);
             return item;

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

@@ -1,5 +1,6 @@
 package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.service.AccountContentPoolConfigService;
 import com.tzld.longarticle.recommend.server.service.rank.RankItem;
@@ -9,7 +10,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.ScoreParam;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -45,11 +45,11 @@ public class LateRankStrategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score = 0.0;
             if (contentPools[2].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,20 +53,20 @@ public class RankV10Strategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(HisFissionAvgReadSumRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_SUM_RATE.value());
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -12,7 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.*;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,39 +53,40 @@ public class RankV11Strategy implements RankStrategy {
             c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
+            int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(HisFissionAvgReadRateRateStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        HisFissionAvgReadRateRateStrategy.class.getSimpleName());
-                score += item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        SimilarityStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 1,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value());
+                score += item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 2,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 2,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + (item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        AccountPreDistributeStrategy.class.getSimpleName()))
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + (item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             c.setHisPublishArticleList(null);

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -12,7 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.*;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,39 +53,40 @@ public class RankV12Strategy implements RankStrategy {
             c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
+            int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName());
-                score += item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        SimilarityStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 1,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value());
+                score += item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 2,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 2,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + (item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        AccountPreDistributeStrategy.class.getSimpleName()))
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + (item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             c.setHisPublishArticleList(null);

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -12,7 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.*;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,40 +53,41 @@ public class RankV13Strategy implements RankStrategy {
             c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
+            int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                double similarityScore = Math.pow(item.getScore(SimilarityStrategy.class.getSimpleName()),
-                        weightService.getWeight(param.getStrategy(), 1,
-                                SimilarityStrategy.class.getSimpleName()));
-                score = item.getScore(HisFissionAvgReadRateRateStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        HisFissionAvgReadRateRateStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 1,
-                            ViewCountRateStrategy.class.getSimpleName());
+                double similarityScore = Math.pow(item.getScore(ScoreStrategyEnum.SIMILARITY.value()),
+                        weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                                ScoreStrategyEnum.SIMILARITY.value()));
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
                 score = score * similarityScore;
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 2,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 2,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + (item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        AccountPreDistributeStrategy.class.getSimpleName()))
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + (item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             c.setHisPublishArticleList(null);

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

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -12,7 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.*;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,40 +53,41 @@ public class RankV14Strategy implements RankStrategy {
             c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
+            int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                double similarityScore = Math.pow(item.getScore(SimilarityStrategy.class.getSimpleName()),
-                        weightService.getWeight(param.getStrategy(), 1,
-                                SimilarityStrategy.class.getSimpleName()));
-                score = item.getScore(HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 1,
-                        HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 1,
-                            ViewCountRateStrategy.class.getSimpleName());
+                double similarityScore = Math.pow(item.getScore(ScoreStrategyEnum.SIMILARITY.value()),
+                        weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                                ScoreStrategyEnum.SIMILARITY.value()));
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
                 score = score * similarityScore;
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 2,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
-                            * weightService.getWeight(param.getStrategy(), 2,
-                            ViewCountRateStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = (item.getScore(SimilarityStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        SimilarityStrategy.class.getSimpleName()))
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + (item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        * weightService.getWeight(param.getStrategy(), 3,
-                        AccountPreDistributeStrategy.class.getSimpleName()))
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value()))
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + (item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             c.setHisPublishArticleList(null);

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

@@ -1,6 +1,7 @@
 package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.service.rank.RankItem;
 import com.tzld.longarticle.recommend.server.service.rank.RankParam;
@@ -8,8 +9,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankResult;
 import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.SimilarityStrategy;
-import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountStrategy;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -48,15 +47,15 @@ public class RankV2Strategy implements RankStrategy {
         // 1 排序
         Collections.sort(items, (o1, o2) -> {
             int result = -Double.compare(
-                    o1.getScore(SimilarityStrategy.class.getSimpleName()),
-                    o2.getScore(SimilarityStrategy.class.getSimpleName()));
+                    o1.getScore(ScoreStrategyEnum.SIMILARITY.value()),
+                    o2.getScore(ScoreStrategyEnum.SIMILARITY.value()));
             if (result != 0) {
                 return result;
             }
 
             return -Double.compare(
-                    o1.getScore(ViewCountStrategy.class.getSimpleName()),
-                    o2.getScore(ViewCountStrategy.class.getSimpleName()));
+                    o1.getScore(ScoreStrategyEnum.VIEW_COUNT.value()),
+                    o2.getScore(ScoreStrategyEnum.VIEW_COUNT.value()));
         });
         // 2 选文章
         List<Content> result = new ArrayList<>();

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -54,18 +54,18 @@ public class RankV3Strategy implements RankStrategy {
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())
                     || contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -54,18 +54,18 @@ public class RankV4Strategy implements RankStrategy {
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())
                     || contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateCorrelationStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE_CORRELATION.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -3,15 +3,16 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
 import com.tzld.longarticle.recommend.server.service.AccountContentPoolConfigService;
+import com.tzld.longarticle.recommend.server.service.StrategyIndexScoreWeightService;
 import com.tzld.longarticle.recommend.server.service.rank.*;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -34,6 +35,8 @@ public class RankV5Strategy implements RankStrategy {
     private AccountContentPoolConfigService accountContentPoolConfigService;
     @Autowired
     private ArticleRepository articleRepository;
+    @Autowired
+    private StrategyIndexScoreWeightService weightService;
 
     public RankResult rank(RankParam param) {
         List<Content> result = new ArrayList<>();
@@ -50,20 +53,25 @@ public class RankV5Strategy implements RankStrategy {
             c.setScoreMap(scoreMap.get(c.getId()));
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
+            int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
             if (contentPools[0].equals(item.getContent().getContentPoolType())
                     || contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                        ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
+                            * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
+                            ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,20 +53,20 @@ public class RankV7Strategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(HisFissionAvgReadRateCorrelationRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_CORRELATION_RATE.value());
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,23 +53,23 @@ public class RankV8Strategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                score += item.getScore(HisFissionAvgReadRateRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                score += item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value());
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
 
 
 import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
@@ -13,7 +14,6 @@ import com.tzld.longarticle.recommend.server.service.rank.RankStrategy;
 import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
 import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
 import com.tzld.longarticle.recommend.server.service.score.ScoreService;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -53,20 +53,20 @@ public class RankV9Strategy implements RankStrategy {
             item.setScoreMap(scoreMap.get(c.getId()));
             double score;
             if (contentPools[0].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(HisFissionAvgReadRateRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value());
             } else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
-                if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
-                    score += item.getScore(ViewCountRateStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
+                if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
+                    score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value());
                 }
             } else {
-                score = item.getScore(SimilarityStrategy.class.getSimpleName())
-                        + item.getScore(CategoryStrategy.class.getSimpleName())
-                        + item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
-                        + item.getScore(PublishTimesStrategy.class.getSimpleName())
-                        + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
+                score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
+                        + item.getScore(ScoreStrategyEnum.CATEGORY.value())
+                        + item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
+                        + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
+                        + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
             }
             c.setScore(score);
             item.setScore(score);

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

@@ -4,7 +4,7 @@ package com.tzld.longarticle.recommend.server.service.score;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
 import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import com.tzld.longarticle.recommend.server.util.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -92,16 +92,16 @@ public class ScoreService implements ApplicationContextAware {
     private List<ScoreStrategy> getScoreStrategy(ScoreParam param) {
         List<ScoreStrategy> strategies = new ArrayList<>();
         if (!similarityStopStrategies.contains(param.getStrategy())) {
-            strategies.add(strategyMap.get(SimilarityStrategy.class.getSimpleName()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.SIMILARITY.value()));
         }
         if (StringUtils.equals(param.getStrategy(), RankStrategyEnum.late_Strategy.getStrategy())) {
-            strategies.add(strategyMap.get(CategoryStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(AccountPreDistributeStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(PublishTimesStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(FlowCtlDecreaseStrategy.class.getSimpleName()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.CATEGORY.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.PUBLISH_TIMES.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.FLOW_CTL_DECREASE.value()));
             return strategies;
         }
-        strategies.add(strategyMap.get(ViewCountStrategy.class.getSimpleName()));
+        strategies.add(strategyMap.get(ScoreStrategyEnum.VIEW_COUNT.value()));
         if (StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV3.getStrategy())
                 || StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV4.getStrategy())
                 || StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV5.getStrategy())
@@ -113,18 +113,18 @@ public class ScoreService implements ApplicationContextAware {
                 || StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV12.getStrategy())
                 || StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV13.getStrategy())
                 || StringUtils.equals(param.getStrategy(), RankStrategyEnum.ArticleRankV14.getStrategy())) {
-            strategies.add(strategyMap.get(CategoryStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(AccountPreDistributeStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(FlowCtlDecreaseStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(ViewCountRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(ViewCountRateCorrelationStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(PublishTimesStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionFansRateRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionFansSumRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionAvgReadRateRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionAvgReadRateCorrelationRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionAvgReadSumRateStrategy.class.getSimpleName()));
-            strategies.add(strategyMap.get(HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.CATEGORY.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.FLOW_CTL_DECREASE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.VIEW_COUNT_RATE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.VIEW_COUNT_RATE_CORRELATION.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.PUBLISH_TIMES.value()));
+//            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_FANS_RATE_RATE.value()));
+//            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_FANS_SUM_RATE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_CORRELATION_RATE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_AVG_READ_SUM_RATE.value()));
+            strategies.add(strategyMap.get(ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value()));
         }
 
         return strategies;

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

@@ -2,8 +2,10 @@ package com.tzld.longarticle.recommend.server;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.model.dto.Content;
+import com.tzld.longarticle.recommend.server.service.recall.RecallService;
 import com.tzld.longarticle.recommend.server.service.score.Score;
 import com.tzld.longarticle.recommend.server.service.score.ScoreParam;
+import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountRateStrategy;
 import com.tzld.longarticle.recommend.server.service.score.strategy.ViewMultiplierStrategy;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -17,6 +19,10 @@ public class ScoreStrategyTest {
 
     @Resource
     ViewMultiplierStrategy viewMultiplierStrategy;
+    @Resource
+    ViewCountRateStrategy viewCountRateStrategy;
+    @Resource
+    RecallService recallService;
 
     @Test
     public void viewMultiplierStrategy() {
@@ -33,4 +39,23 @@ public class ScoreStrategyTest {
         System.out.println(JSONObject.toJSONString(result));
     }
 
+    @Test
+    public void viewCountRateStrategy() {
+        ScoreParam param = new ScoreParam();
+        param.setGhId("gh_bff0bcb0694a");
+        param.setAccountName("喜乐生活派");
+        List<Content> contentList = new ArrayList<>();
+        Content content = new Content();
+        content.setId("12341234");
+        content.setTitle("炒瘦肉有人放淀粉,有人放蛋清,都错了,教你正确做法,嫩滑不柴");
+        content.setCrawlerChannelContentId("0065561559007185d167afdd61b9ac5a");
+        contentList.add(content);
+        param.setContents(contentList);
+        recallService.setTitleAvgViewCount(contentList, "gh_bff0bcb0694a");
+        System.out.println(JSONObject.toJSONString(param.getContents().get(0).getHisPublishArticleList()));
+        List<Score> result = viewCountRateStrategy.score(param);
+        System.out.println(JSONObject.toJSONString(result));
+        //hisArticleList = hisArticleList.stream().filter(o -> o.getUpdateTime() < 1729267200).collect(Collectors.toList());
+    }
+
 }