Explorar o código

报表加入时间

yumeng %!s(int64=5) %!d(string=hai) anos
pai
achega
2f48b54841

+ 12 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/AccountReportServiceImpl.java

@@ -257,6 +257,7 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 return null;
             }
 
+            String statDate = "";
             List<JSONObject> accountDetail = new ArrayList<>();
             Integer statHour = json.getInteger("statHour");
             Integer hour;
@@ -270,6 +271,7 @@ public class AccountReportServiceImpl implements IAccountReportService {
                 }
                 JSONObject chainRatioJson = new JSONObject();
                 accountDetail = accountReportMapper.selectReportDetailGroupAccountId(nowDate, accountIds, hour);
+                statDate = nowDate;
                 JSONObject nowAccountSummary = accountReportMapper.selectSummaryByAccountId(nowDate, accountIds, hour, discount);
                 if (!Check.isNull(nowAccountSummary)) {
                     returnJson.put("now", nowAccountSummary);
@@ -495,31 +497,41 @@ public class AccountReportServiceImpl implements IAccountReportService {
             } else if (type == 2) {
                 if (Check.isNull(statHour)) {
                     accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, 23);
+                    statDate = anotherDay;
                 } else {
                     accountDetail = accountReportMapper.selectReportDetailGroupAccountId(anotherDay, accountIds, statHour);
+                    statDate = anotherDay;
                 }
             } else if (type == 3) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
             } else if (type == 4) {
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
             } else if (type == 5) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
             } else if (type == 6) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
             } else if (type == 7) {
                 String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -6);
                 accountDetail = accountReportMapper.selectAccountReportByDate(anotherDay, endDate, accountIds, discount);
+                statDate = endDate + " ~ " + anotherDay;
             } else if (type == 8) {
                 accountDetail = accountReportMapper.selectAccountReport(accountIds, discount);
+                statDate = "合计";
             } else if (type == 9) {
                 String startDate = json.getString("startDate");
                 String endDate = json.getString("endDate");
                 accountDetail = accountReportMapper.selectAccountReportByDate(startDate, endDate, accountIds, discount);
+                statDate = statDate + " ~ " + endDate;
             }
+            returnJson.put("statDate", statDate);
             returnJson.put("accountDetail", accountDetail);
         } catch (Exception e) {
             e.printStackTrace();