zhaohaipeng hai 1 ano
pai
achega
9b4f5f0173

+ 63 - 53
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/VideoAdThompsonScorerV2.java

@@ -96,36 +96,41 @@ public class VideoAdThompsonScorerV2 {
         double beta = exp663Param.getOrDefault("beta", 0d);
 
         for (AdPlatformCreativeDTO dto : adIdList) {
-            CreativeStatistic cidStatistics = creativeStatisticsMap.getOrDefault(dto.getCreativeId(), new CreativeStatistic());
-
-            double order;
-            double exp;
-            order = cidStatistics.parseOrderToDouble();
-            exp = cidStatistics.parseExpToDouble();
-
-            double s1 = 0.0;
-            double a = order + alpha;
-            double b = exp + beta;
-            if (a != 0 && b != 0) {
-                s1 = a / b;
-            }
-
-            double score = s1 * dto.getCpa() * dto.getBid1() * dto.getBid2();
 
             // 日志上报扩展参数
             Map<String, Object> ext = new HashMap<>();
-            ext.put("a", alpha);
-            ext.put("b", beta);
-            ext.put("order", order);
-            ext.put("exp", exp);
-            ext.put("s1", s1);
-            ext.put("bid1", dto.getBid1());
-            ext.put("bid2", dto.getBid2());
-            ext.put("pairOrSingle", "single");
-            ext.put("cidStatistic", JSON.toJSONString(cidStatistics));
-            ext.put("cpa", dto.getCpa());
-            ext.put("abCode", 663);
+            double score = 0.0;
+            try {
+                CreativeStatistic cidStatistics = creativeStatisticsMap.getOrDefault(dto.getCreativeId(), new CreativeStatistic());
 
+                double order;
+                double exp;
+                order = cidStatistics.parseOrderToDouble();
+                exp = cidStatistics.parseExpToDouble();
+
+                double s1 = 0.0;
+                double a = order + alpha;
+                double b = exp + beta;
+                if (a != 0 && b != 0) {
+                    s1 = a / b;
+                }
+
+                score = s1 * dto.getCpa() * dto.getBid1() * dto.getBid2();
+
+                ext.put("a", alpha);
+                ext.put("b", beta);
+                ext.put("order", order);
+                ext.put("exp", exp);
+                ext.put("s1", s1);
+                ext.put("bid1", dto.getBid1());
+                ext.put("bid2", dto.getBid2());
+                ext.put("pairOrSingle", "single");
+                ext.put("cidStatistic", JSON.toJSONString(cidStatistics));
+                ext.put("cpa", dto.getCpa());
+                ext.put("abCode", 663);
+            } catch (Exception e) {
+                log.error("svc=663exp, error: ", e);
+            }
             AdRankItem item = new AdRankItem();
             item.setCpa(dto.getCpa());
             item.setAdId(dto.getCreativeId());
@@ -320,38 +325,43 @@ public class VideoAdThompsonScorerV2 {
             double exp;
             CreativeStatistic vidCidStatistics = videoCreativeStatisticsMap.getOrDefault(cid, new CreativeStatistic());
             CreativeStatistic cidStatistics = creativeStatisticsMap.getOrDefault(cid, new CreativeStatistic());
+            // 日志上报扩展参数
+            Map<String, Object> ext = new HashMap<>();
+            double score = 0.0;
+            try {
 
-            if (vidCidStatistics.parseExpToDouble() >= viewThreshold) {
-                pairOrSingle = "pair";
-                order = vidCidStatistics.parseOrderToDouble();
-                exp = vidCidStatistics.parseExpToDouble();
-            } else {
-                pairOrSingle = "single";
-                order = cidStatistics.parseOrderToDouble();
-                exp = cidStatistics.parseExpToDouble();
-            }
 
-            double s1 = this.betaSampler((alpha + order), ((beta + exp) / betaK));
-            double score = s1 * dto.getCpa() * dto.getBid1() * dto.getBid2();
+                if (vidCidStatistics.parseExpToDouble() >= viewThreshold) {
+                    pairOrSingle = "pair";
+                    order = vidCidStatistics.parseOrderToDouble();
+                    exp = vidCidStatistics.parseExpToDouble();
+                } else {
+                    pairOrSingle = "single";
+                    order = cidStatistics.parseOrderToDouble();
+                    exp = cidStatistics.parseExpToDouble();
+                }
 
+                double s1 = this.betaSampler((alpha + order), ((beta + exp) / betaK));
+                score = s1 * dto.getCpa() * dto.getBid1() * dto.getBid2();
 
-            // 日志上报扩展参数
-            Map<String, Object> ext = new HashMap<>();
-            ext.put("a", alpha);
-            ext.put("b", beta);
-            ext.put("bk", betaK);
-            ext.put("order", order);
-            ext.put("exp", exp);
-            ext.put("s1", s1);
-            ext.put("bid1", dto.getBid1());
-            ext.put("bid2", dto.getBid2());
-            ext.put("viewThreshold", viewThreshold);
-            ext.put("pairOrSingle", pairOrSingle);
-            ext.put("cidStatistic", JSON.toJSONString(cidStatistics));
-            ext.put("vidCidStatistic", JSON.toJSONString(vidCidStatistics));
-            ext.put("cpa", dto.getCpa());
-            ext.put("abCode", 666);
 
+                ext.put("a", alpha);
+                ext.put("b", beta);
+                ext.put("bk", betaK);
+                ext.put("order", order);
+                ext.put("exp", exp);
+                ext.put("s1", s1);
+                ext.put("bid1", dto.getBid1());
+                ext.put("bid2", dto.getBid2());
+                ext.put("viewThreshold", viewThreshold);
+                ext.put("pairOrSingle", pairOrSingle);
+                ext.put("cidStatistic", JSON.toJSONString(cidStatistics));
+                ext.put("vidCidStatistic", JSON.toJSONString(vidCidStatistics));
+                ext.put("cpa", dto.getCpa());
+                ext.put("abCode", 666);
+            } catch (Exception e) {
+                log.error("svc=666exp, error: ", e);
+            }
             AdRankItem item = new AdRankItem();
             item.setCpa(dto.getCpa());
             item.setAdId(dto.getCreativeId());