Jay
2024-11-25 ee9f604388a3e77d3f4654e326f3976552e7f532
提交 | 用户 | 时间
08b6a5 1 package com.iailab.module.data.job.task;
H 2
3 import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO;
4 import com.iailab.module.data.video.config.VideoConfiguration;
5 import com.iailab.module.data.video.dto.CameraDTO;
6 import com.iailab.module.data.video.hikvision.utils.HIKDevice;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Component;
11 import org.springframework.util.CollectionUtils;
12
13 import java.util.List;
14
15 @Component("devCameraHikvisionTask")
16 public class DevCameraHikvisionTask implements ITask {
17
18     private Logger logger = LoggerFactory.getLogger(getClass());
19
20     @Autowired
21     private static HIKDevice hikDevice;
22     
23     @Autowired
24     public void setHIKDevice(HIKDevice tHIKDevice) {
25         DevCameraHikvisionTask.hikDevice = tHIKDevice;
26     }
27
28     @Override
29     public void run(String params) {
30         logger.info("devCameraDahuaTask定时任务正在执行,参数为:{}", params);
31         CameraPageReqVO cameraPageReqVO = new CameraPageReqVO();
32         cameraPageReqVO.setType("1");
33         List<CameraDTO> list = VideoConfiguration.staticCameraService.list(cameraPageReqVO);
34         if (CollectionUtils.isEmpty(list)) {
35             logger.info("Alarm List 为空");
36             return;
37         }
38         list.stream().forEach(cameraDTO -> {
39             hikDevice.loginDevice(cameraDTO);
40         });
41     }
42 }