| | |
| | | import com.ard.work.service.ITyService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import javax.annotation.Resource; |
| | | import static com.ard.route.enums.kml.DroneEnumValueEnums.M30_M30T; |
| | | import static com.ard.route.enums.kml.DroneEnumValueEnums.M350_RTK; |
| | | import static com.ard.route.util.InitializationUtils.divided_23; |
| | | import static com.ard.route.util.InitializationUtils.divided23; |
| | | import static com.ard.route.util.ToolUtils.*; |
| | | import static com.ard.route.util.UavRouteReqUtils.buildWayLineUploadDTO; |
| | | import static com.ard.route.util.UavRouteReqUtils.fileConversionEntity; |
| | |
| | | ArdRouteInfo ardRouteInfo = ardRouteInfoMapper.selectArdRouteInfoById(id); |
| | | try { |
| | | if (ardRouteInfo != null) { |
| | | if (ardRouteInfo.getRouteData() != null){ |
| | | ardRouteInfo.setUavRouteReq((UavRouteReq) deserialize(ardRouteInfo.getRouteData())); |
| | | if ("3".equals(ardRouteInfo.getType())) { |
| | | if (ardRouteInfo.getRouteData() != null){ |
| | | UavRouteReq uavRouteReq = new UavRouteReq(); |
| | | BeanUtils.copyProperties(deserialize(ardRouteInfo.getRouteData()), uavRouteReq); |
| | | ardRouteInfo.setUavRouteReq(uavRouteReq); |
| | | } |
| | | } else { |
| | | if (ardRouteInfo.getRouteData() != null){ |
| | | ardRouteInfo.setUavRouteReq((UavRouteReq) deserialize(ardRouteInfo.getRouteData())); |
| | | } |
| | | } |
| | | if (ardRouteInfo.getCloudData() != null){ |
| | | ardRouteInfo.setArdPointCloudList(deserializeLs(ardRouteInfo.getCloudData())); |
| | | } |
| | | } |
| | |
| | | if (ardRouteInfo.getGroupId() == null){ |
| | | ardRouteInfo.setGroupId("0"); |
| | | } |
| | | ardRouteInfo.getUavRouteReq().setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | KmzResultVo kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(),ardRouteInfo.getName()); |
| | | if ("3".equals(ardRouteInfo.getType())){ |
| | | ardRouteInfo.getUavRouteReq().setHeightMode("EGM96"); |
| | | }else { |
| | | ardRouteInfo.getUavRouteReq().setHeightMode("relativeToStartPoint"); |
| | | } |
| | | UavRouteReq uavRouteReq = ardRouteInfo.getUavRouteReq(); |
| | | uavRouteReq.setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | // 机场1:M30/M30T 需保留 aircraft 中的子类型(0-67-0 / 0-67-1), |
| | | // 否则 M30T 会按 M30 生成 KMZ(payload 52 而非 53) |
| | | if (M30_M30T.getValue().equals(uavRouteReq.getDroneType())) { |
| | | uavRouteReq.setSubDroneType(subStringSubDroneType(ardRouteInfo.getAircraft())); |
| | | } |
| | | KmzResultVo kmzResult = routeService.buildKmz(uavRouteReq,ardRouteInfo.getName()); |
| | | zoomProcessing(ardRouteInfo); |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | ardRouteInfo.setReadOnly("0"); |
| | |
| | | // 先删除航线 |
| | | delOssService(route); |
| | | // 再生成航线 |
| | | ardRouteInfo.getUavRouteReq().setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | UavRouteReq uavRouteReq = ardRouteInfo.getUavRouteReq(); |
| | | uavRouteReq.setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | // 机场1:M30T(0-67-1) 需同步子类型,避免编辑后按 M30 重新生成 KMZ |
| | | if (M30_M30T.getValue().equals(uavRouteReq.getDroneType())) { |
| | | uavRouteReq.setSubDroneType(subStringSubDroneType(ardRouteInfo.getAircraft())); |
| | | } |
| | | zoomProcessing(ardRouteInfo); |
| | | kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(), ardRouteInfo.getName()); |
| | | kmzResult = routeService.buildKmz(uavRouteReq, ardRouteInfo.getName()); |
| | | if ("更新航线kmz文件失败".equals(kmzResult.getData())) { |
| | | return 0; |
| | | } |
| | |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | if (action.getZoom() != null){ |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | action.setZoom(divided23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | |
| | | ArdRouteInfo route = ardRouteInfoMapper.selectArdRouteInfoById(id); |
| | | try { |
| | | route.setUavRouteReq((UavRouteReq) deserialize(route.getRouteData())); |
| | | route.setArdPointCloudList(deserializeLs(route.getRouteData())); |
| | | if (route.getCloudData() != null){ |
| | | route.setArdPointCloudList(deserializeLs(route.getCloudData())); |
| | | } |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | WaylineInfo WaylineInfo = new WaylineInfo(); |
| | | WaylineInfo.setBoxSn(boxSn); |
| | | WaylineInfo.setWaylineId(route.getId()); |
| | | WaylineInfo.setRouteName(route.getName()); |
| | | UavWaylineCache.put(WaylineInfo); |
| | | // 4.调用接口 |
| | | tyService.wayLineUpload(wayLineUploadDTO); |