|
@@ -5,6 +5,7 @@ import com.tzld.piaoquan.recommend.server.service.rank.strategy.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -12,6 +13,8 @@ import java.util.*;
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
public class RankRouter {
|
|
public class RankRouter {
|
|
|
|
+ @Value("${rank.strategy.default:567}")
|
|
|
|
+ private String rankStrategyDefault;
|
|
|
|
|
|
private LinkedHashMap<String, RankService> strategyMap;
|
|
private LinkedHashMap<String, RankService> strategyMap;
|
|
|
|
|
|
@@ -52,6 +55,9 @@ public class RankRouter {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (null != rankStrategyDefault && strategyMap.containsKey(rankStrategyDefault)) {
|
|
|
|
+ return strategyMap.get(rankStrategyDefault).rank(param);
|
|
|
|
+ }
|
|
|
|
|
|
Optional<RankService> defaultStrategy = strategyMap.values().stream().findFirst();
|
|
Optional<RankService> defaultStrategy = strategyMap.values().stream().findFirst();
|
|
if (defaultStrategy.isPresent()) {
|
|
if (defaultStrategy.isPresent()) {
|