From 39ffdf5754b4ebca682bd3c925f7a500e8a1bbda Mon Sep 17 00:00:00 2001
From: aix <vip_xiaobin810@163.com>
Date: Thu, 08 Aug 2024 16:56:36 +0800
Subject: [PATCH] 国土调查云身份凭证token

---
 src/main/java/com/dji/sample/patches/utils/TimerUtil.java |  160 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 102 insertions(+), 58 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 b6ea71f..005ea33 100644
--- a/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
@@ -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);
             }
@@ -142,58 +142,100 @@
 //            waylineJobService.publishOneFlightTask(waylineJobDTO.get());
 //        }
 //    }
-    @Scheduled(cron = "0 0 1 * * ?")
-    public void mytask4() throws IOException {
-        Long time = getCurrentTimestampPlus8Hours(8);
-        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("别墅巡查一段", "a07229af-471a-4058-9da6-5a2b84308b9e", times, lists1, listOfLists);
-    }
-
-    @Scheduled(cron = "0 50 0 * * ?")
-    public void mytask5() 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("别墅巡查二段", "561ecb37-d673-40f8-a859-05dbfc7d9976", times, lists1, listOfLists);
-    }
-
-    @Scheduled(cron = "0 40 1 * * ?")
-    public void mytask6() 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("九洲巡河一段", "9f471686-a73a-4e90-8f37-92eed8ed5929", times, lists1, listOfLists);
-    }
-
-    @Scheduled(cron = "0 40 2 * * ?")
-    public void mytask7() 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("九洲巡河二段", "58cd4261-02d7-4c4e-b876-25a4a2630c18", times, lists1, listOfLists);
-    }
-
+//    @Scheduled(cron = "0 0 1 * * ?")
+//    public void mytask4() throws IOException {
+//        Long time = getCurrentTimestampPlus8Hours(8);
+//        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("别墅巡查一段", "2a44748a-1500-406f-80cf-ad92186fe8d2", times, lists1, listOfLists);
+//    }
+//
+//    @Scheduled(cron = "0 50 0 * * ?")
+//    public void mytask5() 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("别墅巡查二段", "a07229af-471a-4058-9da6-5a2b84308b9e", times, lists1, listOfLists);
+//    }
+//
+//    @Scheduled(cron = "0 40 1 * * ?")
+//    public void mytask6() 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("九洲巡河一段", "9f471686-a73a-4e90-8f37-92eed8ed5929", times, lists1, listOfLists);
+//    }
+//
+//    @Scheduled(cron = "0 40 2 * * ?")
+//    public void mytask7() 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("九洲巡河二段", "58cd4261-02d7-4c4e-b876-25a4a2630c18", times, lists1, listOfLists);
+//    }
+//
+//    @Scheduled(cron = "0 30 2 * * ?")
+//    public void mytask8() throws IOException {
+//        Long time = getCurrentTimestampPlus8Hours(12);
+//        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("定时任务2:30", "c3a7b125-bc0b-49d4-96ed-80743200ab80", times, lists1, listOfLists);
+//    }
+//    @Scheduled(cron = "0 30 2 * * ?")
+//    public void mytask9() throws IOException {
+//        Long time = getCurrentTimestampPlus8Hours(14);
+//        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("定时任务4:30", "c3a7b125-bc0b-49d4-96ed-80743200ab80", times, lists1, listOfLists);
+//    }
+//    @Scheduled(cron = "0 0 6 * * ?")
+//    public static void mytask10() {
+//        File directory = new File("/tmp");
+//        String[] partialFileNames = {"temp", "mark"}; // 要匹配的部分文件名
+//        if (directory.isDirectory()) {
+//            File[] files = directory.listFiles();
+//            if (files != null) {
+//                for (File file : files) {
+//                    for (String partialFileName : partialFileNames) {
+//                        if (file.isFile() && file.getName().contains(partialFileName)) {
+//                            file.delete();
+//                            break; // 跳出内层循环,以免重复删除同一个文件
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//    }
     /**
      * 完成对未推送的图斑数据进行整合发送
      *
@@ -237,8 +279,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());
         // 压缩文件夹中的内容
@@ -246,6 +289,7 @@
         zipFolder(patchesConfigPojo.getSourceDir(), destKMZFile);
         return convert(new File(destKMZFile));
     }
+
 
     /**
      * 将航线上传Oss
@@ -493,7 +537,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 +545,7 @@
                 + "\"rep_fre_type\":3,"
                 + "\"rep_rule_type\":1,"
                 + "\"time_range\":[],"
+                + "\"rth_mode\":1,"
                 + "\"1conValue\":[],"
                 + "\"1repValue\":\"\","
                 + "\"task_days\":%s,"
@@ -615,7 +660,6 @@
 
     public static String getNowTimeName() {
         LocalDateTime currentTime = LocalDateTime.now();
-
         // 格式化时间,生成当前时间
         return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSS"));
     }
@@ -624,6 +668,6 @@
         LocalDateTime currentTime = LocalDateTime.now();
 
         // 格式化时间,生成当前时间
-        return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMdd"));
+        return currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSSS"));
     }
 }

--
Gitblit v1.9.3