|
@@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -394,6 +395,19 @@ public class RankService {
|
|
}
|
|
}
|
|
|
|
|
|
private RankResult mergeAndSort4Density(RankParam param, List<Video> rovRecallRank, List<Video> flowPoolRank) {
|
|
private RankResult mergeAndSort4Density(RankParam param, List<Video> rovRecallRank, List<Video> flowPoolRank) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if (CollectionUtils.isEmpty(rovRecallRank)) {
|
|
if (CollectionUtils.isEmpty(rovRecallRank)) {
|
|
if (param.getSize() < flowPoolRank.size()) {
|
|
if (param.getSize() < flowPoolRank.size()) {
|
|
return new RankResult(flowPoolRank.subList(0, param.getSize()));
|
|
return new RankResult(flowPoolRank.subList(0, param.getSize()));
|
|
@@ -414,13 +428,15 @@ public class RankService {
|
|
if (!entry.getValue().containsKey(appType)){
|
|
if (!entry.getValue().containsKey(appType)){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- String str = (String) entry.getValue().get(appType);
|
|
+ JSONObject jb = (JSONObject) entry.getValue().get(appType);
|
|
- Map<String, Object> tmp = JSONUtils.fromJson(str,
|
|
+ try{
|
|
- new TypeToken<Map<String, Object>>() {},
|
|
+ if (jb.containsKey("density") && jb.get("density") instanceof Integer){
|
|
- Collections.emptyMap());
|
|
+ densityRules.put(k, jb.getInteger("density"));
|
|
- if (tmp.containsKey("density") && tmp.get("density") instanceof Integer){
|
|
+ }
|
|
- densityRules.put(k, (Integer)tmp.get("density"));
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("parse densityRules is wrong:", e);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -487,4 +503,11 @@ public class RankService {
|
|
return new RankResult(resultWithDnsity);
|
|
return new RankResult(resultWithDnsity);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|