Jelajahi Sumber

数据投放-素材维度-所有非整形数据的小数补全俩位

huangxuechao 4 tahun lalu
induk
melakukan
ec640d2655

+ 6 - 8
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/report/service/impl/BytedanceReportMaterialDailyServiceImpl.java

@@ -63,9 +63,7 @@ public class BytedanceReportMaterialDailyServiceImpl extends ServiceImpl<Bytedan
 
 
             DecimalFormat decimalFormat = new DecimalFormat("0.00#");
-            String strCost = decimalFormat.format(cost);
-
-            dailyReportMap.put("cost", strCost);
+            dailyReportMap.put("cost", decimalFormat.format(cost));
             dailyReportMap.put("click", click);
             dailyReportMap.put("showMaterial", showMaterial);
             dailyReportMap.put("convertMaterial", convertMaterial);
@@ -76,24 +74,24 @@ public class BytedanceReportMaterialDailyServiceImpl extends ServiceImpl<Bytedan
                 dailyReportMap.put("clickRate", 0);
             }else {
                 BigDecimal costPerThousandShow = cost.multiply(new BigDecimal(1000)).divide(showMaterial, 2, BigDecimal.ROUND_HALF_UP);
-                dailyReportMap.put("costPerThousandShow", costPerThousandShow);
+                dailyReportMap.put("costPerThousandShow", decimalFormat.format(costPerThousandShow));
                 BigDecimal clickRate = click.multiply(new BigDecimal(100)).divide(showMaterial, 2, BigDecimal.ROUND_HALF_UP);
-                dailyReportMap.put("clickRate", clickRate);
+                dailyReportMap.put("clickRate", decimalFormat.format(clickRate));
             }
             if (StringUtils.equals("0", convertMaterial.toString())) {
                 dailyReportMap.put("costConvert", 0);
             }else {
                 BigDecimal costConvert = cost.divide(convertMaterial, 2, BigDecimal.ROUND_HALF_UP);
-                dailyReportMap.put("costConvert", costConvert);
+                dailyReportMap.put("costConvert", decimalFormat.format(costConvert));
             }
             if (StringUtils.equals("0", click.toString())) {
                 dailyReportMap.put("costPerClick", 0);
                 dailyReportMap.put("convertRate", 0);
             }else {
                 BigDecimal costPerClick = cost.divide(click, 2, BigDecimal.ROUND_HALF_UP);
-                dailyReportMap.put("costPerClick", costPerClick);
+                dailyReportMap.put("costPerClick", decimalFormat.format(costPerClick));
                 BigDecimal convertRate = convertMaterial.multiply(new BigDecimal(100)).divide(click,2,BigDecimal.ROUND_HALF_UP);
-                dailyReportMap.put("convertRate", convertRate);
+                dailyReportMap.put("convertRate", decimalFormat.format(convertRate));
             }
         }