2
liusuyi
2026-05-12 9b5c9db9189493fbc6db48f55a7b7311b2a3253c
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package com.ard.qs.api;
 
import com.ard.common.core.domain.R;
import com.ard.common.core.web.domain.AjaxResult;
import com.ard.common.log.annotation.Log;
import com.ard.common.log.enums.BusinessType;
import com.ard.common.security.annotation.InnerAuth;
import com.ard.qs.api.domain.QsDevice;
import com.ard.qs.service.IQsDeviceService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Set;
 
/**
 * 视频监控设备Controller
 *
 * @author fengcheng
 * @date 2026-03-27
 */
@RestController
@RequestMapping("/api/device")
public class QsDeviceApiController {
    @Autowired
    private IQsDeviceService qsDeviceService;
 
    /**
     * 查询视频监控设备
     */
    @InnerAuth
    @PostMapping("/allList")
    public R<List<QsDevice>> list(@RequestBody QsDevice qsDevice) {
        List<QsDevice> list = qsDeviceService.selectQsDeviceList(qsDevice);
        return R.ok(list);
    }
 
    /**
     * 更新设备在线状态
     *
     * @param onlineDeviceSet 在线设备集合
     * @param deviceStatus    设备状态
     * @return
     */
    @InnerAuth
    @PostMapping("/updateDeviceStatusList/{deviceStatus}")
    public R<Boolean> updateQsDeviceStatusList(@RequestBody Set<Long> onlineDeviceSet, @PathVariable String deviceStatus) {
        Boolean b = qsDeviceService.updateQsDeviceStatusList(onlineDeviceSet, deviceStatus);
        return R.ok(b);
    }
 
 
    /**
     * 修改视频监控设备
     */
    @InnerAuth
    @PutMapping("/updateQsDevice")
    public R<Boolean> updateQsDevice(@RequestBody QsDevice qsDevice) {
        return qsDeviceService.editQsDevice(qsDevice) > 0 ? R.ok(true) : R.ok(false);
    }
 
    /**
     * 更具流id获取视频监控设备
     */
    @InnerAuth
    @GetMapping("/getQsDeviceStream/{stream}")
    public R<QsDevice> getQsDeviceStream(@PathVariable String stream) {
        return R.ok(qsDeviceService.getQsDeviceStream(stream));
    }
 
    /**
     * 获取视频监控设备详细信息
     */
    @InnerAuth
    @GetMapping("/getQsDeviceInfo/{id}")
    public R<QsDevice> getQsDeviceInfo(@PathVariable Long id) {
        return R.ok(qsDeviceService.selectQsDeviceById(id));
    }
 
    /**
     * 设备状态任务
     */
    @InnerAuth
    @GetMapping("/task")
    public R<Void> task() {
        qsDeviceService.task();
        return R.ok();
    }
 
    /**
     * 清理设备计划id
     *
     * @param planId 设备id
     * @return
     */
    @InnerAuth
    @GetMapping("/cleanRecordPlanId/{planId}")
    public R<Void> cleanRecordPlanId(@PathVariable Long planId) {
        qsDeviceService.cleanRecordPlanId(planId);
        return R.ok();
    }
 
    /**
     * 根据设备id集合查询设备信息
     *
     * @param startDeviceIdList 设备id集合
     * @return
     */
    @InnerAuth
    @GetMapping("/queryByIds/{startDeviceIdList}")
    public R<List<QsDevice>> queryByIds(@PathVariable List<Long> startDeviceIdList) {
        List<QsDevice> deviceList = qsDeviceService.queryByIds(startDeviceIdList);
        return R.ok(deviceList);
    }
 
    /**
     * 根据计划id查询设备数量
     *
     * @param planId 设备id
     * @return
     */
    @InnerAuth
    @GetMapping("/countRecordPlanDevice/{planId}")
    public R<Integer> countRecordPlanDevice(@PathVariable Long planId) {
        Integer i = qsDeviceService.countRecordPlanDevice(planId);
        return R.ok(i);
    }
 
    /**
     * 新增视频监控设备
     */
    @InnerAuth
    @PostMapping("/addQsDevice")
    public R<Boolean> addQsDevice(@RequestBody QsDevice qsDevice) {
        return qsDeviceService.addQsDevice(qsDevice) > 0 ? R.ok(true) : R.ok(false);
    }
 
    /**
     * 根据 gbDeviceId 更新设备在线状态
     *
     * @param gbDeviceId   国标设备编号
     * @param deviceStatus 设备状态
     * @return
     */
    @InnerAuth
    @PostMapping("/updateDeviceStatusByGbDeviceId/{gbDeviceId}/{deviceStatus}")
    public R<Boolean> updateDeviceStatusByGbDeviceId(@PathVariable String gbDeviceId, @PathVariable String deviceStatus) {
        Boolean result = qsDeviceService.updateDeviceStatusByGbDeviceId(gbDeviceId, deviceStatus);
        return R.ok(result);
    }
 
    /**
     * 根据 jtMobileNo 更新设备在线状态
     *
     * @param jtMobileNo   设备手机号
     * @param deviceStatus 设备状态
     * @return
     */
    @InnerAuth
    @PostMapping("/updateDeviceStatusByJtMobileNo/{jtMobileNo}/{deviceStatus}")
    public R<Boolean> updateDeviceStatusByJtMobileNo(@PathVariable String jtMobileNo, @PathVariable String deviceStatus) {
        Boolean result = qsDeviceService.updateDeviceStatusByJtMobileNo(jtMobileNo, deviceStatus);
        return R.ok(result);
    }
 
 
    /**
     * 删除视频监控设备
     */
    @InnerAuth
    @DeleteMapping("/removeQsDevice/{ids}")
    public R<Boolean> remove(@PathVariable Long[] ids) {
        return qsDeviceService.deleteQsDeviceByIds(ids) > 0 ? R.ok(true) : R.ok(false);
    }
}