|
@@ -70,6 +70,9 @@ public class RecommendService {
|
|
|
@ApolloJsonValue("${new.exp.list:[6]}")
|
|
|
private Set<Integer> newExpList;
|
|
|
|
|
|
+ @ApolloJsonValue("${new.exp,config.v2:[]}")
|
|
|
+ private List<ExpConfig> expConfigs;
|
|
|
+
|
|
|
@Autowired
|
|
|
private FlowPoolConfigService flowPoolConfigService;
|
|
|
@Autowired
|
|
@@ -349,8 +352,32 @@ public class RecommendService {
|
|
|
param.setMachineInfo(machineInfo);
|
|
|
}
|
|
|
|
|
|
- param.setExpIdMap(JSONUtils.fromJson(request.getNewExpGroup(), new TypeToken<Map<String, String>>() {
|
|
|
- }, Collections.emptyMap()));
|
|
|
+
|
|
|
+ Map<String, List<Layer>> layerMap = CommonCollectionUtils.toMap(expConfigs, c -> c.getAppType(),
|
|
|
+ c -> c.getLayers());
|
|
|
+ if (MapUtils.isNotEmpty(layerMap)) {
|
|
|
+ Map<String, Integer> bucketMap = JSONUtils.fromJson(request.getNewExpGroup(),
|
|
|
+ new TypeToken<Map<String, Integer>>() {
|
|
|
+ }, Collections.emptyMap());
|
|
|
+ if (MapUtils.isNotEmpty(bucketMap)) {
|
|
|
+ List<Layer> layers = layerMap.get(param.getAppType() + "");
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(layers)) {
|
|
|
+ Map<String, String> expIdMap = new HashMap<>();
|
|
|
+ for (Layer layer : layers) {
|
|
|
+ for (Exp exp : layer.getExps()) {
|
|
|
+ if (bucketMap.containsKey(layer.getLayerId())
|
|
|
+ && exp.getRange().length == 2
|
|
|
+ && exp.getRange()[0] <= bucketMap.get(layer.getLayerId())
|
|
|
+ && exp.getRange()[1] >= bucketMap.get(layer.getLayerId())) {
|
|
|
+ expIdMap.put(layer.getLayerId(), exp.getExpId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ param.setExpIdMap(expIdMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return param;
|
|
|
}
|
|
@@ -570,4 +597,76 @@ public class RecommendService {
|
|
|
consumer.accept(RegionHWithoutDupRecallStrategy.PUSH_FORM);
|
|
|
}
|
|
|
|
|
|
+ public static class ExpConfig {
|
|
|
+ private String appType;
|
|
|
+ private List<Layer> layers;
|
|
|
+
|
|
|
+ public String getAppType() {
|
|
|
+ return appType;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setAppType(String appType) {
|
|
|
+ this.appType = appType;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Layer> getLayers() {
|
|
|
+ return layers;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setLayers(List<Layer> layers) {
|
|
|
+ this.layers = layers;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class Layer {
|
|
|
+ private String layerId;
|
|
|
+ private int bucketNum;
|
|
|
+ private List<Exp> exps;
|
|
|
+
|
|
|
+ public String getLayerId() {
|
|
|
+ return layerId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setLayerId(String layerId) {
|
|
|
+ this.layerId = layerId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getBucketNum() {
|
|
|
+ return bucketNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setBucketNum(int bucketNum) {
|
|
|
+ this.bucketNum = bucketNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Exp> getExps() {
|
|
|
+ return exps;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setExps(List<Exp> exps) {
|
|
|
+ this.exps = exps;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class Exp {
|
|
|
+ private String expId;
|
|
|
+ private int[] range;
|
|
|
+
|
|
|
+ public String getExpId() {
|
|
|
+ return expId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setExpId(String expId) {
|
|
|
+ this.expId = expId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int[] getRange() {
|
|
|
+ return range;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setRange(int[] range) {
|
|
|
+ this.range = range;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|