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