|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+package com.chinaitop.depot.monitor.service.impl;
|
|
|
2
|
+
|
|
|
3
|
+import com.chinaitop.depot.basic.model.MonitorCamera;
|
|
|
4
|
+import com.chinaitop.depot.basic.model.MonitorCameraExample;
|
|
|
5
|
+import com.chinaitop.depot.basic.service.MonitorCameraService;
|
|
|
6
|
+import com.chinaitop.depot.hk.dto.req.CameraReqDTO;
|
|
|
7
|
+import com.chinaitop.depot.hk.dto.res.CameraResDTO;
|
|
|
8
|
+import com.chinaitop.depot.hk.dto.res.ResultResDTO;
|
|
|
9
|
+import com.chinaitop.depot.hk.service.HkService;
|
|
|
10
|
+import com.chinaitop.depot.monitor.service.MonitorService;
|
|
|
11
|
+import com.chinaitop.depot.utils.ParameterUtil;
|
|
|
12
|
+import com.github.pagehelper.PageHelper;
|
|
|
13
|
+import com.github.pagehelper.PageInfo;
|
|
|
14
|
+import org.springframework.stereotype.Service;
|
|
|
15
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
16
|
+
|
|
|
17
|
+import javax.annotation.Resource;
|
|
|
18
|
+import java.util.List;
|
|
|
19
|
+
|
|
|
20
|
+@Service
|
|
|
21
|
+public class MonitorServiceImpl implements MonitorService {
|
|
|
22
|
+
|
|
|
23
|
+ @Resource
|
|
|
24
|
+ private MonitorCameraService cameraService;
|
|
|
25
|
+
|
|
|
26
|
+ @Resource
|
|
|
27
|
+ private HkService hkService;
|
|
|
28
|
+
|
|
|
29
|
+ @Transactional
|
|
|
30
|
+ @Override
|
|
|
31
|
+ public void UpdateMonitorStatus() {
|
|
|
32
|
+ //查询所有摄像头
|
|
|
33
|
+ MonitorCameraExample example = new MonitorCameraExample();
|
|
|
34
|
+ MonitorCameraExample.Criteria criteria = example.createCriteria();
|
|
|
35
|
+ criteria.andIsremoveEqualTo("1");//默认加载未删除的数据
|
|
|
36
|
+ List<MonitorCamera> list = cameraService.queryByExample(example);
|
|
|
37
|
+ Integer status;
|
|
|
38
|
+ if (!list.isEmpty()) {
|
|
|
39
|
+ for (MonitorCamera camera : list) {
|
|
|
40
|
+ if(camera.getCameraIndexCode()!=null){
|
|
|
41
|
+ MonitorCamera monitorCamera =new MonitorCamera();
|
|
|
42
|
+ CameraResDTO resDTO= hkService.getCamera(new CameraReqDTO(camera.getCameraIndexCode()));
|
|
|
43
|
+ if(resDTO.getStatus()!=null){
|
|
|
44
|
+ status=Integer.parseInt(resDTO.getStatus());
|
|
|
45
|
+ }else{
|
|
|
46
|
+ status=0;
|
|
|
47
|
+ }
|
|
|
48
|
+ monitorCamera.setId(camera.getId());
|
|
|
49
|
+ monitorCamera.setStatus(status) ;
|
|
|
50
|
+ cameraService.update(monitorCamera);
|
|
|
51
|
+ }
|
|
|
52
|
+ }
|
|
|
53
|
+ } else {
|
|
|
54
|
+
|
|
|
55
|
+ System.out.println("暂无数据需要更新");
|
|
|
56
|
+ }
|
|
|
57
|
+
|
|
|
58
|
+ }
|
|
|
59
|
+}
|