|
|
@@ -1,8 +1,6 @@
|
|
|
package com.middle.platform.stream.biz.service;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
@@ -11,8 +9,6 @@ import com.middle.platform.common.core.constant.Global;
|
|
|
import com.middle.platform.common.core.exception.BusinessException;
|
|
|
import com.middle.platform.common.core.modle.BasePara;
|
|
|
import com.middle.platform.manage.api.feign.DeviceApi;
|
|
|
-import com.middle.platform.manage.api.pojo.DevicesNameVo;
|
|
|
-import com.middle.platform.manage.api.pojo.DevicesVo;
|
|
|
import com.middle.platform.pagehelper.core.PageRes;
|
|
|
import com.middle.platform.stream.biz.domain.req.StreamAddRes;
|
|
|
import com.middle.platform.stream.biz.domain.req.StreamUpdateRes;
|
|
|
@@ -35,7 +31,6 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author xucaiqin
|
|
|
@@ -60,21 +55,10 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
* @date 2024-05-08 18:44
|
|
|
*/
|
|
|
public PageRes<DevicesPathVo> getDevicePathList(BasePara basePara) {
|
|
|
- //根据设备名称模糊筛选设备,获得设备id列表
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
- //如果有设备,需要先查出设备id
|
|
|
- if (StrUtil.isNotBlank(basePara.getKeywords())) {
|
|
|
- DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
- devicesNameVo.setKeywords(basePara.getKeywords());
|
|
|
- List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
- for (DevicesVo devicesVo : devicesVos) {
|
|
|
- ids.add(devicesVo.getId());
|
|
|
- }
|
|
|
- }
|
|
|
PageHelper.startPage(basePara.getPage(), basePara.getPageSize());
|
|
|
List<SDevice> sDevices = sDeviceMapper.selectList(new LambdaQueryWrapper<SDevice>()
|
|
|
.eq(SDevice::getDelFlag, Global.UN_DEL)
|
|
|
- .in(CollUtil.isNotEmpty(ids), SDevice::getDeviceId, ids));
|
|
|
+ .like(SDevice::getName, basePara.getKeywords()));
|
|
|
|
|
|
if (Objects.isNull(sDevices)) {
|
|
|
return new PageRes<>();
|
|
|
@@ -82,12 +66,7 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
PageInfo<SDevice> pageInfo = new PageInfo<>(sDevices);
|
|
|
List<DevicesPathVo> res = new ArrayList<>();
|
|
|
for (SDevice sDevice : sDevices) {
|
|
|
- DevicesPathVo devicesPathVo = BeanUtil.toBean(sDevice, DevicesPathVo.class);
|
|
|
- DevicesVo devicesVo = deviceApi.queryDevice(sDevice.getDeviceId());
|
|
|
- if (Objects.nonNull(devicesVo)) {
|
|
|
- devicesPathVo.setName(devicesVo.getName());
|
|
|
- }
|
|
|
- res.add(devicesPathVo);
|
|
|
+ res.add(BeanUtil.toBean(sDevice, DevicesPathVo.class));
|
|
|
}
|
|
|
return PageRes.build(pageInfo, res);
|
|
|
}
|
|
|
@@ -129,7 +108,7 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
}
|
|
|
SDevice sDevice1 = new SDevice();
|
|
|
sDevice1.setId(streamUpdateRes.getId());
|
|
|
- sDevice1.setDeviceId(streamUpdateRes.getDeviceId());
|
|
|
+ sDevice1.setName(streamUpdateRes.getName());
|
|
|
sDevice1.setCover(streamUpdateRes.getCover());
|
|
|
// sDevice1.setPath("");
|
|
|
// sDevice1.setTarget("");
|
|
|
@@ -166,45 +145,6 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
return VideoPathUtil.videoUrl(streamMediaProperties.getUrl(), sDevice.getPath());
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * rtmp列表查询
|
|
|
-// *
|
|
|
-// * @param streamPage
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public List<Object> rtmpPage(StreamPage streamPage) {
|
|
|
-// log.info("rtmpPage in...");
|
|
|
-// //根据设备名称模糊筛选设备,获得设备id列表
|
|
|
-// String keywords = streamPage.getKeywords();
|
|
|
-// List<Long> ids = new ArrayList<>();
|
|
|
-// if (keywords != null && !keywords.isEmpty()) {
|
|
|
-// //如果有设备,需要先查出设备id
|
|
|
-// DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
-// devicesNameVo.setKeywords(keywords);
|
|
|
-// List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
-// if (Objects.isNull(devicesVos)) {
|
|
|
-// throw new BusinessException("查无产品");
|
|
|
-// }
|
|
|
-// for (DevicesVo devicesVo : devicesVos) {
|
|
|
-// ids.add(devicesVo.getId());
|
|
|
-// }
|
|
|
-// streamPage.setDeviceIds(ids);
|
|
|
-// }
|
|
|
-// log.info("rtmpList:{}", ids);
|
|
|
-// //数据库查询
|
|
|
-// StreamPageRes streamPageRes = sDeviceMapper.selectStreamPage(streamPage);
|
|
|
-// if (Objects.isNull(streamPageRes)) {
|
|
|
-// throw new BusinessException("查无产品!");
|
|
|
-// }
|
|
|
-// //API调用
|
|
|
-// ArrayList<Object> objects = new ArrayList<>();
|
|
|
-// Object o = apiProxy.rtmpList();
|
|
|
-// log.info("rtmpList:{}", o);
|
|
|
-// return new ArrayList<>() {{
|
|
|
-// add(o);
|
|
|
-// }};
|
|
|
-// }
|
|
|
-
|
|
|
/**
|
|
|
* 分页查询
|
|
|
*
|
|
|
@@ -212,22 +152,12 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
* @date 2024-05-09 09:10
|
|
|
*/
|
|
|
public Object pageQuery(VideoPage videoPage) {
|
|
|
- //根据设备名称模糊筛选设备,获得设备id列表
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
- //如果有设备,需要先查出设备id
|
|
|
- if (StrUtil.isNotBlank(videoPage.getKeywords())) {
|
|
|
- DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
- devicesNameVo.setKeywords(videoPage.getKeywords());
|
|
|
- List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
- for (DevicesVo devicesVo : devicesVos) {
|
|
|
- ids.add(devicesVo.getId());
|
|
|
- }
|
|
|
- }
|
|
|
PageHelper.startPage(videoPage.getPage(), videoPage.getPageSize());
|
|
|
List<SDevice> sDevices = sDeviceMapper.selectList(new LambdaQueryWrapper<SDevice>()
|
|
|
.eq(SDevice::getType, videoPage.getType())
|
|
|
+ .like(SDevice::getName, videoPage.getKeywords())
|
|
|
.eq(SDevice::getDelFlag, Global.UN_DEL)
|
|
|
- .in(CollUtil.isNotEmpty(ids), SDevice::getDeviceId, ids));
|
|
|
+ );
|
|
|
|
|
|
if (Objects.isNull(sDevices)) {
|
|
|
return new PageRes<>();
|
|
|
@@ -237,10 +167,6 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
List<StreamPageRes> streamPageRes2 = new ArrayList<>();
|
|
|
for (SDevice sDevice : sDevices) {
|
|
|
StreamPageRes streamPageRes = BeanUtil.toBean(sDevice, StreamPageRes.class);
|
|
|
- DevicesVo devicesVo = deviceApi.queryDevice(sDevice.getDeviceId());
|
|
|
- if (Objects.nonNull(devicesVo)) {
|
|
|
- streamPageRes.setDeviceName(devicesVo.getName());
|
|
|
- }
|
|
|
Optional.ofNullable(dictApi.query(DictType.VIDEO_TYPE, String.valueOf(streamPageRes.getType()))).ifPresent(d -> streamPageRes.setTypeLabel(d.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.USE_FLAG_TYPE, String.valueOf(streamPageRes.getUseFlag()))).ifPresent(d -> streamPageRes.setUseFlagLabel(d.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.SAVE_RULE_TYPE, String.valueOf(streamPageRes.getSaveRule()))).ifPresent(d -> streamPageRes.setSaveRuleLabel(d.getLabel()));
|
|
|
@@ -251,16 +177,6 @@ public class SDeviceService extends ServiceImpl<SDeviceMapper, SDevice> {
|
|
|
return PageRes.build(pageInfo, streamPageRes2);
|
|
|
}
|
|
|
|
|
|
- public Object dropdown(String name) {
|
|
|
- DevicesNameVo devicesNameVo = new DevicesNameVo();
|
|
|
- devicesNameVo.setKeywords(name);
|
|
|
- List<DevicesVo> devicesVos = deviceApi.devicesQuery(devicesNameVo);
|
|
|
- if (CollUtil.isEmpty(devicesVos)) {
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- List<SDevice> sDevices = sDeviceMapper.selectList(new LambdaQueryWrapper<SDevice>().eq(SDevice::getDelFlag, Global.UN_DEL));
|
|
|
- return devicesVos.stream().filter(d -> sDevices.stream().noneMatch(d2 -> Objects.equals(d2.getDeviceId(), d.getId()))).collect(Collectors.toList());
|
|
|
- }
|
|
|
|
|
|
public Object delete(Long id) {
|
|
|
SDevice sDevice = new SDevice();
|