Browse Source

cold start

丁云鹏 11 months ago
parent
commit
e89289d747

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

@@ -84,6 +84,7 @@ public class RecommendService {
     public RecallParam convertToRecallParam(RecommendParam param) {
         RecallParam recallParam = new RecallParam();
         BeanUtils.copyProperties(param, recallParam);
+        recallParam.setStrategy(param.getStrategy());
         return recallParam;
     }
 

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

@@ -13,4 +13,5 @@ public class FilterParam {
     private String accountName;
     private List<Content> contents;
     private String accountId;
+    private String strategy;
 }

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

@@ -3,13 +3,12 @@ package com.tzld.longarticle.recommend.server.service.filter;
 import com.tzld.longarticle.recommend.server.common.ThreadPoolFactory;
 import com.tzld.longarticle.recommend.server.model.Content;
 import com.tzld.longarticle.recommend.server.service.ServiceBeanFactory;
-import com.tzld.longarticle.recommend.server.service.filter.strategy.BadStrategy;
-import com.tzld.longarticle.recommend.server.service.filter.strategy.HistoryTitleStrategy;
-import com.tzld.longarticle.recommend.server.service.filter.strategy.SensitiveStrategy;
+import com.tzld.longarticle.recommend.server.service.filter.strategy.*;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import com.tzld.longarticle.recommend.server.util.JSONUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -90,11 +89,12 @@ public class FilterService {
     private List<FilterStrategy> getStrategies(FilterParam param) {
         List<FilterStrategy> strategies = new ArrayList<>();
         strategies.add(ServiceBeanFactory.getBean(HistoryTitleStrategy.class));
-//        strategies.add(ServiceBeanFactory.getBean(DuplicateStrategy.class));
-//        strategies.add(ServiceBeanFactory.getBean(CategoryStrategy.class));
         strategies.add(ServiceBeanFactory.getBean(BadStrategy.class));
         strategies.add(ServiceBeanFactory.getBean(SensitiveStrategy.class));
-
+        strategies.add(ServiceBeanFactory.getBean(AccountStrategy.class));
+        if (StringUtils.equals(param.getStrategy(), "ArticleRankV3")) {
+            strategies.add(ServiceBeanFactory.getBean(AccountPreDistributeStrategy.class));
+        }
         return strategies;
     }
 }

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

@@ -14,6 +14,7 @@ public class FilterParamFactory {
         filterParam.setAccountName(param.getAccountName());
         filterParam.setContents(contents);
         filterParam.setAccountId(param.getAccountId());
+        filterParam.setStrategy(param.getStrategy());
         return filterParam;
     }
 }

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

@@ -11,4 +11,5 @@ public class RecallParam {
     private String accountName;
     private Integer publishNum;
     private String planId;
+    private String strategy;
 }