| | |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.mapper.ArdCamerasMapper; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.hiksdk.common.GlobalVariable; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.hiksdk.config.MinioClientSingleton; |
| | |
| | | public class HikClientServiceImpl implements IHikClientService { |
| | | |
| | | @Resource |
| | | ArdCamerasMapper ardCamerasMapper; |
| | | IArdCamerasService ardCamerasService; |
| | | |
| | | private static HCNetSDK hCNetSDK; |
| | | |
| | |
| | | public void loginAll() { |
| | | try { |
| | | log.debug("加载lib完成!"); |
| | | List<ArdCameras> ardCameras = ardCamerasMapper.selectArdCamerasListNoDataScope(new ArdCameras()); |
| | | List<ArdCameras> ardCameras = ardCamerasService.selectArdCamerasListNoDataScope(new ArdCameras()); |
| | | for (ArdCameras camera : ardCameras) { |
| | | Thread.sleep(500); |
| | | login(camera); |
| | |
| | | NET_DVR_PTZPOS m_ptzPosCurrent = new NET_DVR_PTZPOS(); |
| | | m_ptzPosCurrent.wAction = 1; |
| | | try { |
| | | ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId); |
| | | ArdCameras cameras = ardCamerasService.selectArdCamerasById(cameraId); |
| | | double[] cameraPositon = new double[]{cameras.getLongitude(), cameras.getLatitude(), cameras.getAltitude()}; |
| | | double[] targetPositions = cmd.getTargetPosition(); |
| | | double[] cameraPTZ = GisUtil.getCameraPTZ(cameraPositon, targetPositions, 20, 150); |
| | |
| | | @SdkOperate |
| | | public boolean controlLock(CameraCmd cmd) { |
| | | String cameraId = cmd.getCameraId();//申请锁的相机 |
| | | ArdCameras ardCameras = ardCamerasMapper.selectArdCamerasById(cameraId); |
| | | ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId); |
| | | Date now = new Date(); |
| | | now.setTime(now.getTime() + cmd.getExpired() * 1000); |
| | | ardCameras.setOperatorExpired(now);//设置当前过期时间 |
| | | ardCamerasMapper.updateArdCameras(ardCameras); |
| | | ardCamerasService.updateArdCameras(ardCameras); |
| | | return true; |
| | | } |
| | | |
| | |
| | | public boolean controlUnLock(CameraCmd cmd) { |
| | | String cameraId = cmd.getCameraId();//申请解锁的相机 |
| | | String operator = cmd.getOperator();//申请者 |
| | | ArdCameras ardCameras = ardCamerasMapper.selectArdCamerasById(cameraId); |
| | | ArdCameras ardCameras = ardCamerasService.selectArdCamerasById(cameraId); |
| | | if (ardCameras.getOperatorId().equals(operator)) { |
| | | //如果解锁相机的当前用户是申请者,则清空该相机的过期时间 |
| | | ardCameras.setOperatorExpired(null); |
| | | int i = ardCamerasMapper.updateArdCameras(ardCameras); |
| | | int i = ardCamerasService.updateArdCameras(ardCameras); |
| | | if (i > 0) { |
| | | log.debug(cameraId + "--解锁成功"); |
| | | } |