| | |
| | | package com.ard.route.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.ard.common.exception.ControlException; |
| | |
| | | import com.ard.data.noflyzone.service.IArdNoFlyZoneService; |
| | | import com.ard.data.noflyzone.utils.NoFlyZoneUtils; |
| | | import com.ard.framework.web.service.TokenService; |
| | | import com.ard.inspection.domain.ArdPointCloud; |
| | | import com.ard.inspection.mapper.ArdPointCloudMapper; |
| | | import com.ard.oss.model.MinioUploadResult; |
| | | import com.ard.oss.service.impl.OssServiceContext; |
| | | import com.ard.route.domain.djuav.ActionGroupReq; |
| | |
| | | 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.ArdRouteCloud; |
| | | import com.ard.route.domain.route.ArdRouteInfo; |
| | | import com.ard.route.domain.route.ArdRouteMission; |
| | | import com.ard.route.domain.vo.KmzResultVo; |
| | | import com.ard.route.mapper.ArdRouteCloudMapper; |
| | | import com.ard.route.mapper.ArdRouteInfoMapper; |
| | | import com.ard.route.mapper.ArdRouteMissionMapper; |
| | | import com.ard.route.service.IArdRouteInfoService; |
| | |
| | | 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.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; |
| | |
| | | @Autowired |
| | | private ArdRouteMissionMapper ardRouteMissionMapper; |
| | | |
| | | @Autowired |
| | | private ArdPointCloudMapper ardPointCloudMapper; |
| | | |
| | | @Autowired |
| | | private ArdRouteCloudMapper ardRouteCloudMapper; |
| | | |
| | | @Resource |
| | | private IArdNoFlyZoneService ardNoFlyZoneService; |
| | | |
| | |
| | | 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())); |
| | | } |
| | | } |
| | | } catch (IOException | ClassNotFoundException e) { |
| | |
| | | if (ardRouteInfo.getGroupId() == null){ |
| | | ardRouteInfo.setGroupId("0"); |
| | | } |
| | | if ("3".equals(ardRouteInfo.getType())){ |
| | | ardRouteInfo.getUavRouteReq().setHeightMode("EGM96"); |
| | | }else { |
| | | ardRouteInfo.getUavRouteReq().setHeightMode("relativeToStartPoint"); |
| | | } |
| | | ardRouteInfo.getUavRouteReq().setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | KmzResultVo kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(),ardRouteInfo.getName()); |
| | | zoomProcessing(ardRouteInfo); |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | ardRouteInfo.setReadOnly("0"); |
| | | insertRoutePointCloud(ardRouteInfo); |
| | | ardRouteInfoMapper.insertArdRouteInfo(dataProcessing(ardRouteInfo)); |
| | | return kmzResult.getPath(); |
| | | } |
| | | |
| | | /** |
| | | * 新增航信信息时,修改点云数据 |
| | | * 同时增加航线与点云关联关系表数据 |
| | | */ |
| | | private void insertRoutePointCloud(ArdRouteInfo ardRouteInfo) { |
| | | List<ArdRouteCloud> cloudList = new ArrayList<>(); |
| | | if (ardRouteInfo.getArdPointCloudList() != null){ |
| | | for (ArdPointCloud cloudId : ardRouteInfo.getArdPointCloudList()) { |
| | | ArdRouteCloud cloud = new ArdRouteCloud(); |
| | | cloud.setRouteId(ardRouteInfo.getId()); |
| | | cloud.setCloudId(cloudId.getId()); |
| | | cloudId.setAssociatedState("1"); |
| | | cloudList.add(cloud); |
| | | cloudId.setUpdateTime(DateUtils.getNowDate()); |
| | | ardPointCloudMapper.updateArdPointCloud(cloudId); |
| | | } |
| | | ardRouteCloudMapper.batchRouteCloud(cloudList); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | 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())); |
| | | } |
| | | } |
| | | } |
| | |
| | | private ArdRouteInfo dataProcessing(ArdRouteInfo ardRouteInfo) { |
| | | // 航线数据 |
| | | byte[] routeData = null; |
| | | byte[] cloudData = null; |
| | | try { |
| | | if (ardRouteInfo.getUavRouteReq() != null){ |
| | | routeData = serialize(ardRouteInfo.getUavRouteReq()); |
| | | } |
| | | if (ardRouteInfo.getArdPointCloudList() != null){ |
| | | cloudData = serialize(ardRouteInfo.getArdPointCloudList()); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | ardRouteInfo.setRouteData(routeData); |
| | | ardRouteInfo.setCloudData(cloudData); |
| | | ardRouteInfo.setPointCount(getPointCount(ardRouteInfo)); |
| | | return ardRouteInfo; |
| | | } |
| | |
| | | ArdRouteInfo route = ardRouteInfoMapper.selectArdRouteInfoById(id); |
| | | try { |
| | | route.setUavRouteReq((UavRouteReq) deserialize(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); |