|
@ -7,12 +7,26 @@ import org.dromara.common.sdk.cloudapi.device.VideoId; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.LensChangeVideoTypeEnum; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.LensChangeVideoTypeEnum; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.UrlTypeEnum; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.UrlTypeEnum; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.VideoQualityEnum; |
|
|
import org.dromara.common.sdk.cloudapi.livestream.VideoQualityEnum; |
|
|
|
|
|
import org.dromara.common.sdk.cloudapi.wayline.FlighttaskProgress; |
|
|
|
|
|
import org.dromara.common.sdk.common.HttpResultResponse; |
|
|
|
|
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
|
|
|
|
|
import org.dromara.sample.manage.model.dto.DeviceDTO; |
|
|
|
|
|
import org.dromara.sample.manage.model.dto.LiveDTO; |
|
|
import org.dromara.sample.manage.model.dto.LiveTypeDTO; |
|
|
import org.dromara.sample.manage.model.dto.LiveTypeDTO; |
|
|
|
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
import org.dromara.sample.manage.service.ILiveStreamService; |
|
|
import org.dromara.sample.manage.service.ILiveStreamService; |
|
|
|
|
|
import org.dromara.sample.manage.service.IPlayTextService; |
|
|
|
|
|
import org.dromara.sample.wayline.model.dto.WaylineJobDTO; |
|
|
|
|
|
import org.dromara.sample.wayline.service.IWaylineJobService; |
|
|
|
|
|
import org.dromara.sample.wayline.service.IWaylineRedisService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @auther wuyuan |
|
|
* @auther wuyuan |
|
|
* @data 2025/5/12 |
|
|
* @data 2025/5/12 |
|
@ -24,6 +38,19 @@ public class RocketMqConsum implements RocketMQListener<MessageExt> { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ILiveStreamService liveStreamService; |
|
|
private ILiveStreamService liveStreamService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IPlayTextService playTextService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IWaylineRedisService waylineRedisService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IDeviceService deviceService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IWaylineJobService waylineJobService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onMessage(MessageExt message) { |
|
|
public void onMessage(MessageExt message) { |
|
|
String tags = message.getTags(); |
|
|
String tags = message.getTags(); |
|
@ -34,11 +61,33 @@ public class RocketMqConsum implements RocketMQListener<MessageExt> { |
|
|
liveTypeDTO.setVideoType(LensChangeVideoTypeEnum.WIDE); |
|
|
liveTypeDTO.setVideoType(LensChangeVideoTypeEnum.WIDE); |
|
|
liveTypeDTO.setVideoQuality(VideoQualityEnum.ULTRA_HD); |
|
|
liveTypeDTO.setVideoQuality(VideoQualityEnum.ULTRA_HD); |
|
|
liveTypeDTO.setVideoId(videoId); |
|
|
liveTypeDTO.setVideoId(videoId); |
|
|
|
|
|
Optional<DeviceDTO> deviceBySn = deviceService.getDeviceBySn(videoId.getDroneSn()); |
|
|
|
|
|
Optional<EventsReceiver<FlighttaskProgress>> runningWaylineJob = waylineRedisService.getRunningWaylineJob(deviceBySn.get().getDeviceSn()); |
|
|
|
|
|
if(runningWaylineJob.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
String jobId = runningWaylineJob.get().getOutput().getExt().getFlightId(); |
|
|
|
|
|
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(jobId); |
|
|
if(tags.equals("videoStart")){ |
|
|
if(tags.equals("videoStart")){ |
|
|
liveStreamService.liveStart(liveTypeDTO); |
|
|
HttpResultResponse httpResultResponse = liveStreamService.liveStart(liveTypeDTO); |
|
|
|
|
|
if (httpResultResponse.getCode() == 0 || httpResultResponse.getCode() == 513012 || httpResultResponse.getCode() == 513003){ |
|
|
|
|
|
Map<String,Object> reqMap = new HashMap<>(); |
|
|
|
|
|
reqMap.put("deviceSn:",videoId.getDroneSn()); |
|
|
|
|
|
reqMap.put("jobId",waylineJobDTO.get().getJobId()); |
|
|
|
|
|
reqMap.put("jobName",waylineJobDTO.get().getJobName()); |
|
|
|
|
|
playTextService.streamType(reqMap); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}else if(tags.equals("videoStopStart")){ |
|
|
}else if(tags.equals("videoStopStart")){ |
|
|
liveStreamService.liveStop(videoId); |
|
|
HttpResultResponse httpResultResponse = liveStreamService.liveStop(videoId); |
|
|
liveStreamService.liveStart(liveTypeDTO); |
|
|
liveStreamService.liveStart(liveTypeDTO); |
|
|
|
|
|
if (httpResultResponse.getCode() == 0 || httpResultResponse.getCode() == 513012 || httpResultResponse.getCode() == 513003){ |
|
|
|
|
|
Map<String,Object> reqMap = new HashMap<>(); |
|
|
|
|
|
reqMap.put("deviceSn:",videoId.getDroneSn()); |
|
|
|
|
|
reqMap.put("jobId",waylineJobDTO.get().getJobId()); |
|
|
|
|
|
reqMap.put("jobName",waylineJobDTO.get().getJobName()); |
|
|
|
|
|
playTextService.streamType(reqMap); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|