/**
|
# __----~~~~~~~~~~~------___
|
# . . ~~//====...... __--~ ~~
|
# -. \_|// |||\\ ~~~~~~::::... /~
|
# ___-==_ _-~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);
|
}
|
}
|