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);