|
@@ -10,6 +10,7 @@ import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.param.RankRecommendRequestParam;
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -217,30 +218,36 @@ public class RankStrategyBy680 extends RankStrategyBasic {
|
|
|
if (noApiAdVerIds.contains(item.getAdVerId())) {
|
|
|
item.setScore(item.getCpm() * cpmCoefficient / 1000);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ result.sort(ComparatorUtil.equalsRandomComparator());
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(result)){
|
|
|
+ AdRankItem top1Item = result.get(0);
|
|
|
for (Map.Entry<String, Map<String, String>> entry : videoFeature.entrySet()) {
|
|
|
if (MapUtils.isNotEmpty(entry.getValue())) {
|
|
|
- item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
+ top1Item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (Map.Entry<String, Map<String, String>> entry : userFeature.entrySet()) {
|
|
|
if (MapUtils.isNotEmpty(entry.getValue())) {
|
|
|
- item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
+ top1Item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<String, Map<String, String>> adVerFeature = allAdVerFeature.getOrDefault(item.getAdVerId(), new HashMap<>());
|
|
|
+ Map<String, Map<String, String>> adVerFeature = allAdVerFeature.getOrDefault(top1Item.getAdVerId(), new HashMap<>());
|
|
|
for (Map.Entry<String, Map<String, String>> entry : adVerFeature.entrySet()) {
|
|
|
if (MapUtils.isNotEmpty(entry.getValue())) {
|
|
|
- item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
+ top1Item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(String.valueOf(item.getAdId()), new HashMap<>());
|
|
|
+ Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(String.valueOf(top1Item.getAdId()), new HashMap<>());
|
|
|
for (Map.Entry<String, Map<String, String>> entry : cidFeature.entrySet()) {
|
|
|
if (MapUtils.isNotEmpty(entry.getValue())) {
|
|
|
- item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
+ top1Item.getMetaFeatureMap().put(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -250,8 +257,6 @@ public class RankStrategyBy680 extends RankStrategyBasic {
|
|
|
time6 - start, time1 - start, time2 - time1, time3 - time2, time4 - time3,
|
|
|
time5 - time4, time6 - time5, request.getAdIdList().size(), adRankItems.size());
|
|
|
|
|
|
- result.sort(ComparatorUtil.equalsRandomComparator());
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|