From 40335dc948a63c160f2172fc02d1a1290833fc7c Mon Sep 17 00:00:00 2001 From: mengff <1198151809@qq.com> Date: Wed, 17 Jan 2024 14:41:38 +0800 Subject: [PATCH] =?UTF-8?q?----=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= 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, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/device/controller/DeviceStatus.java b/src/main/java/com/example/device/controller/DeviceStatus.java index 9f229dd..499f82a 100644 --- a/src/main/java/com/example/device/controller/DeviceStatus.java +++ b/src/main/java/com/example/device/controller/DeviceStatus.java @@ -38,6 +38,7 @@ public class DeviceStatus { private ExcelExportService excelExportService; + //每天凌晨0点到晚上23点整点测试设备状态 @Scheduled(cron = "0 0 0-23 * * ?") // @Scheduled(cron = "0 0 1,5,7,8,11,14,17,19,21,23") public void generateDeviceStatus() { @@ -168,10 +169,10 @@ public class DeviceStatus { /** * 成功率和丢包率按小时分组 - * + * 每天17点 23点 30分导出excel表 */ - @Scheduled(cron = "0 0 8 * * ?") + @Scheduled(cron = "0 30 17,23 * * ?") public void calculateSuccessRate() { LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(1); @@ -197,6 +198,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 = "/Users/mengfanfeng/Downloads/excel/"+formattedDateTime+"--deviceStatus.xlsx"; try (Workbook workbook = new XSSFWorkbook()) { FileOutputStream fileOut = new FileOutputStream(filePath);