|
@@ -1,286 +1,289 @@
|
|
|
-package com.sckj.device.service.impl;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.sckj.camera.manager.CameraProperties;
|
|
|
-import com.sckj.common.TapholeAdminThreadLocal;
|
|
|
-import com.sckj.common.core.AjaxResult;
|
|
|
-import com.sckj.common.exception.OperateException;
|
|
|
-import com.sckj.common.validate.commons.PageValidate;
|
|
|
-import com.sckj.device.validate.TCameraCreateValidate;
|
|
|
-import com.sckj.device.validate.TCameraUpdateDTO;
|
|
|
-import com.sckj.device.validate.TCameraUpdateValidate;
|
|
|
-import com.sckj.device.validate.TCameraSearchValidate;
|
|
|
-import com.sckj.device.vo.CameraDTO;
|
|
|
-import com.sckj.device.vo.TCameraListedVo;
|
|
|
-import com.sckj.device.vo.TCameraDetailVo;
|
|
|
-import com.sckj.common.core.PageResult;
|
|
|
-import com.sckj.device.entity.TCamera;
|
|
|
-import com.sckj.device.mapper.TCameraMapper;
|
|
|
-import org.apache.commons.lang3.ObjectUtils;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.Assert;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.*;
|
|
|
-import java.util.regex.Matcher;
|
|
|
-import java.util.regex.Pattern;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
-/**
|
|
|
- * 摄像头实现类
|
|
|
- *
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class TCameraServiceImpl extends ServiceImpl<TCameraMapper, TCamera> {
|
|
|
-
|
|
|
- @Resource
|
|
|
- TCameraMapper tCameraMapper;
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头列表
|
|
|
- *
|
|
|
- * @param pageValidate 分页参数
|
|
|
- * @param searchValidate 搜索参数
|
|
|
- * @return PageResult<TCameraListedVo>
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public PageResult<TCameraListedVo> list(PageValidate pageValidate, TCameraSearchValidate searchValidate) {
|
|
|
- Integer page = pageValidate.getPageNo();
|
|
|
- Integer limit = pageValidate.getPageSize();
|
|
|
-
|
|
|
- QueryWrapper<TCamera> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("del_flag", "1");
|
|
|
- queryWrapper.orderByDesc("id");
|
|
|
-
|
|
|
- tCameraMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
|
|
- "=:no:str",
|
|
|
- "like:name:str",
|
|
|
- "=:model:str",
|
|
|
- });
|
|
|
-
|
|
|
- IPage<TCamera> iPage = tCameraMapper.selectPage(new Page<>(page, limit), queryWrapper.eq("type", "1"));
|
|
|
-
|
|
|
- List<TCameraListedVo> list = new LinkedList<>();
|
|
|
- for (TCamera item : iPage.getRecords()) {
|
|
|
- TCameraListedVo vo = new TCameraListedVo();
|
|
|
- BeanUtils.copyProperties(item, vo);
|
|
|
- vo.setAddress("rtsp://"+item.getAccount()+":"+item.getPassword()+"@"+item.getIp()+":"+item.getPort()+"/102");
|
|
|
- list.add(vo);
|
|
|
- }
|
|
|
-
|
|
|
- return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头详情
|
|
|
- *
|
|
|
- * @param id 主键参数
|
|
|
- * @return TCamera
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public TCameraDetailVo detail(Integer id) {
|
|
|
- TCamera model = tCameraMapper.selectOne(
|
|
|
- new QueryWrapper<TCamera>()
|
|
|
- .eq("id", id).eq("del_flag", "1")
|
|
|
- .last("limit 1"));
|
|
|
-
|
|
|
- Assert.notNull(model, "数据不存在");
|
|
|
-
|
|
|
- TCameraDetailVo vo = new TCameraDetailVo();
|
|
|
- BeanUtils.copyProperties(model, vo);
|
|
|
- return vo;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头新增
|
|
|
- *
|
|
|
- * @param createValidate 参数
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public int add(TCameraCreateValidate createValidate) {
|
|
|
- TCamera model = new TCamera();
|
|
|
- if (!checkPortAndIp(createValidate.getPort(), createValidate.getIp())) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- model.setCreateTime(new Date(System.currentTimeMillis()));
|
|
|
- model.setCreateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
|
|
|
- model.setUpdateTime(new Date(System.currentTimeMillis()));
|
|
|
- model.setNo(createValidate.getNo());
|
|
|
- model.setName(createValidate.getName());
|
|
|
- model.setModel(createValidate.getModel());
|
|
|
- model.setLocation(createValidate.getLocation());
|
|
|
- model.setIp(createValidate.getIp());
|
|
|
- model.setPort(createValidate.getPort());
|
|
|
- model.setStatus(createValidate.getStatus());
|
|
|
- model.setVcrId(createValidate.getVcrId());
|
|
|
- model.setType(createValidate.getType());
|
|
|
- return tCameraMapper.insert(model);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头编辑
|
|
|
- *
|
|
|
- * @param updateValidate 参数
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public int edit(TCameraUpdateValidate updateValidate) {
|
|
|
- TCamera model = tCameraMapper.selectOne(
|
|
|
- new QueryWrapper<TCamera>()
|
|
|
- .eq("id", updateValidate.getId())
|
|
|
- .last("limit 1"));
|
|
|
-
|
|
|
- Assert.notNull(model, "数据不存在!");
|
|
|
-
|
|
|
- if (!checkPortAndIp(updateValidate.getPort(), updateValidate.getIp())) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
- model.setUpdateTime(new Date(System.currentTimeMillis()));
|
|
|
- model.setUpdateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
|
|
|
- model.setNo(updateValidate.getNo());
|
|
|
- model.setName(updateValidate.getName());
|
|
|
- model.setModel(updateValidate.getModel());
|
|
|
- model.setLocation(updateValidate.getLocation());
|
|
|
- model.setIp(updateValidate.getIp());
|
|
|
- model.setPort(updateValidate.getPort());
|
|
|
- model.setStatus(updateValidate.getStatus());
|
|
|
- model.setVcrId(updateValidate.getVcrId());
|
|
|
- return tCameraMapper.updateById(model);
|
|
|
- }
|
|
|
-
|
|
|
- public boolean checkPortAndIp(String port, String ip) {
|
|
|
- if (Integer.parseInt(port) > 65535 && Integer.parseInt(port) < 0) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- String IP_PATTERN = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
|
|
|
- Pattern pattern = Pattern.compile(IP_PATTERN);
|
|
|
- Matcher matcher = pattern.matcher(ip);
|
|
|
- if (!matcher.matches()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头删除
|
|
|
- *
|
|
|
- * @param id 主键ID
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public void del(Integer id) {
|
|
|
- TCamera model = tCameraMapper.selectOne(
|
|
|
- new QueryWrapper<TCamera>()
|
|
|
- .eq("id", id)
|
|
|
- .last("limit 1"));
|
|
|
-
|
|
|
- Assert.notNull(model, "数据不存在!");
|
|
|
-
|
|
|
- model.setDelFlag("0");
|
|
|
-
|
|
|
- tCameraMapper.updateById(model);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 摄像头批量删除
|
|
|
- *
|
|
|
- * @param ids 主键数组
|
|
|
- * @author zhanghao
|
|
|
- */
|
|
|
- public AjaxResult<Object> del_ex(List<Long> ids) {
|
|
|
- List<TCamera> models = tCameraMapper.selectList(
|
|
|
- new QueryWrapper<TCamera>()
|
|
|
- .in("id", ids));
|
|
|
-
|
|
|
- if (CollectionUtils.isEmpty(models)){
|
|
|
- return AjaxResult.failed("数据不存在");
|
|
|
- }
|
|
|
- TCamera model = new TCamera();
|
|
|
- model.setDelFlag("0");
|
|
|
- tCameraMapper.update(model, new QueryWrapper<TCamera>().in("id", ids));
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @Resource
|
|
|
- private CameraProperties cameraProperties;
|
|
|
-
|
|
|
-
|
|
|
- public Map<String, Object> getCameraInfo() {
|
|
|
- List<TCamera> cameraList = lambdaQuery().eq(TCamera::getType, "1").in(TCamera::getStatus, "1", "2").orderByAsc(TCamera::getSort).list();
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- List<CameraDTO> collect = cameraList.stream().flatMap((item) -> {
|
|
|
- CameraDTO dto = new CameraDTO();
|
|
|
- BeanUtils.copyProperties(item, dto);
|
|
|
- String channelNumberStr = 1 + "02"; //新通道(2012年之后设备,02代表子码流)
|
|
|
- String rtspUrl = "rtsp://" + item.getAccount() + ":" + item.getPassword() + "@" + item.getIp() + ":" + item.getPortRtsp() + "/" + channelNumberStr + "?transportmode=unicast"; //新码流
|
|
|
- dto.setRtspUrl(rtspUrl);
|
|
|
- return Stream.of(dto);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- map.put("cameraList", collect);
|
|
|
-
|
|
|
- List<CameraDTO> bannerList = new ArrayList<>();
|
|
|
- for (CameraDTO cameraDTO : collect) {
|
|
|
- if ("2".equals(cameraDTO.getStatus())) {
|
|
|
- bannerList.add(cameraDTO);
|
|
|
- }
|
|
|
- }
|
|
|
- map.put("bannerList", bannerList);
|
|
|
- map.put("rtmpUrl", "http://" + cameraProperties.getRtmp().getWebrtchost());
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- public Map<String, Object> getCameraParamInfo() {
|
|
|
- List<TCamera> cameraList = lambdaQuery().eq(TCamera::getType, "1").in(TCamera::getStatus, "1", "2").orderByAsc(TCamera::getSort).list();
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- List<CameraDTO> collect = cameraList.stream().flatMap((item) -> {
|
|
|
- CameraDTO dto = new CameraDTO();
|
|
|
- BeanUtils.copyProperties(item, dto);
|
|
|
- return Stream.of(dto);
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- List<CameraDTO> normalList = new ArrayList<>();
|
|
|
- List<CameraDTO> bannerList = new ArrayList<>();
|
|
|
-
|
|
|
- for (CameraDTO cameraDTO : collect) {
|
|
|
- if ("1".equals(cameraDTO.getStatus())) {
|
|
|
- normalList.add(cameraDTO);
|
|
|
- }
|
|
|
- if ("2".equals(cameraDTO.getStatus())) {
|
|
|
- bannerList.add(cameraDTO);
|
|
|
- }
|
|
|
- }
|
|
|
- map.put("normalList", normalList);
|
|
|
- map.put("bannerList", bannerList);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Transactional
|
|
|
- public void updateBatchs(List<TCameraUpdateDTO> cameraList) {
|
|
|
- for (TCameraUpdateDTO camera : cameraList) {
|
|
|
- TCamera queryData = getById(camera.getId());
|
|
|
- if (ObjectUtils.isEmpty(queryData)) {
|
|
|
- throw new OperateException(String.format("传入的ID不存在:%s", camera.getId()));
|
|
|
- }
|
|
|
-
|
|
|
- LambdaUpdateWrapper<TCamera> wrapper = new LambdaUpdateWrapper<>();
|
|
|
- wrapper.eq(TCamera::getId, camera.getId());
|
|
|
- if (ObjectUtils.isNotEmpty(camera.getStatus())) {
|
|
|
- wrapper.set(TCamera::getStatus, camera.getStatus());
|
|
|
- }
|
|
|
- if (camera.getSort() != null) {
|
|
|
- wrapper.set(TCamera::getSort, camera.getSort());
|
|
|
- }
|
|
|
- update(wrapper);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+//package com.sckj.device.service.impl;
|
|
|
+//
|
|
|
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+//import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+//import com.sckj.camera.manager.CameraProperties;
|
|
|
+//import com.sckj.common.TapholeAdminThreadLocal;
|
|
|
+//import com.sckj.common.core.AjaxResult;
|
|
|
+//import com.sckj.common.exception.OperateException;
|
|
|
+//import com.sckj.common.validate.commons.PageValidate;
|
|
|
+//import com.sckj.device.dto.CameraInfo;
|
|
|
+//import com.sckj.device.dto.CameraParamInfo;
|
|
|
+//import com.sckj.device.validate.TCameraCreateValidate;
|
|
|
+//import com.sckj.device.validate.TCameraUpdateDTO;
|
|
|
+//import com.sckj.device.validate.TCameraUpdateValidate;
|
|
|
+//import com.sckj.device.validate.TCameraSearchValidate;
|
|
|
+//import com.sckj.device.vo.CameraDTO;
|
|
|
+//import com.sckj.device.vo.TCameraListedVo;
|
|
|
+//import com.sckj.device.vo.TCameraDetailVo;
|
|
|
+//import com.sckj.common.core.PageResult;
|
|
|
+//import com.sckj.device.entity.TCamera;
|
|
|
+//import com.sckj.device.mapper.TCameraMapper;
|
|
|
+//import org.apache.commons.lang3.ObjectUtils;
|
|
|
+//import org.springframework.beans.BeanUtils;
|
|
|
+//import org.springframework.stereotype.Service;
|
|
|
+//import org.springframework.transaction.annotation.Transactional;
|
|
|
+//import org.springframework.util.Assert;
|
|
|
+//import org.springframework.util.CollectionUtils;
|
|
|
+//
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//import java.util.*;
|
|
|
+//import java.util.regex.Matcher;
|
|
|
+//import java.util.regex.Pattern;
|
|
|
+//import java.util.stream.Collectors;
|
|
|
+//import java.util.stream.Stream;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * 摄像头实现类
|
|
|
+// *
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+//@Service
|
|
|
+//public class TCameraServiceImpl extends ServiceImpl<TCameraMapper, TCamera> {
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// TCameraMapper tCameraMapper;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头列表
|
|
|
+// *
|
|
|
+// * @param pageValidate 分页参数
|
|
|
+// * @param searchValidate 搜索参数
|
|
|
+// * @return PageResult<TCameraListedVo>
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public PageResult<TCameraListedVo> list(PageValidate pageValidate, TCameraSearchValidate searchValidate) {
|
|
|
+// Integer page = pageValidate.getPageNo();
|
|
|
+// Integer limit = pageValidate.getPageSize();
|
|
|
+//
|
|
|
+// QueryWrapper<TCamera> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("del_flag", "1");
|
|
|
+// queryWrapper.orderByDesc("id");
|
|
|
+//
|
|
|
+// tCameraMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
|
|
+// "=:no:str",
|
|
|
+// "like:name:str",
|
|
|
+// "=:model:str",
|
|
|
+// });
|
|
|
+//
|
|
|
+// IPage<TCamera> iPage = tCameraMapper.selectPage(new Page<>(page, limit), queryWrapper.eq("type", "1"));
|
|
|
+//
|
|
|
+// List<TCameraListedVo> list = new LinkedList<>();
|
|
|
+// for (TCamera item : iPage.getRecords()) {
|
|
|
+// TCameraListedVo vo = new TCameraListedVo();
|
|
|
+// BeanUtils.copyProperties(item, vo);
|
|
|
+// vo.setAddress("rtsp://" + item.getAccount() + ":" + item.getPassword() + "@" + item.getIp() + ":" + item.getPort() + "/102");
|
|
|
+// list.add(vo);
|
|
|
+// }
|
|
|
+//
|
|
|
+// return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头详情
|
|
|
+// *
|
|
|
+// * @param id 主键参数
|
|
|
+// * @return TCamera
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public TCameraDetailVo detail(Integer id) {
|
|
|
+// TCamera model = tCameraMapper.selectOne(
|
|
|
+// new QueryWrapper<TCamera>()
|
|
|
+// .eq("id", id).eq("del_flag", "1")
|
|
|
+// .last("limit 1"));
|
|
|
+//
|
|
|
+// Assert.notNull(model, "数据不存在");
|
|
|
+//
|
|
|
+// TCameraDetailVo vo = new TCameraDetailVo();
|
|
|
+// BeanUtils.copyProperties(model, vo);
|
|
|
+// return vo;
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头新增
|
|
|
+// *
|
|
|
+// * @param createValidate 参数
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public int add(TCameraCreateValidate createValidate) {
|
|
|
+// TCamera model = new TCamera();
|
|
|
+// if (!checkPortAndIp(createValidate.getPort(), createValidate.getIp())) {
|
|
|
+// return 0;
|
|
|
+// }
|
|
|
+// model.setCreateTime(new Date(System.currentTimeMillis()));
|
|
|
+// model.setCreateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
|
|
|
+// model.setUpdateTime(new Date(System.currentTimeMillis()));
|
|
|
+// model.setNo(createValidate.getNo());
|
|
|
+// model.setName(createValidate.getName());
|
|
|
+// model.setModel(createValidate.getModel());
|
|
|
+// model.setLocation(createValidate.getLocation());
|
|
|
+// model.setIp(createValidate.getIp());
|
|
|
+// model.setPort(createValidate.getPort());
|
|
|
+// model.setStatus(createValidate.getStatus());
|
|
|
+// model.setVcrId(createValidate.getVcrId());
|
|
|
+// model.setType(createValidate.getType());
|
|
|
+// return tCameraMapper.insert(model);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头编辑
|
|
|
+// *
|
|
|
+// * @param updateValidate 参数
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public int edit(TCameraUpdateValidate updateValidate) {
|
|
|
+// TCamera model = tCameraMapper.selectOne(
|
|
|
+// new QueryWrapper<TCamera>()
|
|
|
+// .eq("id", updateValidate.getId())
|
|
|
+// .last("limit 1"));
|
|
|
+//
|
|
|
+// Assert.notNull(model, "数据不存在!");
|
|
|
+//
|
|
|
+// if (!checkPortAndIp(updateValidate.getPort(), updateValidate.getIp())) {
|
|
|
+// return 0;
|
|
|
+// }
|
|
|
+//
|
|
|
+// model.setUpdateTime(new Date(System.currentTimeMillis()));
|
|
|
+// model.setUpdateBy(String.valueOf(TapholeAdminThreadLocal.getAdminUsername()));
|
|
|
+// model.setNo(updateValidate.getNo());
|
|
|
+// model.setName(updateValidate.getName());
|
|
|
+// model.setModel(updateValidate.getModel());
|
|
|
+// model.setLocation(updateValidate.getLocation());
|
|
|
+// model.setIp(updateValidate.getIp());
|
|
|
+// model.setPort(updateValidate.getPort());
|
|
|
+// model.setStatus(updateValidate.getStatus());
|
|
|
+// model.setVcrId(updateValidate.getVcrId());
|
|
|
+// return tCameraMapper.updateById(model);
|
|
|
+// }
|
|
|
+//
|
|
|
+// public boolean checkPortAndIp(String port, String ip) {
|
|
|
+// if (Integer.parseInt(port) > 65535 && Integer.parseInt(port) < 0) {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// String IP_PATTERN = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
|
|
|
+// Pattern pattern = Pattern.compile(IP_PATTERN);
|
|
|
+// Matcher matcher = pattern.matcher(ip);
|
|
|
+// if (!matcher.matches()) {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头删除
|
|
|
+// *
|
|
|
+// * @param id 主键ID
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public void del(Integer id) {
|
|
|
+// TCamera model = tCameraMapper.selectOne(
|
|
|
+// new QueryWrapper<TCamera>()
|
|
|
+// .eq("id", id)
|
|
|
+// .last("limit 1"));
|
|
|
+//
|
|
|
+// Assert.notNull(model, "数据不存在!");
|
|
|
+//
|
|
|
+// model.setDelFlag("0");
|
|
|
+//
|
|
|
+// tCameraMapper.updateById(model);
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 摄像头批量删除
|
|
|
+// *
|
|
|
+// * @param ids 主键数组
|
|
|
+// * @author zhanghao
|
|
|
+// */
|
|
|
+// public AjaxResult<Object> del_ex(List<Long> ids) {
|
|
|
+// List<TCamera> models = tCameraMapper.selectList(
|
|
|
+// new QueryWrapper<TCamera>()
|
|
|
+// .in("id", ids));
|
|
|
+//
|
|
|
+// if (CollectionUtils.isEmpty(models)) {
|
|
|
+// return AjaxResult.failed("数据不存在");
|
|
|
+// }
|
|
|
+// TCamera model = new TCamera();
|
|
|
+// model.setDelFlag("0");
|
|
|
+// tCameraMapper.update(model, new QueryWrapper<TCamera>().in("id", ids));
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private CameraProperties cameraProperties;
|
|
|
+//
|
|
|
+//
|
|
|
+// public CameraInfo getCameraInfo() {
|
|
|
+// List<TCamera> cameraList = lambdaQuery().eq(TCamera::getType, "1").in(TCamera::getStatus, "1", "2").orderByAsc(TCamera::getSort).list();
|
|
|
+// CameraInfo cameraParamInfo = new CameraInfo();
|
|
|
+// List<CameraDTO> collect = cameraList.stream().flatMap((item) -> {
|
|
|
+// CameraDTO dto = new CameraDTO();
|
|
|
+// BeanUtils.copyProperties(item, dto);
|
|
|
+// String channelNumberStr = 1 + "02"; //新通道(2012年之后设备,02代表子码流)
|
|
|
+// String rtspUrl = "rtsp://" + item.getAccount() + ":" + item.getPassword() + "@" + item.getIp() + ":" + item.getPortRtsp() + "/" + channelNumberStr + "?transportmode=unicast"; //新码流
|
|
|
+// dto.setRtspUrl(rtspUrl);
|
|
|
+// return Stream.of(dto);
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+// cameraParamInfo.setCameraList(collect);
|
|
|
+//
|
|
|
+// List<CameraDTO> bannerList = new ArrayList<>();
|
|
|
+// for (CameraDTO cameraDTO : collect) {
|
|
|
+// if ("2".equals(cameraDTO.getStatus())) {
|
|
|
+// bannerList.add(cameraDTO);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// cameraParamInfo.setBannerList(collect);
|
|
|
+// cameraParamInfo.setRtmpUrl("http://" + cameraProperties.getRtmp().getWebrtchost());
|
|
|
+//// map.put("rtmpUrl", "http://" + cameraProperties.getRtmp().getWebrtchost());
|
|
|
+// return cameraParamInfo;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public CameraParamInfo getCameraParamInfo() {
|
|
|
+// List<TCamera> cameraList = lambdaQuery().eq(TCamera::getType, "1").in(TCamera::getStatus, "1", "2").orderByAsc(TCamera::getSort).list();
|
|
|
+// CameraParamInfo map = new CameraParamInfo();
|
|
|
+// List<CameraDTO> collect = cameraList.stream().flatMap((item) -> {
|
|
|
+// CameraDTO dto = new CameraDTO();
|
|
|
+// BeanUtils.copyProperties(item, dto);
|
|
|
+// return Stream.of(dto);
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// List<CameraDTO> normalList = new ArrayList<>();
|
|
|
+// List<CameraDTO> bannerList = new ArrayList<>();
|
|
|
+//
|
|
|
+// for (CameraDTO cameraDTO : collect) {
|
|
|
+// if ("1".equals(cameraDTO.getStatus())) {
|
|
|
+// normalList.add(cameraDTO);
|
|
|
+// }
|
|
|
+// if ("2".equals(cameraDTO.getStatus())) {
|
|
|
+// bannerList.add(cameraDTO);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// map.setNormalList(normalList);
|
|
|
+// map.setBannerList(bannerList);
|
|
|
+// return map;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @Transactional
|
|
|
+// public void updateBatchs(List<TCameraUpdateDTO> cameraList) {
|
|
|
+// for (TCameraUpdateDTO camera : cameraList) {
|
|
|
+// TCamera queryData = getById(camera.getId());
|
|
|
+// if (ObjectUtils.isEmpty(queryData)) {
|
|
|
+// throw new OperateException(String.format("传入的ID不存在:%s", camera.getId()));
|
|
|
+// }
|
|
|
+//
|
|
|
+// LambdaUpdateWrapper<TCamera> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+// wrapper.eq(TCamera::getId, camera.getId());
|
|
|
+// if (ObjectUtils.isNotEmpty(camera.getStatus())) {
|
|
|
+// wrapper.set(TCamera::getStatus, camera.getStatus());
|
|
|
+// }
|
|
|
+// if (camera.getSort() != null) {
|
|
|
+// wrapper.set(TCamera::getSort, camera.getSort());
|
|
|
+// }
|
|
|
+// update(wrapper);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|