|
@@ -203,9 +203,17 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当前日期
|
|
String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当前日期
|
|
String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 当前日期-1
|
|
String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 当前日期-1
|
|
if (type == 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)) {
|
|
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)) {
|
|
if (!Check.isNull(yesterdayJson)) {
|
|
BigDecimal cost = accountJson.getBigDecimal("cost"); // 今日消耗
|
|
BigDecimal cost = accountJson.getBigDecimal("cost"); // 今日消耗
|
|
BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
|
|
BigDecimal yesterdayCost = yesterdayJson.getBigDecimal("cost");// 昨日消耗
|