Browse Source

推流接口

pull/6/head
李克 1 month ago
parent
commit
7e3fbe05ba
  1. 30
      dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/MegaphoneController.java

30
dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/MegaphoneController.java

@ -40,8 +40,11 @@ import org.dromara.sample.manage.model.dto.*;
import org.dromara.sample.manage.model.entity.DeviceStreamEntity; import org.dromara.sample.manage.model.entity.DeviceStreamEntity;
import org.dromara.sample.manage.service.IDeviceStreamService; import org.dromara.sample.manage.service.IDeviceStreamService;
import org.dromara.sample.media.mapper.IFileMapper; import org.dromara.sample.media.mapper.IFileMapper;
import org.dromara.sample.wayline.model.dto.WaylineJobDTO;
import org.dromara.sample.wayline.service.IWaylineJobService;
import org.dromara.system.api.RemoteConfigService; import org.dromara.system.api.RemoteConfigService;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -73,6 +76,8 @@ public class MegaphoneController {
@Resource @Resource
private ServicesPublish servicesPublish; private ServicesPublish servicesPublish;
@Autowired
private IWaylineJobService waylineJobService;
@Resource @Resource
PropertySetPublish propertySetPublish; PropertySetPublish propertySetPublish;
@ -303,8 +308,19 @@ public class MegaphoneController {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("labelEn",type); map.put("labelEn",type);
map.put("deviceSn",objectMap.get("deviceSn")); map.put("deviceSn",objectMap.get("deviceSn"));
map.put("jobId",objectMap.get("jobId")); if (Objects.isNull(objectMap.get("jobId"))){
map.put("jobName",objectMap.get("jobName")); map.put("jobId",objectMap.get("jobId"));
map.put("jobName",objectMap.get("jobName"));
}else {
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(objectMap.get("jobId").toString());
map.put("jobId",objectMap.get("jobId"));
if (!waylineJobDTO.isEmpty()){
map.put("jobName",waylineJobDTO.get().getJobName());
}else {
map.put("jobName",null);
}
}
StreamTypeDTO param1 = Convert.convert(StreamTypeDTO.class, map); StreamTypeDTO param1 = Convert.convert(StreamTypeDTO.class, map);
gatewayPublish.publish(topTow,new CommonTopicRequest<>() gatewayPublish.publish(topTow,new CommonTopicRequest<>()
.setData(Objects.requireNonNull(param1)),1); .setData(Objects.requireNonNull(param1)),1);
@ -349,8 +365,14 @@ public class MegaphoneController {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("labelEn",type); map.put("labelEn",type);
map.put("deviceSn",objectMap.get("deviceSn")); map.put("deviceSn",objectMap.get("deviceSn"));
map.put("jobId",objectMap.get("jobId")); if (Objects.isNull(objectMap.get("jobId"))){
map.put("jobName",objectMap.get("jobName")); map.put("jobId",objectMap.get("jobId"));
map.put("jobName",objectMap.get("jobName"));
}else {
Optional<WaylineJobDTO> waylineJobDTO = waylineJobService.getJobByJobInternalId(objectMap.get("jobId").toString());
map.put("jobId",waylineJobDTO.get().getJobId());
map.put("jobName",waylineJobDTO.get().getJobName());
}
StreamTypeDTO param1 = Convert.convert(StreamTypeDTO.class, map); StreamTypeDTO param1 = Convert.convert(StreamTypeDTO.class, map);
gatewayPublish.publish(topTow,new CommonTopicRequest<>() gatewayPublish.publish(topTow,new CommonTopicRequest<>()
.setData(Objects.requireNonNull(param1)),1); .setData(Objects.requireNonNull(param1)),1);

Loading…
Cancel
Save