Эх сурвалжийг харах

风控设置过多小数的精度问题

marxjaw 2 сар өмнө
parent
commit
5a6e671edb

+ 2 - 2
yt-risk/risk-manage/src/main/java/com/ytpm/service/impl/RiskServiceImpl.java

@@ -568,9 +568,9 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
         int firstAdCount = Integer.parseInt(limitMap.get("firstAdCount"));
         if(adCount>=firstAdCount){
             //过滤出ecpm值小于预设值的视频数
-            int ecpm = Integer.parseInt(limitMap.get("ecpm"));
+            BigDecimal ecpm = new BigDecimal(limitMap.get("ecpm"));
             long count = records.stream().filter(
-                    s -> Objects.nonNull(s.getEcpm())&&(s.getEcpm().compareTo(BigDecimal.valueOf(ecpm))) < 0).count();
+                    s -> Objects.nonNull(s.getEcpm())&&(s.getEcpm().compareTo(ecpm)) < 0).count();
             int exact = Math.toIntExact(count);
             //判断小于预设值的视频数超出预设次数
             int haveCount = Integer.parseInt(limitMap.get("haveCount"));