|
@@ -41,6 +41,13 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
|
|
|
private Map<String, Double> bucketsLen = new HashMap<>();
|
|
|
|
|
|
+ private static final Long feibianCustomerId = 13L;
|
|
|
+
|
|
|
+ private static final Long yuanwanCustomerId = 70L;
|
|
|
+
|
|
|
+ @Value("${swap.exp:770}")
|
|
|
+ protected String swapExp;
|
|
|
+
|
|
|
@Value("${word2vec.exp:694}")
|
|
|
private String word2vecExp;
|
|
|
|
|
@@ -92,6 +99,12 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
|
|
|
Map<String, String> userFeatureMap = new HashMap<>();
|
|
|
Map<String, String> c1Feature = userFeature.getOrDefault("alg_mid_feature_ad_action", new HashMap<>());
|
|
|
+ boolean targetCrowd = false;
|
|
|
+ if (c1Feature.containsKey("user_conver_ad_class") && StringUtils.isNotEmpty(c1Feature.get("user_conver_ad_class"))) {
|
|
|
+ if (c1Feature.get("user_conver_ad_class").contains("中医")) {
|
|
|
+ targetCrowd = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
List<TupleMapEntry<Tuple5>> midActionList = this.handleC1Feature(c1Feature, userFeatureMap);
|
|
|
|
|
|
Map<String, Double> midTimeDiffMap = this.parseC1FeatureListToTimeDiffMap(midActionList, ts);
|
|
@@ -156,6 +169,7 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
adRankItem.setCampaignId(dto.getCampaignId());
|
|
|
adRankItem.setCpm(ObjUtil.nullOrDefault(dto.getCpm(), 90).doubleValue());
|
|
|
adRankItem.setSkuId(dto.getSkuId());
|
|
|
+ adRankItem.setCustomerId(dto.getCustomerId());
|
|
|
adRankItem.setRandom(random.nextInt(1000));
|
|
|
if (noApiAdVerIds.contains(dto.getAdVerId())) {
|
|
|
adRankItem.getExt().put("isApi", "0");
|
|
@@ -308,6 +322,28 @@ public class RankStrategyBy688 extends RankStrategyBasic {
|
|
|
|
|
|
|
|
|
result.sort(ComparatorUtil.equalsRandomComparator());
|
|
|
+ if (scoreParam.getExpCodeSet().contains(swapExp) && targetCrowd) {
|
|
|
+ AdRankItem top1Item = result.get(0);
|
|
|
+ // 确定要查找的目标客户ID
|
|
|
+ Long targetCustomerId = null;
|
|
|
+ if (Objects.equals(top1Item.getCustomerId(), feibianCustomerId)) {
|
|
|
+ targetCustomerId = yuanwanCustomerId;
|
|
|
+ } else if (Objects.equals(top1Item.getCustomerId(), yuanwanCustomerId)) {
|
|
|
+ targetCustomerId = feibianCustomerId;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果需要交换,查找目标ID并交换位置
|
|
|
+ if (targetCustomerId != null) {
|
|
|
+ for (int i = 1; i < result.size(); i++) {
|
|
|
+ AdRankItem adRankItem = result.get(i);
|
|
|
+ if (adRankItem != null && Objects.equals(adRankItem.getCustomerId(), targetCustomerId)) {
|
|
|
+ log.info("swapExp source={} target={}, mid={}", result.get(0), result.get(i), request.getMid());
|
|
|
+ Collections.swap(result, 0, i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(result)) {
|
|
|
AdRankItem top1Item = result.get(0);
|