Browse Source

提交

nantong
袁强 1 month ago
parent
commit
56d59d7ff7
  1. 4
      dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/device/DeviceEnum.java
  2. 1
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessTaskController.java
  3. 34
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessTaskLabel.java
  4. 10
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessTaskBo.java
  5. 35
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessTaskLabelVo.java
  6. 5
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessTaskVo.java
  7. 27
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessTaskLabelMapper.java
  8. 11
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessTaskServiceImpl.java
  9. 12
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml
  10. 11
      dk-modules/business/src/main/resources/mapper/business/BusinessTaskLabelMapper.xml
  11. 5
      dk-modules/business/src/main/resources/mapper/business/BusinessTaskMapper.xml
  12. 5
      dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/LiveStreamController.java
  13. 4
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/IDeviceService.java
  14. 2
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceRedisServiceImpl.java
  15. 6
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java
  16. 30
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/LiveStreamServiceImpl.java
  17. 24
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/SDKDeviceService.java
  18. 28
      dk-modules/sample/src/main/java/org/dromara/sample/rocketmq/RocketMqConsum.java

4
dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/device/DeviceEnum.java

@ -143,7 +143,7 @@ public enum DeviceEnum {
.findAny().orElseThrow(() -> new CloudSDKException(DeviceEnum.class, finalKey1));
}
@JsonCreator
/* @JsonCreator
public static DeviceEnum findKey(String key) {
if(StringUtils.isEmpty(key)){
key = DeviceEnum.M3TD.getDevice();
@ -152,7 +152,7 @@ public enum DeviceEnum {
String finalKey1 = key;
return Arrays.stream(values()).filter(device -> device.toString().equals(finalKey))
.findAny().orElseThrow(() -> new CloudSDKException(DeviceEnum.class, finalKey1));
}
}*/
}

1
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessTaskController.java

@ -46,7 +46,6 @@ public class BusinessTaskController extends BaseController {
/**
* 查询工单预约列表
*/
@ApiEncrypt(response=true)
@SaCheckPermission("business:task:list")
@GetMapping("/list")
public TableDataInfo<BusinessTaskVo> list(BusinessTaskBo bo, PageQuery pageQuery) {

34
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessTaskLabel.java

@ -0,0 +1,34 @@
package org.dromara.business.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* @auther yq
* @data 2025/2/26
*/
@Data
@TableName("business_task_label")
public class BusinessTaskLabel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long taskId;
private String labelCn;
private String labelEn;
}

10
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessTaskBo.java

@ -1,10 +1,9 @@
package org.dromara.business.domain.bo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.dromara.business.domain.BusinessTask;
import org.dromara.business.domain.BusinessTaskLabel;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
@ -13,8 +12,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.awt.*;
import java.util.Date;
import java.util.List;
/**
* 工单预约业务对象 business_task
@ -87,4 +87,6 @@ public class BusinessTaskBo extends BaseEntity {
private Date flightTime;
//飞行说明
private String flightExplain;
private List<BusinessTaskLabel> taskLabelList;
}

35
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessTaskLabelVo.java

@ -0,0 +1,35 @@
package org.dromara.business.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.business.domain.BusinessTask;
import org.dromara.business.domain.BusinessTaskLabel;
import java.io.Serial;
import java.io.Serializable;
/**
* @auther yq
* @data 2025/2/26
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BusinessTaskLabel.class)
public class BusinessTaskLabelVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private Long taskId;
private String labelCn;
private String labelEn;
}

5
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessTaskVo.java

@ -5,13 +5,14 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.business.domain.BusinessTask;
import org.dromara.business.domain.BusinessTaskLabel;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -91,6 +92,6 @@ public class BusinessTaskVo implements Serializable {
private String flightExplain;
private List<BusinessTaskLabel> taskLabelList;
}

27
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessTaskLabelMapper.java

@ -0,0 +1,27 @@
package org.dromara.business.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.business.domain.BusinessTask;
import org.dromara.business.domain.BusinessTaskLabel;
import org.dromara.business.domain.bo.BusinessTaskBo;
import org.dromara.business.domain.vo.BusinessTaskLabelVo;
import org.dromara.business.domain.vo.BusinessTaskVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 工单预约Mapper接口
*
* @author LionLi
* @date 2025-02-26
*/
public interface BusinessTaskLabelMapper extends BaseMapperPlus<BusinessTaskLabel, BusinessTaskLabelVo> {
List<BusinessTaskLabelVo> selectTaskLabelList(@Param("taskId") Long taskId);
}

11
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessTaskServiceImpl.java

@ -2,12 +2,15 @@ package org.dromara.business.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.dromara.business.domain.BusinessTask;
import org.dromara.business.domain.BusinessTaskLabel;
import org.dromara.business.domain.bo.BusinessTaskBo;
import org.dromara.business.domain.vo.BusinessTaskVo;
import org.dromara.business.mapper.BusinessTaskLabelMapper;
import org.dromara.business.mapper.BusinessTaskMapper;
import org.dromara.business.service.IBusinessTaskService;
import org.dromara.common.core.constant.BusinessConstants;
@ -35,6 +38,7 @@ import java.util.Map;
public class BusinessTaskServiceImpl implements IBusinessTaskService {
private final BusinessTaskMapper baseMapper;
private final BusinessTaskLabelMapper taskLabelMapper;
/**
* 查询工单预约
@ -92,6 +96,9 @@ public class BusinessTaskServiceImpl implements IBusinessTaskService {
*/
@Override
public Boolean insertByBo(BusinessTaskBo bo) {
if(bo.getTaskLabelList().isEmpty()){
throw new RuntimeException("未获取到识别类型标签");
}
// 获取当前登录用户信息
LoginUser currentUser = LoginHelper.getLoginUser();
bo.setCreateBy(currentUser.getUserId());
@ -105,6 +112,10 @@ public class BusinessTaskServiceImpl implements IBusinessTaskService {
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
bo.getTaskLabelList().forEach(labelVo -> {
labelVo.setTaskId(bo.getId());
});
taskLabelMapper.insert(bo.getTaskLabelList());
}
return flag;
}

12
dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml

@ -890,8 +890,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
temp.label_en AS labelEn,
temp.label_cn as labelCn,
bl.lat AS lat,
bl.lng AS lng,
ba.lat AS lat,
ba.lng AS lng,
COUNT(*) AS value
FROM
(
@ -904,15 +904,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.label_en, ba.label_cn
) temp
INNER JOIN
business_alert bl ON temp.label_en = bl.label_en
AND bl.lat IS NOT NULL
business_alert ba ON temp.label_en = ba.label_en
AND ba.lat IS NOT NULL
<where>
<include refid="searchSql"></include>
</where>
GROUP BY
temp.label_en,temp.label_cn, bl.lat, bl.lng
temp.label_en,temp.label_cn, ba.lat, ba.lng
HAVING
<![CDATA[ ST_Distance_Sphere(POINT(lng, lat), POINT(bl.lng, bl.lat)) <= 30 ]]>
<![CDATA[ ST_Distance_Sphere(POINT(lng, lat), POINT(ba.lng, ba.lat)) <= 30 ]]>
</select>

11
dk-modules/business/src/main/resources/mapper/business/BusinessTaskLabelMapper.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.business.mapper.BusinessTaskLabelMapper">
<select id="selectTaskLabelList" resultType="org.dromara.business.domain.vo.BusinessTaskLabelVo">
select * from business_task_label where task_id=#{taskId}
</select>
</mapper>

5
dk-modules/business/src/main/resources/mapper/business/BusinessTaskMapper.xml

@ -28,6 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result column="operatTime" property="operatTime" />
<result column="flightTime" property="flightTime" />
<result column="flightExplain" property="flightExplain" />
<collection column="{taskId=id}"
property="taskLabelList" ofType="org.dromara.business.domain.vo.BusinessAlertVo"
javaType="java.util.ArrayList"
select="org.dromara.business.mapper.BusinessTaskLabelMapper.selectTaskLabelList"/>
</resultMap>
<select id="distance" resultType="java.lang.Integer">
SELECT device_id,

5
dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/LiveStreamController.java

@ -7,6 +7,7 @@ import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.sdk.common.HttpResultResponse;
import org.dromara.sample.manage.model.dto.CapacityDeviceDTO;
import org.dromara.sample.manage.model.dto.LiveTypeDTO;
import org.dromara.sample.manage.service.IDeviceRedisService;
import org.dromara.sample.manage.service.ILiveStreamService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
@ -34,6 +35,9 @@ public class LiveStreamController {
@Autowired
private ObjectMapper mapper;
@Autowired
private IDeviceRedisService deviceRedisService;
/**
* 从数据库中获取当前用户工作区中所有无人机的实时能力数据
* Get live capability data of all drones in the current user's workspace from the database.
@ -59,6 +63,7 @@ public class LiveStreamController {
@PostMapping("/streams/start")
@Operation(summary = "启用直播", description = "启用直播")
public HttpResultResponse liveStart(@RequestBody LiveTypeDTO liveParam) {
return liveStreamService.liveStart(liveParam);
}

4
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/IDeviceService.java

@ -11,6 +11,7 @@ import org.dromara.common.websocket.dto.BizCodeEnum;
import org.dromara.sample.manage.model.dto.DeviceDTO;
import org.dromara.sample.manage.model.dto.DeviceFirmwareUpgradeDTO;
import org.dromara.sample.manage.model.dto.TopologyDeviceDTO;
import org.dromara.sample.manage.model.entity.DeviceEntity;
import org.dromara.sample.manage.model.param.DeviceQueryParam;
import com.fasterxml.jackson.databind.JsonNode;
@ -36,6 +37,7 @@ public interface IDeviceService {
*/
void gatewayOffline(String gatewaySn);
/**
* Subscribe to the topic of the gateway when the gateway device goes online, and unsubscribe from the topic of the sub-device.
* @param gateway
@ -144,6 +146,8 @@ public interface IDeviceService {
*/
Optional<DeviceDTO> getDeviceBySn(String sn);
DeviceEntity getDeviceByChildSn(String childSn);
/**
* Create job for device firmware updates.
* @param workspaceId

2
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceRedisServiceImpl.java

@ -154,6 +154,6 @@ public class DeviceRedisServiceImpl implements IDeviceRedisService {
@Override
public Boolean delDeviceVideo(String sn) {
return RedisOpsUtils.del(sn);
return RedisOpsUtils.del(RedisConst.VIDEO_STATUS +sn);
}
}

6
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java

@ -566,6 +566,12 @@ public class DeviceServiceImpl implements IDeviceService {
return Optional.of(device);
}
@Override
public DeviceEntity getDeviceByChildSn(String childSn) {
DeviceEntity deviceEntity = mapper.selectOne(new LambdaQueryWrapper<DeviceEntity>().eq(DeviceEntity::getChildSn, childSn));
return deviceEntity;
}
@Override
public HttpResultResponse createDeviceOtaJob(String workspaceId, List<DeviceFirmwareUpgradeDTO> upgradeDTOS) {
List<OtaCreateDevice> deviceOtaFirmwares = deviceFirmwareService.getDeviceOtaFirmware(workspaceId, upgradeDTOS);

30
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/LiveStreamServiceImpl.java

@ -68,26 +68,29 @@ public class LiveStreamServiceImpl implements ILiveStreamService {
@Override
public HttpResultResponse liveStart(LiveTypeDTO liveParam) {
// Check if this lens is available live.
HttpResultResponse<DeviceDTO> responseResult = this.checkBeforeLive(liveParam.getVideoId());
if (HttpResultResponse.CODE_SUCCESS != responseResult.getCode()) {
return responseResult;
}
Boolean flag = deviceRedisService.checkDeviceVideo(liveParam.getVideoId().getDroneSn());
ILivestreamUrl url = LiveStreamProperty.get(liveParam.getUrlType());
url = setExt(liveParam.getUrlType(), url, liveParam.getVideoId());
TopicServicesResponse<ServicesReplyData<String>> response = abstractLivestreamService.liveStartPush(
SDKManager.getDeviceSDK(responseResult.getData().getDeviceSn()),
new LiveStartPushRequest()
.setUrl(url)
.setUrlType(liveParam.getUrlType())
.setVideoId(liveParam.getVideoId())
.setVideoQuality(liveParam.getVideoQuality()));
if (!response.getData().getResult().isSuccess()) {
return HttpResultResponse.error(response.getData().getResult());
if (!flag) {
TopicServicesResponse<ServicesReplyData<String>> response = abstractLivestreamService.liveStartPush(
SDKManager.getDeviceSDK(responseResult.getData().getDeviceSn()),
new LiveStartPushRequest()
.setUrl(url)
.setUrlType(liveParam.getUrlType())
.setVideoId(liveParam.getVideoId())
.setVideoQuality(liveParam.getVideoQuality()));
if (!response.getData().getResult().isSuccess()) {
return HttpResultResponse.error(response.getData().getResult());
}
}
LiveDTO live = new LiveDTO();
switch (liveParam.getUrlType()) {
@ -107,9 +110,6 @@ public class LiveStreamServiceImpl implements ILiveStreamService {
.append(gb28181.getChannel())
.toString());
break;
case RTSP:
live.setUrl(response.getData().getOutput());
break;
case WHIP:
live.setUrl(url.toString().replace("whip", "whep"));
break;

24
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/SDKDeviceService.java

@ -159,7 +159,9 @@ public class SDKDeviceService extends AbstractDeviceService {
if(request.getData().getMediaFileDetail() != null){
RedisOpsUtils.hashSet("updateMediaFileDetail",from,request.getData().getMediaFileDetail().getRemainUpload());
}
if( deviceRedisService.getDeviceOsd(deviceOpt.get().getChildDeviceSn(),OsdDockDrone.class).isEmpty() && deviceRedisService.checkDeviceVideo(deviceOpt.get().getChildDeviceSn())){
deviceRedisService.delDeviceVideo(deviceOpt.get().getChildDeviceSn());
}
DeviceDTO device = deviceOpt.get();
if (StringUtils.hasText(device.getChildDeviceSn())) {
deviceService.getDeviceBySn(device.getChildDeviceSn()).ifPresent(device::setChildren);
@ -186,22 +188,18 @@ public class SDKDeviceService extends AbstractDeviceService {
}
if(request.getData().getLiveStatus().size() == 0 ){
String deviceVideoEnum = DeviceVideoEnum.find(deviceOnline.get().getDeviceName()).getDevice();
if(!deviceRedisService.checkDeviceVideo(deviceOnline.get().getDeviceSn())){
VideoId videoId = new VideoId(deviceOnline.get().getDeviceSn()+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
deviceRedisService.setDeviceVideo(deviceOnline.get().getDeviceSn(),videoId);
MessageProducerUtil.sendAsyncProducerMessage("videoStartConsum","videoStopStart",deviceOnline.get().getDeviceSn(),videoId.toString());
}
deviceRedisService.delDeviceVideo(deviceOnline.get().getDeviceSn());
VideoId videoId = new VideoId(deviceOnline.get().getDeviceSn()+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
MessageProducerUtil.sendAsyncProducerMessage("videoStartConsum","videoStopStart",deviceOnline.get().getDeviceSn(),videoId.toString());
}
List<DockLiveStatusData> dockLiveStatusDataList = request.getData().getLiveStatus().stream().filter(item ->
item.getVideoId().getDroneSn().equals(dockOnline.get().getChildDeviceSn()) && item.getStatus() == true).collect(Collectors.toList());
if(dockLiveStatusDataList.size() == 0){
String deviceVideoEnum = DeviceVideoEnum.find(deviceOnline.get().getDeviceName()).getDevice();
if(!deviceRedisService.checkDeviceVideo(deviceOnline.get().getDeviceSn())){
VideoId videoId = new VideoId(deviceOnline.get().getDeviceSn()+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
deviceRedisService.setDeviceVideo(deviceOnline.get().getDeviceSn(),videoId);
MessageProducerUtil.sendAsyncProducerMessage("videoStartConsum","videoStopStart",deviceOnline.get().getDeviceSn(),videoId.toString());
}
VideoId videoId = new VideoId(deviceOnline.get().getDeviceSn()+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
deviceRedisService.delDeviceVideo(deviceOnline.get().getDeviceSn());
MessageProducerUtil.sendAsyncProducerMessage("videoStartConsum","videoStopStart",deviceOnline.get().getDeviceSn(),videoId.toString());
}
}
@ -209,7 +207,6 @@ public class SDKDeviceService extends AbstractDeviceService {
public void osdDockDrone(TopicOsdRequest<OsdDockDrone> request, MessageHeaders headers) {
String from = request.getFrom();
Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(from);
log.error(deviceOpt.get().getDeviceSn());
if (deviceOpt.isEmpty()) {
deviceOpt = deviceService.getDeviceBySn(from);
if (deviceOpt.isEmpty()) {
@ -226,8 +223,7 @@ public class SDKDeviceService extends AbstractDeviceService {
DeviceDTO device = deviceOpt.get();
String deviceVideoEnum = DeviceVideoEnum.find(device.getDeviceName()).getDevice();
if(!deviceRedisService.checkDeviceVideo(device.getDeviceSn())){
VideoId videoId = new VideoId(device.getDeviceSn()+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
deviceRedisService.setDeviceVideo(device.getDeviceSn(),videoId);
VideoId videoId = new VideoId(device.getDeviceSn()+SLASH+deviceVideoEnum+SLASH + VideoTypeEnum.NORMAL.getType() + DASH+DeviceTypeVideoEnum.ZERO.getVideoType());
MessageProducerUtil.sendAsyncProducerMessage("videoStartConsum","videoStart",device.getDeviceSn(),videoId.toString());
}
deviceRedisService.setDeviceOnline(device);

28
dk-modules/sample/src/main/java/org/dromara/sample/rocketmq/RocketMqConsum.java

@ -13,6 +13,8 @@ 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.entity.DeviceEntity;
import org.dromara.sample.manage.service.IDeviceRedisService;
import org.dromara.sample.manage.service.IDeviceService;
import org.dromara.sample.manage.service.ILiveStreamService;
import org.dromara.sample.manage.service.IPlayTextService;
@ -50,6 +52,8 @@ public class RocketMqConsum implements RocketMQListener<MessageExt> {
@Autowired
private IWaylineJobService waylineJobService;
@Autowired
private IDeviceRedisService deviceRedisService;
@Override
public void onMessage(MessageExt message) {
@ -61,35 +65,35 @@ public class RocketMqConsum implements RocketMQListener<MessageExt> {
liveTypeDTO.setVideoType(LensChangeVideoTypeEnum.WIDE);
liveTypeDTO.setVideoQuality(VideoQualityEnum.ULTRA_HD);
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);
/*DeviceEntity deviceBySn = deviceService.getDeviceByChildSn(videoId.getDroneSn());
Optional<EventsReceiver<FlighttaskProgress>> runningWaylineJob = waylineRedisService.getRunningWaylineJob(deviceBySn.getDeviceSn());
if(runningWaylineJob.isPresent()) {
String jobId = runningWaylineJob.get().getOutput().getExt().getFlightId();
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(jobId);
}*/
if(tags.equals("videoStart")){
HttpResultResponse httpResultResponse = liveStreamService.liveStart(liveTypeDTO);
if (httpResultResponse.getCode() == 0 || httpResultResponse.getCode() == 513012 || httpResultResponse.getCode() == 513003){
/*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")){
liveStreamService.liveStop(videoId);
HttpResultResponse httpResultResponse = liveStreamService.liveStart(liveTypeDTO);
if (httpResultResponse.getCode() == 0 || httpResultResponse.getCode() == 513012 || httpResultResponse.getCode() == 513003){
/*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);
}
}*/
}
deviceRedisService.setDeviceVideo(videoId.getDroneSn(),videoId);
}
}

Loading…
Cancel
Save