Merge branch 'wvp-28181-2.0' into main-dev

# Conflicts:
#	pom.xml
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
#	src/main/resources/all-application.yml
#	src/main/resources/application-dev.yml
This commit is contained in:
648540858
2024-02-07 20:30:37 +08:00
144 changed files with 6070 additions and 28330 deletions

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.vmanager.gb28181.MobilePosition;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
@@ -13,6 +14,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.github.pagehelper.util.StringUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +61,7 @@ public class MobilePositionController {
* @param end 结束时间
* @return
*/
@Operation(summary = "查询历史轨迹")
@Operation(summary = "查询历史轨迹", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号")
@Parameter(name = "start", description = "开始时间")
@@ -84,7 +86,7 @@ public class MobilePositionController {
* @param deviceId 设备ID
* @return
*/
@Operation(summary = "查询设备最新位置")
@Operation(summary = "查询设备最新位置", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/latest/{deviceId}")
public MobilePosition latestPosition(@PathVariable String deviceId) {
@@ -96,7 +98,7 @@ public class MobilePositionController {
* @param deviceId 设备ID
* @return
*/
@Operation(summary = "获取移动位置信息")
@Operation(summary = "获取移动位置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/realtime/{deviceId}")
public DeferredResult<MobilePosition> realTimePosition(@PathVariable String deviceId) {
@@ -136,7 +138,7 @@ public class MobilePositionController {
* @param interval 上报时间间隔
* @return true = 命令发送成功
*/
@Operation(summary = "订阅位置信息")
@Operation(summary = "订阅位置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "expires", description = "订阅超时时间", required = true)
@Parameter(name = "interval", description = "上报时间间隔", required = true)
@@ -162,7 +164,7 @@ public class MobilePositionController {
* @param deviceId 设备ID
* @return true = 命令发送成功
*/
@Operation(summary = "数据位置信息格式处理")
@Operation(summary = "数据位置信息格式处理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/transform/{deviceId}")
public void positionTransform(@PathVariable String deviceId) {

View File

@@ -1,37 +0,0 @@
package com.genersoft.iot.vmp.vmanager.gb28181.SseController;
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
/**
* @description: SSE推送
* @author: lawrencehj
* @data: 2021-01-20
*/
@Tag(name = "SSE推送")
@Controller
@RequestMapping("/api")
public class SseController {
@Autowired
AlarmEventListener alarmEventListener;
@GetMapping("/emit")
public SseEmitter emit(@RequestParam String browserId) {
final SseEmitter sseEmitter = new SseEmitter(0L);
try {
alarmEventListener.addSseEmitters(browserId, sseEmitter);
}catch (Exception e){
sseEmitter.completeWithError(e);
}
return sseEmitter;
}
}

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.vmanager.gb28181.alarm;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
@@ -13,6 +14,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,7 +58,7 @@ public class AlarmController {
* @return
*/
@DeleteMapping("/delete")
@Operation(summary = "删除报警")
@Operation(summary = "删除报警", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "ID")
@Parameter(name = "deviceIds", description = "多个设备id,逗号分隔")
@Parameter(name = "time", description = "结束时间")
@@ -93,7 +95,7 @@ public class AlarmController {
* @return
*/
@GetMapping("/test/notify/alarm")
@Operation(summary = "测试向上级/设备发送模拟报警通知")
@Operation(summary = "测试向上级/设备发送模拟报警通知", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号")
public void delete(@RequestParam String deviceId) {
Device device = storage.queryVideoDevice(deviceId);
@@ -141,7 +143,7 @@ public class AlarmController {
* @param endTime 结束时间
* @return
*/
@Operation(summary = "分页查询报警")
@Operation(summary = "分页查询报警", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page",description = "当前页",required = true)
@Parameter(name = "count",description = "每页查询数量",required = true)
@Parameter(name = "deviceId",description = "设备id")

View File

@@ -9,6 +9,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
@@ -17,6 +18,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +59,7 @@ public class DeviceConfig {
* @return
*/
@GetMapping("/basicParam/{deviceId}")
@Operation(summary = "基本配置设置命令")
@Operation(summary = "基本配置设置命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "name", description = "名称")
@@ -113,7 +115,7 @@ public class DeviceConfig {
* @param channelId 通道ID
* @return
*/
@Operation(summary = "设备配置查询请求")
@Operation(summary = "设备配置查询请求", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "configType", description = "配置类型")

View File

@@ -9,6 +9,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
@@ -17,6 +18,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,7 +55,7 @@ public class DeviceControl {
*
* @param deviceId 设备ID
*/
@Operation(summary = "远程启动控制命令")
@Operation(summary = "远程启动控制命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/teleboot/{deviceId}")
public void teleBootApi(@PathVariable String deviceId) {
@@ -76,7 +78,7 @@ public class DeviceControl {
* @param recordCmdStr Record手动录像StopRecord停止手动录像
* @param channelId 通道编码(可选)
*/
@Operation(summary = "录像控制")
@Operation(summary = "录像控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "recordCmdStr", description = "命令, 可选值Record手动录像StopRecord停止手动录像", required = true)
@@ -125,7 +127,7 @@ public class DeviceControl {
* @param deviceId 设备ID
* @param guardCmdStr SetGuard布防ResetGuard撤防
*/
@Operation(summary = "布防/撤防命令")
@Operation(summary = "布防/撤防命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "guardCmdStr", description = "命令, 可选值SetGuard布防ResetGuard撤防", required = true)
@GetMapping("/guard/{deviceId}/{guardCmdStr}")
@@ -170,7 +172,7 @@ public class DeviceControl {
* @param alarmMethod 报警方式(可选)
* @param alarmType 报警类型(可选)
*/
@Operation(summary = "报警复位")
@Operation(summary = "报警复位", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "alarmMethod", description = "报警方式")
@@ -217,7 +219,7 @@ public class DeviceControl {
* @param deviceId 设备ID
* @param channelId 通道ID
*/
@Operation(summary = "强制关键帧")
@Operation(summary = "强制关键帧", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号")
@GetMapping("/i_frame/{deviceId}")
@@ -249,7 +251,7 @@ public class DeviceControl {
* @param presetIndex 调用预置位编号(可选)
* @param channelId 通道编码(可选)
*/
@Operation(summary = "看守位控制")
@Operation(summary = "看守位控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "enabled", description = "是否开启看守位 1:开启,0:关闭", required = true)
@@ -309,7 +311,7 @@ public class DeviceControl {
* @param lengthy 拉框宽度像素值
* @return
*/
@Operation(summary = "拉框放大")
@Operation(summary = "拉框放大", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "length", description = "播放窗口长度像素值", required = true)
@@ -359,7 +361,7 @@ public class DeviceControl {
* @param lengthy 拉框宽度像素值
* @return
*/
@Operation(summary = "拉框放大")
@Operation(summary = "拉框缩小", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号")
@Parameter(name = "length", description = "播放窗口长度像素值", required = true)

View File

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
@@ -23,6 +24,7 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.ibatis.annotations.Options;
@@ -85,7 +87,7 @@ public class DeviceQuery {
* @param deviceId 国标ID
* @return 国标设备
*/
@Operation(summary = "查询国标设备")
@Operation(summary = "查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/devices/{deviceId}")
public Device devices(@PathVariable String deviceId){
@@ -99,7 +101,7 @@ public class DeviceQuery {
* @param count 每页查询数量
* @return 分页国标列表
*/
@Operation(summary = "分页查询国标设备")
@Operation(summary = "分页查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@GetMapping("/devices")
@@ -123,7 +125,7 @@ public class DeviceQuery {
* @return 通道列表
*/
@GetMapping("/devices/{deviceId}/channels")
@Operation(summary = "分页查询通道")
@Operation(summary = "分页查询通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@@ -149,7 +151,7 @@ public class DeviceQuery {
* @param deviceId 设备id
* @return
*/
@Operation(summary = "同步设备通道")
@Operation(summary = "同步设备通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/devices/{deviceId}/sync")
public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
@@ -177,7 +179,7 @@ public class DeviceQuery {
* @param deviceId 设备id
* @return
*/
@Operation(summary = "移除设备")
@Operation(summary = "移除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@DeleteMapping("/devices/{deviceId}/delete")
public String delete(@PathVariable String deviceId){
@@ -222,7 +224,7 @@ public class DeviceQuery {
* @param channelType 通道类型
* @return 子通道列表
*/
@Operation(summary = "分页查询子目录通道")
@Operation(summary = "分页查询子目录通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "page", description = "当前页", required = true)
@@ -254,7 +256,7 @@ public class DeviceQuery {
* @param channel 通道
* @return
*/
@Operation(summary = "更新通道信息")
@Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channel", description = "通道信息", required = true)
@PostMapping("/channel/update/{deviceId}")
@@ -268,7 +270,7 @@ public class DeviceQuery {
* @param streamMode 数据流传输模式
* @return
*/
@Operation(summary = "修改数据流传输模式")
@Operation(summary = "修改数据流传输模式", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "streamMode", description = "数据流传输模式, 取值:" +
"UDPudp传输TCP-ACTIVEtcp主动模式,暂不支持TCP-PASSIVEtcp被动模式", required = true)
@@ -284,7 +286,7 @@ public class DeviceQuery {
* @param device 设备信息
* @return
*/
@Operation(summary = "添加设备信息")
@Operation(summary = "添加设备信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "device", description = "设备", required = true)
@PostMapping("/device/add/")
public void addDevice(Device device){
@@ -306,7 +308,7 @@ public class DeviceQuery {
* @param device 设备信息
* @return
*/
@Operation(summary = "更新设备信息")
@Operation(summary = "更新设备信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "device", description = "设备", required = true)
@PostMapping("/device/update/")
public void updateDevice(Device device){
@@ -321,7 +323,7 @@ public class DeviceQuery {
*
* @param deviceId 设备id
*/
@Operation(summary = "设备状态查询")
@Operation(summary = "设备状态查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/devices/{deviceId}/status")
public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
@@ -372,7 +374,7 @@ public class DeviceQuery {
* @param endTime 报警发生终止时间(可选)
* @return true = 命令发送成功
*/
@Operation(summary = "设备状态查询")
@Operation(summary = "设备报警查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "startPriority", description = "报警起始级别")
@Parameter(name = "endPriority", description = "报警终止级别")
@@ -422,7 +424,7 @@ public class DeviceQuery {
@GetMapping("/{deviceId}/sync_status")
@Operation(summary = "获取通道同步进度")
@Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
@@ -442,7 +444,7 @@ public class DeviceQuery {
}
@GetMapping("/{deviceId}/subscribe_info")
@Operation(summary = "获取设备的订阅状态")
@Operation(summary = "获取设备的订阅状态", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
public WVPResult<Map<String, Integer>> getSubscribeInfo(@PathVariable String deviceId) {
Set<String> allKeys = dynamicTask.getAllKeys();

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.service.IGbStreamService;
@@ -11,6 +12,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +45,7 @@ public class GbStreamController {
* @param platformId 平台ID
* @return
*/
@Operation(summary = "查询国标通道")
@Operation(summary = "查询国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
@Parameter(name = "platformId", description = "平台ID", required = true)
@@ -79,12 +81,12 @@ public class GbStreamController {
* @param gbStreamParam
* @return
*/
@Operation(summary = "移除国标关联")
@Operation(summary = "移除国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
@DeleteMapping(value = "/del")
@ResponseBody
public void del(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) {
if (gbStreamParam.isAll()) {
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
}
@@ -99,11 +101,11 @@ public class GbStreamController {
* @param gbStreamParam
* @return
*/
@Operation(summary = "保存国标关联")
@Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping(value = "/add")
@ResponseBody
public void add(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) {
if (gbStreamParam.isAll()) {
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
@@ -118,7 +120,7 @@ public class GbStreamController {
* @param gbId
* @return
*/
@Operation(summary = "保存国标关联")
@Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
@GetMapping(value = "/addWithGbid")
@ResponseBody
public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.conf.security.SecurityUtils;
import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
@@ -12,6 +13,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +47,7 @@ public class MediaController {
* @param stream 流id
* @return
*/
@Operation(summary = "根据应用名和流id获取播放地址")
@Operation(summary = "根据应用名和流id获取播放地址", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "app", description = "应用名", required = true)
@Parameter(name = "stream", description = "流id", required = true)
@Parameter(name = "mediaServerId", description = "媒体服务器id")

View File

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
@@ -21,6 +22,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +85,7 @@ public class PlatformController {
*
* @return
*/
@Operation(summary = "获取国标服务的配置")
@Operation(summary = "获取国标服务的配置", security = @SecurityRequirement(name = JwtUtils.HEADER))
@GetMapping("/server_config")
public JSONObject serverConfig() {
JSONObject result = new JSONObject();
@@ -99,7 +101,7 @@ public class PlatformController {
*
* @return
*/
@Operation(summary = "获取级联服务器信息")
@Operation(summary = "获取级联服务器信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "平台国标编号", required = true)
@GetMapping("/info/{id}")
public ParentPlatform getPlatform(@PathVariable String id) {
@@ -119,7 +121,7 @@ public class PlatformController {
* @return
*/
@GetMapping("/query/{count}/{page}")
@Operation(summary = "分页查询级联平台")
@Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
@@ -140,7 +142,7 @@ public class PlatformController {
* @param parentPlatform
* @return
*/
@Operation(summary = "添加上级平台信息")
@Operation(summary = "添加上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/add")
@ResponseBody
public void addPlatform(@RequestBody ParentPlatform parentPlatform) {
@@ -185,7 +187,7 @@ public class PlatformController {
* @param parentPlatform
* @return
*/
@Operation(summary = "保存上级平台信息")
@Operation(summary = "保存上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/save")
@ResponseBody
public void savePlatform(@RequestBody ParentPlatform parentPlatform) {
@@ -216,7 +218,7 @@ public class PlatformController {
* @param serverGBId 上级平台国标ID
* @return
*/
@Operation(summary = "删除上级平台")
@Operation(summary = "删除上级平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "serverGBId", description = "上级平台的国标编号")
@DeleteMapping("/delete/{serverGBId}")
@ResponseBody
@@ -273,7 +275,7 @@ public class PlatformController {
* @param serverGBId 上级平台国标ID
* @return
*/
@Operation(summary = "查询上级平台是否存在")
@Operation(summary = "查询上级平台是否存在", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "serverGBId", description = "上级平台的国标编号")
@GetMapping("/exit/{serverGBId}")
@ResponseBody
@@ -294,7 +296,7 @@ public class PlatformController {
* @param channelType 通道类型
* @return
*/
@Operation(summary = "查询上级平台是否存在")
@Operation(summary = "查询上级平台是否存在", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
@Parameter(name = "platformId", description = "上级平台的国标编号")
@@ -331,7 +333,7 @@ public class PlatformController {
* @param param 通道关联参数
* @return
*/
@Operation(summary = "向上级平台添加国标通道")
@Operation(summary = "向上级平台添加国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/update_channel_for_gb")
@ResponseBody
public void updateChannelForGB(@RequestBody UpdateChannelParam param) {
@@ -360,7 +362,7 @@ public class PlatformController {
* @param param 通道关联参数
* @return
*/
@Operation(summary = "从上级平台移除国标通道")
@Operation(summary = "从上级平台移除国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
@DeleteMapping("/del_channel_for_gb")
@ResponseBody
public void delChannelForGB(@RequestBody UpdateChannelParam param) {
@@ -389,7 +391,7 @@ public class PlatformController {
* @param parentId 目录父ID
* @return
*/
@Operation(summary = "获取目录")
@Operation(summary = "获取目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "platformId", description = "上级平台的国标编号", required = true)
@Parameter(name = "parentId", description = "父级目录的国标编号", required = true)
@GetMapping("/catalog")
@@ -420,7 +422,7 @@ public class PlatformController {
* @param platformCatalog 目录
* @return
*/
@Operation(summary = "添加目录")
@Operation(summary = "添加目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/catalog/add")
@ResponseBody
public void addCatalog(@RequestBody PlatformCatalog platformCatalog) {
@@ -445,7 +447,7 @@ public class PlatformController {
* @param platformCatalog 目录
* @return
*/
@Operation(summary = "编辑目录")
@Operation(summary = "编辑目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/catalog/edit")
@ResponseBody
public void editCatalog(@RequestBody PlatformCatalog platformCatalog) {
@@ -471,7 +473,7 @@ public class PlatformController {
* @param platformId 平台Id
* @return
*/
@Operation(summary = "删除目录")
@Operation(summary = "删除目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "目录Id", required = true)
@Parameter(name = "platformId", description = "平台Id", required = true)
@DeleteMapping("/catalog/del")
@@ -506,7 +508,7 @@ public class PlatformController {
* @param platformCatalog 关联的信息
* @return
*/
@Operation(summary = "删除关联")
@Operation(summary = "删除关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
@DeleteMapping("/catalog/relation/del")
@ResponseBody
public void delRelation(@RequestBody PlatformCatalog platformCatalog) {
@@ -529,7 +531,7 @@ public class PlatformController {
* @param catalogId 目录Id
* @return
*/
@Operation(summary = "修改默认目录")
@Operation(summary = "修改默认目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "catalogId", description = "目录Id", required = true)
@Parameter(name = "platformId", description = "平台Id", required = true)
@PostMapping("/catalog/default/update")

View File

@@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
@@ -31,6 +32,7 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,7 +94,7 @@ public class PlayController {
@Autowired
private UserSetting userSetting;
@Operation(summary = "开始点播")
@Operation(summary = "开始点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/start/{deviceId}/{channelId}")
@@ -157,7 +159,7 @@ public class PlayController {
return result;
}
@Operation(summary = "停止点播")
@Operation(summary = "停止点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "isSubStream", description = "是否子码流true-子码流false-主码流默认为false", required = true)
@@ -202,7 +204,7 @@ public class PlayController {
* 将不是h264的视频通过ffmpeg 转码为h264 + aac
* @param streamId 流ID
*/
@Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac")
@Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "streamId", description = "视频流ID", required = true)
@PostMapping("/convert/{streamId}")
public JSONObject playConvert(@PathVariable String streamId) {
@@ -244,7 +246,7 @@ public class PlayController {
/**
* 结束转码
*/
@Operation(summary = "结束转码")
@Operation(summary = "结束转码", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "key", description = "视频流key", required = true)
@Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true)
@PostMapping("/convertStop/{key}")
@@ -269,7 +271,7 @@ public class PlayController {
}
}
@Operation(summary = "语音广播命令")
@Operation(summary = "语音广播命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "deviceId", description = "通道国标编号", required = true)
@Parameter(name = "timeout", description = "推流超时时间(秒)", required = true)
@@ -309,7 +311,7 @@ public class PlayController {
playService.stopAudioBroadcast(deviceId, channelId);
}
@Operation(summary = "获取所有的ssrc")
@Operation(summary = "获取所有的ssrc", security = @SecurityRequirement(name = JwtUtils.HEADER))
@GetMapping("/ssrc")
public JSONObject getSSRC() {
if (logger.isDebugEnabled()) {
@@ -332,7 +334,7 @@ public class PlayController {
return jsonObject;
}
@Operation(summary = "获取截图")
@Operation(summary = "获取截图", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "isSubStream", description = "是否子码流true-子码流false-主码流默认为false", required = true)

View File

@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.ServiceException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
@@ -20,6 +21,7 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,7 +70,7 @@ public class PlaybackController {
@Autowired
private UserSetting userSetting;
@Operation(summary = "开始视频回放")
@Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "startTime", description = "开始时间", required = true)
@@ -125,7 +127,7 @@ public class PlaybackController {
}
@Operation(summary = "停止视频回放")
@Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "stream", description = "流ID", required = true)
@@ -149,7 +151,7 @@ public class PlaybackController {
}
@Operation(summary = "回放暂停")
@Operation(summary = "回放暂停", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "streamId", description = "回放流ID", required = true)
@GetMapping("/pause/{streamId}")
public void playPause(@PathVariable String streamId) {
@@ -165,7 +167,7 @@ public class PlaybackController {
}
@Operation(summary = "回放恢复")
@Operation(summary = "回放恢复", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "streamId", description = "回放流ID", required = true)
@GetMapping("/resume/{streamId}")
public void playResume(@PathVariable String streamId) {
@@ -180,7 +182,7 @@ public class PlaybackController {
}
@Operation(summary = "回放拖动播放")
@Operation(summary = "回放拖动播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "streamId", description = "回放流ID", required = true)
@Parameter(name = "seekTime", description = "拖动偏移量单位s", required = true)
@GetMapping("/seek/{streamId}/{seekTime}")
@@ -200,7 +202,7 @@ public class PlaybackController {
}
}
@Operation(summary = "回放倍速播放")
@Operation(summary = "回放倍速播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "streamId", description = "回放流ID", required = true)
@Parameter(name = "speed", description = "倍速0.25 0.5 1、2、4", required = true)
@GetMapping("/speed/{streamId}/{speed}")

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.ptz;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
@@ -10,6 +11,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +52,7 @@ public class PtzController {
* @param zoomSpeed 缩放速度
*/
@Operation(summary = "云台控制")
@Operation(summary = "云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true)
@@ -113,7 +115,7 @@ public class PtzController {
}
@Operation(summary = "通用前端控制命令")
@Operation(summary = "通用前端控制命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "cmdCode", description = "指令码", required = true)
@@ -137,7 +139,7 @@ public class PtzController {
}
@Operation(summary = "预置位查询")
@Operation(summary = "预置位查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/preset/query/{deviceId}/{channelId}")

View File

@@ -1,16 +1,21 @@
package com.genersoft.iot.vmp.vmanager.gb28181.record;
import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
@@ -19,10 +24,12 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -55,13 +62,16 @@ public class GBRecordController {
@Autowired
private IPlayService playService;
@Autowired
private IInviteStreamService inviteStreamService;
@Autowired
private IDeviceService deviceService;
@Autowired
private UserSetting userSetting;
@Operation(summary = "录像查询")
@Operation(summary = "录像查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "startTime", description = "开始时间", required = true)
@@ -115,7 +125,7 @@ public class GBRecordController {
}
@Operation(summary = "开始历史媒体下载")
@Operation(summary = "开始历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "startTime", description = "开始时间", required = true)
@@ -164,7 +174,7 @@ public class GBRecordController {
return result;
}
@Operation(summary = "停止历史媒体下载")
@Operation(summary = "停止历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "stream", description = "流ID", required = true)
@@ -192,7 +202,7 @@ public class GBRecordController {
}
}
@Operation(summary = "获取历史媒体下载进度")
@Operation(summary = "获取历史媒体下载进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "stream", description = "流ID", required = true)

View File

@@ -0,0 +1,55 @@
package com.genersoft.iot.vmp.vmanager.gb28181.sse;
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* SSE 推送.
*
* @author lawrencehj
* @author <a href="mailto:xiaoQQya@126.com">xiaoQQya</a>
* @since 2021/01/20
*/
@Tag(name = "SSE 推送")
@RestController
@RequestMapping("/api")
public class SseController {
@Resource
private AlarmEventListener alarmEventListener;
/**
* SSE 推送.
*
* @param response 响应
* @param browserId 浏览器ID
* @throws IOException IOEXCEPTION
* @author <a href="mailto:xiaoQQya@126.com">xiaoQQya</a>
* @since 2023/11/06
*/
@GetMapping("/emit")
public void emit(HttpServletResponse response, @RequestParam String browserId) throws IOException, InterruptedException {
response.setContentType("text/event-stream");
response.setCharacterEncoding("utf-8");
PrintWriter writer = response.getWriter();
alarmEventListener.addSseEmitter(browserId, writer);
while (!writer.checkError()) {
Thread.sleep(1000);
writer.write(":keep alive\n\n");
writer.flush();
}
alarmEventListener.removeSseEmitter(browserId, writer);
}
}