|
@ -1,5 +1,8 @@ |
|
|
package org.dromara.sample.manage.service.impl; |
|
|
package org.dromara.sample.manage.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
import org.dromara.common.rocketmq.producer.MessageProducerUtil; |
|
|
import org.dromara.common.rocketmq.producer.MessageProducerUtil; |
|
|
import org.dromara.common.sdk.cloudapi.device.DeviceDomainEnum; |
|
|
import org.dromara.common.sdk.cloudapi.device.DeviceDomainEnum; |
|
|
import org.dromara.common.sdk.cloudapi.device.VideoId; |
|
|
import org.dromara.common.sdk.cloudapi.device.VideoId; |
|
@ -8,9 +11,12 @@ import org.dromara.common.sdk.cloudapi.livestream.api.AbstractLivestreamService; |
|
|
import org.dromara.common.sdk.cloudapi.wayline.FlighttaskProgress; |
|
|
import org.dromara.common.sdk.cloudapi.wayline.FlighttaskProgress; |
|
|
import org.dromara.common.sdk.common.HttpResultResponse; |
|
|
import org.dromara.common.sdk.common.HttpResultResponse; |
|
|
import org.dromara.common.sdk.common.SDKManager; |
|
|
import org.dromara.common.sdk.common.SDKManager; |
|
|
|
|
|
import org.dromara.common.sdk.mqtt.CommonTopicRequest; |
|
|
|
|
|
import org.dromara.common.sdk.mqtt.MqttGatewayPublish; |
|
|
import org.dromara.common.sdk.mqtt.services.ServicesReplyData; |
|
|
import org.dromara.common.sdk.mqtt.services.ServicesReplyData; |
|
|
import org.dromara.common.sdk.mqtt.services.TopicServicesResponse; |
|
|
import org.dromara.common.sdk.mqtt.services.TopicServicesResponse; |
|
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
|
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
|
|
|
|
|
import org.dromara.sample.feign.RemoteSystemFeign; |
|
|
import org.dromara.sample.manage.model.dto.*; |
|
|
import org.dromara.sample.manage.model.dto.*; |
|
|
import org.dromara.sample.manage.model.entity.DeviceEntity; |
|
|
import org.dromara.sample.manage.model.entity.DeviceEntity; |
|
|
import org.dromara.sample.manage.model.param.DeviceQueryParam; |
|
|
import org.dromara.sample.manage.model.param.DeviceQueryParam; |
|
@ -49,6 +55,8 @@ public class LiveStreamServiceImpl implements ILiveStreamService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private AbstractLivestreamService abstractLivestreamService; |
|
|
private AbstractLivestreamService abstractLivestreamService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private MqttGatewayPublish gatewayPublish; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private IPlayTextService playTextService; |
|
|
private IPlayTextService playTextService; |
|
@ -59,6 +67,9 @@ public class LiveStreamServiceImpl implements ILiveStreamService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IWaylineJobService waylineJobService; |
|
|
private IWaylineJobService waylineJobService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private RemoteSystemFeign remoteSystemFeign; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<CapacityDeviceDTO> getLiveCapacity(String workspaceId) { |
|
|
public List<CapacityDeviceDTO> getLiveCapacity(String workspaceId) { |
|
|
|
|
|
|
|
@ -134,15 +145,32 @@ public class LiveStreamServiceImpl implements ILiveStreamService { |
|
|
Optional<EventsReceiver<FlighttaskProgress>> runningWaylineJob = waylineRedisService.getRunningWaylineJob(deviceBySn.getDeviceSn()); |
|
|
Optional<EventsReceiver<FlighttaskProgress>> runningWaylineJob = waylineRedisService.getRunningWaylineJob(deviceBySn.getDeviceSn()); |
|
|
Map<String,Object> reqMap = new HashMap<>(); |
|
|
Map<String,Object> reqMap = new HashMap<>(); |
|
|
if(runningWaylineJob.isPresent()) { |
|
|
if(runningWaylineJob.isPresent()) { |
|
|
|
|
|
//开启ai推流
|
|
|
|
|
|
List<String> deviceSn = remoteSystemFeign.selectStreamType(deviceBySn.getDeviceSn()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(deviceSn)){ |
|
|
ILivestreamUrl iLivestreamUrl = LiveStreamProperty.get(UrlTypeEnum.RTMP); |
|
|
ILivestreamUrl iLivestreamUrl = LiveStreamProperty.get(UrlTypeEnum.RTMP); |
|
|
String jobId = runningWaylineJob.get().getOutput().getExt().getFlightId(); |
|
|
String jobId = runningWaylineJob.get().getOutput().getExt().getFlightId(); |
|
|
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(jobId); |
|
|
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(jobId); |
|
|
reqMap.put("jobId",waylineJobDTO.get().getJobId()); |
|
|
reqMap.put("jobId",waylineJobDTO.get().getJobId()); |
|
|
reqMap.put("jobName",waylineJobDTO.get().getJobName()); |
|
|
reqMap.put("jobName",waylineJobDTO.get().getJobName()); |
|
|
reqMap.put("deviceSn",deviceBySn.getDeviceSn()); |
|
|
reqMap.put("deviceSn",deviceBySn.getDeviceSn()); |
|
|
reqMap.put("videoId",liveParam.getVideoId().toString()); |
|
|
reqMap.put("videoId",liveParam.getVideoId().getDroneSn().toString()+"-"+liveParam.getVideoId().getPayloadIndex().toString()); |
|
|
reqMap.put("url",iLivestreamUrl.toString()); |
|
|
reqMap.put("url",iLivestreamUrl.toString()); |
|
|
playTextService.streamType(reqMap); |
|
|
playTextService.streamType(reqMap); |
|
|
|
|
|
for (String s : deviceSn){ |
|
|
|
|
|
String[] split = s.split(","); |
|
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
|
list.add(split[2]); |
|
|
|
|
|
DisobeyDTO disobeyDTO = new DisobeyDTO(); |
|
|
|
|
|
disobeyDTO.setUrl("http://114.235.183.163"); |
|
|
|
|
|
disobeyDTO.setOpen(1); |
|
|
|
|
|
disobeyDTO.setType(list); |
|
|
|
|
|
disobeyDTO.setRtmpUrl(liveParam.getVideoId().getDroneSn().toString()+"-"+liveParam.getVideoId().getPayloadIndex().toString()); |
|
|
|
|
|
gatewayPublish.publish("task/image/disobey/smoke",new CommonTopicRequest<>() |
|
|
|
|
|
.setData(Objects.requireNonNull(disobeyDTO)),1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -156,10 +184,25 @@ public class LiveStreamServiceImpl implements ILiveStreamService { |
|
|
if (HttpResultResponse.CODE_SUCCESS != responseResult.getCode()) { |
|
|
if (HttpResultResponse.CODE_SUCCESS != responseResult.getCode()) { |
|
|
return responseResult; |
|
|
return responseResult; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TopicServicesResponse<ServicesReplyData> response = abstractLivestreamService.liveStopPush( |
|
|
TopicServicesResponse<ServicesReplyData> response = abstractLivestreamService.liveStopPush( |
|
|
SDKManager.getDeviceSDK(responseResult.getData().getDeviceSn()), new LiveStopPushRequest() |
|
|
SDKManager.getDeviceSDK(responseResult.getData().getDeviceSn()), new LiveStopPushRequest() |
|
|
.setVideoId(videoId)); |
|
|
.setVideoId(videoId)); |
|
|
|
|
|
// //关闭ai推流
|
|
|
|
|
|
// List<String> deviceSn = remoteSystemFeign.selectStreamType(responseResult.getData().getDeviceSn());
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(deviceSn)){
|
|
|
|
|
|
// for (String s : deviceSn){
|
|
|
|
|
|
// List<String> list = new ArrayList<>();
|
|
|
|
|
|
// list.add(s);
|
|
|
|
|
|
// DisobeyDTO disobeyDTO = new DisobeyDTO();
|
|
|
|
|
|
// disobeyDTO.setUrl(s);
|
|
|
|
|
|
// disobeyDTO.setOpen(2);
|
|
|
|
|
|
// disobeyDTO.setType(list);
|
|
|
|
|
|
// disobeyDTO.setRtmpUrl(videoId.toString());
|
|
|
|
|
|
// gatewayPublish.publish("task/image/disobey/smoke",new CommonTopicRequest<>()
|
|
|
|
|
|
// .setData(Objects.requireNonNull(disobeyDTO)),1);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (!response.getData().getResult().isSuccess()) { |
|
|
if (!response.getData().getResult().isSuccess()) { |
|
|
return HttpResultResponse.error(response.getData().getResult()); |
|
|
return HttpResultResponse.error(response.getData().getResult()); |
|
|
} |
|
|
} |
|
|