396 lines
14 KiB
Plaintext
396 lines
14 KiB
Plaintext
package com.sercurityControl.proteam.controller;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.securityControl.common.core.utils.StringUtils;
|
|
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
|
import com.securityControl.common.core.web.controller.BaseController;
|
|
import com.securityControl.common.core.web.domain.AjaxResult;
|
|
import com.securityControl.common.log.annotation.Log;
|
|
import com.securityControl.common.log.enums.BusinessType;
|
|
import com.sercurityControl.proteam.domain.*;
|
|
import com.sercurityControl.proteam.service.VideoService;
|
|
import com.sercurityControl.proteam.service.impl.VideoRequest;
|
|
|
|
import com.sercurityControl.proteam.util.QxVideotape;
|
|
import com.sercurityControl.proteam.util.VideoConfigUtil;
|
|
import com.sercurityControl.proteam.util.WordUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/*import com.sercurityControl.proteam.util.VideoUtil;*/
|
|
|
|
/**
|
|
* @author bonus
|
|
* @data 2022/12/13 10:09
|
|
* @description 实时监控
|
|
*/
|
|
@Api(tags = "班组信息")
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("/pot/video")
|
|
public class VideoController extends BaseController {
|
|
|
|
@Autowired
|
|
private VideoService service;
|
|
@Autowired
|
|
private VideoRequest request;
|
|
|
|
@Resource
|
|
private VideoConfigUtil configUtil;
|
|
|
|
|
|
/**
|
|
* 地级市查询树节点数据
|
|
*
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "地级市查询树节点数据")
|
|
@PostMapping("/getMenuListCity")
|
|
@Log(title = "无人机巡视", businessType = BusinessType.UPDATE, details = "地级市查询树节点数据")
|
|
public AjaxResult getMenuListCity(String orgId, String keyWord) {
|
|
return service.getMenuListCity(orgId, keyWord);
|
|
}
|
|
|
|
|
|
/**
|
|
* 查询省外球机
|
|
*
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "省外球机树列表查询")
|
|
@PostMapping("/getMenuListSWCity")
|
|
@Log(title = "无人机巡视", businessType = BusinessType.UPDATE, details = "地级市查询树节点数据")
|
|
public AjaxResult getMenuListSWCity(String orgId, String keyWord) {
|
|
return service.initTreeSwCity(orgId, keyWord);
|
|
}
|
|
/**
|
|
* 风险等级查询树节点数据
|
|
*
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "风险等级查询树节点数据")
|
|
@PostMapping("/getMenuListRisk")
|
|
@Log(title = "无人机巡视", businessType = BusinessType.UPDATE, details = "getMenuListRisk")
|
|
public AjaxResult getMenuListRisk(String orgId, String keyWord) {
|
|
return service.getMenuListRisk(orgId, keyWord);
|
|
}
|
|
|
|
/**
|
|
* @return com.securityControl.common.core.web.domain.AjaxResult
|
|
* @author cw chen
|
|
* @description 固定球机查询数节点
|
|
* @Param orgId
|
|
* @Param keyWord
|
|
* @date 2023-06-29 16:02
|
|
*/
|
|
@ApiOperation(value = "固定球机查询树节点数据")
|
|
@PostMapping("/getMenuListRegular")
|
|
@Log(title = "视频监控", businessType = BusinessType.UPDATE, details = "getMenuListRegular")
|
|
public AjaxResult getMenuListRegular(String orgId, String keyWord) {
|
|
try {
|
|
List<DtreeEntity> regularList = service.getMenuListRegular(orgId, keyWord);
|
|
return AjaxResult.success("success",regularList);
|
|
} catch (Exception e) {
|
|
logger.error("固定球机查询树节点数据",e);
|
|
return AjaxResult.error("服务异常,请稍后重试");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 查询录像
|
|
*
|
|
* @param entity 条件
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "风险等级查询树节点数据")
|
|
@PostMapping("/getQueryRecord")
|
|
@Log(title = "历史记录", businessType = BusinessType.QUERY, details = "查询录像")
|
|
public AjaxResult getQueryRecord(QueryRecordEntity entity) {
|
|
if ("1".equals(entity.getType())) {
|
|
return AjaxResult.success(request.getSesQueryRecord(entity));
|
|
} else {
|
|
return AjaxResult.success(request.getSesQueryRecord(entity));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 3D云台
|
|
*
|
|
* @param
|
|
* @return 集合
|
|
*/
|
|
|
|
@PostMapping("set3DyunConfig")
|
|
public AjaxResult set3DyunConfig(String Sx, String Sy, String Ex, String Ey, String puid){
|
|
AjaxResult ar = new AjaxResult();
|
|
String msg="设置失败";
|
|
try{
|
|
Map<String, Object> map= configUtil.getMaps();
|
|
String url= configUtil.getUrl();
|
|
msg= QxVideotape.set3DyunConfig(Sx,Sy,Ex,Ey,puid,map,url);
|
|
}catch (Exception e){
|
|
msg="设置异常";
|
|
}
|
|
return AjaxResult.success(msg);
|
|
}
|
|
|
|
/**
|
|
* 查询历史图片
|
|
*
|
|
* @param entity 条件
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "风险等级查询树节点数据")
|
|
@PostMapping("/getQueryImage")
|
|
@Log(title = "历史记录", businessType = BusinessType.QUERY, details = "查询历史图片")
|
|
public AjaxResult getQueryImage(QueryImageEntity entity) {
|
|
try {
|
|
return AjaxResult.success(request.getQueryImageByDevice(entity));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 查询上下线数据
|
|
*
|
|
* @param entity 条件
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "风险等级查询树节点数据")
|
|
@PostMapping("/getQueryDescriptionInfo")
|
|
@Log(title = "历史记录", businessType = BusinessType.QUERY, details = "查询上下线数据")
|
|
public AjaxResult getQueryDescriptionInfo(QueryDescriptionInfoEntity entity) {
|
|
try {
|
|
return AjaxResult.success(request.getQueryDevStatusDescriptionInfo(entity));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取球机上下线记录
|
|
*
|
|
* @param puIdList 球机编码集合
|
|
* @param startTime 开始时间(时间戳)
|
|
* @param endTime 结束时间(时间戳)
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "获取球机上下线记录")
|
|
@PostMapping("/getBallUpDown")
|
|
public AjaxResult getBallUpDown(String puIdList, String startTime, String endTime) {
|
|
return service.getBallUpDown(puIdList, startTime, endTime);
|
|
}
|
|
|
|
/**
|
|
* 获取球机平台录像//图片
|
|
*
|
|
* @param puIdList 球机编码集合
|
|
* @param startTime 开始时间(时间戳)
|
|
* @param endTime 结束时间(时间戳)
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "获取球平台录像//图片")
|
|
@PostMapping("/getBallVideo")
|
|
public AjaxResult getBallVideo(String puIdList, String type, String startTime, String endTime) {
|
|
return service.getBallVideo(puIdList, type, startTime, endTime);
|
|
}
|
|
|
|
/**
|
|
* 获取球机前端录像//图片
|
|
*
|
|
* @param puIdList 球机编码集合
|
|
* @param startTime 开始时间(时间戳)
|
|
* @param endTime 结束时间(时间戳)
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "获取球机前端录像//图片")
|
|
@PostMapping("/getBallVideoWeb")
|
|
public AjaxResult getBallVideoWeb(String puIdList, String type, String startTime, String endTime) {
|
|
return service.getBallVideoWeb(puIdList, type, startTime, endTime);
|
|
}
|
|
|
|
// /**
|
|
// * 获取球机前端录像//图片
|
|
// *
|
|
// * @param multipartFile 文件
|
|
// */
|
|
// @ApiOperation(value = "转MP4")
|
|
// @PostMapping("/webmToMp4")
|
|
// public AjaxResult webmToMp4(MultipartFile multipartFile, HttpServletRequest request, HttpServletResponse response) {
|
|
// try {
|
|
// // WebmUtil webmUtil = new WebmUtil(transferToFile(multipartFile));
|
|
// Map<String, Object> map = new HashMap<>();
|
|
// String convert2Mp4 = null;
|
|
//// if (webmUtil.isVideo()) {
|
|
//// convert2Mp4 = webmUtil.convert2Mp4();
|
|
//// map.put("titleName", multipartFile.getOriginalFilename().replaceAll(".webm", ".mp4"));
|
|
//// map.put("fileName", convert2Mp4);
|
|
//// }
|
|
// return AjaxResult.success(map);
|
|
// } catch (Exception e) {
|
|
// e.printStackTrace();
|
|
// return AjaxResult.error();
|
|
// }
|
|
// }
|
|
|
|
/**
|
|
* @return void
|
|
* @author cw chen
|
|
* @description 整改附件下载查看
|
|
* @Param
|
|
* @date 2023-04-17 11:03
|
|
*/
|
|
@GetMapping(value = "uploadRectFile")
|
|
public void uploadRectFile(HttpServletRequest request, HttpServletResponse response, String titleName, String fileName) {
|
|
try {
|
|
WordUtils.exportVideo(request, response, titleName, fileName);
|
|
} catch (IOException e) {
|
|
logger.error("整改附件下载查看", e);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 文件转换
|
|
*
|
|
* @param multipartFile 文件
|
|
* @return 文件
|
|
*/
|
|
public File transferToFile(MultipartFile multipartFile) {
|
|
File file = null;
|
|
try {
|
|
String originalFilename = multipartFile.getOriginalFilename();
|
|
assert originalFilename != null;
|
|
String[] fileName = originalFilename.split("\\.");
|
|
file = File.createTempFile(fileName[0] + "xxx", "." + fileName[1]);
|
|
multipartFile.transferTo(file);
|
|
file.deleteOnExit();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return file;
|
|
}
|
|
|
|
/**
|
|
* 获取视频诊断信息
|
|
*
|
|
* @param entity 条件
|
|
* @return 集合
|
|
*/
|
|
@ApiOperation(value = "获取视频诊断信息")
|
|
@PostMapping("/getVideoDiagnosis")
|
|
@Log(title = "视频诊断", menu = "频诊断->获取视频诊断信息", businessType = BusinessType.QUERY, details = "获取视频诊断信息")
|
|
public Map<String, Object> getVideoDiagnosis(VideoDiagnosis entity) {
|
|
if (StringUtils.isBlank(entity.getCreateDate())) {
|
|
entity.setCreateDate(DateTimeHelper.getNowDate());
|
|
}
|
|
PageHelper.startPage(Integer.parseInt(entity.getPage()), Integer.parseInt(entity.getLimit()));
|
|
Map<String, Object> map = new HashMap<String, Object>(16);
|
|
try {
|
|
PageInfo<VideoDiagnosis> pageInfo = service.getVideoDiagnosis(entity);
|
|
map.put("code", 200);
|
|
map.put("msg", "获取数据成功");
|
|
map.put("count", pageInfo.getTotal());
|
|
map.put("curr", Integer.parseInt(entity.getPage()));
|
|
map.put("limit", Integer.parseInt(entity.getLimit()));
|
|
map.put("data", pageInfo.getList());
|
|
} catch (Exception e) {
|
|
map.put("code", 500);
|
|
map.put("msg", "获取数据失败");
|
|
map.put("count", 0);
|
|
map.put("curr", Integer.parseInt(entity.getPage()));
|
|
map.put("limit", Integer.parseInt(entity.getLimit()));
|
|
map.put("data", null);
|
|
logger.error("数据获取失败", e);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/**
|
|
* 添加视频诊断数据
|
|
*
|
|
* @param entity 数据
|
|
* @return 条数
|
|
*/
|
|
@ApiOperation(value = "添加视频诊断数据")
|
|
@PostMapping("/addVideoData")
|
|
@Log(title = "视频诊断", menu = "视频诊断->添加视频诊断数据", businessType = BusinessType.QUERY, details = "添加视频诊断数据")
|
|
public AjaxResult addVideoData(VideoDiagnosis entity) {
|
|
return service.addVideoData(entity);
|
|
}
|
|
|
|
/**
|
|
* @return com.securityControl.common.core.web.domain.AjaxResult
|
|
* @author cw chen
|
|
* @description 删除视频诊断数据
|
|
* @Param entity
|
|
* @date 2023-07-03 16:30
|
|
*/
|
|
@ApiOperation(value = "删除视频诊断数据")
|
|
@PostMapping("/delVideoData")
|
|
@Log(title = "视频诊断", menu = "视频诊断->删除视频诊断数据", businessType = BusinessType.QUERY, details = "删除视频诊断数据")
|
|
public AjaxResult delVideoData(VideoDiagnosis entity) {
|
|
try {
|
|
service.delVideoData(entity);
|
|
return AjaxResult.success("删除成功");
|
|
} catch (Exception e) {
|
|
logger.error("删除视频诊断数据", e);
|
|
return AjaxResult.error("删除失败");
|
|
}
|
|
}
|
|
|
|
@ApiOperation(value = "根据id获取视频诊断数据详情")
|
|
@PostMapping("/getVideoDataById")
|
|
@Log(title = "视频诊断", menu = "视频诊断->删除视频诊断数据", businessType = BusinessType.QUERY, details = "删除视频诊断数据")
|
|
public AjaxResult getVideoDataById(VideoDiagnosis entity) {
|
|
try {
|
|
VideoDiagnosis videoDiagnosis = service.getVideoDataById(entity);
|
|
return AjaxResult.success("获取成功", videoDiagnosis);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
logger.error("根据id获取视频诊断数据详情", e);
|
|
return AjaxResult.error("服务异常,请稍后重试", null);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return com.securityControl.common.core.web.domain.AjaxResult
|
|
* @author cw chen
|
|
* @description 更新视频诊断数据
|
|
* @Param entity
|
|
* @date 2023-07-03 16:38
|
|
*/
|
|
@ApiOperation(value = "更新视频诊断数据")
|
|
@PostMapping("/updateVideoData")
|
|
@Log(title = "视频诊断", menu = "视频诊断->更新视频诊断数据", businessType = BusinessType.QUERY, details = "更新视频诊断数据")
|
|
public AjaxResult updateVideoData(VideoDiagnosis entity) {
|
|
try {
|
|
service.updateVideoData(entity);
|
|
return AjaxResult.success("修改成功");
|
|
} catch (Exception e) {
|
|
logger.error("更新视频诊断数据", e);
|
|
return AjaxResult.error("修改失败");
|
|
}
|
|
}
|
|
}
|