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 +}