| | |
| | | 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"); |
| | | boolean isM350RTK = M350_RTK.getValue().equals(ardRouteInfo.getUavRouteReq().getDroneType()); |
| | | |
| | | for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt")); |
| | | // 判断无人机类型 |
| | | if (ardRouteInfo.getUavRouteReq().getDroneType().equals(89)){ |
| | | // 调整航点高度 |
| | | adjustRoutePointHeight(routePointReq, altitudeOffset); |
| | | // 如果是M350_RTK无人机,处理变焦动作 |
| | | if (isM350RTK && routePointReq.getActionGroupList() != null) { |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | action.setZoom(divided_6(action.getZoom())); |
| | | if (actionGroupReq != null && actionGroupReq.getActions() != null) { |
| | | processZoomActions(actionGroupReq); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return ardRouteInfo; |
| | | } |
| | | |
| | | // 提取航点高度调整逻辑到方法中 |
| | | private void adjustRoutePointHeight(RoutePointReq routePointReq, double altitudeOffset) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + altitudeOffset); |
| | | } |
| | | |
| | | // 提取变焦值处理逻辑到方法中 |
| | | private void processZoomActions(ActionGroupReq actionGroupReq) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | if (action != null && action.getZoom() != null) { |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if (information.getPath() != null){ |
| | | ossService.deleteObject("kmz", subStringMinioUrlName(information.getPath())); |
| | | } |
| | | if (information.getPath1() != null){ |
| | | ossDockService.deleteObject("kmz", subStringMinioUrlName(information.getPath1())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | 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); |