瀏覽代碼

今日数据百分比调整

yumeng 5 年之前
父節點
當前提交
b8e701da95

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

@@ -203,9 +203,17 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当前日期
             String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 当前日期-1
             if (type == 1) { // 今日总消耗
-                accountJson = reportMapper.selectDayReport(nowDate);
+                JSONObject nowJson = reportMapper.selectDayReport(nowDate);
+                if (Check.isNull(nowJson)) {
+                    return accountJson;
+                }
+                int maxHour = nowJson.getInteger("maxHour");
+                if (maxHour == 0 || Check.isNull(maxHour)) {
+                    return accountJson;
+                }
+                accountJson = reportMapper.selectSumDayHourlyByHourAndDate(nowDate, String.valueOf(maxHour - 1));
                 if (!Check.isNull(accountJson)) {
-                    JSONObject yesterdayJson = reportMapper.selectSumDayHourlyByHourAndDate(anotherDay, accountJson.getString("maxHour"));
+                    JSONObject yesterdayJson = reportMapper.selectSumDayHourlyByHourAndDate(anotherDay, String.valueOf(maxHour - 1));
                     if (!Check.isNull(yesterdayJson)) {
                         BigDecimal cost = accountJson.getBigDecimal("cost"); // 今日消耗
                         BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗