临时提交
parent
1616a2a731
commit
400eef2d2e
|
@ -196,5 +196,11 @@ public class CommonGBChannel {
|
|||
@Schema(description = "国标-国民经济行业分类代码(可选)")
|
||||
private String gbIndustrialClassification;
|
||||
|
||||
@Schema(description = "关联的推流Id(流来源是推流时有效)")
|
||||
private Integer streamPushId;
|
||||
|
||||
@Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)")
|
||||
private Integer streamProxyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.genersoft.iot.vmp.service.*;
|
|||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -26,13 +26,13 @@ import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
|
|||
import com.genersoft.iot.vmp.media.event.hook.HookType;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.service.*;
|
|||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.utils.MediaServerUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service.redisMsg;
|
|||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.genersoft.iot.vmp.service.redisMsg;
|
|||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||
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.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.service.bean.PushStreamStatusChangeFromRedisDto;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
|||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
|||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
|
||||
import com.genersoft.iot.vmp.streamPush.dao.StreamPushMapper;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||
package com.genersoft.iot.vmp.streamPush.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
|
@ -110,6 +110,7 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
|||
if (ObjectUtils.isEmpty(this.getGbName())) {
|
||||
this.setGbName( app+ "-" +stream);
|
||||
}
|
||||
this.setStreamPushId(this.getId());
|
||||
return this;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.genersoft.iot.vmp.streamPush.bean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StreamPushExcelDto {
|
||||
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("应用名")
|
||||
private String app;
|
||||
|
||||
@ExcelProperty("流ID")
|
||||
private String stream;
|
||||
|
||||
@ExcelProperty("国标ID")
|
||||
private String gbId;
|
||||
|
||||
@ExcelProperty("平台ID")
|
||||
private String platformId;
|
||||
|
||||
@ExcelProperty("目录ID")
|
||||
private String catalogId;
|
||||
|
||||
@ExcelProperty("在线状态")
|
||||
private boolean status;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.genersoft.iot.vmp.streamPush.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用来关联推流数据关联的平台和目录
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class StreamPushInfoForUpdateLoad extends StreamPush{
|
||||
|
||||
private String platformId;
|
||||
|
||||
private String catalogId;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.genersoft.iot.vmp.vmanager.streamPush;
|
||||
package com.genersoft.iot.vmp.streamPush.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
|
@ -11,11 +11,12 @@ import com.genersoft.iot.vmp.conf.security.SecurityUtils;
|
|||
import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPushExcelDto;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.enent.StreamPushUploadFileHandler;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -173,7 +174,7 @@ public class StreamPushController {
|
|||
RequestMessage msg = new RequestMessage();
|
||||
msg.setKey(key);
|
||||
WVPResult<Map<String, List<String>>> wvpResult = new WVPResult<>();
|
||||
if (errorStreams.size() == 0 && errorGBs.size() == 0) {
|
||||
if (errorStreams.isEmpty() && errorGBs.isEmpty()) {
|
||||
wvpResult.setCode(0);
|
||||
wvpResult.setMsg("成功");
|
||||
}else {
|
|
@ -1,7 +1,7 @@
|
|||
package com.genersoft.iot.vmp.storager.dao;
|
||||
package com.genersoft.iot.vmp.streamPush.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
|
@ -1,11 +1,11 @@
|
|||
package com.genersoft.iot.vmp.service.impl;
|
||||
package com.genersoft.iot.vmp.streamPush.enent;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPushExcelDto;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPushInfoForUpdateLoad;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
@ -32,12 +32,12 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
|||
/**
|
||||
* 用于存储不加过滤的所有数据
|
||||
*/
|
||||
private final List<StreamPush> streamPushItems = new ArrayList<>();
|
||||
private final List<StreamPushInfoForUpdateLoad> streamPushItems = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 用于存储更具APP+Stream过滤后的数据,可以直接存入stream_push表与gb_stream表
|
||||
*/
|
||||
private final Map<String, StreamPush> streamPushItemForSave = new HashMap<>();
|
||||
private final Map<String, StreamPushInfoForUpdateLoad> streamPushItemForSave = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 用于存储按照APP+Stream为KEY, 平台ID+目录Id 为value的数据,用于存储到gb_stream表后获取app+Stream对应的平台与目录信息,然后存入关联表
|
||||
|
@ -81,7 +81,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
|||
this.errorDataHandler = errorDataHandler;
|
||||
// 获取数据库已有的数据,已经存在的则忽略
|
||||
List<String> allAppAndStreams = pushService.getAllAppAndStream();
|
||||
if (allAppAndStreams.size() > 0) {
|
||||
if (!allAppAndStreams.isEmpty()) {
|
||||
for (String allAppAndStream : allAppAndStreams) {
|
||||
pushMapInDb.put(allAppAndStream, allAppAndStream);
|
||||
}
|
||||
|
@ -126,31 +126,23 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
|||
streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream() + streamPushExcelDto.getPlatformId());
|
||||
}
|
||||
|
||||
StreamPush streamPushItem = new StreamPush();
|
||||
streamPushItem.setApp(streamPushExcelDto.getApp());
|
||||
streamPushItem.setStream(streamPushExcelDto.getStream());
|
||||
streamPushItem.setGbId(streamPushExcelDto.getGbId());
|
||||
streamPushItem.setStatus(streamPushExcelDto.getStatus());
|
||||
streamPushItem.setStreamType("push");
|
||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||
streamPushItem.setMediaServerId(defaultMediaServerId);
|
||||
streamPushItem.setName(streamPushExcelDto.getName());
|
||||
streamPushItem.setOriginType(2);
|
||||
streamPushItem.setOriginTypeStr("rtsp_push");
|
||||
streamPushItem.setTotalReaderCount(0);
|
||||
streamPushItem.setPlatformId(streamPushExcelDto.getPlatformId());
|
||||
streamPushItem.setCatalogId(streamPushExcelDto.getCatalogId());
|
||||
StreamPushInfoForUpdateLoad streamPushInfoForUpdateLoad = new StreamPushInfoForUpdateLoad();
|
||||
streamPushInfoForUpdateLoad.setApp(streamPushExcelDto.getApp());
|
||||
streamPushInfoForUpdateLoad.setStream(streamPushExcelDto.getStream());
|
||||
streamPushInfoForUpdateLoad.setGbDeviceId(streamPushExcelDto.getGbId());
|
||||
streamPushInfoForUpdateLoad.setGbStatus(streamPushExcelDto.isStatus());
|
||||
streamPushInfoForUpdateLoad.setCreateTime(DateUtil.getNow());
|
||||
streamPushInfoForUpdateLoad.setMediaServerId(defaultMediaServerId);
|
||||
streamPushInfoForUpdateLoad.setGbName(streamPushExcelDto.getName());
|
||||
streamPushInfoForUpdateLoad.setPlatformId(streamPushExcelDto.getPlatformId());
|
||||
streamPushInfoForUpdateLoad.setCatalogId(streamPushExcelDto.getCatalogId());
|
||||
|
||||
// 存入所有的通道信息
|
||||
streamPushItems.add(streamPushItem);
|
||||
streamPushItemForSave.put(streamPushItem.getApp() + streamPushItem.getStream(), streamPushItem);
|
||||
streamPushItems.add(streamPushInfoForUpdateLoad);
|
||||
streamPushItemForSave.put(streamPushInfoForUpdateLoad.getApp() + streamPushInfoForUpdateLoad.getStream(), streamPushInfoForUpdateLoad);
|
||||
|
||||
if (!ObjectUtils.isEmpty(streamPushExcelDto.getPlatformId())) {
|
||||
List<String[]> platformList = streamPushItemsForPlatform.get(streamPushItem.getApp() + streamPushItem.getStream());
|
||||
if (platformList == null) {
|
||||
platformList = new ArrayList<>();
|
||||
streamPushItemsForPlatform.put(streamPushItem.getApp() + streamPushItem.getStream(), platformList);
|
||||
}
|
||||
List<String[]> platformList = streamPushItemsForPlatform.computeIfAbsent(streamPushInfoForUpdateLoad.getApp() + streamPushInfoForUpdateLoad.getStream(), k -> new ArrayList<>());
|
||||
String platformId = streamPushExcelDto.getPlatformId();
|
||||
String catalogId = streamPushExcelDto.getCatalogId();
|
||||
if (ObjectUtils.isEmpty(streamPushExcelDto.getCatalogId())) {
|
||||
|
@ -184,7 +176,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
|||
}
|
||||
|
||||
private void saveData(){
|
||||
if (streamPushItemForSave.size() > 0) {
|
||||
if (!streamPushItemForSave.isEmpty()) {
|
||||
// 向数据库查询是否存在重复的app
|
||||
pushService.batchAddForUpload(new ArrayList<>(streamPushItemForSave.values()), streamPushItemsForPlatform);
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
package com.genersoft.iot.vmp.service;
|
||||
package com.genersoft.iot.vmp.streamPush.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPushInfoForUpdateLoad;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -72,6 +74,9 @@ public interface IStreamPushService {
|
|||
*/
|
||||
void batchAdd(List<StreamPush> streamPushExcelDtoList);
|
||||
|
||||
@Transactional
|
||||
void batchAddForUpload(List<StreamPushInfoForUpdateLoad> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll);
|
||||
|
||||
/**
|
||||
* 中止多个推流
|
||||
*/
|
||||
|
@ -80,7 +85,7 @@ public interface IStreamPushService {
|
|||
/**
|
||||
* 导入时批量增加
|
||||
*/
|
||||
void batchAddForUpload(List<StreamPush> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll);
|
||||
void batchAddForUpload(List<StreamPushInfoForUpdateLoad> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll);
|
||||
|
||||
/**
|
||||
* 全部离线
|
|
@ -1,4 +1,4 @@
|
|||
package com.genersoft.iot.vmp.service.impl;
|
||||
package com.genersoft.iot.vmp.streamPush.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
@ -20,20 +20,23 @@ import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOfflineEvent;
|
|||
import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOnlineEvent;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPushInfoForUpdateLoad;
|
||||
import com.genersoft.iot.vmp.streamPush.dao.StreamPushMapper;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
@ -44,7 +47,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -95,6 +97,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
*/
|
||||
@Async("taskExecutor")
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void onApplicationEvent(MediaArrivalEvent event) {
|
||||
MediaInfo mediaInfo = event.getMediaInfo();
|
||||
if (mediaInfo == null) {
|
||||
|
@ -148,6 +151,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
*/
|
||||
@Async("taskExecutor")
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void onApplicationEvent(MediaDepartureEvent event) {
|
||||
|
||||
// 兼容流注销时类型从redis记录获取
|
||||
|
@ -190,6 +194,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
*/
|
||||
@Async("taskExecutor")
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void onApplicationEvent(MediaServerOnlineEvent event) {
|
||||
zlmServerOnline(event.getMediaServerId());
|
||||
}
|
||||
|
@ -199,6 +204,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
*/
|
||||
@Async("taskExecutor")
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void onApplicationEvent(MediaServerOfflineEvent event) {
|
||||
zlmServerOffline(event.getMediaServerId());
|
||||
}
|
||||
|
@ -469,26 +475,28 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
|
||||
|
||||
@Override
|
||||
public void batchAddForUpload(List<StreamPush> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll ) {
|
||||
@Transactional
|
||||
public void batchAddForUpload(List<StreamPushInfoForUpdateLoad> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll ) {
|
||||
// 存储数据到stream_push表
|
||||
streamPushMapper.addAll(streamPushItems);
|
||||
List<StreamPush> streamPushItemForGbStream = streamPushItems.stream()
|
||||
.filter(streamPushItem-> streamPushItem.getGbId() != null)
|
||||
.collect(Collectors.toList());
|
||||
// 存储数据到gb_stream表, id会返回到streamPushItemForGbStream里
|
||||
if (streamPushItemForGbStream.size() > 0) {
|
||||
gbStreamMapper.batchAdd(streamPushItemForGbStream);
|
||||
}
|
||||
// 去除没有ID也就是没有存储到数据库的数据
|
||||
List<StreamPush> streamPushItemsForPlatform = streamPushItemForGbStream.stream()
|
||||
.filter(streamPushItem-> streamPushItem.getGbStreamId() != null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (streamPushItemsForPlatform.size() > 0) {
|
||||
List<CommonGBChannel> channelList = new ArrayList<>();
|
||||
for (StreamPush streamPushItem : streamPushItems) {
|
||||
if (streamPushItem.getGbDeviceId() != null && streamPushItem.getId() > 0) {
|
||||
channelList.add(streamPushItem.getCommonGBChannel());
|
||||
}
|
||||
}
|
||||
// 存储数据到gb_stream表, id会返回到streamPushItemForGbStream里
|
||||
if (!channelList.isEmpty()) {
|
||||
gbChannelService.batchAdd(channelList);
|
||||
}
|
||||
|
||||
|
||||
if (!streamPushItemsForPlatform.isEmpty()) {
|
||||
// 获取所有平台,平台和目录信息一般不会特别大量。
|
||||
List<ParentPlatform> parentPlatformList = parentPlatformMapper.getParentPlatformList();
|
||||
Map<String, Map<String, PlatformCatalog>> platformInfoMap = new HashMap<>();
|
||||
if (parentPlatformList.size() == 0) {
|
||||
if (parentPlatformList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (ParentPlatform platform : parentPlatformList) {
|
|
@ -1,88 +0,0 @@
|
|||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
public class StreamPushExcelDto {
|
||||
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("应用名")
|
||||
private String app;
|
||||
|
||||
@ExcelProperty("流ID")
|
||||
private String stream;
|
||||
|
||||
@ExcelProperty("国标ID")
|
||||
private String gbId;
|
||||
|
||||
@ExcelProperty("平台ID")
|
||||
private String platformId;
|
||||
|
||||
@ExcelProperty("目录ID")
|
||||
private String catalogId;
|
||||
|
||||
@ExcelProperty("在线状态")
|
||||
private boolean status;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(String stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public String getGbId() {
|
||||
return gbId;
|
||||
}
|
||||
|
||||
public void setGbId(String gbId) {
|
||||
this.gbId = gbId;
|
||||
}
|
||||
|
||||
|
||||
public String getPlatformId() {
|
||||
return platformId;
|
||||
}
|
||||
|
||||
public void setPlatformId(String platformId) {
|
||||
this.platformId = platformId;
|
||||
}
|
||||
|
||||
public String getCatalogId() {
|
||||
return catalogId;
|
||||
}
|
||||
|
||||
public void setCatalogId(String catalogId) {
|
||||
this.catalogId = catalogId;
|
||||
}
|
||||
|
||||
public boolean isStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public boolean getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(boolean status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
|||
import com.genersoft.iot.vmp.service.*;
|
||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
|
||||
|
|
Loading…
Reference in New Issue