Browse Source

Merge branch 'dev-xym-update-guarantees' into pre-master

xueyiming 2 weeks ago
parent
commit
96ca55afc5

+ 15 - 14
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBasic.java

@@ -114,20 +114,18 @@ public abstract class RankStrategyBasic implements RankStrategy {
     protected Map<String, GuaranteeView> getGuaranteeViewMap(RankRecommendRequestParam request, ScoreParam scoreParam) {
         Map<String, GuaranteeView> map = new HashMap<>();
         try {
-            if (scoreParam.getExpCodeSet().contains(guaranteeExp)) {
-                String thatDayDateString = DateUtils.getThatDayDateString();
-                String redisKey = adPlatformGuaranteeKey.replace("{date}", thatDayDateString);
-                List<String> adVerIds = request.getAdIdList().stream().map(AdPlatformCreativeDTO::getAdVerId).distinct()
-                        .filter(Objects::nonNull).collect(Collectors.toList());
-                List<String> redisKeys = adVerIds.stream().map(e -> redisKey.replace("{adverId}", e)).collect(Collectors.toList());
-                List<String> values = adRedisHelper.mget(redisKeys);
-                if (CollectionUtils.isNotEmpty(values)) {
-                    for (int i = 0; i < redisKeys.size(); i++) {
-                        String value = values.get(i);
-                        if (value != null) {
-                            GuaranteeView guaranteeView = JSONObject.parseObject(value, GuaranteeView.class);
-                            map.put(adVerIds.get(i), guaranteeView);
-                        }
+            String thatDayDateString = DateUtils.getThatDayDateString();
+            String redisKey = adPlatformGuaranteeKey.replace("{date}", thatDayDateString);
+            List<String> adVerIds = request.getAdIdList().stream().map(AdPlatformCreativeDTO::getAdVerId).distinct()
+                    .filter(Objects::nonNull).collect(Collectors.toList());
+            List<String> redisKeys = adVerIds.stream().map(e -> redisKey.replace("{adverId}", e)).collect(Collectors.toList());
+            List<String> values = adRedisHelper.mget(redisKeys);
+            if (CollectionUtils.isNotEmpty(values)) {
+                for (int i = 0; i < redisKeys.size(); i++) {
+                    String value = values.get(i);
+                    if (value != null) {
+                        GuaranteeView guaranteeView = JSONObject.parseObject(value, GuaranteeView.class);
+                        map.put(adVerIds.get(i), guaranteeView);
                     }
                 }
             }
@@ -180,6 +178,9 @@ public abstract class RankStrategyBasic implements RankStrategy {
     }
 
     protected double getGuaranteeScoreCoefficient(ScoreParam scoreParam, Map<String, Object> ext) {
+        if (ext.get("guaranteeWeight") != null && (double) ext.get("guaranteeWeight") == 0) {
+            return 0.0;
+        }
         if (scoreParam.getExpCodeSet().contains(guaranteeExp)) {
             ext.put("guarantee", 1);
             if (ext.get("guaranteeWeight") == null) {