| | |
| | | package com.ruoyi.device.camera.service.impl; |
| | | |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import com.ruoyi.device.channel.domain.ArdChannel; |
| | | import com.ruoyi.device.dhsdk.service.IDhClientService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.ruoyi.device.hiksdk.sdk.HCNetSDK.NET_DVR_CHECK_USER_STATUS; |
| | | |
| | | |
| | | /** |
| | | * @Description: 相机sdk业务 |
| | | * @ClassName: CameraSdkServiceImpl |
| | | * @Author: 刘苏义 |
| | | * @Date: 2023年10月16日15:21:01 |
| | | **/ |
| | | @Service |
| | | @Slf4j(topic = "SDK") |
| | | public class CameraSdkServiceImpl implements ICameraSdkService { |
| | | @Resource |
| | | IHikClientService hikClientService; |
| | | @Resource |
| | | IDhClientService dhClientService; |
| | | @Resource |
| | | RedisCache redisCache; |
| | | |
| | | @Override |
| | | public void initSDK() { |
| | | //初始化加载sdk库文件 |
| | | boolean initHIK = hikClientService.init(); |
| | | if (initHIK) { |
| | | hikClientService.loginAll();//登录全部海康相机 |
| | | } |
| | | Boolean initDH = dhClientService.init(); |
| | | if (initDH) { |
| | | dhClientService.loginAll();//登录全部大华相机 |
| | | } |
| | | } |
| | | @Override |
| | | public void syncLogin(ArdCameras cameras) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void asyncLogin(ArdCameras cameras) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean logout(String cameraId) { |
| | | return false; |
| | | } |
| | | //在线检测 |
| | | @Override |
| | | public boolean isOnLine(CameraCmd cmd) { |
| | | try { |
| | | boolean onLine = false; |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | onLine = hikClientService.isOnLine(cmd); |
| | | } else if (factory.equals("2")) { |
| | | onLine = dhClientService.isOnLine(cmd); |
| | | } |
| | | } |
| | | return onLine; |
| | | } catch (Exception ex) { |
| | | log.error("检测在线异常:" + ex.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | | //云台控制 |
| | | @Override |
| | | public boolean pTZControl(CameraCmd cmd) { |
| | | try { |
| | | boolean result = false; |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.pTZControlWithSpeed(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.pTZControl(cmd); |
| | | } |
| | | } |
| | | return result; |
| | | } catch (Exception ex) { |
| | | log.error("ptz控制异常:" + ex.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | | //设置聚焦值 |
| | | @Override |
| | | public boolean setFocusPos(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.setFocusPos(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("设置聚焦值异常:" + ex.getMessage()); |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | //获取聚焦值 |
| | | @Override |
| | | public Map<String, Object> getFocusPos(CameraCmd cmd) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | map = hikClientService.getFocusPos(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取聚焦值异常:" + ex.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | //设置预置位 |
| | | @Override |
| | | public boolean setPreset(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.setPreset(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.setPreset(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("设置预置位异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //调用预置位 |
| | | @Override |
| | | public boolean gotoPreset(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.gotoPreset(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.gotoPreset(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("调用预置位异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //获取码流压缩参数 |
| | | @Override |
| | | public Map<String, String> getVideoCompressionCfg(CameraCmd cmd) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | map = hikClientService.getVideoCompressionCfg(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取码流压缩参数异常:" + ex.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | //透雾开关 |
| | | @Override |
| | | public boolean controlDefogcfg(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlDefogcfg(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控透雾异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //红外开关 |
| | | @Override |
| | | public boolean controlInfrarecfg(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlInfrarecfg(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控红外异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //手动/自动聚焦 |
| | | @Override |
| | | public boolean controlFocusMode(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlFocusMode(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.controlFocusMode(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控聚焦模式异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //获取聚焦模式 |
| | | @Override |
| | | public String getFocusMode(CameraCmd cmd) { |
| | | String result = ""; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.getFocusMode(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取聚焦模式异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //云台加热 |
| | | @Override |
| | | public boolean controlPTHeateRpwron(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlPTHeateRpwron(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控云台加热异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //镜头加热 |
| | | @Override |
| | | public boolean controlCameraDeicing(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlCameraDeicing(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控云台加热异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //操控锁定 |
| | | @Override |
| | | public boolean controlLock(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlLock(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("操控锁定异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //设置解锁 |
| | | @Override |
| | | public boolean controlUnLock(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.controlUnLock(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("设置解锁异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //获取云台锁定信息 |
| | | @Override |
| | | public int getPTZLockInfo(CameraCmd cmd) { |
| | | int result = 99; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.getPTZLockInfo(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取云台锁定信息异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public String captureJPEGPicture(CameraCmd cmd) { |
| | | return null; |
| | | } |
| | | //抓图 |
| | | @Override |
| | | public String picCutCate(CameraCmd cmd) { |
| | | String url = ""; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | url = hikClientService.picCutCate(cmd); |
| | | } else if (factory.equals("2")) { |
| | | url = dhClientService.picCutCate(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("抓图异常:" + ex.getMessage()); |
| | | } |
| | | return url; |
| | | } |
| | | //获取ptz |
| | | @Override |
| | | public Map<String, Object> getPtz(CameraCmd cmd) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | map = hikClientService.getPtz(cmd); |
| | | } else if (factory.equals("2")) { |
| | | map = dhClientService.getPtz(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取ptz异常:" + ex.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | //获取ptz范围 |
| | | @Override |
| | | public Map<String, Object> getPtzScope(CameraCmd cmd) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | map = hikClientService.getPtzScope(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取ptz范围异常:" + ex.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | //设置ptz |
| | | @Override |
| | | public boolean setPtz(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.setPtz(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.setPtz(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("设置ptz异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //设置零方位角 |
| | | @Override |
| | | public boolean setZeroPtz(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.setZeroPtz(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.setZeroPtz(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("设置零方位角异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //引导指向目标 |
| | | @Override |
| | | public boolean guideTargetPosition(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.guideTargetPosition(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.guideTargetPosition(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("引导指向目标异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //开始录像 |
| | | @Override |
| | | public boolean recordStart(CameraCmd cmd) { |
| | | boolean result = false; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | result = hikClientService.recordStart(cmd); |
| | | } else if (factory.equals("2")) { |
| | | result = dhClientService.recordStart(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("开始录像异常:" + ex.getMessage()); |
| | | } |
| | | return result; |
| | | } |
| | | //停止录像并存入minio |
| | | @Override |
| | | public String recordStopToMinio(CameraCmd cmd) { |
| | | String url = ""; |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | url = hikClientService.recordStopToMinio(cmd); |
| | | } else if (factory.equals("2")) { |
| | | url = dhClientService.recordStopToMinio(cmd); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("停止录像异常:" + ex.getMessage()); |
| | | } |
| | | return url; |
| | | } |
| | | //停止录像并不存入minio |
| | | @Override |
| | | public void recordStopNotToMinio(CameraCmd cmd) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ArdChannel> getCameraChannelList(ArdCameras camera) { |
| | | return null; |
| | | } |
| | | |
| | | //获取相机架设参数 |
| | | @Override |
| | | public Map<String, Object> getGisInfo(CameraCmd cmd) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | try { |
| | | String cameraId = cmd.getCameraId(); |
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCamera != null) { |
| | | String factory = ardCamera.getFactory(); |
| | | if (factory.equals("1")) { |
| | | map = hikClientService.getGisInfo(cmd); |
| | | } else if (factory.equals("2")) { |
| | | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error("获取相机架设参数异常:" + ex.getMessage()); |
| | | } |
| | | return map; |
| | | } |
| | | } |
| | | package com.ruoyi.device.camera.service.impl;
|
| | |
|
| | | import com.ruoyi.common.annotation.SdkOperate;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.core.redis.RedisCache;
|
| | | 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.camera.service.ICameraSdkService;
|
| | | import com.ruoyi.device.dhsdk.service.IDhClientService;
|
| | | import com.ruoyi.device.hiksdk.service.IHikClientService;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.beans.factory.SmartInitializingSingleton;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import javax.annotation.PostConstruct;
|
| | | import javax.annotation.Resource;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
|
| | | /**
|
| | | * @Description: 相机sdk业务
|
| | | * @ClassName: CameraSdkServiceImpl
|
| | | * @Author: 刘苏义
|
| | | * @Date: 2023年10月16日15:21:01
|
| | | **/
|
| | | @Service
|
| | | @Slf4j(topic = "SDK")
|
| | | public class CameraSdkServiceImpl implements ICameraSdkService {
|
| | | @Resource
|
| | | private IArdCamerasService ardCamerasService;
|
| | | @Resource
|
| | | IHikClientService hikClientService;
|
| | | @Resource
|
| | | IDhClientService dhClientService;
|
| | | @Resource
|
| | | RedisCache redisCache;
|
| | | @Resource
|
| | | AsyncLogin asyncLogin;
|
| | |
|
| | |
|
| | |
|
| | | //初始化SDK
|
| | | @PostConstruct
|
| | | @Override
|
| | | public void loginAll() {
|
| | | try {
|
| | | List<ArdCameras> ardCameras = ardCamerasService.selectArdCamerasListNoDataScope(new ArdCameras());
|
| | | for (ArdCameras camera : ardCameras) {
|
| | | if ("1".equals(camera.getFactory())) {
|
| | | asyncLogin.hikLogin(camera);
|
| | | } else if ("2".equals(camera.getFactory())) {
|
| | | asyncLogin.dhLogin(camera);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("初始化登录相机异常:" + ex.getMessage());
|
| | | }
|
| | | }
|
| | |
|
| | | //登录
|
| | | @Override
|
| | | public Boolean login(ArdCameras ardCamera) {
|
| | | boolean result = false;
|
| | | try {
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | asyncLogin.hikLogin(ardCamera);
|
| | | result = true;
|
| | | } else if (factory.equals("2")) {
|
| | | asyncLogin.dhLogin(ardCamera);
|
| | | result = true;
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("登录异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //注销
|
| | | @Override
|
| | | public boolean logout(String cameraId) {
|
| | | boolean result = false;
|
| | | try {
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.logout(cameraId);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.logout(cameraId);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("注销异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //在线检测
|
| | | @Override
|
| | | public boolean isOnLine(CameraCmd cmd) {
|
| | | try {
|
| | | boolean onLine = false;
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | onLine = hikClientService.isOnLine(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | onLine = dhClientService.isOnLine(cmd);
|
| | | }
|
| | | }
|
| | | return onLine;
|
| | | } catch (Exception ex) {
|
| | | log.error("检测在线异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //云台控制
|
| | | @SdkOperate
|
| | | @Override
|
| | | public boolean pTZControl(CameraCmd cmd) {
|
| | | try {
|
| | | boolean result = false;
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.pTZControlWithSpeed(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.pTZControl(cmd);
|
| | | }
|
| | | }
|
| | | return result;
|
| | | } catch (Exception ex) {
|
| | | log.error("ptz控制异常:" + ex.getMessage());
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | //设置聚焦值
|
| | | @Override
|
| | | public boolean setFocusPos(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.setFocusPos(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.setFocusPos(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("设置聚焦值异常:" + ex.getMessage());
|
| | |
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //获取聚焦值
|
| | | @Override
|
| | | public int getFocusPos(CameraCmd cmd) {
|
| | | int result = 0;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.getFocusPos(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.getFocusPos(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取聚焦值异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //设置预置位
|
| | | @Override
|
| | | public boolean setPreset(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.setPreset(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.setPreset(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("设置预置位异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //调用预置位
|
| | | @Override
|
| | | public boolean gotoPreset(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.gotoPreset(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.gotoPreset(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("调用预置位异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //获取码流压缩参数
|
| | | @Override
|
| | | public Map<String, Object> getVideoCompressionCfg(CameraCmd cmd) {
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | map = hikClientService.getVideoCompressionCfg(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | map = dhClientService.getVideoCompressionCfg(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取码流压缩参数异常:" + ex.getMessage());
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | //透雾开关
|
| | | @Override
|
| | | public boolean controlDefogcfg(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.controlDefogcfg(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | //不支持
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("操控透雾异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //红外开关
|
| | | @Override
|
| | | public boolean controlInfrarecfg(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.controlInfrarecfg(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.controlInfrarecfg(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("操控红外异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //手动/自动聚焦
|
| | | @Override
|
| | | public boolean controlFocusMode(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.controlFocusMode(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.controlFocusMode(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("操控聚焦模式异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //获取聚焦模式
|
| | | @Override
|
| | | public String getFocusMode(CameraCmd cmd) {
|
| | | String result = "";
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.getFocusMode(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.getFocusMode(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取聚焦模式异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //云台加热
|
| | | @Override
|
| | | public boolean controlPTHeateRpwron(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.controlPTHeateRpwron(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | //不支持
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("操控云台加热异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //镜头加热
|
| | | @Override
|
| | | public boolean controlCameraDeicing(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.controlCameraDeicing(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | //不支持
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("操控云台加热异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //获取云台锁定信息
|
| | | @Override
|
| | | public int getPTZLockInfo(CameraCmd cmd) {
|
| | | int result = 99;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.getPTZLockInfo(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | |
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取云台锁定信息异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String captureJPEGPicture(CameraCmd cmd) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | //抓图
|
| | | @SdkOperate
|
| | | @Override
|
| | | public String picCutCate(CameraCmd cmd) {
|
| | | String url = "";
|
| | | try {
|
| | | //获取摄像头ID
|
| | | String cameraId = cmd.getCameraId();
|
| | | //从redis中获取摄像头信息
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | //获取摄像头工厂
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | //调用hikClientService的picCutCate方法
|
| | | url = hikClientService.picCutCate(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | //调用dhClientService的picCutCate方法
|
| | | url = dhClientService.picCutCate(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("抓图异常:" + ex.getMessage());
|
| | | }
|
| | | return url;
|
| | | }
|
| | |
|
| | | //获取ptz
|
| | | @Override
|
| | | public Map<String, Object> getPtz(CameraCmd cmd) {
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | map = hikClientService.getPtz(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | map = dhClientService.getPtz(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取ptz异常:" + ex.getMessage());
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | //获取ptz范围
|
| | | @Override
|
| | | public Map<String, Object> getPtzScope(CameraCmd cmd) {
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | map = hikClientService.getPtzScope(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | |
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取ptz范围异常:" + ex.getMessage());
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | //设置ptz
|
| | | @SdkOperate
|
| | | @Override
|
| | | public boolean setPtz(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.setPtz(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.setPtz(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("设置ptz异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //设置零方位角
|
| | | @SdkOperate
|
| | | @Override
|
| | | public boolean setZeroPtz(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.setZeroPtz(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.setZeroPtz(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("设置零方位角异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //引导指向目标
|
| | | @SdkOperate
|
| | | @Override
|
| | | public boolean guideTargetPosition(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.guideTargetPosition(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.guideTargetPosition(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("引导指向目标异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @描述 操控锁定
|
| | | * @参数 [userId, channelNum]
|
| | | * @返回值 boolean
|
| | | * @创建人 刘苏义
|
| | | * @创建时间 2023/1/17 16:36
|
| | | * @修改人和其它信息 0-解锁 1-锁定
|
| | | */
|
| | | @Override
|
| | | @SdkOperate
|
| | | public boolean controlLock(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();//申请锁的相机
|
| | | ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
|
| | | Date now = new Date();
|
| | | now.setTime(now.getTime() + cmd.getExpired() * 1000);
|
| | | ardCameras.setOperatorExpired(now);//设置当前过期时间
|
| | | ardCamerasService.updateArdCameras(ardCameras);
|
| | | return true;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @描述 操控解锁
|
| | | * @参数 [userId, channelNum]
|
| | | * @返回值 boolean
|
| | | * @创建人 刘苏义
|
| | | * @创建时间 2023/6/30 15:36
|
| | | * @修改人和其它信息
|
| | | */
|
| | | @Override
|
| | | public boolean controlUnLock(CameraCmd cmd) {
|
| | | String cameraId = cmd.getCameraId();//申请解锁的相机
|
| | | String operator = cmd.getOperator();//申请者
|
| | | ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId);
|
| | | if (ardCameras.getOperatorId().equals(operator)) {
|
| | | //如果解锁相机的当前用户是申请者,则清空该相机的过期时间
|
| | | ardCameras.setOperatorExpired(null);
|
| | | int i = ardCamerasService.updateArdCameras(ardCameras);
|
| | | if (i > 0) {
|
| | | log.debug(cameraId + "--解锁成功");
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | |
|
| | | //录像
|
| | | @SdkOperate
|
| | | @Override
|
| | | public String record(CameraCmd cmd) {
|
| | | String url = "";
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | url = hikClientService.record(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | url = dhClientService.record(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("录像异常:" + ex.getMessage());
|
| | | }
|
| | | return url;
|
| | | }
|
| | |
|
| | | //开始录像
|
| | | @Override
|
| | | public boolean recordStart(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.recordStart(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.recordStart(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("开始录像异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //停止录像并存入minio
|
| | | @Override
|
| | | public String recordStopToMinio(CameraCmd cmd) {
|
| | | String url = "";
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | url = hikClientService.recordStopToMinio(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | url = dhClientService.recordStopToMinio(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("停止录像异常:" + ex.getMessage());
|
| | | }
|
| | | return url;
|
| | | }
|
| | |
|
| | | //停止录像并不存入minio
|
| | | @Override
|
| | | public boolean recordStopNotToMinio(CameraCmd cmd) {
|
| | | boolean result = false;
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | result = hikClientService.recordStopNotToMinio(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | result = dhClientService.recordStopNotToMinio(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("停止录像异常:" + ex.getMessage());
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //获取相机架设参数
|
| | | @Override
|
| | | public Map<String, Object> getGisInfo(CameraCmd cmd) {
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | try {
|
| | | String cameraId = cmd.getCameraId();
|
| | | ArdCameras ardCamera = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
|
| | | if (ardCamera != null) {
|
| | | String factory = ardCamera.getFactory();
|
| | | if (factory.equals("1")) {
|
| | | map = hikClientService.getGisInfo(cmd);
|
| | | } else if (factory.equals("2")) {
|
| | | map = dhClientService.getGisInfo(cmd);
|
| | | }
|
| | | }
|
| | | } catch (Exception ex) {
|
| | | log.error("获取相机架设参数异常:" + ex.getMessage());
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | |
|
| | | }
|