|
@ -38,6 +38,7 @@ public class DeviceStatus { |
|
|
private ExcelExportService excelExportService; |
|
|
private ExcelExportService excelExportService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//每天凌晨0点到晚上23点整点测试设备状态
|
|
|
@Scheduled(cron = "0 0 0-23 * * ?") |
|
|
@Scheduled(cron = "0 0 0-23 * * ?") |
|
|
// @Scheduled(cron = "0 0 1,5,7,8,11,14,17,19,21,23")
|
|
|
// @Scheduled(cron = "0 0 1,5,7,8,11,14,17,19,21,23")
|
|
|
public void generateDeviceStatus() { |
|
|
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() { |
|
|
public void calculateSuccessRate() { |
|
|
|
|
|
|
|
|
LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(1); |
|
|
LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(1); |
|
@ -197,6 +198,7 @@ public class DeviceStatus { |
|
|
LocalDateTime dateTime = LocalDateTime.now(); |
|
|
LocalDateTime dateTime = LocalDateTime.now(); |
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
String formattedDateTime = dateTime.format(formatter); |
|
|
String formattedDateTime = dateTime.format(formatter); |
|
|
|
|
|
//修改成服务器地址
|
|
|
String filePath = "/Users/mengfanfeng/Downloads/excel/"+formattedDateTime+"--deviceStatus.xlsx"; |
|
|
String filePath = "/Users/mengfanfeng/Downloads/excel/"+formattedDateTime+"--deviceStatus.xlsx"; |
|
|
try (Workbook workbook = new XSSFWorkbook()) { |
|
|
try (Workbook workbook = new XSSFWorkbook()) { |
|
|
FileOutputStream fileOut = new FileOutputStream(filePath); |
|
|
FileOutputStream fileOut = new FileOutputStream(filePath); |
|
|