| | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.hiksdk.service.hikClientService; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class SdkController extends BaseController { |
| | | |
| | | @Resource |
| | | private hikClientService sdk; |
| | | private IHikClientService sdk; |
| | | @Resource |
| | | private IArdCamerasService ardCamerasService; |
| | | |
| | |
| | | @Log(title = "在线状态", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult getOnlineState(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.isOnLine(cmd)); |
| | | } |
| | | |
| | |
| | | @Log(title = "云台控制", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult PTZControlWithSpeed(@RequestBody CameraCmd cmd) { |
| | | return toAjax(sdk.PTZControlWithSpeed(cmd)); |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.pTZControlWithSpeed(cmd)); |
| | | } |
| | | |
| | | |
| | |
| | | @Log(title = "调用预置点", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult gotoPreset(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.gotoPreset(cmd)); |
| | | } |
| | | |
| | |
| | | @Log(title = "设置预置点", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult setPreset(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.setPreset(cmd)); |
| | | } |
| | | |
| | |
| | | @Log(title = "获取聚焦值", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult getFocusPos(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | Map<String, Object> Map = sdk.getFocusPos(cmd); |
| | | return AjaxResult.success("获取聚焦值", Map); |
| | | } |
| | |
| | | @Log(title = "设置聚焦值", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult setFocusPos(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.setFocusPos(cmd)); |
| | | } |
| | | |
| | |
| | | @Log(title = "获取PTZ", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult GetPTZ(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | Map<String, Object> ptzMap = sdk.getPtz(cmd); |
| | | return AjaxResult.success("获取ptz", ptzMap); |
| | | } |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"}) |
| | | public @ResponseBody |
| | | AjaxResult GetPTZScope(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | Map<String, Object> ptzMap = sdk.getPtzScope(cmd); |
| | | return AjaxResult.success("获取ptz范围", ptzMap); |
| | | } |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.ptzMap"}) |
| | | public @ResponseBody |
| | | AjaxResult SetPTZ(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.setPtz(cmd)); |
| | | } |
| | | |
| | | @ApiOperation("指向目标") |
| | | @PostMapping("/setTargetPosition") |
| | | @Log(title = "指向目标", businessType = BusinessType.CONTROL) |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.targetPosition"}) |
| | | public @ResponseBody |
| | | AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.guideTargetPosition(cmd)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("设置零方位角") |
| | | @PostMapping("/setZeroPTZ") |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"}) |
| | | public @ResponseBody |
| | | AjaxResult SetZeroPTZ(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.setZeroPtz(cmd)); |
| | | } |
| | | |
| | |
| | | @Log(title = "设置锁定", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult setPTZLock(@RequestBody CameraCmd cmd) { |
| | | return toAjax(sdk.controlLock(cmd)); |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return AjaxResult.success(sdk.controlLock(cmd)); |
| | | } |
| | | |
| | | @ApiOperation("设置解锁") |
| | | @PostMapping("/setPTZUnLock") |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId"}) |
| | | @Log(title = "设置解锁", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult setPTZUnLock(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return AjaxResult.success(sdk.controlUnLock(cmd)); |
| | | } |
| | | |
| | | @ApiOperation("获取云台锁定信息") |
| | |
| | | @Log(title = "获取云台锁定信息", businessType = BusinessType.CONTROL) |
| | | public @ResponseBody |
| | | AjaxResult getPTZLockInfo(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | int byWorkMode = sdk.getPTZLockInfo(cmd); |
| | | if (byWorkMode == 0) { |
| | | return AjaxResult.success("云台锁定状态:解锁"); |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult defogcfg(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.controlDefogcfg(cmd)); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult infrarecfg(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.controlInfrarecfg(cmd)); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult enableFocusMode(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.controlFocusMode(cmd)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取聚焦模式", notes = "1手动2自动") |
| | | @PostMapping("/getFocusMode") |
| | | public @ResponseBody |
| | | AjaxResult getFocusMode(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | String focusMode = sdk.getFocusMode(cmd); |
| | | return AjaxResult.success(focusMode); |
| | | } |
| | | |
| | | @ApiOperation("云台加热") |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult HeateRpwron(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.controlPTHeateRpwron(cmd)); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult CameraDeicing(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | return toAjax(sdk.controlCameraDeicing(cmd)); |
| | | } |
| | | |
| | | @PostMapping("/captureJPEGPicture") |
| | | public @ResponseBody |
| | | AjaxResult captureJPEGPicture(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | String base64Str = sdk.captureJPEGPicture(cmd); |
| | | return toAjaxString(base64Str, "相机抓图"); |
| | | } |
| | | |
| | | @ApiOperation("相机抓图") |
| | | @PostMapping("/picCutCate") |
| | | @Log(title = "相机抓图", businessType = BusinessType.CONTROL) |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"}) |
| | | public @ResponseBody |
| | | AjaxResult picCutCate(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | String path = sdk.picCutCate(cmd); |
| | | return toAjaxString(path, "相机抓图"); |
| | | } |
| | |
| | | @ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"}) |
| | | public @ResponseBody |
| | | AjaxResult record(@RequestBody CameraCmd cmd) { |
| | | cmd.setOperator(SecurityUtils.getUserId()); |
| | | String path = sdk.record(cmd); |
| | | return toAjaxString(path, "手动录像"); |
| | | } |