Browse Source

----修改定时任务

main
mengff 11 months ago
parent
commit
1d4b60894f
  1. 4
      src/main/java/com/example/device/controller/DeviceStatus.java

4
src/main/java/com/example/device/controller/DeviceStatus.java

@ -171,7 +171,7 @@ public class DeviceStatus {
* *
*/ */
@Scheduled(cron = "0 5 1 * * ?") @Scheduled(cron = "0 30 23 * * ?")
public void calculateSuccessRate() { public void calculateSuccessRate() {
LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS); LocalDateTime todayStart = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS);
@ -193,7 +193,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 = "/home/excel/"+formattedDateTime+"--deviceStatus.xlsx";
try (Workbook workbook = new XSSFWorkbook()) { try (Workbook workbook = new XSSFWorkbook()) {
FileOutputStream fileOut = new FileOutputStream(filePath); FileOutputStream fileOut = new FileOutputStream(filePath);
workbook.write(fileOut); workbook.write(fileOut);

Loading…
Cancel
Save