| | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import static com.ruoyi.device.hiksdk.common.GlobalVariable.threadMap; |
| | | import static com.ruoyi.device.hiksdk.util.hikSdkUtil.HCNetSDK.*; |
| | | |
| | | /** |
| | |
| | | log.debug("加载lib完成!"); |
| | | List<ArdCameras> ardCameras = ardCamerasMapper.selectArdCamerasListNoDataScope(new ArdCameras()); |
| | | for (ArdCameras camera : ardCameras) { |
| | | Thread.sleep(100); |
| | | login(camera); |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | ardCameras.setOperatorId(operator); |
| | | //设置当前过期时间 |
| | | Date now = new Date(); |
| | | now.setTime(now.getTime() + expired * 1000 * 60); |
| | | now.setTime(now.getTime() + expired * 1000); |
| | | ardCameras.setOperatorExpired(now); |
| | | ardCamerasMapper.updateArdCameras(ardCameras); |
| | | } else { |
| | |
| | | if (currentOperator.equals(operator)) { |
| | | //设置当前过期时间 |
| | | Date now = new Date(); |
| | | now.setTime(now.getTime() + expired * 1000 * 60); |
| | | now.setTime(now.getTime() + expired * 1000); |
| | | ardCameras.setOperatorExpired(now); |
| | | ardCamerasMapper.updateArdCameras(ardCameras); |
| | | } else { |
| | |
| | | //判断优先级 |
| | | if (operatorLevel > currentLevel) { |
| | | Date now = new Date(); |
| | | now.setTime(now.getTime() + expired * 60 * 1000); |
| | | now.setTime(now.getTime() + expired * 60); |
| | | ardCameras.setOperatorExpired(now);//设置当前过期时间 |
| | | ardCameras.setOperatorId(operator);//设置当前用户 |
| | | ardCamerasMapper.updateArdCameras(ardCameras); |
| | |
| | | return; |
| | | } |
| | | log.info("取流成功"); |
| | | GlobalVariable.threadMap.put(cameraId,Thread.currentThread().getName()); |
| | | GlobalVariable.previewMap.put(cameraId, lRealHandle); |
| | | if (!hCNetSDK.NET_DVR_SaveRealData_V30(GlobalVariable.previewMap.get(cameraId), 2, path)) { |
| | | log.error("保存视频文件到临时文件夹失败 错误码为: " + hCNetSDK.NET_DVR_GetLastError()); |