|
|
@@ -1,15 +1,22 @@
|
|
|
package com.middle.platform.stream.biz.service.impl;
|
|
|
|
|
|
+import com.middle.platform.common.core.exception.BusinessException;
|
|
|
+import com.middle.platform.manage.api.feign.DeviceApi;
|
|
|
+import com.middle.platform.manage.api.pojo.DevicesVo;
|
|
|
+import com.middle.platform.stream.biz.domain.res.streamPageRes;
|
|
|
+import com.middle.platform.stream.biz.mapper.SDeviceMapper;
|
|
|
import com.middle.platform.stream.biz.pojo.PullPara;
|
|
|
import com.middle.platform.stream.biz.pojo.PushPara;
|
|
|
import com.middle.platform.stream.biz.pojo.StreamPage;
|
|
|
import com.middle.platform.stream.biz.service.ApiProxy;
|
|
|
import com.middle.platform.stream.biz.service.StreamMediaService;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* @author xucaiqin
|
|
|
@@ -19,17 +26,36 @@ import java.util.List;
|
|
|
@RequiredArgsConstructor
|
|
|
public class StreamMediaServiceImpl implements StreamMediaService {
|
|
|
private final ApiProxy apiProxy;
|
|
|
+ private final SDeviceMapper sDeviceMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ DeviceApi deviceApi;
|
|
|
|
|
|
@Override
|
|
|
public List<Object> rtmpPage(StreamPage streamPage) {
|
|
|
//根据设备名称模糊筛选设备,获得设备id列表
|
|
|
String keywords = streamPage.getKeywords();
|
|
|
- //
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ if (keywords != null && !keywords.isEmpty()) {
|
|
|
+ //如果有设备,需要先查出设备id
|
|
|
+ List<DevicesVo> devicesVos = deviceApi.devicesQuery(keywords);
|
|
|
+ if (Objects.isNull(devicesVos)) {
|
|
|
+ throw new BusinessException("查无产品");
|
|
|
+ }
|
|
|
+ for (DevicesVo devicesVo : devicesVos) {
|
|
|
+ ids.add(devicesVo.getId());
|
|
|
+ }
|
|
|
+ streamPage.setDeviceIds(ids);
|
|
|
+ }
|
|
|
+ //数据库查询
|
|
|
+ streamPageRes streamPageRes = sDeviceMapper.selectStreamPage(streamPage);
|
|
|
+ if (Objects.isNull(streamPageRes)) {
|
|
|
+ throw new BusinessException("查无产品!");
|
|
|
+ }
|
|
|
+ //API调用
|
|
|
ArrayList<Object> objects = new ArrayList<>();
|
|
|
-
|
|
|
Object o = apiProxy.rtmpList();
|
|
|
|
|
|
-
|
|
|
return new ArrayList<>() {{
|
|
|
add(o);
|
|
|
}};
|