|
@@ -1,5 +1,6 @@
|
|
|
package com.huimv.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -8,8 +9,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.huimv.admin.common.utils.Result;
|
|
|
import com.huimv.admin.common.utils.ResultCode;
|
|
|
+import com.huimv.admin.common.utils.ResultUtil;
|
|
|
+import com.huimv.admin.entity.CameraArea;
|
|
|
import com.huimv.admin.entity.CameraBase;
|
|
|
import com.huimv.admin.entity.CameraBrand;
|
|
|
+import com.huimv.admin.entity.hkwsdto.CameraDto1;
|
|
|
import com.huimv.admin.entity.vo.CameraListVo;
|
|
|
import com.huimv.admin.entity.vo.CameraListsVo;
|
|
|
import com.huimv.admin.entity.vo.CameraVo;
|
|
@@ -23,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -34,11 +39,11 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CameraBaseServiceImpl extends ServiceImpl<CameraBaseMapper, CameraBase> implements ICameraBaseService {
|
|
|
- @Autowired
|
|
|
- private CameraBrandMapper cameraBrandMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private CameraAreaMapper cameraAreaMapper;
|
|
|
+ @Autowired
|
|
|
+ private CameraBrandMapper cameraBrandMapper;
|
|
|
|
|
|
@Override
|
|
|
public Result listPage(CameraListVo cameraListVo) {
|
|
@@ -46,10 +51,9 @@ public class CameraBaseServiceImpl extends ServiceImpl<CameraBaseMapper, CameraB
|
|
|
String strchStr = cameraListVo.getStrchStr();
|
|
|
Integer size = cameraListVo.getSize();
|
|
|
Integer areaId = cameraListVo.getAreaId();
|
|
|
- Integer brandId = cameraListVo.getBrandId();
|
|
|
Integer sort = cameraListVo.getSort();
|
|
|
Integer farmId = cameraListVo.getFarmId();
|
|
|
- Integer isOnline = cameraListVo.getIsOnline();
|
|
|
+ Integer onLineStatus = cameraListVo.getOnLineStatus();
|
|
|
QueryWrapper<CameraBase> wrapper = new QueryWrapper<>();
|
|
|
if (farmId != null) {
|
|
|
wrapper.eq("farm_id", farmId);
|
|
@@ -57,17 +61,11 @@ public class CameraBaseServiceImpl extends ServiceImpl<CameraBaseMapper, CameraB
|
|
|
if (areaId != null) {
|
|
|
wrapper.eq("area_id", areaId);
|
|
|
}
|
|
|
- if (brandId != null) {
|
|
|
- wrapper.eq("brand_id", brandId);
|
|
|
- }
|
|
|
-
|
|
|
- if (isOnline != null) {
|
|
|
- wrapper.eq("is_online", isOnline);
|
|
|
+ if (onLineStatus != null) {
|
|
|
+ wrapper.eq("is_online", onLineStatus);
|
|
|
}
|
|
|
-
|
|
|
if (StringUtils.isNotBlank(strchStr)) {
|
|
|
- wrapper.and(i -> i.like("camera_name", strchStr)
|
|
|
- .or().like("camera_ip", strchStr));
|
|
|
+ wrapper.and(i -> i.like("camera_name", strchStr));
|
|
|
}
|
|
|
if (sort == null) {
|
|
|
wrapper.orderByDesc("id");
|
|
@@ -81,347 +79,56 @@ public class CameraBaseServiceImpl extends ServiceImpl<CameraBaseMapper, CameraB
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List getCameraDetails(CameraListsVo cameraListsVo) {
|
|
|
+ public Result getCameraDetails(CameraListsVo cameraListsVo) {
|
|
|
List<Integer> cameraIds = cameraListsVo.getCameraIds();
|
|
|
- CameraListVo cameraListVo = new CameraListsVo();
|
|
|
- cameraListVo.setCurrent(1);
|
|
|
- cameraListVo.setSize(10000);
|
|
|
- cameraListVo.setStrchStr(cameraListsVo.getStrchStr());
|
|
|
- cameraListVo.setAreaId(cameraListsVo.getAreaId());
|
|
|
- cameraListVo.setBrandId(cameraListsVo.getBrandId());
|
|
|
- cameraListVo.setSort(cameraListsVo.getSort());
|
|
|
-
|
|
|
- if (cameraIds == null || cameraIds.size() == 0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- List cameraDetailsList = new ArrayList();
|
|
|
- IPage<CameraBase> page = (IPage<CameraBase>)this.listPage(cameraListVo).getData();
|
|
|
- List<CameraBase> list = page.getRecords();
|
|
|
- int i = 0;
|
|
|
- final String farmAppPort = "8081";
|
|
|
- final String farmVideoApp = "/appleVideo/play?";
|
|
|
- final String hlsMediaPort= "85";
|
|
|
- for (CameraBase camera : list) {
|
|
|
- for (Integer cameraId : cameraIds) {
|
|
|
- if (cameraId.equals( camera.getId())){
|
|
|
-
|
|
|
- String cameraAccount = camera.getAccount();
|
|
|
- String cameraPassword = camera.getPassword();
|
|
|
- String camerIp = camera.getCameraIp();
|
|
|
- String cameraName = camera.getCameraName();
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- String url = cameraAreaMapper.selectById(areaId).getPublicUrl();
|
|
|
- String rtsp ;
|
|
|
- CameraBrand cameraBrand = cameraBrandMapper.selectById(camera.getBrandId());
|
|
|
- Integer type = cameraBrand.getStreamType();
|
|
|
- if (type == 0){
|
|
|
- rtsp = cameraBrand.getMainStream();
|
|
|
- }else {
|
|
|
- rtsp = cameraBrand.getAssistStream();
|
|
|
- }
|
|
|
- CameraVo cameraVo= new CameraVo();
|
|
|
- cameraVo.setId(camera.getId());
|
|
|
- cameraVo.setAreaId(areaId);
|
|
|
-
|
|
|
- cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
-// cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
- //http://61.153.248.106:6713/mag/hls/6bf5d2cf30bb440cad3fc126512f5188/1/live.m3u8
|
|
|
-// cameraVo.setRtspUrl("http://" + ip + ":" + port + "/mag/hls/" + sysKey +"/1/live.m3u8");
|
|
|
- cameraVo.setRtspUrl("http://61.153.248.106:6713/mag/hls/6bf5d2cf30bb440cad3fc126512f5188/1/live.m3u8");
|
|
|
- cameraVo.setCameraName(cameraName);
|
|
|
- cameraVo.setHttpUrl(handleHlsHttpUrl(url,cameraAccount,cameraPassword,camerIp,farmAppPort,farmVideoApp,hlsMediaPort));
|
|
|
- if (i > 0){
|
|
|
- cameraVo.setLastId(list.get(i-1).getId());
|
|
|
- }
|
|
|
- if (i < list.size()-1 ){
|
|
|
- cameraVo.setNextId(list.get(i+1).getId());
|
|
|
- }
|
|
|
- cameraDetailsList.add(cameraVo);
|
|
|
- }
|
|
|
- }
|
|
|
- i++;
|
|
|
- }
|
|
|
- return cameraDetailsList;
|
|
|
- }
|
|
|
-
|
|
|
- //构造HlsHttp地址
|
|
|
- private String handleHlsHttpUrl(String url, String cameraAccount, String cameraPassword, String camerIp, String farmAppPort, String farmVideoApp, String hlsMediaPort) {
|
|
|
- url = url.substring(0,url.indexOf(":"));
|
|
|
- url="http://"+url;
|
|
|
- //return url+":"+farmAppPort+farmVideoApp+"url="+cameraAccount + ":" + cameraPassword + "@" + camerIp+"&name="+"&dt=3000&targetUrl="+url+":"+hlsMediaPort;
|
|
|
- return url+":"+farmAppPort+farmVideoApp+"url="+cameraAccount + ":" + cameraPassword + "@" + camerIp+"&dt=3000&targetUrl="+url+":"+hlsMediaPort;
|
|
|
- }
|
|
|
-
|
|
|
- // @Override
|
|
|
- public List getCameraDetails_yu(CameraListsVo cameraListsVo) {
|
|
|
- List<Integer> cameraIds = cameraListsVo.getCameraIds();
|
|
|
- CameraListVo cameraListVo = new CameraListsVo();
|
|
|
- cameraListVo.setCurrent(1);
|
|
|
- cameraListVo.setSize(10000);
|
|
|
- cameraListVo.setStrchStr(cameraListsVo.getStrchStr());
|
|
|
- cameraListVo.setAreaId(cameraListsVo.getAreaId());
|
|
|
- cameraListVo.setBrandId(cameraListsVo.getBrandId());
|
|
|
- cameraListVo.setSort(cameraListsVo.getSort());
|
|
|
-
|
|
|
-
|
|
|
- if (cameraIds == null || cameraIds.size() == 0) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- List cameraDetailsList = new ArrayList();
|
|
|
- IPage<CameraBase> page = (IPage<CameraBase>) this.listPage(cameraListVo).getData();
|
|
|
- List<CameraBase> list = page.getRecords();
|
|
|
- int i = 0;
|
|
|
- for (CameraBase camera : list) {
|
|
|
- for (Integer cameraId : cameraIds) {
|
|
|
- if (cameraId.equals(camera.getId())) {
|
|
|
-
|
|
|
- String cameraAccount = camera.getAccount();
|
|
|
- String cameraPassword = camera.getPassword();
|
|
|
- String camerIp = camera.getCameraIp();
|
|
|
- String cameraName = camera.getCameraName();
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- String url = cameraAreaMapper.selectById(areaId).getPublicUrl();
|
|
|
-
|
|
|
- String rtsp;
|
|
|
- CameraBrand cameraBrand = cameraBrandMapper.selectById(camera.getBrandId());
|
|
|
- Integer type = cameraBrand.getStreamType();
|
|
|
- if (type == 0) {
|
|
|
- rtsp = cameraBrand.getMainStream();
|
|
|
- } else {
|
|
|
- rtsp = cameraBrand.getAssistStream();
|
|
|
- }
|
|
|
- CameraVo cameraVo = new CameraVo();
|
|
|
- cameraVo.setAreaId(areaId);
|
|
|
- cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
- cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
- cameraVo.setCameraName(cameraName);
|
|
|
- if (i > 0) {
|
|
|
- cameraVo.setLastId(list.get(i - 1).getId());
|
|
|
- }
|
|
|
- if (i < list.size() - 1) {
|
|
|
- cameraVo.setNextId(list.get(i + 1).getId());
|
|
|
- }
|
|
|
- cameraDetailsList.add(cameraVo);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- i++;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return cameraDetailsList;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result updateStatus(Integer id) {
|
|
|
- CameraBase byId = this.getById(id);
|
|
|
-
|
|
|
- if (byId.getRunStatus()) {
|
|
|
- byId.setRunStatus(false);
|
|
|
- this.updateById(byId);
|
|
|
- return new Result(10000, "已停用", true);
|
|
|
- } else {
|
|
|
- byId.setRunStatus(true);
|
|
|
- this.updateById(byId);
|
|
|
- return new Result(10000, "已启用", true);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result add(CameraBase camera) {
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- Integer brandId = camera.getBrandId();
|
|
|
-
|
|
|
- int brandName = this.count(new QueryWrapper<CameraBase>().eq("camera_name", camera.getCameraName()).eq("farm_id", camera.getFarmId()));
|
|
|
- if (brandName > 0) {
|
|
|
- return new Result(10001, "摄像头名称重复", false);
|
|
|
- }
|
|
|
- if (areaId != null) {
|
|
|
- camera.setAreaName(cameraAreaMapper.selectById(areaId).getAreaName());
|
|
|
- }
|
|
|
- if (brandId != null) {
|
|
|
- camera.setBrandName(cameraBrandMapper.selectById(brandId).getBrandName());
|
|
|
- }
|
|
|
- this.save(camera);
|
|
|
-
|
|
|
- return new Result(10000, "添加成功", true);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result updates(CameraBase camera) {
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- Integer brandId = camera.getBrandId();
|
|
|
- this.updateById(camera);
|
|
|
- int brandName = this.count(new QueryWrapper<CameraBase>().eq("camera_name", camera.getCameraName()));
|
|
|
- if (brandName > 1) {
|
|
|
- return new Result(10001, "摄像头名称重复", false);
|
|
|
- }
|
|
|
- if (areaId != null) {
|
|
|
- camera.setAreaName(cameraAreaMapper.selectById(areaId).getAreaName());
|
|
|
- }
|
|
|
- if (brandId != null) {
|
|
|
- camera.setBrandName(cameraBrandMapper.selectById(brandId).getBrandName());
|
|
|
- }
|
|
|
- this.updateById(camera);
|
|
|
- return new Result(10000, "修改成功", true);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public CameraVo getCameraDetailsByRoomId(Integer roomId) {
|
|
|
-
|
|
|
-
|
|
|
- CameraBase camera = this.getOne(new QueryWrapper<CameraBase>().eq("room_id", roomId));
|
|
|
-
|
|
|
- return getCameraVo(camera);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// @Override
|
|
|
-// public Result initCamera(Integer farmId, Integer userId) {
|
|
|
-// BaseScreenCameraAccount cameraAccount = cameraAccountMapper.selectOne(new QueryWrapper<BaseScreenCameraAccount>().eq("farm_id", farmId).eq("account_id", userId));
|
|
|
-// Integer cameraId;
|
|
|
-// if (ObjectUtil.isEmpty(cameraAccount)) {
|
|
|
-// cameraId = this.getOne(new QueryWrapper<Camera>().eq("run_status", 1).eq("farm_id", farmId).last("limit 1")).getId();
|
|
|
-// } else {
|
|
|
-// cameraId = cameraAccount.getCameraId();
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// Camera camera = this.getById(cameraId);
|
|
|
-// if (!camera.getRunStatus()) {
|
|
|
-// return new Result(10001, "该摄像头已经被禁用", false);
|
|
|
-// }
|
|
|
-//
|
|
|
-// return new Result(ResultCode.SUCCESS, getCameraVo(camera));
|
|
|
-// }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result listScreenCamera(Integer farmId) {
|
|
|
- List<CameraBase> cameras = this.list(new QueryWrapper<CameraBase>().eq("farm_id", farmId));
|
|
|
+ CameraBrand cameraBrand = cameraBrandMapper.selectById(18);
|
|
|
List list = new ArrayList();
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- list.add(getCameraVo(cameras.get(RandomUtil.randomInt(0, cameras.size()))));
|
|
|
- }
|
|
|
-
|
|
|
- return new Result(ResultCode.SUCCESS, list);
|
|
|
+ for (Integer cameraId : cameraIds) {
|
|
|
+ CameraBase cameraBase = this.getById(cameraId);
|
|
|
+ String regionUuid = cameraBase.getRegionUuid();
|
|
|
+ CameraArea cameraArea = cameraAreaMapper.selectOne(new QueryWrapper<CameraArea>().eq("region_uuid", regionUuid));
|
|
|
+ // http://61.153.248.106:6713/mag/hls/6bf5d2cf30bb440cad3fc126512f5188/1/live.m3u8
|
|
|
+ String hls ="http://"+cameraArea.getPublicUrl()+cameraBrand.getStreamType()+cameraBase.getCameraUuid()+"/"+ cameraBrand.getMainStream()+"/"+"live.m3u8";
|
|
|
+ CameraVo cameraVo = new CameraVo();
|
|
|
+ cameraVo.setHlsUrl(hls);
|
|
|
+ cameraVo.setId(cameraBase.getId());
|
|
|
+ cameraVo.setCameraName(cameraBase.getCameraName());
|
|
|
+ list.add(cameraVo);
|
|
|
+ }
|
|
|
+ return ResultUtil.list(list);
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public Result screenCamera(Integer farmId) {
|
|
|
-//
|
|
|
-// BaseRoom baseRoom = baseRoomMapper.selectOne(new QueryWrapper<BaseRoom>().eq("farm_id", farmId).last("limit 1"));
|
|
|
-// Integer roomId;
|
|
|
-// if (ObjectUtil.isNotEmpty(baseRoom)) {
|
|
|
-//
|
|
|
-// roomId = baseRoom.getId();
|
|
|
-// } else {
|
|
|
-// return new Result(ResultCode.SUCCESS, null);
|
|
|
-// }
|
|
|
-// Camera room_id = this.getOne(new QueryWrapper<Camera>().eq("room_id", roomId));
|
|
|
-// CameraVo cameraVo = getCameraVo(room_id);
|
|
|
-//
|
|
|
-// return new Result(ResultCode.SUCCESS, cameraVo);
|
|
|
-// }
|
|
|
|
|
|
@Override
|
|
|
- public List getCameraDetails2(CameraListsVo cameraListsVo) {
|
|
|
- List<Integer> cameraIds = cameraListsVo.getCameraIds();
|
|
|
- CameraListVo cameraListVo = new CameraListsVo();
|
|
|
- cameraListVo.setCurrent(1);
|
|
|
- cameraListVo.setSize(10000);
|
|
|
- cameraListVo.setStrchStr(cameraListsVo.getStrchStr());
|
|
|
- cameraListVo.setAreaId(cameraListsVo.getAreaId());
|
|
|
- cameraListVo.setBrandId(cameraListsVo.getBrandId());
|
|
|
- cameraListVo.setSort(cameraListsVo.getSort());
|
|
|
-
|
|
|
- if (cameraIds == null || cameraIds.size() == 0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- List cameraDetailsList = new ArrayList();
|
|
|
- IPage<CameraBase> page = (IPage<CameraBase>)this.listPage(cameraListVo).getData();
|
|
|
- List<CameraBase> list = page.getRecords();
|
|
|
- int i = 0;
|
|
|
- final String farmAppPort = "8081";
|
|
|
- final String farmVideoApp = "/appleVideo/play?";
|
|
|
- final String hlsMediaPort= "85";
|
|
|
- for (CameraBase camera : list) {
|
|
|
- for (Integer cameraId : cameraIds) {
|
|
|
- if (cameraId.equals( camera.getId())){
|
|
|
- String cameraAccount = camera.getAccount();
|
|
|
- String cameraPassword = camera.getPassword();
|
|
|
- String camerIp = camera.getCameraIp();
|
|
|
- String cameraName = camera.getCameraName();
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- String url = cameraAreaMapper.selectById(areaId).getPublicUrl();
|
|
|
- url = url.substring(0,url.indexOf(":"));
|
|
|
- url="http://"+url;
|
|
|
- CameraVo cameraVo= new CameraVo();
|
|
|
- cameraVo.setAreaId(areaId);
|
|
|
-// cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
-// cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
- //示例
|
|
|
-// cameraVo.setHttpUrl("http://183.249.204.153:8081/appleVideo/play?url=admin:hmkj6688@192.168.1.108&name=101&dt=3000&targetUrl=http://183.249.204.153:85");
|
|
|
- cameraVo.setHttpUrl(url+":"+farmAppPort+farmVideoApp+"url="+cameraAccount + ":" + cameraPassword + "@" + camerIp+"&name="+"&dt=3000&targetUrl="+url+":"+hlsMediaPort);
|
|
|
- cameraVo.setCameraName(cameraName);
|
|
|
- if (i > 0){
|
|
|
- cameraVo.setLastId(list.get(i-1).getId());
|
|
|
- }
|
|
|
- if (i < list.size()-1 ){
|
|
|
- cameraVo.setNextId(list.get(i+1).getId());
|
|
|
- }
|
|
|
- cameraDetailsList.add(cameraVo);
|
|
|
- }
|
|
|
+ public void sync(Map<String, Integer> params, List<CameraDto1> list) {
|
|
|
+ Integer farmId = params.get("farmId");
|
|
|
+ //先删除
|
|
|
+ this.remove(new QueryWrapper<CameraBase>().eq("farm_id",farmId));
|
|
|
+ System.out.println(list.size());
|
|
|
+ //
|
|
|
+ for (CameraDto1 cameraDto1 : list) {
|
|
|
+ CameraBase cameraBase = new CameraBase();
|
|
|
+ BeanUtil.copyProperties(cameraDto1,cameraBase);
|
|
|
+ CameraArea cameraArea = cameraAreaMapper.selectOne(new QueryWrapper<CameraArea>().eq("region_uuid", cameraDto1.getRegionUuid()));
|
|
|
+ if (ObjectUtil.isNotEmpty(cameraArea)){
|
|
|
+ cameraBase.setAreaName(cameraArea.getAreaName());
|
|
|
}
|
|
|
- i++;
|
|
|
+ cameraBase.setBrandName("海康威视");
|
|
|
+ cameraBase.setFarmId(farmId);
|
|
|
+ this.save(cameraBase);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- return cameraDetailsList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ //更新摄像头状态
|
|
|
@Override
|
|
|
- public List getByAreaId(Integer areaId) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public CameraVo getCameraVo(CameraBase camera) {
|
|
|
-
|
|
|
- String cameraAccount = camera.getAccount();
|
|
|
- String cameraPassword = camera.getPassword();
|
|
|
- String camerIp = camera.getCameraIp();
|
|
|
- String cameraName = camera.getCameraName();
|
|
|
- Integer areaId = camera.getAreaId();
|
|
|
- String url = cameraAreaMapper.selectById(areaId).getPublicUrl();
|
|
|
-
|
|
|
- String rtsp;
|
|
|
- CameraBrand cameraBrand = cameraBrandMapper.selectById(camera.getBrandId());
|
|
|
- Integer type = cameraBrand.getStreamType();
|
|
|
- if (type == 0) {
|
|
|
- rtsp = cameraBrand.getMainStream();
|
|
|
- } else {
|
|
|
- rtsp = cameraBrand.getAssistStream();
|
|
|
+ public void updateCameraOnlin(List<CameraDto1> list) {
|
|
|
+ for (CameraDto1 cameraDto1 : list) {
|
|
|
+ String cameraUuid = cameraDto1.getCameraUuid();
|
|
|
+ CameraBase one = this.getOne(new QueryWrapper<CameraBase>().eq("camera_uuid", cameraUuid));
|
|
|
+ one.setOnLineStatus(1 ==cameraDto1.getOnLineStatus());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- CameraVo cameraVo = new CameraVo();
|
|
|
- cameraVo.setAreaId(areaId);
|
|
|
-
|
|
|
- if (camera.getId() == 767){
|
|
|
- cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
- cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + "/cam/realmonitor?channel=2&subtype=0");
|
|
|
- }else {
|
|
|
- cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
- cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
- }
|
|
|
-// cameraVo.setWsUrl("ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
-// cameraVo.setRtspUrl("rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
- cameraVo.setCameraName(cameraName);
|
|
|
- return cameraVo;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|