|
@@ -1,5 +1,6 @@
|
|
|
package com.tzld.longarticle.recommend.server.service;
|
|
|
|
|
|
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.longarticle.recommend.server.model.*;
|
|
|
import com.tzld.longarticle.recommend.server.service.rank.RankParam;
|
|
|
import com.tzld.longarticle.recommend.server.service.rank.RankResult;
|
|
@@ -13,9 +14,11 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -30,11 +33,19 @@ public class RecommendService {
|
|
|
@Autowired
|
|
|
private RankService rankService;
|
|
|
|
|
|
+ @ApolloJsonValue("${accountStrategyConfig:{}}")
|
|
|
+ private Map<String, String> accountStrategyConfigMap;
|
|
|
+
|
|
|
|
|
|
public RecommendResponse recommend(RecommendRequest request) {
|
|
|
|
|
|
RecommendParam param = genRecommendParam(request);
|
|
|
log.info("genRecommendParam {}", JSONUtils.toJson(param));
|
|
|
+ // 获取账号排序设置
|
|
|
+ String strategyConfig = accountStrategyConfigMap.get(request.getAccountName());
|
|
|
+ if (StringUtils.hasText(strategyConfig)) {
|
|
|
+ param.setStrategy(strategyConfig);
|
|
|
+ }
|
|
|
RecallResult recallResult = recallService.recall(convertToRecallParam(param));
|
|
|
log.info("recallResult {}", JSONUtils.toJson(recallResult));
|
|
|
|