| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- package com.genersoft.iot.vmp.extend.controller;
- import com.genersoft.iot.vmp.extend.dto.ExtendDevicePageDto;
- import com.genersoft.iot.vmp.extend.dto.ExtendRecordPageDto;
- import com.genersoft.iot.vmp.extend.entity.ExtendDevice;
- import com.genersoft.iot.vmp.extend.entity.ExtendDeviceChannel;
- import com.genersoft.iot.vmp.extend.entity.ExtendRecord;
- import com.genersoft.iot.vmp.extend.service.ExtendDeviceChannelService;
- import com.genersoft.iot.vmp.extend.service.ExtendDeviceService;
- import com.genersoft.iot.vmp.extend.service.ExtendRecordService;
- import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
- import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
- import com.genersoft.iot.vmp.vmanager.gb28181.play.PlayController;
- import com.genersoft.iot.vmp.vmanager.gb28181.ptz.PtzController;
- import com.github.pagehelper.PageInfo;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.context.request.async.DeferredResult;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import java.util.List;
- import java.util.Map;
- @RestController
- @RequestMapping(value = "/internal/device")
- public class ExtendDeviceController {
- @Resource
- private ExtendDeviceService deviceService;
- @Resource
- private ExtendDeviceChannelService deviceChannelService;
- @Resource
- private ExtendRecordService recordService;
- @Resource
- private PlayController playController;
- @Resource
- private PtzController ptzController;
- /**
- * 分页查询设备
- * @param dto
- * @return
- */
- @PostMapping("/page")
- public PageInfo<ExtendDevice> page(@RequestBody ExtendDevicePageDto dto) {
- if (dto.getPageNum() == 0) {
- dto.setPageNum(1);
- }
- if (dto.getPageSize() == 0) {
- dto.setPageSize(10);
- }
- return deviceService.page(dto);
- }
- /**
- * 根据deviceId获取设备
- * @param deviceIds
- * @return
- */
- @RequestMapping("/getDevices")
- public Map<String,ExtendDevice> getDevices(@RequestParam List<String> deviceIds) {
- return deviceService.getDevices(deviceIds);
- }
- /**
- * 查询设备通道
- * @param deviceId
- * @return
- */
- @RequestMapping("/deviceChannel")
- public List<ExtendDeviceChannel> deviceChannel(@RequestParam String deviceId) {
- return deviceChannelService.deviceChannel(deviceId);
- }
- /**
- * 播放实时视频
- * @param request
- * @param deviceId
- * @param channelId
- * @return
- */
- @RequestMapping("/start")
- public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, @RequestParam String deviceId,
- @RequestParam String channelId) {
- return playController.play(request,deviceId,channelId);
- }
- /**
- * 设备控制
- * @param deviceId
- */
- @RequestMapping("/control")
- public void control(@RequestParam String deviceId
- ,@RequestParam String channelId
- ,@RequestParam String command
- ,@RequestParam int horizonSpeed
- ,@RequestParam int verticalSpeed
- ,@RequestParam int zoomSpeed) {
- ptzController.ptz(deviceId,channelId,command,horizonSpeed,verticalSpeed,zoomSpeed);
- }
- /**
- * 历史视频分页查询
- * @param dto
- * @return
- */
- @PostMapping("/recordPage")
- public PageInfo<ExtendRecord> recordPage(@RequestBody ExtendRecordPageDto dto) {
- if (dto.getPageNum() == 0) {
- dto.setPageNum(1);
- }
- if (dto.getPageSize() == 0) {
- dto.setPageSize(10);
- }
- return recordService.page(dto);
- }
- /**
- * 通用前端控制命令
- * @param deviceId
- */
- @RequestMapping("/command")
- public void command(@RequestParam String deviceId
- ,@RequestParam String channelId
- ,@RequestParam int cmdCode
- ,@RequestParam int parameter1
- ,@RequestParam int parameter2
- ,@RequestParam int bindCode2) {
- ptzController.frontEndCommand(deviceId,channelId,cmdCode,parameter1,parameter2,bindCode2);
- }
- }
|