|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import com.dji.sample.component.mqtt.model.EventsReceiver;
|
|
|
import com.dji.sample.manage.model.dto.OsdDroneDTO;
|
|
|
import com.dji.sample.map.model.dto.FlightTrackDTO;
|
|
|
+import com.dji.sample.wayline.model.dto.WaylineJobDTO;
|
|
|
import com.dji.sample.wayline.model.enums.WaylineJobStatusEnum;
|
|
|
import com.dji.sample.wayline.service.IWaylineRedisService;
|
|
|
import com.dji.sdk.cloudapi.property.DockDroneCommanderFlightHeight;
|
|
|
@@ -86,6 +87,8 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
@Autowired
|
|
|
private IWaylineRedisService waylineRedisService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public TopicStatusResponse<MqttReply> updateTopoOnline(TopicStatusRequest<UpdateTopo> request, MessageHeaders headers) {
|
|
|
UpdateTopoSubDevice updateTopoSubDevice = request.getData().getSubDevices().get(0);
|
|
|
@@ -208,7 +211,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
log.info("=============获取机库飞机OSD信息:" + request.getData());
|
|
|
deviceRedisService.setDeviceOsd(from, request.getData());
|
|
|
|
|
|
- OsdDroneDTO data = toDroneDto(request.getData());
|
|
|
+
|
|
|
deviceService.pushOsdDataToWeb(device.getWorkspaceId(), BizCodeEnum.DEVICE_OSD, from, request.getData());
|
|
|
//添加航点轨迹信息
|
|
|
String jobId = null;
|
|
|
@@ -221,6 +224,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
.orElse(null);
|
|
|
log.info("======FlightId:" + jobId);
|
|
|
}
|
|
|
+ OsdDroneDTO data = toDroneDto(request.getData());
|
|
|
toAddFilghtPoint(from, device, data,jobId);
|
|
|
}
|
|
|
|
|
|
@@ -269,6 +273,17 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
|
|
|
deviceRedisService.setDeviceOnline(device);
|
|
|
deviceRedisService.setDeviceOsd(from, request.getData());
|
|
|
+ //添加航点轨迹信息
|
|
|
+ String jobId = null;
|
|
|
+ Optional<EventsReceiver<FlighttaskProgress>> runningDataOpt = waylineRedisService.getRunningWaylineJob(request.getGateway());
|
|
|
+ if (runningDataOpt.isPresent()) {
|
|
|
+ log.info("======jobId getSn:" + runningDataOpt.map(EventsReceiver::getSn).get());
|
|
|
+ jobId = runningDataOpt.map(EventsReceiver::getOutput)
|
|
|
+ .map(FlighttaskProgress::getExt)
|
|
|
+ .map(FlighttaskProgressExt::getFlightId)
|
|
|
+ .orElse(null);
|
|
|
+ log.info("======FlightId:" + jobId);
|
|
|
+ }
|
|
|
OsdDroneDTO data = toDroneDto(request.getData());
|
|
|
deviceService.pushOsdDataToPilot(device.getWorkspaceId(), from,
|
|
|
new DeviceOsdHost()
|
|
|
@@ -282,7 +297,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
.setVerticalSpeed(data.getVerticalSpeed()));
|
|
|
deviceService.pushOsdDataToWeb(device.getWorkspaceId(), BizCodeEnum.DEVICE_OSD, from, data);
|
|
|
//添加航点轨迹信息
|
|
|
- toAddFilghtPoint(from, device, data,null);
|
|
|
+ toAddFilghtPoint(from, device, data,jobId);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -308,7 +323,12 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
}
|
|
|
log.info("==============创建飞行任务====:" + data.toString());
|
|
|
deviceRedisService.setDroneFlightTaskLock(device.getDeviceSn());
|
|
|
- flightTask = createFlightTask(device);
|
|
|
+ String templateType = null;
|
|
|
+ if(null != jobId) {
|
|
|
+ Optional<WaylineJobDTO> waylineJobDTO = waylineRedisService.getConditionalWaylineJob(jobId);
|
|
|
+ templateType = waylineJobDTO.get().getWaylineType().getType();
|
|
|
+ }
|
|
|
+ flightTask = createFlightTask(device,templateType);
|
|
|
}
|
|
|
//添加飞行轨迹
|
|
|
addFlightPoint(flightTask, device,data,false);
|
|
|
@@ -501,7 +521,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
return flightTaskDTO;
|
|
|
}
|
|
|
|
|
|
- private FlightTaskDTO createFlightTask(DeviceDTO device) {
|
|
|
+ private FlightTaskDTO createFlightTask(DeviceDTO device,String templateType) {
|
|
|
Date curTime = new Date();
|
|
|
String taskName = getTaskName(curTime, device.getDeviceSn());
|
|
|
return flightTaskService.createFlightTask(FlightTaskEntity.builder()
|
|
|
@@ -511,6 +531,7 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
.deviceName(device.getDeviceName())
|
|
|
.payload(device.getPayloadsList() == null ? null : device.getPayloadsList().get(0).getPayloadName())
|
|
|
.beginTime(curTime.getTime())
|
|
|
+ .templateType(templateType)
|
|
|
.createTime(curTime.getTime())
|
|
|
.username(UserRequest.getCurrentUser() != null ? UserRequest.getCurrentUser().getUsername() : "system")
|
|
|
.build());
|
|
|
@@ -874,7 +895,6 @@ public class SDKDeviceService extends AbstractDeviceService {
|
|
|
dto.setHorizontalSpeed(osdDockDrone.getHorizontalSpeed());
|
|
|
dto.setWindDirection(osdDockDrone.getWindDirection());
|
|
|
}
|
|
|
-
|
|
|
return dto;
|
|
|
}
|
|
|
|