xiangpei
2024-12-26 7082826bf8f817f4484eda8555599610243ff6a5
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
package com.ycl.controller;
 
import com.ycl.domain.form.CameraCommandForm;
import com.ycl.domain.query.CameraPlayQuery;
import com.ycl.domain.query.CameraQuery;
import com.ycl.domain.result.Result;
import com.ycl.service.HKService;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
/**
 * @author:xp
 * @date:2024/12/20 11:08
 */
@RestController
@RequestMapping("/video")
public class CameraController {
 
    private final HKService hkService;
 
    public CameraController(HKService hkService) {
        this.hkService = hkService;
    }
 
//    /**
//     * 获取摄像头列表
//     *
//     * @param query 查询条件
//     * @return
//     */
//    @GetMapping("/camera/page")
//    public Result getCamerasPage(CameraQuery query) {
//        Map<String, Object> result = hkService.getCamerasPage(query);
//        return Result.ok().data(result.get("list")).total((Integer) result.get("total"));
//    }
//
//
//    /**
//     * 获取摄像头实时的视频流地址
//     *
//     * @param query 点播参数
//     * @return
//     */
//    @GetMapping("/camera/video/play")
//    public Result getCameraVideoStreamUrl(CameraPlayQuery query) {
//        Map<String, Object> result = hkService.previewURLs(query);
//        return Result.ok().data(result.get("url"));
//    }
 
 
    /**
     * 控制摄像头
     *
     * @param form 控制参数
     * @return
     */
    @PostMapping("/camera/command")
    public Result setCameraCommand(@RequestBody CameraCommandForm form) {
        Boolean success = hkService.controlling(form);
        if (success) {
            return Result.ok("操作成功");
        } else {
            return Result.error("操作失败");
        }
    }
 
 
}