Browse Source

----增加扫描结果导出到excel表格中

main
mengff 10 months ago
parent
commit
9927ddc166
  1. 6
      src/main/java/com/example/device/controller/DeviceStatus.java

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

Loading…
Cancel
Save