Browse Source

星罗接口对接和视频流接口

nantong
李克 1 month ago
parent
commit
58133f37bb
  1. 2
      dk-api/api-system/src/main/java/org/dromara/system/api/RemoteConfigService.java
  2. 16
      dk-modules/sample/src/main/java/org/dromara/sample/feign/RemoteSystemFeign.java
  3. 37
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/PlayTextServiceImpl.java
  4. 8
      dk-modules/system/src/main/java/org/dromara/system/controller/system/SysConfigController.java
  5. 10
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteConfigServiceImpl.java

2
dk-api/api-system/src/main/java/org/dromara/system/api/RemoteConfigService.java

@ -24,5 +24,5 @@ public interface RemoteConfigService {
String selectStreamIp();
List<String> selectStreamType(String deviceSn);
// List<String> selectStreamType(String deviceSn);
}

16
dk-modules/sample/src/main/java/org/dromara/sample/feign/RemoteSystemFeign.java

@ -0,0 +1,16 @@
package org.dromara.sample.feign;
import org.dromara.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "gateway",path = "system")
public interface RemoteSystemFeign {
@GetMapping("/config/selectStreamType")
public List<String> selectStreamType(@RequestParam String deviceSn);
}

37
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/PlayTextServiceImpl.java

@ -12,6 +12,7 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.domain.R;
import org.dromara.common.sdk.cloudapi.device.*;
import org.dromara.common.sdk.cloudapi.firmware.*;
import org.dromara.common.sdk.cloudapi.firmware.api.AbstractFirmwareService;
@ -26,32 +27,13 @@ import org.dromara.common.sdk.exception.CloudSDKException;
import org.dromara.common.sdk.mqtt.CommonTopicRequest;
import org.dromara.common.sdk.mqtt.IMqttTopicService;
import org.dromara.common.sdk.mqtt.MqttGatewayPublish;
import org.dromara.common.sdk.mqtt.events.EventsSubscribe;
import org.dromara.common.sdk.mqtt.osd.OsdSubscribe;
import org.dromara.common.sdk.mqtt.property.PropertySetPublish;
import org.dromara.common.sdk.mqtt.property.PropertySetReplyResultEnum;
import org.dromara.common.sdk.mqtt.property.PropertySetSubscribe;
import org.dromara.common.sdk.mqtt.requests.RequestsSubscribe;
import org.dromara.common.sdk.mqtt.services.ServicesPublish;
import org.dromara.common.sdk.mqtt.services.ServicesReplyData;
import org.dromara.common.sdk.mqtt.services.ServicesSubscribe;
import org.dromara.common.sdk.mqtt.services.TopicServicesResponse;
import org.dromara.common.sdk.mqtt.state.StateSubscribe;
import org.dromara.common.sdk.mqtt.status.StatusSubscribe;
import org.dromara.common.websocket.dto.BizCodeEnum;
import org.dromara.sample.common.error.CommonErrorEnum;
import org.dromara.sample.component.mqtt.model.EventsReceiver;
import org.dromara.sample.control.model.enums.DroneAuthorityEnum;
import org.dromara.sample.manage.mapper.IDeviceMapper;
import org.dromara.sample.feign.RemoteSystemFeign;
import org.dromara.sample.manage.mapper.IPlayTextMapper;
import org.dromara.sample.manage.model.dto.*;
import org.dromara.sample.manage.model.entity.DeviceEntity;
import org.dromara.sample.manage.model.entity.PlayTextEntity;
import org.dromara.sample.manage.model.enums.DeviceFirmwareStatusEnum;
import org.dromara.sample.manage.model.enums.PropertySetFieldEnum;
import org.dromara.sample.manage.model.enums.UserTypeEnum;
import org.dromara.sample.manage.model.param.DeviceQueryParam;
import org.dromara.sample.manage.model.receiver.BasicDeviceProperty;
import org.dromara.sample.manage.service.*;
import org.dromara.system.api.RemoteConfigService;
import org.springframework.beans.factory.annotation.Autowired;
@ -81,6 +63,9 @@ public class PlayTextServiceImpl implements IPlayTextService {
@DubboReference
private RemoteConfigService remoteConfigService;
@Resource
private RemoteSystemFeign remoteSystemFeign;
@Override
public HttpResultResponse insertPlayText(PlayTextEntity param) {
param.setTextSn(String.valueOf(UUID.randomUUID()));
@ -124,9 +109,9 @@ public class PlayTextServiceImpl implements IPlayTextService {
public HttpResultResponse streamType(Map<String, Object> objectMap) {
String top = "task/image/disobey/streamType";
//发送mqtt
List<String> list = remoteConfigService.selectStreamType(objectMap.get("deviceSn").toString());
if (CollectionUtils.isNotEmpty(list)){
for (String s : list){
List<String> deviceSn = remoteSystemFeign.selectStreamType(objectMap.get("deviceSn").toString());
if (CollectionUtils.isNotEmpty(deviceSn)){
for (String s : deviceSn){
String[] split = s.split(",");
objectMap.put("deptId",split[0]);
objectMap.put("deptName",split[1]);
@ -137,6 +122,6 @@ public class PlayTextServiceImpl implements IPlayTextService {
.setData(Objects.requireNonNull(param)),1);
}
}
return HttpResultResponse.error("请求成功");
return HttpResultResponse.success("请求成功");
}
}

8
dk-modules/system/src/main/java/org/dromara/system/controller/system/SysConfigController.java

@ -1,6 +1,7 @@
package org.dromara.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
@ -134,4 +135,11 @@ public class SysConfigController extends BaseController {
configService.resetConfigCache();
return R.ok();
}
@GetMapping("/selectStreamType")
public List<String> selectStreamType(@RequestParam String deviceSn) {
return configService.selectStreamType(deviceSn);
}
}

10
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteConfigServiceImpl.java

@ -38,10 +38,10 @@ public class RemoteConfigServiceImpl implements RemoteConfigService {
return ip;
}
@Override
public List<String> selectStreamType(String deviceSn) {
List<String> list =sysConfigService.selectStreamType(deviceSn);
return list;
}
// @Override
// public List<String> selectStreamType(String deviceSn) {
// List<String> list =sysConfigService.selectStreamType(deviceSn);
// return list;
// }
}

Loading…
Cancel
Save