yumeng %!s(int64=5) %!d(string=hai) anos
pai
achega
9c10847a93

+ 5 - 4
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -211,7 +211,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                         BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
                         BigDecimal compareBigDecimal = new BigDecimal(0);
                         if (yesterdayCost.compareTo(compareBigDecimal) != 0) {
-                            BigDecimal costProportion = (cost.subtract(yesterdayCost)).divide(yesterdayCost, BigDecimal.ROUND_UP);
+                            BigDecimal costProportion = (cost.subtract(yesterdayCost)).divide(yesterdayCost);
                             accountJson.put("costProportion", costProportion); // 较昨日增加比例
                         } else {
                             accountJson.put("costProportion", 0); // 较昨日增加比例
@@ -298,7 +298,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                     BigDecimal cost = comparedJson.getBigDecimal("cost");
                     BigDecimal comparedCost = beComparedJson.getBigDecimal("cost");
                     if (comparedCost.compareTo(new BigDecimal(0)) != 0) {
-                        BigDecimal costProportion = (cost.subtract(comparedCost)).divide(comparedCost, BigDecimal.ROUND_UP);
+                        BigDecimal costProportion = (cost.subtract(comparedCost)).divide(comparedCost, BigDecimal.ROUND_HALF_UP, 2);
                         comparedJson.put("costProportion", costProportion);
                     } else {
                         comparedJson.put("costProportion", 0);
@@ -366,7 +366,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                         BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
                         BigDecimal compareBigDecimal = new BigDecimal(0);
                         if (yesterdayCost.compareTo(compareBigDecimal) != 0) {
-                            BigDecimal costProportion = ((cost.subtract(yesterdayCost))).divide(yesterdayCost, BigDecimal.ROUND_UP);
+                            BigDecimal costProportion = ((cost.subtract(yesterdayCost))).divide(yesterdayCost, BigDecimal.ROUND_HALF_UP, 2);
                             nowJson.put("costProportion", costProportion); // 较昨日增加比例
                         } else {
                             nowJson.put("costProportion", 0); // 较昨日增加比例
@@ -497,7 +497,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                             json.put("beComparedDate", beComparedDate);
 
                             if (comparedCost.compareTo(new BigDecimal(0)) != 0) {
-                                BigDecimal costProportion = (cost.subtract(comparedCost)).divide(comparedCost, BigDecimal.ROUND_UP);
+                                BigDecimal costProportion = (cost.subtract(comparedCost)).divide(comparedCost, BigDecimal.ROUND_HALF_UP, 2);
                                 json.put("costProportion", costProportion);
                             } else {
                                 json.put("costProportion", 0);
@@ -631,4 +631,5 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         return reportList;
     }
 
+
 }