| | |
| | | package com.ruoyi.quartz.task; |
| | | |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.common.websocket.util.WebSocketUtils; |
| | | 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.IHikClientService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.ruoyi.common.websocket.util.WebSocketUtils.ONLINE_USER_SESSIONS; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Component("SdkTask") |
| | | public class SdkTask { |
| | | @Resource |
| | | IArdCamerasService ardCamerasService; |
| | | @Resource |
| | | IHikClientService hikClientService; |
| | | |
| | | /** |
| | | * @描述 定时推送ptz |
| | |
| | | * @修改人和其它信息 |
| | | */ |
| | | public void ptzPush() { |
| | | 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"); |
| | |
| | | Map<String, Object> ptz = hikClientService.getPtz(cmd); |
| | | if (ptz.size() > 0) { |
| | | ptz.put("cameraId", camera.getId()); |
| | | ptz.put("operatorExpired",camera.getOperatorExpired()); |
| | | list.add(ptz); |
| | | } |
| | | } |
| | | if (ONLINE_USER_SESSIONS.size() > 0) { |
| | | WebSocketUtils.sendMessageAll(list.toString()); |
| | | Map<String, Object> sendMap = new HashMap<>(); |
| | | sendMap.put("10000", list); |
| | | WebSocketUtils.sendMessageAll(sendMap); |
| | | } |
| | | } |
| | | } |