|
@@ -71,21 +71,30 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
}
|
|
|
|
|
|
// 选择一个客户
|
|
|
- List<String> customers = rankItems.stream().map(i -> i.getExt().getOrDefault(CUSTOMER_FIELD_NAME, "")).map(Objects::toString).filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList());
|
|
|
+ List<String> customers = rankItems.stream().map(i -> i.getExt().getOrDefault(CUSTOMER_FIELD_NAME, ""))
|
|
|
+ .map(Objects::toString)
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
String keyFormat = "ad:engine:customer:layer:info:%s:" + userLayer;
|
|
|
List<HotRankFeatureInfo> customerFeature = this.multiGetFeature(customers, keyFormat);
|
|
|
String customer = this.choose(customerFeature);
|
|
|
|
|
|
// 从当前客户的所有创意中,选择一个创意
|
|
|
- List<String> customerCreativeIds = rankItems.stream().filter(c -> StringUtils.equals(c.getExt().getOrDefault(CUSTOMER_FIELD_NAME, "").toString(), customer)).map(AdRankItem::getAdId).map(Objects::toString).collect(Collectors.toList());
|
|
|
+ List<String> customerCreativeIds = rankItems.stream().filter(c -> StringUtils.equals(c.getExt().getOrDefault(CUSTOMER_FIELD_NAME, "").toString(), customer))
|
|
|
+ .map(AdRankItem::getAdId)
|
|
|
+ .map(Objects::toString)
|
|
|
+ .collect(Collectors.toList());
|
|
|
String cidKeyFormat = "ad:engine:cid:layer:info:%s:" + userLayer;
|
|
|
List<HotRankFeatureInfo> creativeFeature = this.multiGetFeature(customerCreativeIds, cidKeyFormat);
|
|
|
String chooseCreativeIdStr = this.choose(creativeFeature);
|
|
|
Long chooseCreativeId = Long.parseLong(chooseCreativeIdStr);
|
|
|
|
|
|
- Map<String, HotRankFeatureInfo> allCustomerFeatureMap = customerFeature.stream().collect(Collectors.toMap(HotRankFeatureInfo::getLabel, Function.identity(), (o1, o2) -> o1));
|
|
|
+ Map<String, HotRankFeatureInfo> allCustomerFeatureMap = customerFeature.stream()
|
|
|
+ .collect(Collectors.toMap(HotRankFeatureInfo::getLabel, Function.identity(), (o1, o2) -> o1));
|
|
|
|
|
|
- Map<Long, HotRankFeatureInfo> allCreativeFeatureInfoMap = creativeFeature.stream().collect(Collectors.toMap(i -> Long.parseLong(i.getLabel()), Function.identity(), (o1, o2) -> o1));
|
|
|
+ Map<Long, HotRankFeatureInfo> allCreativeFeatureInfoMap = creativeFeature.stream()
|
|
|
+ .collect(Collectors.toMap(i -> Long.parseLong(i.getLabel()), Function.identity(), (o1, o2) -> o1));
|
|
|
|
|
|
Map<String, String> sceneFeature = this.handleSceneFeature(System.currentTimeMillis() / 1000);
|
|
|
Map<String, String> reqFeature = this.getReqFeature(scoreParam, request);
|
|
@@ -112,7 +121,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
Map<String, String> userLayer = this.getUserLayer(request.getMid());
|
|
|
|
|
|
String layer = userLayer.getOrDefault("layer", "无曝光");
|
|
|
- String clazz = userLayer.getOrDefault("class", "其他");
|
|
|
+ String clazz = userLayer.getOrDefault("class", "近期未出现");
|
|
|
|
|
|
if (request.getIsFilterUser()) {
|
|
|
return String.join("-", layer, "炸", clazz);
|
|
@@ -149,7 +158,7 @@ public class RankStrategyBy687 extends RankStrategyBasic {
|
|
|
Map<String, Map<String, String>> feature = cidFeature.getOrDefault(String.valueOf(rankItem.getAdId()), new HashMap<>());
|
|
|
Map<String, String> basicInfo = feature.getOrDefault("alg_cid_feature_basic_info", new HashMap<>());
|
|
|
String customer = basicInfo.getOrDefault(CUSTOMER_FIELD_NAME, "");
|
|
|
- rankItem.getExt().put("customer_name", customer);
|
|
|
+ rankItem.getExt().put(CUSTOMER_FIELD_NAME, customer);
|
|
|
}
|
|
|
|
|
|
private String choose(List<HotRankFeatureInfo> hotRankFeatureInfos) {
|