From 601d2f9df6efa3de3bbc261d5f63628d8e8be6a9 Mon Sep 17 00:00:00 2001 From: zhangzeli <123456> Date: 星期一, 10 一月 2022 11:20:14 +0800 Subject: [PATCH] bug --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/Statistic2Controller.java | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/Statistic2Controller.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/Statistic2Controller.java index 095b26f..5f56265 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/Statistic2Controller.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/Statistic2Controller.java @@ -44,10 +44,13 @@ int year = cal.get(Calendar.YEAR); QueryWrapper<Car> wrapper = new QueryWrapper<>(); + int m = cal.get(Calendar.MONTH) + 1; + Month month= iCarService.getCarCount(year); if (month==null) { month = new Month(); } + List<Integer> list = new ArrayList<>(); list.add(month.getJanuary()); list.add(month.getFebruary()); @@ -61,6 +64,10 @@ list.add(month.getOctober()); list.add(month.getNovember()); list.add(month.getDecember()); + + for (int i=m;i<12;i++){ + list.set(i,0); + } return new ResultUtil<Object>().setData(list); } @@ -70,6 +77,8 @@ Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); QueryWrapper<Car> wrapper = new QueryWrapper<>(); + + int m = cal.get(Calendar.MONTH) + 1; Month month= iCustomerService.getCustomerCount(year); if (month==null) { @@ -88,6 +97,10 @@ list.add(month.getOctober()); list.add(month.getNovember()); list.add(month.getDecember()); + + for (int i=m;i<12;i++){ + list.set(i,0); + } return new ResultUtil<Object>().setData(list); } -- Gitblit v1.9.1