From 1fc2b9a38ce7fb5f0a78361a731e98750fbd20c1 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Mon, 24 Jun 2024 10:28:09 +0800
Subject: [PATCH] 定时四个九洲巡查任务,新增媒体文件任务查询、搜索接口
---
src/main/java/com/dji/sample/patches/utils/TimerUtil.java | 74 ++++++++++++++++++++++++++++---------
1 files changed, 56 insertions(+), 18 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 ace82b0..4230895 100644
--- a/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/TimerUtil.java
@@ -114,7 +114,7 @@
String times = convertTimestampToFormattedString(time);
sendPostWithParameters(waylineName, waylineFile.getWaylineId(), times, lists1, listOfLists);
updatePatchesStatu(list);
- time = addOneHourToTimestamp(time);
+ time = addOneHourToTimestamp(time,1,30);
}
}
@@ -132,16 +132,16 @@
executor.shutdown();
}
- public void myTask3() throws SQLException {
- String workspaceId = "4a574db8-4ad3-48f7-9f16-3edbcd8056e1";
- String name = getNowDay();
- List<String> jobs = waylineJobService.selectJobIdByName(name);
- List<String> jobIds = jobBreakPointService.selectHaveBreak(jobs);
- for (String jobid : jobIds) {
- Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobId(workspaceId, jobid, true);
- waylineJobService.publishOneFlightTask(waylineJobDTO.get());
- }
- }
+ // public void myTask3() throws SQLException {
+// String workspaceId = "4a574db8-4ad3-48f7-9f16-3edbcd8056e1";
+// String name = getNowDay();
+// List<String> jobs = waylineJobService.selectJobIdByName(name);
+// List<String> jobIds = jobBreakPointService.selectHaveBreak(jobs);
+// for (String jobid : jobIds) {
+// 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);
@@ -152,7 +152,46 @@
List<Long> lists1 = new ArrayList<>();
lists1.add(time);
String times = convertTimestampToFormattedString(time);
- sendPostWithParameters("九洲巡查","73e14492-f1b2-4fc4-81c0-7ca65cd3bc56", times, lists1, listOfLists);
+ sendPostWithParameters("别墅巡查一段", "a07229af-471a-4058-9da6-5a2b84308b9e", times, lists1, listOfLists);
+ }
+
+ @Scheduled(cron = "0 0 0 * * ?")
+ public void mytask5() throws IOException {
+ Long time = getCurrentTimestampPlus8Hours(10);
+ 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 0 0 * * ?")
+ public void mytask6() throws IOException {
+ Long time = getCurrentTimestampPlus8Hours(11);
+ 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 0 0 * * ?")
+ public void mytask7() throws IOException {
+ Long time = getCurrentTimestampPlus8Hours(13);
+ 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);
}
/**
@@ -185,7 +224,7 @@
dbSave(territoryConfigPojo.getResult(), territoryConfigPojo.getResultsave(), taskId);
//发送请求给第三方接口
- sendPostWithFileAndParameter(territoryConfigPojo.getResult(), taskId, dkbh, workspaceId);
+ sendPostWithFileAndParameter(territoryConfigPojo.getResult(), taskId);
}
}
@@ -351,7 +390,7 @@
* @param taskId
* @throws IOException
*/
- public void sendPostWithFileAndParameter(String filePath, String taskId, String dkbh, String workspaceId) throws IOException {
+ public void sendPostWithFileAndParameter(String filePath, String taskId) throws IOException {
// 创建 RestTemplate 实例
try {
RestTemplate restTemplate = new RestTemplate();
@@ -373,12 +412,11 @@
// 发送请求
ResponseEntity<String> response = restTemplate.exchange(
- "http://39.98.48.180:8087/landCloudWork/artifact/media/upload.action",
+ "https://jxlandcloud.org.cn/landCloudWork/artifact/media/upload.action",
// "http://localhost:6789/territory/tbdkjbxx/upload",
HttpMethod.POST,
requestEntity,
String.class);
- System.out.println(response);
} catch (Exception e) {
throw new IllegalArgumentException("db推送失败" + e.getMessage());
}
@@ -548,7 +586,7 @@
return timestamp / 1000;
}
- public static Long addOneHourToTimestamp(Long timestampInSeconds) {
+ public static Long addOneHourToTimestamp(Long timestampInSeconds,long hours,long min) {
// 将输入的秒级时间戳转换为Instant对象
Instant instant = Instant.ofEpochSecond(timestampInSeconds);
@@ -556,7 +594,7 @@
ZonedDateTime zonedDateTime = instant.atZone(ZoneId.systemDefault());
// 加上一小时
- ZonedDateTime zonedDateTimePlusOneHour = zonedDateTime.plusHours(1).plusMinutes(30);
+ ZonedDateTime zonedDateTimePlusOneHour = zonedDateTime.plusHours(hours).plusMinutes(min);
// 将ZonedDateTime对象转换回秒级时间戳
return zonedDateTimePlusOneHour.toInstant().getEpochSecond();
--
Gitblit v1.9.3