| | |
| | | import com.ard.framework.web.service.TokenService; |
| | | import com.ard.oss.model.MinioUploadResult; |
| | | import com.ard.oss.service.impl.OssServiceContext; |
| | | import com.ard.ossdock.service.impl.OssDockServiceContext; |
| | | import com.ard.route.domain.djuav.ActionGroupReq; |
| | | import com.ard.route.domain.djuav.PointActionReq; |
| | | import com.ard.route.domain.djuav.RoutePointReq; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import static com.ard.route.util.InitializationUtils.divided_6; |
| | | 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.ToolUtils.*; |
| | | import static com.ard.route.util.UavRouteReqUtils.fileConversionEntity; |
| | | |
| | |
| | | @Autowired |
| | | private OssServiceContext ossService; |
| | | |
| | | @Autowired |
| | | private OssDockServiceContext ossDockService; |
| | | |
| | | @Autowired |
| | | private UavRouteService routeService; |
| | |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | // 主逻辑优化 |
| | | double altitudeOffset = getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(), "alt"); |
| | | |
| | | for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt")); |
| | | // 判断无人机类型 |
| | | if (ardRouteInfo.getUavRouteReq().getDroneType().equals(89)){ |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | action.setZoom(divided_6(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | // 调整航点高度 |
| | | adjustRoutePointHeight(routePointReq, altitudeOffset); |
| | | } |
| | | return ardRouteInfo; |
| | | } |
| | | |
| | | // 提取航点高度调整逻辑到方法中 |
| | | private void adjustRoutePointHeight(RoutePointReq routePointReq, double altitudeOffset) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + altitudeOffset); |
| | | } |
| | | |
| | | /** |
| | |
| | | }else if ("0".equals(ardRouteInfo.getOrderByTime())) { |
| | | ardRouteInfo.setOrderByTime("ASC"); |
| | | } |
| | | // List<ArdRouteInfo> list = ardRouteInfoMapper.selectArdRouteInfoList(ardRouteInfo); |
| | | // for (ArdRouteInfo routeInfo : list) { |
| | | // for (RoutePointReq routePointReq : routeInfo.getUavRouteReq().getRoutePointList()) { |
| | | // routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt")); |
| | | // } |
| | | // } |
| | | return ardRouteInfoMapper.selectArdRouteInfoList(ardRouteInfo); |
| | | } |
| | | |
| | |
| | | } |
| | | ardRouteInfo.getUavRouteReq().setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | KmzResultVo kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(),ardRouteInfo.getName()); |
| | | if (M350_RTK.getValue().equals(ardRouteInfo.getUavRouteReq().getDroneType())) { |
| | | // 变焦数值加工 |
| | | for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) { |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | if (action.getZoom() != null){ |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | ardRouteInfo.setReadOnly("0"); |
| | | ardRouteInfoMapper.insertArdRouteInfo(dataProcessing(ardRouteInfo)); |
| | |
| | | if (information.getPath() != null){ |
| | | ossService.deleteObject("kmz", subStringMinioUrlName(information.getPath())); |
| | | } |
| | | if (information.getPath1() != null){ |
| | | ossDockService.deleteObject("kmz", subStringMinioUrlName(information.getPath1())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | ardRouteInfo.setType(templateTypeData(uavRouteReq)); |
| | | ardRouteInfo.setAircraft(droneTypeData(uavRouteReq)); |
| | | } |
| | | |
| | | // 判断禁飞区 |
| | | try { |
| | | arrayWithinNoFlyZone(ardRouteInfo.getUavRouteReq().getRoutePointList()); |
| | | } catch (ControlException e) { |
| | | // 返回包含禁飞区错误信息的特定结果 |
| | | return MinioUploadResult.builder() |
| | | .originalFilename("禁飞区错误.航线航点在禁飞区!") |
| | | .build(); |
| | | } |
| | | |
| | | String url = ossService.upload("kmz",file); |
| | | String urlDock = ossDockService.upload("kmz",file); |
| | | ardRouteInfo.setName(file.getOriginalFilename()); |
| | | ardRouteInfo.setPath(url); |
| | | ardRouteInfo.setPath1(urlDock); |
| | | ardRouteInfo.setGroupId("0"); // 默认分组 |
| | | ardRouteInfo.setReadOnly("1"); // 默认只读 |
| | | insertRouteInfomation(ardRouteInfo); |
| | |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | // 判断禁飞区 |
| | | try { |
| | | arrayWithinNoFlyZone(route.getUavRouteReq().getRoutePointList()); |
| | | } catch (ControlException e) { |
| | | log.error("禁飞区错误.航线航点在禁飞区!", e); |
| | | // 返回包含禁飞区错误信息的特定结果 |
| | | return false; |
| | | } |
| | | |
| | | arrayWithinNoFlyZone(route.getUavRouteReq().getRoutePointList()); |
| | | // 1.2通过minio获取航线信息 |
| | | // 2.将航线信息转换成对应实体类 |
| | | WayLineUploadDTO wayLineUploadDTO = buildWayLineUploadDTO(route); |