elkers
7 天以前 3ca43c0f02fd9974eb087c79f411a3d55f806613
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
/**
#                                                    __----~~~~~~~~~~~------___
#                                   .  .   ~~//====......          __--~ ~~
#                   -.            \_|//     |||\\  ~~~~~~::::... /~
#                ___-==_       _-~o~  \/    |||  \\            _/~~-
#        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
#    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
#  .~       .~       |   \\ -_    /  /-   /   ||      \   /
# /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
# |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
#          '         ~-|      /|    |-~\~~       __--~~
#                      |-~~-_/ |    |   ~\_   _-~            /\
#                           /  \     \__   \/~                \__
#                       _--~ _/ | .-~~____--~-/                  ~~==.
#                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
#                                 -_     ~\      ~~---l__i__i__i--~~_/
#                                 _-~-__   ~)  \--______________--~~
#                               //.-~~~-~_--~- |-------~~~~~~~~
#                                      //.-~~~--\
#                  神兽保佑
#                  永无BUG!
*/
package com.nanjing.water.host.controller;
 
import com.nanjing.water.common.ExecutedResult;
import com.nanjing.water.common.PagerResult;
import com.nanjing.water.common.util.ParameterUtil;
import com.nanjing.water.common.validator.ParameterValidateResult;
import com.nanjing.water.common.validator.ParameterValidator;
import com.nanjing.water.entity.request.ReqListId;
import com.nanjing.water.host.BasicController;
import com.nanjing.water.repository.po.MonitorVideoStreamingPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.io.IOException;
import java.util.List;
import com.nanjing.water.service.MonitorVideoStreamingService;
import com.nanjing.water.entity.request.monitorvideostreaming.ReqCreateMonitorVideoStreaming;
import com.nanjing.water.entity.request.monitorvideostreaming.ReqModifyMonitorVideoStreaming;
import com.nanjing.water.entity.search.SearchMonitorVideoStreaming;
import com.nanjing.water.repository.vo.MonitorVideoStreamingVO;
 
/**
 * 9000.监控视频播放流
 * @author lin.liu
 * @order 9000
 */
@RestController
@RequestMapping(value = "monitorVideoStreaming")
public class MonitorVideoStreamingController extends BasicController {
    @Autowired
    private MonitorVideoStreamingService service;
 
    /**
     * 创建[监控视频播放流]
     * @author lin.liu
     */
    @PostMapping(value = "create")
    public ExecutedResult<Long> create(@RequestBody ReqCreateMonitorVideoStreaming request) {
        //#region 参数验证
        ParameterValidator validator = new ParameterValidator()
                // 非空
                //.addNotNullOrEmpty(ParameterUtil.named("名称"), request.getName())
                // 限制最大长度
                //.addLengthMax(ParameterUtil.named("名称"), request.getName(), ConstantFactory.LENGTH_MAX50)
                ;
        ParameterValidateResult result = validator.validate();
        if (result.getIsFiled()) {
            return failed(result.getErrorMsg());
        }
        //#endregion
        return service.create(request);
    }
 
    /**
     * 编辑[监控视频播放流]
     * @author lin.liu
     */
    @PostMapping(value = "modify")
    public ExecutedResult<String> modify(@RequestBody ReqModifyMonitorVideoStreaming request) {
        //#region 参数验证
        ParameterValidator validator = new ParameterValidator()
                // 必须大于0
                .addGreater(ParameterUtil.named("[监控视频播放流]id"), request.getId(), 0L)
                // 非空
                //.addNotNullOrEmpty(ParameterUtil.named("名称"), request.getName())
                // 限制最大长度
                //.addLengthMax(ParameterUtil.named("名称"), request.getName(), ConstantFactory.LENGTH_MAX50)
                ;
        ParameterValidateResult result = validator.validate();
        if (result.getIsFiled()) {
            return failed(result.getErrorMsg());
        }
        //#endregion
        return service.modify(request);
    }
 
    /**
     * 获取[监控视频播放流]
     * @author lin.liu
     */
    @GetMapping(value = "get/{id}")
    public ExecutedResult<MonitorVideoStreamingVO> get(@PathVariable Long id) {
        return service.get(id);
    }
    /**
     * 根据监控点id获取[监控视频播放流]
     * @author lin.liu
     */
    @GetMapping(value = "getAllByPoint")
    public ExecutedResult<List<MonitorVideoStreamingPO>> getAllByPoint(@RequestParam Long pointId) {
        return service.getAllByPoint(pointId);
    }
 
    /**
     * 查询[监控视频播放流]
     * @author lin.liu
     */
    @PostMapping(value = "search")
    public ExecutedResult<PagerResult<MonitorVideoStreamingVO>> search(@RequestBody SearchMonitorVideoStreaming request) {
        return service.search(request);
    }
    /**
     * 开启视频点播[监控视频播放流]
     * @author lin.liu
     */
    @GetMapping(value = "play/{deviceId}/{channelId}")
    public ExecutedResult<MonitorVideoStreamingPO> play(@PathVariable String deviceId, @PathVariable String channelId) throws IOException {
        return service.play(deviceId,channelId);
    }
    /**
     * 停止视频点播[监控视频播放流]
     * @author lin.liu
     */
    @GetMapping(value = "stop/{deviceId}/{channelId}")
    public ExecutedResult<MonitorVideoStreamingPO> stop(@PathVariable String deviceId,@PathVariable String channelId) throws IOException {
 
        return service.stop(deviceId,channelId,"手动停止点播");
    }
    /**
     * 点播续时[监控视频播放流]
     * @author lin.liu
     */
    @GetMapping(value = "updateEndTime/{deviceId}/{channelId}")
    public ExecutedResult<MonitorVideoStreamingPO> updateEndTime(@PathVariable String deviceId, @PathVariable String channelId) throws IOException {
 
        return service.updateEndTime(deviceId,channelId);
    }
}