| | |
| | | import com.ruoyi.device.camera.domain.CameraCmd;
|
| | | import com.ruoyi.device.camera.service.IArdCamerasService;
|
| | | import com.ruoyi.device.camera.service.ICameraSdkService;
|
| | |
|
| | | import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
|
| | | import com.ruoyi.device.noguidezone.service.IArdCameraNoGuideZoneService;
|
| | | import com.ruoyi.utils.gis.GisUtil;
|
| | | import com.ruoyi.utils.gis.Point;
|
| | | import io.swagger.annotations.Api;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.ServletOutputStream;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.io.IOException;
|
| | | import java.io.OutputStream;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | private ICameraSdkService cameraSdkService;
|
| | | @Resource
|
| | | private IArdCamerasService ardCamerasService;
|
| | |
|
| | | @Autowired
|
| | | private IArdCameraNoGuideZoneService ardCameraNoGuideZoneService;
|
| | |
|
| | |
|
| | | @RequestMapping("/preview")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult PTZControlWithSpeed(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.pTZControl(cmd));
|
| | | return cameraSdkService.pTZControl(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("调用预置点")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult gotoPreset(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.gotoPreset(cmd));
|
| | | return cameraSdkService.gotoPreset(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置预置点")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setPreset(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.setPreset(cmd));
|
| | | return cameraSdkService.setPreset(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取聚焦值")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getFocusPos(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | int focus = cameraSdkService.getFocusPos(cmd);
|
| | | return AjaxResult.success("获取聚焦值", focus);
|
| | | return cameraSdkService.getFocusPos(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置聚焦值")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setFocusPos(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.setFocusPos(cmd));
|
| | | return cameraSdkService.setFocusPos(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取PTZ")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getPTZ(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | Map<String, Object> ptzMap = cameraSdkService.getPtz(cmd);
|
| | | return AjaxResult.success("获取ptz", ptzMap);
|
| | | return cameraSdkService.getPtz(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取PTZ范围")
|
| | | @PostMapping("/getPTZScope")
|
| | | @Log(title = "获取PTZ范围", businessType = BusinessType.CONTROL)
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getPTZScope(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | Map<String, Object> ptzMap = cameraSdkService.getPtzScope(cmd);
|
| | | return AjaxResult.success("获取ptz范围", ptzMap);
|
| | | return cameraSdkService.getPtzScope(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置PTZ")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setPTZ(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.setPtz(cmd));
|
| | | return cameraSdkService.setPtz(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("指向目标")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.guideTargetPosition(cmd));
|
| | | //拦截手动引导
|
| | | ArdCameraNoGuideZone ardCameraNoGuideZone = new ArdCameraNoGuideZone();
|
| | | ardCameraNoGuideZone.setCameraId(cmd.getCameraId());
|
| | | ardCameraNoGuideZone.setEnabled("1");
|
| | | //获取当前相机的禁引可视域列表
|
| | | List<ArdCameraNoGuideZone> ardCameraNoGuideZones = ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
|
| | | if (ardCameraNoGuideZones.size() > 0) {
|
| | | //获取到当前相机的坐标集合
|
| | | for (ArdCameraNoGuideZone zone : ardCameraNoGuideZones) {
|
| | | String[] parts = zone.getPoi().split(",");
|
| | | List<Point> pointList = new ArrayList<>();
|
| | | for (int i = 0; i < parts.length; i += 3) {
|
| | | Point point = new Point();
|
| | | point.setLongitude(Double.valueOf(parts[i]));
|
| | | point.setLatitude(Double.valueOf(parts[i + 1]));
|
| | | pointList.add(point);
|
| | | }
|
| | | double lon = cmd.getTargetPosition()[0];
|
| | | double lat = cmd.getTargetPosition()[1];
|
| | | Point targetPoint = new Point(lon, lat);
|
| | | //判断引导目标是否在坐标集合组成的多边形内
|
| | | boolean inPolygon = GisUtil.isInPolygon(targetPoint, pointList);
|
| | | if (inPolygon) {
|
| | | return AjaxResult.error("引导坐标位于禁引可视域内");
|
| | | }
|
| | | }
|
| | | }
|
| | | return cameraSdkService.guideTargetPosition(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("指向目标井")
|
| | | @PostMapping("/setTargetWell")
|
| | | @Log(title = "指向目标井", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.wellId"})
|
| | | public @ResponseBody
|
| | | AjaxResult setTargetWell(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return cameraSdkService.guideTargetWell(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置零方位角")
|
| | | @PostMapping("/setZeroPTZ")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setZeroPTZ(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.setZeroPtz(cmd));
|
| | | return cameraSdkService.setZeroPtz(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置锁定")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setPTZLock(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return AjaxResult.success(cameraSdkService.controlLock(cmd));
|
| | | return cameraSdkService.controlLock(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置解锁")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setPTZUnLock(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return AjaxResult.success(cameraSdkService.controlUnLock(cmd));
|
| | | return cameraSdkService.controlUnLock(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取云台锁定信息")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getPTZLockInfo(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | int byWorkMode = cameraSdkService.getPTZLockInfo(cmd);
|
| | | AjaxResult ajaxResult = cameraSdkService.getPTZLockInfo(cmd);
|
| | | Integer byWorkMode = (Integer) ajaxResult.get("msg");
|
| | | if (byWorkMode == 0) {
|
| | | return AjaxResult.success("云台锁定状态:解锁");
|
| | | } else if (byWorkMode == 1) {
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult defogcfg(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.controlDefogcfg(cmd));
|
| | | return cameraSdkService.controlDefogcfg(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("红外开关")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult infrarecfg(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.controlInfrarecfg(cmd));
|
| | | return cameraSdkService.controlInfrarecfg(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation(value = "手动/自动聚焦", notes = "true手动flase自动")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult enableFocusMode(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.controlFocusMode(cmd));
|
| | | return cameraSdkService.controlFocusMode(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation(value = "获取聚焦模式", notes = "1手动2自动")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getFocusMode(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | String focusMode = cameraSdkService.getFocusMode(cmd);
|
| | | return AjaxResult.success(focusMode);
|
| | | return cameraSdkService.getFocusMode(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("云台加热")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult heateRpwron(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.controlPTHeateRpwron(cmd));
|
| | | return cameraSdkService.controlPTHeateRpwron(cmd);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult cameraDeicing(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.controlCameraDeicing(cmd));
|
| | | return cameraSdkService.controlCameraDeicing(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("相机抓图")
|
| | |
| | | return toAjaxString(path, "相机抓图");
|
| | | }
|
| | |
|
| | | @ApiOperation("本地抓图")
|
| | | @PostMapping("/localCapture")
|
| | | @Log(title = "相机抓图", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
|
| | | public @ResponseBody
|
| | | void localCapture(@RequestBody CameraCmd cmd, HttpServletResponse response) throws IOException {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | response.setContentType("image/jpeg");
|
| | | AjaxResult result = cameraSdkService.localCapture(cmd);
|
| | | OutputStream outputStream = response.getOutputStream();
|
| | | byte[] data = (byte[]) result.get("data");
|
| | | outputStream.write(data);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取相机架设参数")
|
| | | @PostMapping("/getGisInfo")
|
| | | @Log(title = "获取相机架设参数", businessType = BusinessType.CONTROL)
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult getGisInfo(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return AjaxResult.success(cameraSdkService.getGisInfo(cmd));
|
| | | return cameraSdkService.getGisInfo(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("录像")
|
| | | //@ApiOperation("录像")
|
| | | @PostMapping("/record")
|
| | | @Log(title = "手动录像开始", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
|
| | | //@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.enable"})
|
| | | public @ResponseBody
|
| | | AjaxResult record(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | |
| | | return AjaxResult.success(url);
|
| | | }
|
| | |
|
| | | @ApiOperation("手动录像开始")
|
| | | //@ApiOperation("手动录像开始")
|
| | | @PostMapping("/recordStart")
|
| | | @Log(title = "手动录像开始", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
|
| | | //@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
|
| | | public @ResponseBody
|
| | | AjaxResult recordStart(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | |
| | | return toAjax(b);
|
| | | }
|
| | |
|
| | | @ApiOperation("手动录像停止")
|
| | | //@ApiOperation("手动录像停止")
|
| | | @PostMapping("/recordStop")
|
| | | @Log(title = "手动录像停止", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.recordBucketName", "cmd.recordObjectName"})
|
| | | //@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.recordBucketName", "cmd.recordObjectName"})
|
| | | public @ResponseBody
|
| | | AjaxResult recordStop(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | String url = cameraSdkService.recordStopToMinio(cmd);
|
| | | return AjaxResult.success(url);
|
| | | }
|
| | |
|
| | | @ApiOperation("本地录像开始")
|
| | | @PostMapping("/localRecordStart")
|
| | | @Log(title = "本地录像开始", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo"})
|
| | | public @ResponseBody
|
| | | AjaxResult localRecordStart(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return cameraSdkService.localRecordStart(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("本地录像停止")
|
| | | @PostMapping("/localRecordStop")
|
| | | @Log(title = "本地录像停止", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.chanNo", "cmd.recordId"})
|
| | | public @ResponseBody
|
| | | void localRecordStop(@RequestBody CameraCmd cmd, HttpServletResponse response) throws IOException {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | response.setContentType("video/mp4");
|
| | | AjaxResult result = cameraSdkService.localRecordStop(cmd);
|
| | | byte[] recordBytes = (byte[]) result.get("data");
|
| | | OutputStream outputStream = response.getOutputStream();
|
| | | outputStream.write(recordBytes);
|
| | | }
|
| | | }
|