|
@@ -0,0 +1,46 @@
|
|
|
+package com.tzld.piaoquan.ad.engine.service.score.strategy;
|
|
|
+
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.param.RankRecommendRequestParam;
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.util.ObjUtil;
|
|
|
+import com.tzld.piaoquan.ad.engine.service.feature.Feature;
|
|
|
+import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class GetFeatureOnly extends RankStrategyBasic {
|
|
|
+ @Override
|
|
|
+ public List<AdRankItem> adItemRank(RankRecommendRequestParam request, ScoreParam scoreParam) {
|
|
|
+ long ts = System.currentTimeMillis() / 1000;
|
|
|
+
|
|
|
+ String brand = scoreParam.getRequestContext().getMachineinfoBrand();
|
|
|
+ if (StringUtils.isNotEmpty(brand)) {
|
|
|
+ scoreParam.getRequestContext().setMachineinfoBrand(brand + "-n");
|
|
|
+ }
|
|
|
+
|
|
|
+ Feature feature = this.getFeature(scoreParam, request);
|
|
|
+ Map<String, String> reqFeature = this.getReqFeature(scoreParam, request);
|
|
|
+ Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
|
|
|
+
|
|
|
+ AdPlatformCreativeDTO dto = request.getAdIdList().get(0);
|
|
|
+ AdRankItem adRankItem = new AdRankItem();
|
|
|
+ adRankItem.setAdId(dto.getCreativeId());
|
|
|
+ adRankItem.setCreativeCode(dto.getCreativeCode());
|
|
|
+ adRankItem.setAdVerId(dto.getAdVerId());
|
|
|
+ adRankItem.setVideoId(request.getVideoId());
|
|
|
+ adRankItem.setCpa(dto.getCpa());
|
|
|
+ adRankItem.setId(dto.getAdId());
|
|
|
+ adRankItem.setCampaignId(dto.getCampaignId());
|
|
|
+ adRankItem.setCpm(ObjUtil.nullOrDefault(dto.getCpm(), 90).doubleValue());
|
|
|
+ adRankItem.setSkuId(dto.getSkuId());
|
|
|
+
|
|
|
+ putMetaFeature(adRankItem, feature, reqFeature, sceneFeatureMap, request);
|
|
|
+ return Collections.singletonList(adRankItem);
|
|
|
+ }
|
|
|
+}
|