| | |
| | | package com.ruoyi.quartz.task; |
| | | |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | |
| | | */ |
| | | public void ptzPush() { |
| | | try { |
| | | RedisCache redisCache = SpringUtils.getBean(RedisCache.class); |
| | | ISysUserService sysUserService = SpringUtils.getBean(ISysUserService.class); |
| | | IArdCamerasService ardCamerasService = SpringUtils.getBean(IArdCamerasService.class); |
| | | IHikClientService hikClientService = SpringUtils.getBean(IHikClientService.class); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | ArdCameras ardCameras = new ArdCameras(); |
| | | ardCameras.setGdtype("1"); |
| | | List<ArdCameras> ardCamerasList = ardCamerasService.selectArdCamerasListNoDataScope(ardCameras); |
| | | for (ArdCameras camera : ardCamerasList) { |
| | | List<Object> Objects = redisCache.getListKey(getCacheKey()); |
| | | if (Objects.size() > 0) { |
| | | for (Object obj : Objects) { |
| | | ArdCameras camera = (ArdCameras) obj; |
| | | CameraCmd cmd = new CameraCmd(); |
| | | cmd.setCameraId(camera.getId()); |
| | | cmd.setChannelNum(1); |
| | |
| | | long secDatePoor = 0; |
| | | if (StringUtils.isNotNull(camera.getOperatorExpired())) { |
| | | secDatePoor = DateUtils.getSecDatePoor(camera.getOperatorExpired(), new Date()); |
| | | if(secDatePoor<0) |
| | | { |
| | | if (secDatePoor < 0) { |
| | | secDatePoor=0; |
| | | } |
| | | } |
| | |
| | | WebSocketUtils.sendMessageAll(sendMap); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } catch (Exception ex) { |
| | | log.error("推送ptz异常:"+ex.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * 获取cache key |
| | | * |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey() { |
| | | return CacheConstants.CAMERA_LIST_KEY; |
| | | } |
| | | } |