| | |
| | | <!-- <version>3.11</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!--Swagger2 --> |
| | | <!--Swagger3 --> |
| | | <!--在线文档 --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>2.9.2</version> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | <version>3.0.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>2.6.1</version> |
| | | </dependency> |
| | | |
| | | <!--参数校验 --> |
| | | <dependency> |
| | | <groupId>javax.validation</groupId> |
| | | <artifactId>validation-api</artifactId> |
| | |
| | | import org.springframework.boot.SpringApplication;
|
| | | import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| | | import org.springframework.context.ConfigurableApplicationContext;
|
| | | import springfox.documentation.oas.annotations.EnableOpenApi;
|
| | |
|
| | | @SpringBootApplication
|
| | | @EnableOpenApi
|
| | | public class VManageBootstrap extends LogManager {
|
| | | private static String[] args;
|
| | | private static ConfigurableApplicationContext context;
|
New file |
| | |
| | | package com.genersoft.iot.vmp.conf; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.builders.RequestParameterBuilder; |
| | | import springfox.documentation.schema.ScalarType; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Configuration |
| | | public class Swagger3Config { |
| | | |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.OAS_30) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .pathMapping("/"); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("WVP-PRO 接口文档") |
| | | .description("更多请咨询服务开发者(18010473990@@163.com)。") |
| | | .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | @Override
|
| | | public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
|
| | | try {
|
| | |
|
| | | if (device == null) return;
|
| | | String ssrc = streamSession.createPlaySsrc();
|
| | | String streamId = null;
|
| | | if (rtpEnable) {
|
| | |
| | | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | |
| | | @Api(tags = "国标设备配置") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequestMapping("/api/device/config") |
| | | public class DeviceConfig { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| | |
| | | |
| | | /** |
| | | * 看守位控制命令API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param enabled 看守位使能1:开启,0:关闭 |
| | | * @param resetTime 自动归位时间间隔(可选) |
| | | * @param presetIndex 调用预置位编号(可选) |
| | | * @param channelId 通道编码(可选) |
| | | * @param deviceId 设备ID |
| | | * @param channelId 通道ID |
| | | * @param name 名称 |
| | | * @param expiration 到期时间 |
| | | * @param heartBeatInterval 心跳间隔 |
| | | * @param heartBeatCount 心跳计数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/config/{deviceId}/basicParam") |
| | | @ApiOperation("看守位控制命令") |
| | | @GetMapping("/basicParam/{deviceId}") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value ="设备ID" ), |
| | | @ApiImplicitParam(name = "channelId", value ="通道ID" ), |
| | | @ApiImplicitParam(name = "name", value ="名称" ), |
| | | @ApiImplicitParam(name = "expiration", value ="到期时间" ), |
| | | @ApiImplicitParam(name = "heartBeatInterval", value ="心跳间隔" ), |
| | | @ApiImplicitParam(name = "heartBeatCount", value ="心跳计数" ), |
| | | }) |
| | | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, |
| | | @RequestParam(required = false) String channelId, |
| | | @RequestParam(required = false) String name, |
| | |
| | | |
| | | /** |
| | | * 设备配置查询请求API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | * @param configType 配置类型 |
| | | * @param channelId 通道ID |
| | | * @return |
| | | */ |
| | | @GetMapping("/config/{deviceId}/query/{configType}") |
| | | @ApiOperation("设备配置查询请求") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value ="设备ID" ), |
| | | @ApiImplicitParam(name = "channelId", value ="通道ID" ), |
| | | @ApiImplicitParam(name = "configType", value ="配置类型" ), |
| | | }) |
| | | @GetMapping("/query/{deviceId}/{configType}") |
| | | public DeferredResult<ResponseEntity<String>> configDownloadApi(@PathVariable String deviceId, |
| | | @PathVariable String configType, |
| | | @RequestParam(required = false) String channelId) { |
| | |
| | | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | |
| | | @Api(tags = "国标设备控制") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequestMapping("/api/device/control") |
| | | public class DeviceControl { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| | |
| | | /** |
| | | * 远程启动控制命令API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | */ |
| | | @GetMapping("/control/{deviceId}/teleboot") |
| | | @PostMapping("/control/{deviceId}/teleboot") |
| | | @ApiOperation("远程启动控制命令") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true), |
| | | }) |
| | | @GetMapping("/teleboot/{deviceId}") |
| | | public ResponseEntity<String> teleBootApi(@PathVariable String deviceId) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("设备远程启动API调用"); |
| | |
| | | /** |
| | | * 录像控制命令API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像 |
| | | * @param channelId 通道编码(可选) |
| | | */ |
| | | @GetMapping("/control/{deviceId}/record/{recordCmdStr}") |
| | | @ApiOperation("录像控制命令") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value ="设备ID", required = true), |
| | | @ApiImplicitParam(name = "channelId", value ="通道编码"), |
| | | @ApiImplicitParam(name = "recordCmdStr", value ="命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", |
| | | required = true), |
| | | }) |
| | | @GetMapping("/record/{deviceId}/{recordCmdStr}") |
| | | public DeferredResult<ResponseEntity<String>> recordApi(@PathVariable String deviceId, |
| | | @PathVariable String recordCmdStr, @RequestParam(required = false) String channelId) { |
| | | if (logger.isDebugEnabled()) { |
| | |
| | | /** |
| | | * 报警布防/撤防命令API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | * @param guardCmdStr SetGuard:布防,ResetGuard:撤防 |
| | | */ |
| | | @GetMapping("/control/{deviceId}/guard/{guardCmdStr}") |
| | | @ApiOperation("录像控制命令") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true), |
| | | @ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true) |
| | | }) |
| | | @GetMapping("/guard/{deviceId}/{guardCmdStr}") |
| | | public DeferredResult<ResponseEntity<String>> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("布防/撤防API调用"); |
| | |
| | | /** |
| | | * 报警复位API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | * @param alarmMethod 报警方式(可选) |
| | | * @param alarmType 报警类型(可选) |
| | | */ |
| | | @GetMapping("/control/{deviceId}/resetAlarm") |
| | | @ApiOperation("报警复位") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true), |
| | | @ApiImplicitParam(name = "alarmMethod", value ="报警方式"), |
| | | @ApiImplicitParam(name = "alarmType", value ="报警类型"), |
| | | }) |
| | | @GetMapping("/reset_alarm/{deviceId}") |
| | | public DeferredResult<ResponseEntity<String>> resetAlarmApi(@PathVariable String deviceId, |
| | | @RequestParam(required = false) String alarmMethod, |
| | | @RequestParam(required = false) String alarmType) { |
| | |
| | | /** |
| | | * 强制关键帧API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param channelId |
| | | * @param deviceId 设备ID |
| | | * @param channelId 通道ID |
| | | */ |
| | | @GetMapping("/control/{deviceId}/iFrame") |
| | | @PostMapping("/control/{deviceId}/iFrame") |
| | | @ApiOperation("强制关键帧") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true), |
| | | @ApiImplicitParam(name = "channelId", value ="通道ID", required = true), |
| | | }) |
| | | @GetMapping("/i_frame/{deviceId}") |
| | | public ResponseEntity<String> iFrame(@PathVariable String deviceId, |
| | | @RequestParam(required = false) String channelId) { |
| | | if (logger.isDebugEnabled()) { |
| | |
| | | /** |
| | | * 看守位控制命令API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备ID |
| | | * @param enabled 看守位使能1:开启,0:关闭 |
| | | * @param resetTime 自动归位时间间隔(可选) |
| | | * @param presetIndex 调用预置位编号(可选) |
| | | * @param channelId 通道编码(可选) |
| | | */ |
| | | @GetMapping("/control/{deviceId}/homePosition/{enabled}") |
| | | @ApiOperation("看守位控制") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true), |
| | | @ApiImplicitParam(name = "enabled", value = "是否开启看守位 1:开启,0:关闭", required = true), |
| | | @ApiImplicitParam(name = "resetTime", value = "自动归位时间间隔"), |
| | | @ApiImplicitParam(name = "presetIndex", value = "调用预置位编号"), |
| | | @ApiImplicitParam(name = "channelId", value ="通道ID"), |
| | | }) |
| | | @GetMapping("/home_position/{deviceId}/{enabled}") |
| | | public DeferredResult<ResponseEntity<String>> homePositionApi(@PathVariable String deviceId, |
| | | @PathVariable String enabled, |
| | | @RequestParam(required = false) String resetTime, |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.annotations.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.sip.message.Response; |
| | | |
| | | @Api(tags = "国标设备查询1", value = "国标设备查询") |
| | | @SuppressWarnings("rawtypes") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequestMapping("/api/device/query") |
| | | public class DeviceQuery { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| | |
| | | |
| | | @Autowired |
| | | private DeviceOffLineDetector offLineDetector; |
| | | |
| | | |
| | | /** |
| | | * 使用ID查询国标设备 |
| | | * @param deviceId 国标ID |
| | | * @return 国标设备 |
| | | */ |
| | | @ApiOperation("使用ID查询国标设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true), |
| | | }) |
| | | @GetMapping("/devices/{deviceId}") |
| | | public ResponseEntity<Device> devices(@PathVariable String deviceId){ |
| | | |
| | |
| | | Device device = storager.queryVideoDevice(deviceId); |
| | | return new ResponseEntity<>(device,HttpStatus.OK); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页查询国标设备 |
| | | * @param page 当前页 |
| | | * @param count 每页查询数量 |
| | | * @return 分页国标列表 |
| | | */ |
| | | @ApiOperation("分页查询国标设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "当前页", required = true), |
| | | @ApiImplicitParam(name = "count", value = "每页查询数量", required = true), |
| | | }) |
| | | @GetMapping("/devices") |
| | | public PageInfo<Device> devices(int page, int count){ |
| | | |
| | |
| | | * @param channelType 设备 false/子目录 true |
| | | * @return 通道列表 |
| | | */ |
| | | @ApiOperation("分页查询通道") |
| | | @GetMapping("/devices/{deviceId}/channels") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="deviceId", value = "设备id", required = true), |
| | | @ApiImplicitParam(name="page", value = "当前页", required = true), |
| | | @ApiImplicitParam(name="count", value = "每页查询数量", required = true), |
| | | @ApiImplicitParam(name="query", value = "查询内容"), |
| | | @ApiImplicitParam(name="online", value = "是否在线"), |
| | | @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true"), |
| | | }) |
| | | public ResponseEntity<PageInfo> channels(@PathVariable String deviceId, |
| | | int page, int count, |
| | | @RequestParam(required = false) String query, |
| | |
| | | PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count); |
| | | return new ResponseEntity<>(pageResult,HttpStatus.OK); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同步设备通道 |
| | | * @param deviceId 设备id |
| | | * @return |
| | | */ |
| | | @ApiOperation("同步设备通道") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="deviceId", value = "设备id", required = true), |
| | | }) |
| | | @PostMapping("/devices/{deviceId}/sync") |
| | | public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){ |
| | | |
| | |
| | | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result); |
| | | return result; |
| | | } |
| | | |
| | | @PostMapping("/devices/{deviceId}/delete") |
| | | |
| | | /** |
| | | * 移除设备 |
| | | * @param deviceId 设备id |
| | | * @return |
| | | */ |
| | | @ApiOperation("移除设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="deviceId", value = "设备id", required = true), |
| | | }) |
| | | @DeleteMapping("/devices/{deviceId}/delete") |
| | | public ResponseEntity<String> delete(@PathVariable String deviceId){ |
| | | |
| | | if (logger.isDebugEnabled()) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询通道数 |
| | | * 分页查询子目录通道 |
| | | * @param deviceId 通道id |
| | | * @param channelId 通道id |
| | | * @param page 当前页 |
| | | * @param count 每页条数 |
| | | * @param query 查询内容 |
| | | * @param online 是否在线 |
| | | * @param channelType 通道类型 |
| | | * @return 子通道列表 |
| | | */ |
| | | @GetMapping("/subChannels/{deviceId}/{channelId}/channels") |
| | | @ApiOperation("分页查询子目录通道") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="deviceId", value = "设备id", required = true), |
| | | @ApiImplicitParam(name="channelId", value = "通道id", required = true), |
| | | @ApiImplicitParam(name="page", value = "当前页", required = true), |
| | | @ApiImplicitParam(name="count", value = "每页条数", required = true), |
| | | @ApiImplicitParam(name="query", value = "查询内容"), |
| | | @ApiImplicitParam(name="online", value = "是否在线"), |
| | | @ApiImplicitParam(name="channelType", value = "通道类型, 子目录"), |
| | | }) |
| | | @GetMapping("/sub_channels/{deviceId}/{channelId}/channels") |
| | | public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId, |
| | | @PathVariable String channelId, |
| | | int page, |
| | |
| | | return new ResponseEntity<>(pageResult,HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 更新通道信息 |
| | | * @param deviceId 设备id |
| | | * @param channel 通道 |
| | | * @return |
| | | */ |
| | | @ApiOperation("更新通道信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="deviceId", value = "设备id", required = true), |
| | | @ApiImplicitParam(name="channel", value = "通道", required = true), |
| | | }) |
| | | @PostMapping("/channel/update/{deviceId}") |
| | | public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ |
| | | storager.updateChannel(deviceId, channel); |
| | | return new ResponseEntity<>(null,HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping("/devices/{deviceId}/transport/{streamMode}") |
| | | @PostMapping("/devices/{deviceId}/transport/{streamMode}") |
| | | /** |
| | | * 修改数据流传输模式 |
| | | * @param deviceId 设备id |
| | | * @param streamMode 数据流传输模式 |
| | | * @return |
| | | */ |
| | | @ApiOperation("修改数据流传输模式") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备id", required = true), |
| | | @ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" + |
| | | "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)"), |
| | | }) |
| | | @PostMapping("/transport/{deviceId}/{streamMode}") |
| | | public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ |
| | | Device device = storager.queryVideoDevice(deviceId); |
| | | device.setStreamMode(streamMode); |
| | |
| | | /** |
| | | * 设备状态查询请求API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备id |
| | | */ |
| | | @ApiOperation("设备状态查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备id", required = true), |
| | | }) |
| | | @GetMapping("/devices/{deviceId}/status") |
| | | public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) { |
| | | if (logger.isDebugEnabled()) { |
| | |
| | | |
| | | /** |
| | | * 设备报警查询请求API接口 |
| | | * |
| | | * @param deviceId |
| | | * @param deviceId 设备id |
| | | * @param startPriority 报警起始级别(可选) |
| | | * @param endPriority 报警终止级别(可选) |
| | | * @param alarmMethod 报警方式条件(可选) |
| | | * @param alarmType 报警类型 |
| | | * @param startTime 报警发生起始时间(可选) |
| | | * @param endTime 报警发生终止时间(可选) |
| | | * @return true = 命令发送成功 |
| | | */ |
| | | @ApiOperation("设备报警查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备id", required = true), |
| | | @ApiImplicitParam(name = "startPriority", value = "报警起始级别"), |
| | | @ApiImplicitParam(name = "endPriority", value = "报警终止级别"), |
| | | @ApiImplicitParam(name = "alarmMethod", value = "报警方式条件"), |
| | | @ApiImplicitParam(name = "alarmType", value = "报警类型"), |
| | | @ApiImplicitParam(name = "startTime", value = "报警发生起始时间"), |
| | | @ApiImplicitParam(name = "endTime", value = "报警发生终止时间"), |
| | | }) |
| | | @GetMapping("/alarm/{deviceId}") |
| | | public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, |
| | | @RequestParam(required = false) String startPriority, |
| | |
| | | import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam; |
| | | import com.genersoft.iot.vmp.service.IGbStreamService; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @Api(tags = "视频流关联到级联平台") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api/gbStream") |
| | |
| | | private IVideoManagerStorager storager; |
| | | |
| | | |
| | | @RequestMapping(value = "/list") |
| | | /** |
| | | * 查询国标通道 |
| | | * @param page 当前页 |
| | | * @param count 每页条数 |
| | | * @return |
| | | */ |
| | | @ApiOperation("查询国标通道") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "当前页", required = true ), |
| | | @ApiImplicitParam(name = "count", value = "每页条数", required = true ), |
| | | }) |
| | | @GetMapping(value = "/list") |
| | | @ResponseBody |
| | | public PageInfo<GbStream> list(@RequestParam(required = false)Integer page, |
| | | @RequestParam(required = false)Integer count){ |
| | |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/del") |
| | | /** |
| | | * 移除国标关联 |
| | | * @param gbStreamParam |
| | | * @return |
| | | */ |
| | | @ApiOperation("移除国标关联") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true ), |
| | | }) |
| | | @DeleteMapping(value = "/del") |
| | | @ResponseBody |
| | | public Object del(@RequestBody GbStreamParam gbStreamParam){ |
| | | System.out.println(2222); |
| | | System.out.println(gbStreamParam.getGbStreams().size()); |
| | | if (gbStreamService.delPlatformInfo(gbStreamParam.getGbStreams())) { |
| | | return "success"; |
| | | }else { |
| | |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/add") |
| | | /** |
| | | * 保存国标关联 |
| | | * @param gbStreamParam |
| | | * @return |
| | | */ |
| | | @ApiOperation("保存国标关联") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "app", value = "视频流应用名", required = true ), |
| | | // @ApiImplicitParam(name = "gbId", value = "国标ID", required = true ), |
| | | // }) |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(@RequestBody GbStreamParam gbStreamParam){ |
| | | System.out.println(3333); |
| | |
| | | |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequestMapping("/api/play") |
| | | public class PlayController { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(PlayController.class); |
| | |
| | | @Autowired |
| | | private IMediaService mediaService; |
| | | |
| | | @GetMapping("/play/{deviceId}/{channelId}") |
| | | @GetMapping("/start/{deviceId}/{channelId}") |
| | | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, |
| | | @PathVariable String channelId) { |
| | | |
| | |
| | | return playResult.getResult(); |
| | | } |
| | | |
| | | @PostMapping("/play/{streamId}/stop") |
| | | @PostMapping("/stop/{streamId}") |
| | | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) { |
| | | |
| | | logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId)); |
| | |
| | | * @param streamId 流ID |
| | | * @return |
| | | */ |
| | | @PostMapping("/play/{streamId}/convert") |
| | | @PostMapping("/convert/{streamId}") |
| | | public ResponseEntity<String> playConvert(@PathVariable String streamId) { |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); |
| | | if (streamInfo == null) { |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | @PostMapping("/play/convert/stop/{key}") |
| | | @PostMapping("/convertStop/{key}") |
| | | public ResponseEntity<String> playConvertStop(@PathVariable String key) { |
| | | |
| | | JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); |
| | |
| | | |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequestMapping("/api/playback") |
| | | public class PlaybackController { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(PlaybackController.class); |
| | |
| | | @Autowired |
| | | private DeferredResultHolder resultHolder; |
| | | |
| | | @GetMapping("/playback/{deviceId}/{channelId}") |
| | | @GetMapping("/start/{deviceId}/{channelId}") |
| | | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId, String startTime, |
| | | String endTime) { |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | @RequestMapping("/playback/{ssrc}/stop") |
| | | @RequestMapping("/stop/{ssrc}") |
| | | public ResponseEntity<String> playStop(@PathVariable String ssrc) { |
| | | |
| | | cmder.streamByeCmd(ssrc); |
| | |
| | | # [根据业务需求配置] |
| | | userSettings: |
| | | # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认) |
| | | savePositionHistory: false |
| | | savePositionHistory: false |
| | | |
| | | # 在线文档: swagger-ui(生产环境建议关闭) |
| | | springfox: |
| | | documentation: |
| | | swagger-ui: |
| | | enabled: true |
| | |
| | | getDeviceList: function() { |
| | | let that = this; |
| | | this.getDeviceListLoading = true; |
| | | this.$axios.get(`/api/devices`,{ |
| | | this.$axios.get(`/api/device/query/devices`,{ |
| | | params: { |
| | | page: that.currentPage, |
| | | count: that.count |
| | |
| | | //gb28181平台对接 |
| | | //刷新设备信息 |
| | | refDevice: function(itemData) { |
| | | ///api/devices/{deviceId}/sync |
| | | console.log("刷新对应设备:" + itemData.deviceId); |
| | | var that = this; |
| | | that.$refs[itemData.deviceId + 'refbtn' ].loading = true; |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: '/api/devices/' + itemData.deviceId + '/sync' |
| | | url: '/api/device/query/devices/' + itemData.deviceId + '/sync' |
| | | }).then(function(res) { |
| | | console.log("刷新设备结果:"+JSON.stringify(res)); |
| | | if (!res.data.deviceId) { |
| | |
| | | let that = this; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode |
| | | url: '/api/device/query/transport' + row.deviceId + '/' + row.streamMode |
| | | }).then(function(res) { |
| | | |
| | | }).catch(function(e) { |
| | |
| | | getDeviceChannelList: function () { |
| | | let that = this; |
| | | |
| | | this.$axios.get(`/api/devices/${this.$route.params.deviceId}/channels`, { |
| | | this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, { |
| | | params: { |
| | | page: that.currentPage, |
| | | count: that.count, |
| | |
| | | let that = this; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/play/' + deviceId + '/' + channelId |
| | | url: '/api/play/start/' + deviceId + '/' + channelId |
| | | }).then(function (res) { |
| | | console.log(res.data) |
| | | let streamId = res.data.streamId; |
| | |
| | | var that = this; |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: '/api/play/' + itemData.streamId + '/stop' |
| | | url: '/api/play/stop/' + itemData.streamId |
| | | }).then(function (res) { |
| | | console.log(JSON.stringify(res)); |
| | | that.initData(); |
| | |
| | | showSubchannels: function (channelId) { |
| | | let that = this; |
| | | |
| | | this.$axios.get(`/api/subChannels/${this.deviceId}/${this.parentChannelId}/channels`, { |
| | | this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, { |
| | | params: { |
| | | page: that.currentPage, |
| | | count: that.count, |
| | |
| | | console.log(row) |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: `/api/channel/update/${this.deviceId}`, |
| | | url: `/api/device/query/channel/update/${this.deviceId}`, |
| | | params: row |
| | | }).then(function (res) { |
| | | console.log(JSON.stringify(res)); |
| | |
| | | this.$refs.videoPlayer.pause() |
| | | that.$axios({ |
| | | method: 'post', |
| | | url: '/api/play/' + that.streamId + '/convert' |
| | | url: '/api/play/convert/' + that.streamId |
| | | }).then(function (res) { |
| | | if (res.data.code == 0) { |
| | | that.convertKey = res.data.key; |
| | |
| | | that.$refs.videoPlayer.pause() |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: '/api/play/convert/stop/' + this.convertKey |
| | | url: '/api/play/convertStop/' + this.convertKey |
| | | }).then(function (res) { |
| | | if (res.data.code == 0) { |
| | | console.log(res.data.msg) |
| | |
| | | } else { |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/playback/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' + |
| | | url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' + |
| | | row.endTime |
| | | }).then(function (res) { |
| | | var streamInfo = res.data; |
| | |
| | | this.videoUrl = ''; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/playback/' + this.streamId + '/stop' |
| | | url: '/api/playback/stop/' + this.streamId |
| | | }).then(function (res) { |
| | | if (callback) callback() |
| | | }); |