| | |
| | | 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; |
| | |
| | | */ |
| | | @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"; |
| | | // 获取未规划的图斑集合 |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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()); |
| | |
| | | |
| | | // 格式化时间,生成当前时间 |
| | | 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); |
| | | } |
| | | } |