From 158150837c8355f5ca78326529395e56a9bccbdd Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Mon, 08 Jul 2024 10:55:34 +0800
Subject: [PATCH] 更新图斑状态变更、定时航线生成参数调整

---
 src/main/java/com/dji/sample/patches/utils/TimerUtil.java |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 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 4230895..30f0135 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.http.client.SimpleClientHttpRequestFactory;
 import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -63,8 +64,7 @@
     private PatchesConfigPojo patchesConfigPojo;
     @Autowired
     public IWaylineFileService waylineFileService;
-    @Autowired
-    private IFileMapper fileMapper;
+
     @Autowired
     private ITbFJService tbFJService;
     @Autowired
@@ -98,7 +98,7 @@
             //根据获取的图斑集合获得kmz航线文件
             MultipartFile multipartFile = null;
             try {
-                multipartFile = getFile(waylineName, list);
+                multipartFile = getFile(waylineName, list,28.62452712442823, 115.85666327144976);
             } catch (IOException e) {
                 throw new RuntimeException(e);
             }
@@ -114,12 +114,12 @@
             String times = convertTimestampToFormattedString(time);
             sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists);
             updatePatchesStatu(list);
-            time = addOneHourToTimestamp(time,1,30);
+            time = addOneHourToTimestamp(time, 1, 0);
         }
 
     }
 
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 1 0 * * ?")
     public void myTask2() {
         ExecutorService executor = Executors.newSingleThreadExecutor();
         executor.execute(() -> {
@@ -142,9 +142,9 @@
 //            waylineJobService.publishOneFlightTask(waylineJobDTO.get());
 //        }
 //    }
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 0 1 * * ?")
     public void mytask4() throws IOException {
-        Long time = getCurrentTimestampPlus8Hours(9);
+        Long time = getCurrentTimestampPlus8Hours(1);
         List<List<Long>> listOfLists = new ArrayList<>();
         List<Long> sublist = new ArrayList<>();
         sublist.add(time); // 添加整数值
@@ -152,12 +152,12 @@
         List<Long> lists1 = new ArrayList<>();
         lists1.add(time);
         String times = convertTimestampToFormattedString(time);
-        sendPostWithParameters("别墅巡查一段", "a07229af-471a-4058-9da6-5a2b84308b9e", times, lists1, listOfLists);
+        sendPostWithParameters("别墅巡查一段", "c1b9c70e-2e58-4147-b43e-aa4f639726bb", times, lists1, listOfLists);
     }
 
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 50 0 * * ?")
     public void mytask5() throws IOException {
-        Long time = getCurrentTimestampPlus8Hours(10);
+        Long time = getCurrentTimestampPlus8Hours(9);
         List<List<Long>> listOfLists = new ArrayList<>();
         List<Long> sublist = new ArrayList<>();
         sublist.add(time); // 添加整数值
@@ -168,9 +168,9 @@
         sendPostWithParameters("别墅巡查二段", "561ecb37-d673-40f8-a859-05dbfc7d9976", times, lists1, listOfLists);
     }
 
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 40 1 * * ?")
     public void mytask6() throws IOException {
-        Long time = getCurrentTimestampPlus8Hours(11);
+        Long time = getCurrentTimestampPlus8Hours(9);
         List<List<Long>> listOfLists = new ArrayList<>();
         List<Long> sublist = new ArrayList<>();
         sublist.add(time); // 添加整数值
@@ -181,9 +181,9 @@
         sendPostWithParameters("九洲巡河一段", "9f471686-a73a-4e90-8f37-92eed8ed5929", times, lists1, listOfLists);
     }
 
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "0 40 2 * * ?")
     public void mytask7() throws IOException {
-        Long time = getCurrentTimestampPlus8Hours(13);
+        Long time = getCurrentTimestampPlus8Hours(9);
         List<List<Long>> listOfLists = new ArrayList<>();
         List<Long> sublist = new ArrayList<>();
         sublist.add(time); // 添加整数值
@@ -237,8 +237,9 @@
      * @return
      * @throws IOException
      */
-    public MultipartFile getFile(String waylineName, List<LotInfo> list) throws IOException {
-        List<PointPO> coordinates = GeoToolsUtil.getRoutePointOrder(list, 28.62452712442823, 115.85666327144976);
+    public MultipartFile getFile(String waylineName, List<LotInfo> list,double lat, double lon) throws IOException {
+        //南昌28.62452712442823, 115.85666327144976  瑞金 25.8917266,116.020940643
+        List<PointPO> coordinates = GeoToolsUtil.getRoutePointOrder(list, lat, lon);
         XMLTemplateModel xmlModel = XMLTemplateModel.init(coordinates, list);
         CreateWaylineFileUtils.createWaylineFile(xmlModel, patchesConfigPojo.getTemplate(), patchesConfigPojo.getTargetTemplate(), patchesConfigPojo.getWaylines(), patchesConfigPojo.getTargetWaylines());
         // 压缩文件夹中的内容
@@ -412,7 +413,7 @@
 
             // 发送请求
             ResponseEntity<String> response = restTemplate.exchange(
-                    "https://jxlandcloud.org.cn/landCloudWork/artifact/media/upload.action",
+                    "http://39.98.49.177:8083/landCloudWork/artifact/media/upload.action",
 //                    "http://localhost:6789/territory/tbdkjbxx/upload",
                     HttpMethod.POST,
                     requestEntity,
@@ -493,7 +494,7 @@
                 + "\"dock_sn\":\"4TADKCM0010016\","
                 + "\"task_type\":1,"
                 + "\"select_execute_time\":\"%s\","
-                + "\"rth_altitude\":80,"
+                + "\"rth_altitude\":100,"
                 + "\"out_of_control_action\":0,"
                 + "\"executeTimeContinuousArr\":[{\"index\":1,\"value\":[]}],"
                 + "\"executeTimeRepeatArr\":[{\"index\":1,\"value\":\"\"}],"
@@ -501,6 +502,7 @@
                 + "\"rep_fre_type\":3,"
                 + "\"rep_rule_type\":1,"
                 + "\"time_range\":[],"
+                + "\"rth_mode\":1,"
                 + "\"1conValue\":[],"
                 + "\"1repValue\":\"\","
                 + "\"task_days\":%s,"
@@ -586,7 +588,7 @@
         return timestamp / 1000;
     }
 
-    public static Long addOneHourToTimestamp(Long timestampInSeconds,long hours,long min) {
+    public static Long addOneHourToTimestamp(Long timestampInSeconds, long hours, long min) {
         // 将输入的秒级时间戳转换为Instant对象
         Instant instant = Instant.ofEpochSecond(timestampInSeconds);
 

--
Gitblit v1.9.3