From 9c789c67ae94a9ed59fc12f4e2547abda1e42de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Mon, 26 Aug 2024 12:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=95=88=E7=8E=87=E4=BC=98=E5=8C=96=EF=BC=8C=E7=A5=A8?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/saledata/SaleDataServiceImpl.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java index a18528bb8..83ede1009 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java @@ -71,7 +71,10 @@ public class SaleDataServiceImpl implements SaleDataService { LocalDate currentDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); String formattedDate = currentDate.format(formatter); - allByCertificateno = saleDataRepository.findAllByCertificatenoSDTime(formattedDate, formattedDate); + // 将当前日期加一天 + LocalDate nextDay = currentDate.plusDays(1); + String nextDayFormatter = nextDay.format(formatter); + allByCertificateno = saleDataRepository.findAllByCertificatenoSDTime(formattedDate, nextDayFormatter); }else { allByCertificateno = saleDataRepository.findAllByCertificatenoSDTime(starTime, endTime); } @@ -95,7 +98,10 @@ public class SaleDataServiceImpl implements SaleDataService { LocalDate currentDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); String formattedDate = currentDate.format(formatter); - byAge = saleDataRepository.findByAge(formattedDate,formattedDate); + // 将当前日期加一天 + LocalDate nextDay = currentDate.plusDays(1); + String nextDayFormatter = nextDay.format(formatter); + byAge = saleDataRepository.findByAge(formattedDate,nextDayFormatter); }else { byAge = saleDataRepository.findByAge(starTime,endTime); } @@ -198,7 +204,10 @@ public class SaleDataServiceImpl implements SaleDataService { LocalDate currentDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); String formattedDate = currentDate.format(formatter); - saleDataList = saleDataRepository.findAllByTransactiontypenoTime(formattedDate, formattedDate); + // 将当前日期加一天 + LocalDate nextDay = currentDate.plusDays(1); + String nextDayFormatter = nextDay.format(formatter); + saleDataList = saleDataRepository.findAllByTransactiontypenoTime(formattedDate, nextDayFormatter); }else { saleDataList = saleDataRepository.findAllByTransactiontypenoTime(starTime, endTime); } @@ -249,7 +258,10 @@ public class SaleDataServiceImpl implements SaleDataService { LocalDate currentDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); String formattedDate = currentDate.format(formatter); - list = saleDataRepository.findAllByItemtypenameTime(formattedDate, formattedDate); + // 将当前日期加一天 + LocalDate nextDay = currentDate.plusDays(1); + String nextDayFormatter = nextDay.format(formatter); + list = saleDataRepository.findAllByItemtypenameTime(formattedDate, nextDayFormatter); }else { list = saleDataRepository.findAllByItemtypenameTime(starTime, endTime); } @@ -263,6 +275,20 @@ public class SaleDataServiceImpl implements SaleDataService { mapArrayList.add(map); // map.clear(); } + if (mapArrayList.size() == 0){ + HashMap map = new HashMap<>(); + map.put("TypeName","景点"); + map.put("count","0"); + mapArrayList.add(map); + HashMap map1 = new HashMap<>(); + map1.put("TypeName","公园"); + map1.put("count","0"); + mapArrayList.add(map1); + HashMap map2 = new HashMap<>(); + map2.put("TypeName","遗迹"); + map2.put("count","0"); + mapArrayList.add(map2); + } return mapArrayList; }