|
@@ -32,13 +32,16 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
@ApolloJsonValue("${cid.open.hot.rank.user.layer:[]}")
|
|
|
private Set<String> openHotRankUserLayers;
|
|
|
|
|
|
- @Value("${cid.hot.rank.view.threshold:5000}")
|
|
|
- private Integer hotRankViewThreshold;
|
|
|
+ @Value("${hot.rank.customer.view.threshold:5000}")
|
|
|
+ private Integer hotRankCustomerViewThreshold;
|
|
|
|
|
|
- @Value("${cid.hot.rank.calc.weight.coefficient:2.5}")
|
|
|
+ @Value("${hot.rank.creative.view.threshold:5000}")
|
|
|
+ private Integer hotRankCreativeViewThreshold;
|
|
|
+
|
|
|
+ @Value("${hot.rank.calc.weight.coefficient:2.5}")
|
|
|
private Double hotRankCalcWeightCoefficient;
|
|
|
|
|
|
- @Value("${cid.hot.rank.max.weight:1000}")
|
|
|
+ @Value("${hot.rank.max.weight:1000}")
|
|
|
private Double hotRankMaxWeight;
|
|
|
|
|
|
private static final String CUSTOMER_FIELD_NAME = "customer_name";
|
|
@@ -78,7 +81,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
.collect(Collectors.toList());
|
|
|
String keyFormat = "ad:engine:customer:layer:info:%s:" + userLayer;
|
|
|
List<HotRankFeatureInfo> customerFeature = this.multiGetFeature(customers, keyFormat);
|
|
|
- String customer = this.choose(customerFeature);
|
|
|
+ String customer = this.choose(customerFeature, hotRankCustomerViewThreshold);
|
|
|
|
|
|
// 从当前客户的所有创意中,选择一个创意
|
|
|
List<String> customerCreativeIds = rankItems.stream().filter(c -> StringUtils.equals(c.getExt().getOrDefault(CUSTOMER_FIELD_NAME, "").toString(), customer))
|
|
@@ -87,7 +90,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
.collect(Collectors.toList());
|
|
|
String cidKeyFormat = "ad:engine:cid:layer:info:%s:" + userLayer;
|
|
|
List<HotRankFeatureInfo> creativeFeature = this.multiGetFeature(customerCreativeIds, cidKeyFormat);
|
|
|
- String chooseCreativeIdStr = this.choose(creativeFeature);
|
|
|
+ String chooseCreativeIdStr = this.choose(creativeFeature, hotRankCreativeViewThreshold);
|
|
|
Long chooseCreativeId = Long.parseLong(chooseCreativeIdStr);
|
|
|
|
|
|
Map<String, HotRankFeatureInfo> allCustomerFeatureMap = customerFeature.stream()
|
|
@@ -161,7 +164,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
rankItem.getExt().put(CUSTOMER_FIELD_NAME, customer);
|
|
|
}
|
|
|
|
|
|
- private String choose(List<HotRankFeatureInfo> hotRankFeatureInfos) {
|
|
|
+ private String choose(List<HotRankFeatureInfo> hotRankFeatureInfos, int viewThreshold) {
|
|
|
// 按CPM排序
|
|
|
hotRankFeatureInfos.sort(Comparator.comparing(HotRankFeatureInfo::getCpm).reversed());
|
|
|
|
|
@@ -170,7 +173,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
List<HotRankFeatureInfo> tailView = new ArrayList<>();
|
|
|
int highIdx = 1, tailIdx = 1;
|
|
|
for (HotRankFeatureInfo hotRankFeatureInfo : hotRankFeatureInfos) {
|
|
|
- if (hotRankFeatureInfo.getView() >= hotRankViewThreshold) {
|
|
|
+ if (hotRankFeatureInfo.getView() >= viewThreshold) {
|
|
|
hotRankFeatureInfo.setRank(highIdx++);
|
|
|
highView.add(hotRankFeatureInfo);
|
|
|
} else {
|