From 9927ddc16671c25f9a7625fc1b0f633076360a65 Mon Sep 17 00:00:00 2001 From: mengff <1198151809@qq.com> Date: Tue, 16 Jan 2024 14:39:29 +0800 Subject: [PATCH] =?UTF-8?q?----=E5=A2=9E=E5=8A=A0=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=AF=BC=E5=87=BA=E5=88=B0excel=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/device/controller/DeviceStatus.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/device/controller/DeviceStatus.java b/src/main/java/com/example/device/controller/DeviceStatus.java index 214f2a1..88b6460 100644 --- a/src/main/java/com/example/device/controller/DeviceStatus.java +++ b/src/main/java/com/example/device/controller/DeviceStatus.java @@ -171,10 +171,10 @@ public class DeviceStatus { * */ - @Scheduled(cron = "0 30 11,15,17,23 * * ?") + @Scheduled(cron = "0 8 * * ?") public void calculateSuccessRate() { - LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS); + LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(1); LocalDateTime currentTime = LocalDateTime.now(); @@ -197,7 +197,7 @@ public class DeviceStatus { LocalDateTime dateTime = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); String formattedDateTime = dateTime.format(formatter); - String filePath = "/home/excel/"+formattedDateTime+"--deviceStatus.xlsx"; + String filePath = "/Users/mengfanfeng/Downloads/excel/"+formattedDateTime+"--deviceStatus.xlsx"; try (Workbook workbook = new XSSFWorkbook()) { FileOutputStream fileOut = new FileOutputStream(filePath); workbook.write(fileOut);