|
@@ -1,12 +1,14 @@
|
|
|
package com.tzld.piaoquan.ad.engine.service.score.impl;
|
|
|
|
|
|
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.util.NumUtil;
|
|
|
import com.tzld.piaoquan.ad.engine.service.score.RankService680;
|
|
|
import com.tzld.piaoquan.ad.engine.service.score.dto.AdDirectionScore;
|
|
|
import com.tzld.piaoquan.ad.engine.service.score.dto.AdPlatformCreativeDTO;
|
|
|
import com.tzld.piaoquan.ad.engine.service.score.param.RankRecommendRequestParam;
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -43,11 +45,11 @@ public class TacticsAndLRModelScoreRankService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private double calcDirectionScore(AdRankItem adRankItem, AdDirectionScore adDirectionScore) {
|
|
|
- if (Objects.isNull(adDirectionScore)) {
|
|
|
+ private void calcDirectionScore(AdRankItem adRankItem, AdDirectionScore adDirectionScore) {
|
|
|
+ if (Objects.isNull(adDirectionScore) || MapUtils.isNotEmpty(adDirectionScore.getScoreDetail())) {
|
|
|
adRankItem.getScoreMap().put("adDirectionScore", 1.0);
|
|
|
adRankItem.setAdDirectionScore(1);
|
|
|
- return 1;
|
|
|
+ return;
|
|
|
}
|
|
|
double exponent = Objects.nonNull(adDirectionScore.getExponent()) ? adDirectionScore.getExponent() : 1;
|
|
|
Map<String, String> scoreDetail = adDirectionScore.getScoreDetail();
|
|
@@ -56,11 +58,16 @@ public class TacticsAndLRModelScoreRankService {
|
|
|
double phoneModel = Double.parseDouble(scoreDetail.getOrDefault("phoneModel", "1"));
|
|
|
double area = Double.parseDouble(scoreDetail.getOrDefault("area", "1"));
|
|
|
double peoplePackage = Double.parseDouble(scoreDetail.getOrDefault("peoplePackage", "1"));
|
|
|
- double excludeConv = Double.parseDouble(scoreDetail.getOrDefault("excludeConv", "1"));
|
|
|
- double excludeClick = Double.parseDouble(scoreDetail.getOrDefault("excludeClick", "1"));
|
|
|
- double excludeView = Double.parseDouble(scoreDetail.getOrDefault("excludeView", "1"));
|
|
|
|
|
|
- double excludeMin = Math.min(excludeConv, Math.min(excludeClick, excludeView));
|
|
|
+
|
|
|
+ double excludeMin = 1.0;
|
|
|
+
|
|
|
+ if (scoreDetail.containsKey("excludeConv") || scoreDetail.containsKey("excludeClick") || scoreDetail.containsKey("excludeView")) {
|
|
|
+ double excludeConv = Double.parseDouble(scoreDetail.getOrDefault("excludeConv", "10000"));
|
|
|
+ double excludeClick = Double.parseDouble(scoreDetail.getOrDefault("excludeClick", "100001"));
|
|
|
+ double excludeView = Double.parseDouble(scoreDetail.getOrDefault("excludeView", "100001"));
|
|
|
+ excludeMin = NumUtil.min(excludeConv, excludeClick, excludeView);
|
|
|
+ }
|
|
|
|
|
|
double s1 = (network * phoneModel * area * peoplePackage * excludeMin);
|
|
|
double s2 = Math.pow(s1, exponent);
|
|
@@ -69,9 +76,8 @@ public class TacticsAndLRModelScoreRankService {
|
|
|
|
|
|
Map<String, String> scoreDetailMap = new HashMap<>(scoreDetail);
|
|
|
scoreDetailMap.put("exponent", String.valueOf(exponent));
|
|
|
+ scoreDetailMap.put("excludeMin", String.valueOf(excludeMin));
|
|
|
adRankItem.getMetaFeatureMap().put("adDirectionScoreDetail", scoreDetailMap);
|
|
|
-
|
|
|
- return s2;
|
|
|
}
|
|
|
|
|
|
}
|