From 904201c851b7a126dbdf28080a2165619a8efe2d Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Wed, 10 Dec 2025 11:00:12 +0800
Subject: [PATCH] 2025-12-10 zwy 增加判断航线地址path1为null

---
 ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java |  237 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 184 insertions(+), 53 deletions(-)

diff --git a/ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java b/ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java
index 736fad1..2d39428 100644
--- a/ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java
+++ b/ard-sample/src/main/java/com/ard/sample/wayline/service/impl/WaylineJobServiceImpl.java
@@ -1,6 +1,6 @@
 package com.ard.sample.wayline.service.impl;
 
-import com.ard.oss.service.impl.OssServiceContext;
+import com.ard.ossdock.service.impl.OssDockServiceContext;
 import com.ard.route.domain.route.ArdRouteInfo;
 import com.ard.route.service.IArdRouteInfoService;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -65,6 +65,7 @@
 @Service
 @Transactional
 @Slf4j
+@SuppressWarnings("all")
 public class WaylineJobServiceImpl implements IWaylineJobService {
 
     @Autowired
@@ -77,7 +78,7 @@
     private IArdRouteInfoService _ardRouteInfoService;
 
     @Resource
-    private OssServiceContext _ossService;
+    private OssDockServiceContext _ossService;
 
     @Autowired
     private IDeviceService deviceService;
@@ -188,14 +189,14 @@
         }
 
         if (waylineJobOpt.isEmpty()) {
-            return ResponseResult.error("创建机场任务失败!");
+            return ResponseResult.error(314013000,"创建机场任务失败!");
         }
 
         WaylineJobDTO waylineJob = waylineJobOpt.get();
 
         boolean isOnline = deviceService.checkDeviceOnline(waylineJob.getDockSn());
         if (!isOnline) {
-            return ResponseResult.error("机场不在线!");
+            return ResponseResult.error(CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg());
         }
 
         // get wayline file
@@ -205,23 +206,23 @@
 //        }
         // 换航线表
         ArdRouteInfo ardRouteOpt = _ardRouteInfoService.selectArdRouteInfoById(waylineJob.getFileId());
-        if (ardRouteOpt == null) {
-            return ResponseResult.error("机场任务航线不存在!");
+        if (ardRouteOpt == null || ardRouteOpt.getPath1() == null || ardRouteOpt.getPath1().isEmpty()) {
+            return ResponseResult.error(314013001,"机场任务航线不存在!");
         }
 
         // get file url
 //        URL url = waylineFileService.getObjectUrl(waylineFile.get().getWaylineId());
         URL url = null;
-        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath());
+        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath1());
         String md5 = "";
         try (InputStream inputStream = _ossService.getObject(kmzPath, minioUrl)) {
             md5 = DigestUtils.md5Hex(inputStream);
-            url = new URL(ardRouteOpt.getPath());
+            url = new URL(ardRouteOpt.getPath1());
             log.info("机场任务航线文件url地址:{}", url);
             log.info("机场任务航线文件md5值:{}", md5);
         } catch (Exception e) {
             log.error("机场任务航线文件地址错误!{}", e.getMessage());
-            return ResponseResult.error("机场任务航线文件地址错误!" + e.getMessage());
+            return ResponseResult.error(314013002,"机场任务航线文件地址错误!" + e.getMessage());
         }
 
         log.info("机场任务-rth_mode的值:{}", waylineJob.getRthMode());
@@ -235,14 +236,17 @@
                 .outOfControlAction(waylineJob.getOutOfControlAction())
                 .rthMode(waylineJob.getRthMode())
                 .file(WaylineTaskFileDTO.builder()
-                        .url(url.toString())
+//                        .url(url.toString().replace("https://192.168.10.103:9001", "http://192.168.10.103:9011"))
 //                        .fingerprint(waylineFile.get().getSign())
+//                        .replace("https://", "http://")
+//                        .replace("9001", "9011")
+                        .url(url.toString())
                         .fingerprint(md5)
                         .build())
 //                .simulateMission(WaylineSimulateMissionDTO.builder()
 //                        .isEnable(1)
-//                        .latitude(46.558831038)
-//                        .longitude(125.148072319)
+//                        .latitude(46.55819013988211)
+//                        .longitude(125.14652370145113)
 //                        .build())
                 .build();
 
@@ -270,21 +274,23 @@
         log.info("下发任务结果: {}", serviceReply.getResult());
 
         if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
-            log.info("Prepare task ====> Error code: {}", serviceReply.getResult());
+            String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult());
+            log.info("Prepare task ====> Error code: {},Error Msg:{}", serviceReply.getResult(), errorMsg);
             this.updateJob(WaylineJobDTO.builder()
                     .jobId(waylineJob.getJobId())
                     .executeTime(LocalDateTime.now())
                     .status(WaylineJobStatusEnum.FAILED.getVal())
                     .completedTime(LocalDateTime.now())
                     .code(serviceReply.getResult()).build());
-            return ResponseResult.error("Prepare task ====> Error code: " + serviceReply.getResult());
+            //return ResponseResult.error("Prepare task ====> Error code: " + serviceReply.getResult());
+            return ResponseResult.error(serviceReply.getResult(), errorMsg);
         }
 
         // 飞行命令先注释掉
         // Issue an immediate task execution command.
         if (WaylineTaskTypeEnum.IMMEDIATE.getVal() == waylineJob.getTaskType()) {
             if (!executeFlightTask(waylineJob.getJobId())) {
-                return ResponseResult.error("Failed to execute job.");
+                return ResponseResult.error("无法执行作业。");
             }
         }
 
@@ -293,7 +299,7 @@
                      waylineJob.getDockSn() + RedisConst.DELIMITER + waylineJob.getJobId(),
                     waylineJob.getBeginTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
             if (!isAdd) {
-                return ResponseResult.error("Failed to create scheduled job.");
+                return ResponseResult.error("无法创建计划作业。");
             }
         }
 
@@ -303,7 +309,7 @@
     public ResponseResult publishFlightTaskPrepare(Optional<WaylineJobDTO> waylineJobOpt) throws SQLException{
 
         if (waylineJobOpt.isEmpty()) {
-            return ResponseResult.error("创建机场任务失败!");
+            return ResponseResult.error(314013000,"创建机场任务失败!");
         }
         WaylineJobDTO waylineJob = waylineJobOpt.get();
         boolean isOnline = deviceService.checkDeviceOnline(waylineJob.getDockSn());
@@ -312,21 +318,21 @@
         }
         // 换航线表
         ArdRouteInfo ardRouteOpt = _ardRouteInfoService.selectArdRouteInfoById(waylineJob.getFileId());
-        if (ardRouteOpt == null) {
-            return ResponseResult.error("机场任务航线不存在!");
+        if (ardRouteOpt == null || ardRouteOpt.getPath1() == null || ardRouteOpt.getPath1().isEmpty()) {
+            return ResponseResult.error(314013001,"机场任务航线不存在!");
         }
         // get file url
         URL url = null;
-        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath());
+        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath1());
         String md5 = "";
         try (InputStream inputStream = _ossService.getObject(kmzPath, minioUrl)) {
             md5 = DigestUtils.md5Hex(inputStream);
-            url = new URL(ardRouteOpt.getPath());
+            url = new URL(ardRouteOpt.getPath1());
             log.info("机场任务航线文件url地址:{}", url);
             log.info("机场任务航线文件md5值:{}", md5);
         } catch (Exception e) {
             log.error("机场任务航线文件地址错误!{}", e.getMessage());
-            return ResponseResult.error("机场任务航线文件地址错误!" + e.getMessage());
+            return ResponseResult.error(314013002,"机场任务航线文件地址错误!" + e.getMessage());
         }
 
         WaylineTaskCreateDTO flightTask = WaylineTaskCreateDTO.builder()
@@ -374,21 +380,23 @@
         log.info("机场任务航线文件md5值:{}", md5);
 
         if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
-            log.info("Prepare task ====> Error code: {}", serviceReply.getResult());
+            String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult());
+            log.info("Prepare task ====> Error code: {},Error Msg: {}", serviceReply.getResult(), errorMsg);
             this.updateJob(WaylineJobDTO.builder()
                     .jobId(waylineJob.getJobId())
                     .executeTime(LocalDateTime.now())
                     .status(WaylineJobStatusEnum.FAILED.getVal())
                     .completedTime(LocalDateTime.now())
                     .code(serviceReply.getResult()).build());
-            return ResponseResult.error("Prepare task ====> Error code: " + serviceReply.getResult());
+//            return ResponseResult.error("Prepare task ====> Error code: " + serviceReply.getResult());
+            return ResponseResult.error(serviceReply.getResult(), errorMsg);
         }
 
         // 飞行命令先注释掉
         // Issue an immediate task execution command.
         if (WaylineTaskTypeEnum.IMMEDIATE.getVal() == waylineJob.getTaskType()) {
             if (!executeFlightTask(waylineJob.getJobId())) {
-                return ResponseResult.error("Failed to execute job.");
+                return ResponseResult.error("无法执行作业。");
             }
         }
 
@@ -397,7 +405,7 @@
                      waylineJob.getDockSn() + RedisConst.DELIMITER + waylineJob.getJobId(),
                     waylineJob.getBeginTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
             if (!isAdd) {
-                return ResponseResult.error("Failed to create scheduled job.");
+                return ResponseResult.error("无法创建计划作业。");
             }
         }
 
@@ -417,12 +425,13 @@
         // get job
         Optional<WaylineJobDTO> waylineJob = this.getJobByJobId(jobId);
         if (waylineJob.isEmpty()) {
-            throw new IllegalArgumentException("Job doesn't exist.");
+            throw new IllegalArgumentException("计划任务不存在。");
         }
 
         boolean isOnline = deviceService.checkDeviceOnline(waylineJob.get().getDockSn());
         if (!isOnline) {
-            throw new RuntimeException("Dock is offline.");
+//            throw new RuntimeException("Dock is offline.");
+            throw new RuntimeException(CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg());
         }
 
         WaylineJobDTO job = waylineJob.get();
@@ -452,7 +461,8 @@
         log.info("下发-执行飞行任务-结果: {}", serviceReply.getResult());
 
         if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
-            log.info("Execute job ====> Error code: {}", serviceReply.getResult());
+            String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult());
+            log.info("Execute job ====> Error code: {},Error Msg:{}", serviceReply.getResult(), errorMsg);
             this.updateJob(WaylineJobDTO.builder()
                     .jobId(jobId)
                     .executeTime(LocalDateTime.now())
@@ -480,9 +490,9 @@
      * @throws IllegalArgumentException 如果任务状态不正确,抛出非法参数异常
      */
     @Override
-    public void cancelFlightTask(Collection<String> jobIds) {
+    public ResponseResult cancelFlightTask(Collection<String> jobIds) {
         List<WaylineJobDTO> waylineJobs = getJobsByConditions(jobIds, WaylineJobStatusEnum.PENDING);
-
+//        ResponseResult.error(errorCode, CommonErrorEnum.getMsgByCode(errorCode)));
 //        Set<String> waylineJobIds = waylineJobs.stream().map(WaylineJobDTO::getJobId).collect(Collectors.toSet());
 //        // Check if the task status is correct.
 //        boolean isErr = !jobIds.removeAll(waylineJobIds) || !jobIds.isEmpty();
@@ -492,13 +502,85 @@
 ////                    + Arrays.toString(jobIds.toArray()));
 //        }
 
-        // Group job id by dock sn.
+        // 按 dock sn 对作业 ID 进行分组。
         Map<String, List<String>> dockJobs = waylineJobs.stream()
                 .collect(Collectors.groupingBy(WaylineJobDTO::getDockSn,
                         Collectors.mapping(WaylineJobDTO::getJobId, Collectors.toList())));
-        dockJobs.forEach((dockSn, idList) -> this.publishCancelTask(dockSn, idList));
+//        dockJobs.forEach((dockSn, idList) -> this.publishCancelTask(dockSn, idList));
+        for(Map.Entry<String, List<String>> entry : dockJobs.entrySet()) {
+            String docksn = entry.getKey();
+            List<String> jobIdList = entry.getValue();
+           ResponseResult r =   publishCancelTask(docksn, jobIdList);
+           String a = r.getMessage();
+            return r ;
+        }
 
+        return ResponseResult.success();
     }
+
+// region 代码备份
+//    @Override
+//    public void cancelFlightTask(Collection<String> jobIds) {
+//        List<WaylineJobDTO> waylineJobs = getJobsByConditions(jobIds, WaylineJobStatusEnum.PENDING);
+//
+////        Set<String> waylineJobIds = waylineJobs.stream().map(WaylineJobDTO::getJobId).collect(Collectors.toSet());
+////        // Check if the task status is correct.
+////        boolean isErr = !jobIds.removeAll(waylineJobIds) || !jobIds.isEmpty();
+////        if (isErr) {
+////            throw new IllegalArgumentException("任务开始后,无法取消。" + Arrays.toString(jobIds.toArray()));
+//////            throw new IllegalArgumentException("These tasks have an incorrect status and cannot be canceled. "
+//////                    + Arrays.toString(jobIds.toArray()));
+////        }
+//
+//        // Group job id by dock sn.
+//        Map<String, List<String>> dockJobs = waylineJobs.stream()
+//                .collect(Collectors.groupingBy(WaylineJobDTO::getDockSn,
+//                        Collectors.mapping(WaylineJobDTO::getJobId, Collectors.toList())));
+//        dockJobs.forEach((dockSn, idList) -> this.publishCancelTask(dockSn, idList));
+//
+//    }
+
+//@Override
+//public void publishCancelTask(String dockSn, List<String> jobIds) {
+//
+//    boolean isOnline = deviceService.checkDeviceOnline(dockSn);
+//    if (!isOnline) {
+//        Integer errorCode = CommonErrorEnum.DEVICE_OFFLINE.getErrorCode();
+//
+//        //return ResponseResult.error(errorCode, CommonErrorEnum.getMsgByCode(errorCode)));
+//        throw new RuntimeException(CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg());
+//    }
+//    String topic = TopicConst.THING_MODEL_PRE + TopicConst.PRODUCT + dockSn + TopicConst.SERVICES_SUF;
+//
+//    CommonTopicResponse<Object> response = CommonTopicResponse.builder()
+//            .tid(UUID.randomUUID().toString())
+//            .bid(UUID.randomUUID().toString())
+//            .timestamp(System.currentTimeMillis())
+//            .data(Map.of(MapKeyConst.FLIGHT_IDS, jobIds))
+//            .method(WaylineMethodEnum.FLIGHT_TASK_CANCEL.getMethod())
+//            .build();
+//
+//    ServiceReply serviceReply = messageSender.publishWithReply(topic, response);
+//    if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
+//        String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult());
+//        log.info("取消飞行任务失败 ====> 设备sn: {}, 错误码: {}, {}", dockSn, serviceReply.getResult(), errorMsg);
+//        //throw new RuntimeException("Failed to cancel the wayline job of " + dockSn);
+//        throw new RuntimeException("设备:" + dockSn + "取消飞行任务失败,错误码:" + serviceReply.getResult() + "," + errorMsg);
+//    }
+//
+//    for (String jobId : jobIds) {
+//        this.updateJob(WaylineJobDTO.builder()
+//                .jobId(jobId)
+//                .status(WaylineJobStatusEnum.CANCEL.getVal())
+//                .completedTime(LocalDateTime.now())
+//                .build());
+//        RedisOpsUtils.zRemove(RedisConst.WAYLINE_JOB_TIMED_EXECUTE, RedisConst.DELIMITER + dockSn + RedisConst.DELIMITER + jobId);
+//        // 原流程是修改表中数据的status状态值,现在的精力是直接删除
+//        this.deleteTask(jobId);
+//    }
+//
+//}
+// endregion
 
     /**
      * 发布取消任务
@@ -508,10 +590,31 @@
      * @throws RuntimeException 如果设备离线或取消任务失败,则抛出运行时异常
      */
     @Override
-    public void publishCancelTask(String dockSn, List<String> jobIds) {
+    public ResponseResult publishCancelTask(String dockSn, List<String> jobIds) {
+        for(String jobId : jobIds) {
+            Optional<WaylineJobDTO> waylineJobDTO = this.getJobByJobId(jobId);
+            if (waylineJobDTO.isEmpty()) {
+                return ResponseResult.error("任务不存在,jobId: " + jobId);
+            }
+            if (waylineJobDTO.get().getTaskType() == 3) {
+                // 已经执行完的子任务一起全部删除
+                this.deleteTask(jobId);
+                log.info("删除循环任务已经完成,主任务ID:{}。", waylineJobDTO.get().getJobId());
+                List<WaylineJobDTO> waylineParentIds = this.getJobByJobParentId(jobId);
+                if (!waylineParentIds.isEmpty()) {
+                    for (WaylineJobDTO waylineJob : waylineParentIds) {
+                        this.deleteTask(waylineJob.getJobId());
+                        RedisOpsUtils.zRemove(RedisConst.WAYLINE_JOB_TIMED_EXECUTE, dockSn + RedisConst.DELIMITER + waylineJob.getJobId());
+                        log.info("删除循环子任务已经完成,子任务ID:{}。", waylineJob.getJobId());
+                    }
+                }
+                return ResponseResult.success();
+            }
+        }
         boolean isOnline = deviceService.checkDeviceOnline(dockSn);
         if (!isOnline) {
-            throw new RuntimeException("Dock is offline.");
+            Integer errorCode = CommonErrorEnum.DEVICE_OFFLINE.getErrorCode();
+            return ResponseResult.error(errorCode, CommonErrorEnum.getMsgByCode(errorCode));
         }
         String topic = TopicConst.THING_MODEL_PRE + TopicConst.PRODUCT + dockSn + TopicConst.SERVICES_SUF;
 
@@ -525,8 +628,9 @@
 
         ServiceReply serviceReply = messageSender.publishWithReply(topic, response);
         if (ResponseResult.CODE_SUCCESS != serviceReply.getResult()) {
-            log.info("Cancel job ====> Error code: {}", serviceReply.getResult());
-            throw new RuntimeException("Failed to cancel the wayline job of " + dockSn);
+            String errorMsg = CommonErrorEnum.getMsgByCode(serviceReply.getResult());
+            log.info("取消飞行任务失败 ====> 设备sn: {}, 错误码: {}, {}", dockSn, serviceReply.getResult(), errorMsg);
+            return ResponseResult.error(serviceReply.getResult(), errorMsg);
         }
 
         for (String jobId : jobIds) {
@@ -535,11 +639,11 @@
                     .status(WaylineJobStatusEnum.CANCEL.getVal())
                     .completedTime(LocalDateTime.now())
                     .build());
-            RedisOpsUtils.zRemove(RedisConst.WAYLINE_JOB_TIMED_EXECUTE, RedisConst.DELIMITER + dockSn + RedisConst.DELIMITER + jobId);
+            RedisOpsUtils.zRemove(RedisConst.WAYLINE_JOB_TIMED_EXECUTE, dockSn + RedisConst.DELIMITER + jobId);
             // 原流程是修改表中数据的status状态值,现在的精力是直接删除
             this.deleteTask(jobId);
         }
-
+        return ResponseResult.success();
     }
 
     @Override
@@ -559,7 +663,8 @@
     public List<WaylineJobDTO> getJobsByConditions(Collection<String> jobIds, WaylineJobStatusEnum status) {
         return mapper.selectList(
                         new LambdaQueryWrapper<WaylineJobEntity>()
-                                .eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal())
+                                // 不过滤状态,
+                                //.eq(Objects.nonNull(status), WaylineJobEntity::getStatus, status.getVal())
                                 .and(!CollectionUtils.isEmpty(jobIds),
                                         wrapper -> jobIds.forEach(id -> wrapper.eq(WaylineJobEntity::getJobId, id).or())))
                 .stream()
@@ -579,6 +684,18 @@
                 new LambdaQueryWrapper<WaylineJobEntity>()
                         .eq(WaylineJobEntity::getJobId, jobId));
         return Optional.ofNullable(entity2Dto(jobEntity));
+    }
+
+    public List<WaylineJobDTO> getJobByJobParentId(String parentId) {
+        List<WaylineJobEntity> jobEntities = mapper.selectList(
+                new LambdaQueryWrapper<WaylineJobEntity>()
+                        .eq(WaylineJobEntity::getParentId, parentId));
+        if (CollectionUtils.isEmpty(jobEntities)) {
+            return Collections.emptyList(); // 返回不可变空列表,更安全
+        }
+        return jobEntities.stream()
+                .map(this::entity2Dto) // 调用原有的单个转换方法
+                .collect(Collectors.toList());
     }
 
     /**
@@ -628,6 +745,7 @@
         Page<WaylineJobEntity> pageData = mapper.selectPage(
                 new Page<WaylineJobEntity>(page, pageSize),
                 new LambdaQueryWrapper<WaylineJobEntity>()
+                        .isNull(WaylineJobEntity::getParentId)
                         // 实际开始时间筛选,允许为空,为空则不进行筛选
                         .ge(startTime != null, WaylineJobEntity::getBeginTime, startTime)
                         .le(endTime != null, WaylineJobEntity::getBeginTime, endTime)
@@ -640,10 +758,14 @@
                         .ne(isComplete != null && !isComplete, WaylineJobEntity::getStatus, 3)
                         // 任务状态筛选,允许为空,为空则不进行筛选
                         .eq(status != null, WaylineJobEntity::getStatus, status)
-                        .orderByDesc(WaylineJobEntity::getId));
+                        .orderByDesc(WaylineJobEntity::getBeginTime));
         List<WaylineJobDTO> records = pageData.getRecords()
                 .stream()
                 .map(this::entity2Dto)
+                .peek(job -> {
+                    List<WaylineJobDTO> childOpt = this.getJobByJobParentId(job.getJobId());
+                    job.setChildren(childOpt);
+                })
                 .collect(Collectors.toList());
 
         return new PaginationData<WaylineJobDTO>(records, new Pagination(pageData));
@@ -657,6 +779,18 @@
                         .eq(parentId != null,WaylineJobEntity::getParentId,parentId)
                         .ne(WaylineJobEntity::getStatus, 3)
                 .orderByDesc(WaylineJobEntity::getId));
+    }
+
+    /**
+     * 获取所有待定状态的定时任务,未执行即将要执行的。
+     * */
+    public List<WaylineJobEntity> selectScheduledTaskList(){
+        // "1":"定时任务"
+        return mapper.selectList(new LambdaQueryWrapper<WaylineJobEntity>()
+                .eq(WaylineJobEntity::getTaskType, 1)
+                .eq(WaylineJobEntity::getStatus, WaylineJobStatusEnum.PENDING.getVal())
+                .gt(WaylineJobEntity::getBeginTime, System.currentTimeMillis())
+                .orderByDesc(WaylineJobEntity::getBeginTime));
     }
 
 
@@ -717,20 +851,22 @@
 
         // get file url
         URL url = null;
-        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath());
+        String minioUrl = subStringMinioUrlName(ardRouteOpt.getPath1());
         String md5 = "";
         try (InputStream inputStream = _ossService.getObject(kmzPath, minioUrl)) {
             md5 = DigestUtils.md5Hex(inputStream);
-            url = new URL(ardRouteOpt.getPath());
+            url = new URL(ardRouteOpt.getPath1());
             log.info("机场通过flightTaskResourceGet获取航线文件地址,jobId: " + jobId + " 返回信息为url:" + url.toString() + " md5:" + md5);
 //        }
 //        try {
 //            url = waylineFileService.getObjectUrl(waylineFile.get().getWaylineId());
 //            url = new URL(ardRouteOpt.getUpPath());
 
-            Map<String, Object> jsonResourceGet = new HashMap<>();
-            jsonResourceGet.put("url", url.toString());
-            jsonResourceGet.put("fingerprint", md5);
+//            Map<String, Object> jsonResourceGet = new HashMap<>();
+//            jsonResourceGet.put("url", url.toString().replace("https//192.168.10.103:9001", "http//192.168.10.103:9002"));
+//            jsonResourceGet.put("fingerprint", md5);
+//            .replace("https://", "http://")
+//            .replace("9001", "9011")
 
             builder.data(RequestsReply.success(WaylineTaskCreateDTO.builder()
                     .file(WaylineTaskFileDTO.builder()
@@ -738,12 +874,6 @@
                     .fingerprint(md5)
                     .build())
                     .build()));
-
-//            WaylineTaskFileDTO.builder()
-//                    .url(url.toString())
-////                            .fingerprint(waylineFile.get().getSign())
-//                    .fingerprint(md5)
-//                    .build()
 
         } catch (NullPointerException | IOException e) {
             e.printStackTrace();
@@ -794,7 +924,8 @@
                         .data(Map.of(MapKeyConst.FLIGHT_ID, jobId))
                         .build());
         if (ResponseResult.CODE_SUCCESS != reply.getResult()) {
-            throw new RuntimeException("Failed to set media job upload priority. Error Code: " + reply.getResult());
+            String errorMsg = CommonErrorEnum.getMsgByCode(reply.getResult());
+            throw new RuntimeException("未能设置媒体作业上传优先级. Error Code: " + reply.getResult() +", Error Msg: " + errorMsg);
         }
     }
 

--
Gitblit v1.9.3