|
@@ -1,10 +1,8 @@
|
|
package com.tzld.longarticle.recommend.server.service.rank;
|
|
package com.tzld.longarticle.recommend.server.service.rank;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
|
|
import com.tzld.longarticle.recommend.server.service.ServiceBeanFactory;
|
|
import com.tzld.longarticle.recommend.server.service.ServiceBeanFactory;
|
|
-import com.tzld.longarticle.recommend.server.service.rank.strategy.DefaultRankStrategy;
|
|
|
|
-import com.tzld.longarticle.recommend.server.service.rank.strategy.RankV2Strategy;
|
|
|
|
-import com.tzld.longarticle.recommend.server.service.rank.strategy.RankV3Strategy;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -21,15 +19,8 @@ public class RankService {
|
|
}
|
|
}
|
|
|
|
|
|
private RankStrategy getRankStrategy(RankParam param) {
|
|
private RankStrategy getRankStrategy(RankParam param) {
|
|
- switch (param.getStrategy()) {
|
|
|
|
- case "ArticleRankV2":
|
|
|
|
- return ServiceBeanFactory.getBean(RankV2Strategy.class);
|
|
|
|
- case "ArticleRankV3":
|
|
|
|
- return ServiceBeanFactory.getBean(RankV3Strategy.class);
|
|
|
|
- default:
|
|
|
|
- return ServiceBeanFactory.getBean(DefaultRankStrategy.class);
|
|
|
|
- }
|
|
|
|
|
|
+ RankStrategyEnum rankStrategyEnum = RankStrategyEnum.from(param.getStrategy());
|
|
|
|
+ return (RankStrategy) ServiceBeanFactory.getBeanByName(rankStrategyEnum.getTaskExecutorName());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|