From 3a19f58a08a48d217c6da297006c550726af09d3 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Mon, 11 Nov 2024 15:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=8E=87=E8=BF=94=E5=9B=9E=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8E=BB=E9=99=A4=E4=B8=AD=E9=97=B4T?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/controller/DcDeviceOnlineController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java index 1211d7c1..52e08c39 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceOnlineController.java @@ -238,12 +238,15 @@ public class DcDeviceOnlineController extends BaseController { LocalDate startDate = LocalDate.now().minusDays(30); LocalDate endDate = LocalDate.now(); List onlineSums = onlineSumService.queryByDateRangeOfDevice(deviceId, startDate, endDate); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); if (onlineSums.isEmpty()) { return AjaxResult.success(UniversalEnum.NO_DATA_AVAILABLE.getValue()); } Map map = new HashMap<>(); for (OnlineSum onlineSum : onlineSums) { - map.put(onlineSum.getStatisticalDate().toString(), onlineSum.getOnlineRate()); + LocalDateTime dateTime = onlineSum.getStatisticalDate(); + String formattedDate = dateTime.format(formatter); + map.put(formattedDate, onlineSum.getOnlineRate()); } return AjaxResult.success(new TreeMap<>(map)); } @@ -584,4 +587,4 @@ public class DcDeviceOnlineController extends BaseController { } } -} \ No newline at end of file +}