| | |
| | | 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;
|
| | |
| | | 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)
|
| | |
| | | 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);
|
| | | }
|
| | | }
|