houzhongjian
2024-11-08 ff763ecc9e3aa99de5e583e2f930a446b47f9514
提交 | 用户 | 时间
149dd0 1 package com.iailab.module.data.video.controller.admin.camera;
H 2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO;
6 import com.iailab.module.data.video.dto.CameraDTO;
7 import com.iailab.module.data.video.service.CameraService;
8 import io.swagger.v3.oas.annotations.Operation;
9 import io.swagger.v3.oas.annotations.Parameter;
10 import io.swagger.v3.oas.annotations.tags.Tag;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.web.bind.annotation.*;
14
15 import javax.annotation.security.PermitAll;
16 import javax.validation.Valid;
17 import java.util.List;
18 import java.util.Map;
19
20 import static com.iailab.framework.common.pojo.CommonResult.error;
21 import static com.iailab.framework.common.pojo.CommonResult.success;
22
23 /**
24  * @author Houzhongjian
25  * @Description
26  * @createTime 2024年11月01日
27  */
28 @RestController
29 @RequestMapping("/data/video/camera")
30 @Tag(name = "摄像头管理")
31 public class CameraController {
32
33     @Autowired
34     private CameraService cameraService;
35
36     @GetMapping("page")
37     @Operation(summary = "分页")
38     @PreAuthorize("@ss.hasPermission('video:camera:query')")
39     public CommonResult<PageResult<CameraDTO>> page(@Valid CameraPageReqVO cameraPageReqVO) {
40         return success(cameraService.getPage(cameraPageReqVO));
41     }
42
43     @GetMapping("list")
44     @PreAuthorize("@ss.hasPermission('video:camera:query')")
45     public CommonResult<List<CameraDTO>> list(@Valid CameraPageReqVO cameraPageReqVO) {
46         List<CameraDTO> list = cameraService.list(cameraPageReqVO);
47         return success(list);
48     }
49
50     @GetMapping("/get")
51     @Operation(summary = "信息")
52     @PreAuthorize("@ss.hasPermission('video:camera:query')")
53     @Parameter(name = "id", description = "编号", required = true, example = "1024")
54     public CommonResult<CameraDTO> get(@RequestParam("id") String id) {
55         CameraDTO data = cameraService.get(id);
56         return success(data);
57     }
58
59     @PostMapping("/create")
60     @Operation(summary = "保存")
61     @PreAuthorize("@ss.hasPermission('video:camera:save')")
62     public CommonResult save(@RequestBody CameraDTO dto) {
63         if (cameraService.cheack(dto) > 0) {
64             return error(405,"内容重复!");
65         }
66         cameraService.save(dto);
67         return success();
68     }
69
70     @PutMapping("/update")
71     @Operation(summary = "修改")
72     @PreAuthorize("@ss.hasPermission('video:camera:update')")
73     public CommonResult update(@RequestBody CameraDTO dto) {
74         if (cameraService.cheack(dto) > 0) {
75             return error(405,"内容重复!");
76         }
77         cameraService.update(dto);
78         return success();
79     }
80
81     @DeleteMapping("/delete")
82     @Operation(summary = "删除")
83     @PreAuthorize("@ss.hasPermission('video:camera:delete')")
84     public CommonResult delete(@RequestBody String[] ids) {
85         cameraService.delete(ids);
86         return success();
87     }
88
89     @PostMapping("/DHCaptureCallback")
90     @Operation(summary = "大华摄像头截图成功后回调存储处理图片")
91     @PermitAll
92     public CommonResult DHCaptureCallback(@RequestBody Map<String, String> params) {
93         cameraService.dealCapture(params);
94         return success();
95     }
96 }