From 3904fbdccb96a9b1b4f919d18505d5ebb8ef976a Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Thu, 20 Jun 2024 18:13:18 +0800
Subject: [PATCH] 定时九洲巡查

---
 src/main/java/com/dji/sample/patches/utils/TimerUtil.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/dji/sample/patches/utils/TimerUtil.java b/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
index cc0a795..ace82b0 100644
--- a/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
@@ -24,6 +24,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ByteArrayResource;
 import org.springframework.http.*;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -86,7 +87,7 @@
      */
     @Scheduled(cron = "0 0 0 * * ?")
     public void myTask() throws Exception {
-        Long time = getCurrentTimestampPlus8Hours();
+        Long time = getCurrentTimestampPlus8Hours(14);
         String taskId = "";
         String workspaceId = "4a574db8-4ad3-48f7-9f16-3edbcd8056e1";
 //        获取未规划的图斑集合
@@ -140,6 +141,18 @@
             Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, jobid, true);
             waylineJobService.publishOneFlightTask(waylineJobDTO.get());
         }
+    }
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void mytask4() throws IOException {
+        Long time = getCurrentTimestampPlus8Hours(9);
+        List<List<Long>> listOfLists = new ArrayList<>();
+        List<Long> sublist = new ArrayList<>();
+        sublist.add(time); // 添加整数值
+        listOfLists.add(sublist);
+        List<Long> lists1 = new ArrayList<>();
+        lists1.add(time);
+        String times = convertTimestampToFormattedString(time);
+        sendPostWithParameters("九洲巡查","73e14492-f1b2-4fc4-81c0-7ca65cd3bc56", times, lists1, listOfLists);
     }
 
     /**
@@ -520,12 +533,12 @@
         return folder;
     }
 
-    public static Long getCurrentTimestampPlus8Hours() {
+    public static Long getCurrentTimestampPlus8Hours(long hours) {
         // 获取当前时间
         LocalDateTime now = LocalDateTime.now();
 
         // 加上8小时
-        LocalDateTime nowPlus8Hours = now.plusHours(8);
+        LocalDateTime nowPlus8Hours = now.plusHours(hours);
 
         // 转换为UTC时间戳
         ZonedDateTime zonedDateTime = nowPlus8Hours.atZone(ZoneId.systemDefault());
@@ -574,14 +587,5 @@
 
         // 格式化时间,生成当前时间
         return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMdd"));
-    }
-
-    public static void main(String[] args) {
-        // 获取当前时间
-        LocalDateTime currentTime = LocalDateTime.now();
-
-        // 格式化时间,生成文件夹名字
-        String folderName = currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSS"));
-        System.out.println(folderName);
     }
 }

--
Gitblit v1.9.3