zhanghua
2023-09-05 816041ed3de1133396bf0db4a8eadb45ae69d322
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
package com.ycl.controller.video;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ycl.annotation.LogSave;
import com.ycl.api.CommonResult;
import com.ycl.controller.BaseController;
import com.ycl.entity.video.VideoPoint;
import com.ycl.service.video.impl.IVideoPointService;
import com.ycl.util.VideoUtil;
import com.ycl.vo.equipment.VideoPointVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 * 点位管理 前端控制器
 * </p>
 *
 * @author zhanghua
 * @since 2022-09-26
 */
@RestController
@RequestMapping("/video_point")
@Api(tags = "点位管理")
public class VideoPointController extends BaseController {
 
    @Autowired
    IVideoPointService iVideoPointService;
    @Autowired
    VideoUtil videoUtil;
 
    @GetMapping("/query")
    @ApiOperation("查询")
    @LogSave(operationType = "点位管理", contain = "查询点位")
    public CommonResult searchVideoPoint(@RequestParam Long size,
                                         @RequestParam Long current,
                                         @RequestParam(required = false) Integer streetId,
                                         @RequestParam(required = false) Integer communityId) {
 
        IPage<VideoPointVo> pointVoIPage = iVideoPointService.getList(streetId, communityId, current.intValue(), size.intValue());
//        pointVoIPage.getRecords()
//                .stream()
//                .forEach(item -> item.setUrlAddress(videoUtil.getVideo(item.getPlatResourceId(), "HLS", 0)));
        return CommonResult.success(pointVoIPage);
    }
 
    @PostMapping("/addition")
    @ApiOperation("添加")
    @LogSave(operationType = "点位管理", contain = "添加点位")
    public CommonResult addVideoPoint(@RequestBody VideoPoint videoPoint) {
        videoPoint.setType(0);
        return CommonResult.success(iVideoPointService.save(videoPoint));
    }
 
    @PutMapping("/modification")
    @ApiOperation("编辑")
    @LogSave(operationType = "点位管理", contain = "编辑点位")
    public CommonResult modifyVideoPoint(@RequestBody VideoPoint videoPoint) {
        return CommonResult.success(iVideoPointService.updateById(videoPoint));
    }
 
    @DeleteMapping("/deletion")
    @ApiOperation("删除")
    @LogSave(operationType = "点位管理", contain = "修改点位")
    public CommonResult deleteVideoPoint(@RequestParam Long id) {
        return CommonResult.success(iVideoPointService.removeById(id));
    }
}