| | |
| | | import com.ard.data.noflyzone.utils.NoFlyZoneUtils; |
| | | 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 com.ard.route.domain.djuav.UavRouteReq; |
| | | import com.ard.route.domain.dto.ArdNoflyDto; |
| | | import com.ard.route.domain.route.ArdRouteInfo; |
| | | import com.ard.route.domain.sixhe.ArdRouteChange; |
| | | import com.ard.route.domain.vo.KmzResultVo; |
| | | import com.ard.route.mapper.ArdRouteInfoMapper; |
| | | import com.ard.route.service.IArdRouteInfoService; |
| | | import com.ard.route.service.UavRouteService; |
| | | import com.ard.work.domain.cache.UavWaylineCache; |
| | | import com.ard.work.domain.dto.state.PointData; |
| | | import com.ard.work.domain.dto.wayline.*; |
| | | import com.ard.work.service.ITyService; |
| | |
| | | |
| | | @Autowired |
| | | private OssServiceContext ossService; |
| | | |
| | | @Autowired |
| | | private OssDockServiceContext ossDockService; |
| | | |
| | | @Autowired |
| | | private UavRouteService routeService; |
| | |
| | | KmzResultVo kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(), ardRouteInfo.getName()); |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | ardRouteInfo.setReadOnly("0"); |
| | | ardRouteInfo.setPointCount(getPointCount(ardRouteInfo)); |
| | | ardRouteInfoMapper.insertArdRouteInfo(ardRouteInfo); |
| | | return kmzResult.getPath(); |
| | | } |
| | |
| | | } |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | } |
| | | ardRouteInfo.setPointCount(getPointCount(ardRouteInfo)); |
| | | return ardRouteInfoMapper.updateArdRouteInfo(ardRouteInfo); |
| | | } |
| | | |
| | | private Integer getPointCount(ArdRouteInfo ardRouteInfo) { |
| | | if (ardRouteInfo.getUavRouteReq().getRoutePointList() != null) { |
| | | return ardRouteInfo.getUavRouteReq().getRoutePointList().size(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | for (String id : ids) { |
| | | ArdRouteInfo information = ardRouteInfoMapper.selectArdRouteInfoById(id); |
| | | ossService.deleteObject("kmz", subStringMinioUrlName(information.getPath())); |
| | | ossDockService.deleteObject("kmz", subStringMinioUrlName(information.getPath1())); |
| | | } |
| | | return ardRouteInfoMapper.deleteArdRouteInfoByIds(ids); |
| | | } |
| | |
| | | public MinioUploadResult uploadArdRouteInfo(MultipartFile file) { |
| | | try { |
| | | String url = ossService.upload("kmz",file); |
| | | String urlDock = ossDockService.upload("kmz",file); |
| | | ArdRouteInfo information = new ArdRouteInfo(); |
| | | information.setName(file.getOriginalFilename()); |
| | | information.setPath(url); |
| | | information.setPath1(urlDock); |
| | | information.setGroupId("0"); // 默认分组 |
| | | information.setReadOnly("1"); // 默认只读 |
| | | // 生成kmz文件实体类加工 |
| | | |
| | | // 增加航线实体类信息 |
| | | insertRouteInfomation(information); |
| | | return MinioUploadResult.builder() |
| | | .url(url) |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据文件名称查询航线信息 |
| | | * 根据名称查询航线信息 |
| | | * |
| | | * @param name 文件名称 |
| | | * @return 结果 |
| | |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | // 1.2通过minio获取航线信息 |
| | | // 2.将航线信息转换成对应实体类 |
| | | WayLineUploadDTO wayLineUploadDTO = buildWayLineUploadDTO(route); |
| | | // 3.调用接口 |
| | | wayLineUploadDTO.setBoxSn(boxSn); |
| | | // 3.缓存航线信息 |
| | | WaylineInfo WaylineInfo = new WaylineInfo(); |
| | | WaylineInfo.setBoxSn(boxSn); |
| | | WaylineInfo.setWaylineId(route.getId()); |
| | | UavWaylineCache.put(WaylineInfo); |
| | | // 4.调用接口 |
| | | tyService.wayLineUpload(wayLineUploadDTO); |
| | | return true; |
| | | } |
| | |
| | | String exitOnRcLostAction = ardRouteInfo.getUavRouteReq().getExitOnRcLostAction(); //0 |
| | | |
| | | PlanLineData planLineData = new PlanLineData(); |
| | | |
| | | |
| | | |
| | | if (finishAction != null){ |
| | | planLineData.setLoseAction(0); |
| | | } |
| | | if (autoFlightSpeed != null){ |
| | | planLineData.setAutoSpeed(8); |
| | | } |
| | | if (globalTransitionalSpeed != null){ |
| | | planLineData.setMaxSpeed(15); |
| | | } |
| | | planLineData.setMaxSpeed(15); |
| | | // if (globalTransitionalSpeed != null){ |
| | | // planLineData.setMaxSpeed(15); |
| | | // } |
| | | if (exitOnRcLostAction != null){ |
| | | planLineData.setFinishedAction(1); |
| | | } |
| | |
| | | if (height != null){ |
| | | pointData.setHeight(height.floatValue()); |
| | | } |
| | | Double longitude = routePointReq.getLatitude(); |
| | | Double longitude = routePointReq.getLongitude(); |
| | | if (longitude != null){ |
| | | pointData.setLng(longitude.floatValue()); |
| | | } |
| | | Double latitude = routePointReq.getLongitude(); |
| | | Double latitude = routePointReq.getLatitude(); |
| | | if (latitude != null){ |
| | | pointData.setLat(latitude.floatValue()); |
| | | } |
| | |
| | | private void insertRouteInfomation(ArdRouteInfo ardRouteInfo){ |
| | | ardRouteInfo.setId(IdUtils.simpleUUID()); |
| | | ardRouteInfo.setCreateTime(DateUtils.getNowDate()); |
| | | ardRouteInfo.setUpdateTime(DateUtils.getNowDate()); |
| | | ardRouteInfoMapper.insertArdRouteInfo(ardRouteInfo); |
| | | } |
| | | |