临时提交
parent
4897d9a501
commit
dc4385da74
|
@ -95,6 +95,15 @@ alter table wvp_platform
|
||||||
alter table wvp_platform
|
alter table wvp_platform
|
||||||
add share_region bool default false;
|
add share_region bool default false;
|
||||||
|
|
||||||
|
alter table wvp_device_channel
|
||||||
|
add common_gb_channel_id integer;
|
||||||
|
|
||||||
|
alter table wvp_stream_push
|
||||||
|
add common_gb_channel_id integer;
|
||||||
|
|
||||||
|
alter table wvp_stream_proxy
|
||||||
|
add common_gb_channel_id integer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,7 @@ create table wvp_stream_proxy (
|
||||||
update_time character varying(50),
|
update_time character varying(50),
|
||||||
stream_key character varying(255),
|
stream_key character varying(255),
|
||||||
enable_disable_none_reader bool default false,
|
enable_disable_none_reader bool default false,
|
||||||
|
common_gb_channel_id integer,
|
||||||
constraint uk_stream_proxy_app_stream unique (app, stream)
|
constraint uk_stream_proxy_app_stream unique (app, stream)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -266,6 +267,7 @@ create table wvp_stream_push (
|
||||||
update_time character varying(50),
|
update_time character varying(50),
|
||||||
push_ing bool default false,
|
push_ing bool default false,
|
||||||
self bool default false,
|
self bool default false,
|
||||||
|
common_gb_channel_id integer,
|
||||||
constraint uk_stream_push_app_stream unique (app, stream)
|
constraint uk_stream_push_app_stream unique (app, stream)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.bean;
|
package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
@Schema(description = "通道信息")
|
@Schema(description = "通道信息")
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.dto;
|
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lin
|
* @author lin
|
||||||
*/
|
*/
|
||||||
@Schema(description = "拉流代理的信息")
|
@Schema(description = "拉流代理的信息")
|
||||||
public class StreamProxyItem extends GbStream {
|
public class StreamProxyItem {
|
||||||
|
|
||||||
@Schema(description = "类型")
|
@Schema(description = "类型")
|
||||||
private String type;
|
private String type;
|
||||||
|
@ -44,6 +43,12 @@ public class StreamProxyItem extends GbStream {
|
||||||
@Schema(description = "拉流代理时zlm返回的key,用于停止拉流代理")
|
@Schema(description = "拉流代理时zlm返回的key,用于停止拉流代理")
|
||||||
private String streamKey;
|
private String streamKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国标通用信息ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "国标通用信息ID")
|
||||||
|
private int commonGbChannelId;
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -52,32 +57,31 @@ public class StreamProxyItem extends GbStream {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setApp(String app) {
|
public void setApp(String app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStream() {
|
public String getStream() {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStream(String stream) {
|
public void setStream(String stream) {
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaServerId() {
|
public String getMediaServerId() {
|
||||||
return mediaServerId;
|
return mediaServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMediaServerId(String mediaServerId) {
|
public void setMediaServerId(String mediaServerId) {
|
||||||
this.mediaServerId = mediaServerId;
|
this.mediaServerId = mediaServerId;
|
||||||
}
|
}
|
||||||
|
@ -177,4 +181,12 @@ public class StreamProxyItem extends GbStream {
|
||||||
public void setStreamKey(String streamKey) {
|
public void setStreamKey(String streamKey) {
|
||||||
this.streamKey = streamKey;
|
this.streamKey = streamKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCommonGbChannelId() {
|
||||||
|
return commonGbChannelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommonGbChannelId(int commonGbChannelId) {
|
||||||
|
this.commonGbChannelId = commonGbChannelId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "推流信息")
|
@Schema(description = "推流信息")
|
||||||
public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{
|
public class StreamPushItem implements Comparable<StreamPushItem>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
|
@ -133,20 +133,17 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
@Schema(description = "是否自己平台的推流")
|
@Schema(description = "是否自己平台的推流")
|
||||||
private boolean self;
|
private boolean self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国标通用信息ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "国标通用信息ID")
|
||||||
|
private int commonGbChannelId;
|
||||||
|
|
||||||
|
|
||||||
public String getVhost() {
|
|
||||||
return vhost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVhost(String vhost) {
|
|
||||||
this.vhost = vhost;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NotNull StreamPushItem streamPushItem) {
|
public int compareTo(@NotNull StreamPushItem streamPushItem) {
|
||||||
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(super.createTime)
|
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(this.createTime)
|
||||||
- DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
|
- DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,22 +176,18 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setApp(String app) {
|
public void setApp(String app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStream() {
|
public String getStream() {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStream(String stream) {
|
public void setStream(String stream) {
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +224,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.originSock = originSock;
|
this.originSock = originSock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getOriginTypeStr() {
|
public String getOriginTypeStr() {
|
||||||
return originTypeStr;
|
return originTypeStr;
|
||||||
}
|
}
|
||||||
|
@ -264,13 +256,18 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.tracks = tracks;
|
this.tracks = tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getVhost() {
|
||||||
|
return vhost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVhost(String vhost) {
|
||||||
|
this.vhost = vhost;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaServerId() {
|
public String getMediaServerId() {
|
||||||
return mediaServerId;
|
return mediaServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMediaServerId(String mediaServerId) {
|
public void setMediaServerId(String mediaServerId) {
|
||||||
this.mediaServerId = mediaServerId;
|
this.mediaServerId = mediaServerId;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +280,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.serverId = serverId;
|
this.serverId = serverId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getPushTime() {
|
public String getPushTime() {
|
||||||
return pushTime;
|
return pushTime;
|
||||||
}
|
}
|
||||||
|
@ -300,12 +296,10 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCreateTime() {
|
public String getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCreateTime(String createTime) {
|
public void setCreateTime(String createTime) {
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
|
@ -326,64 +320,12 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||||
this.self = self;
|
this.self = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
public int getCommonGbChannelId() {
|
||||||
// public Integer getGbStreamId() {
|
return commonGbChannelId;
|
||||||
// return super.getGbStreamId();
|
}
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void setGbStreamId(Integer gbStreamId) {
|
|
||||||
// super.setGbStreamId(gbStreamId);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// public String getGbId() {
|
|
||||||
// return super.getGbId();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setGbId(String gbId) {
|
|
||||||
// super.setGbId(gbId);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getName() {
|
|
||||||
// return super.getName();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setName(String name) {
|
|
||||||
// super.setName(name);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public double getLongitude() {
|
|
||||||
// return super.getLongitude();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setLongitude(double longitude) {
|
|
||||||
// super.setLongitude(longitude);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public double getLatitude() {
|
|
||||||
// return super.getLatitude();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setLatitude(double latitude) {
|
|
||||||
// super.setLatitude(latitude);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getStreamType() {
|
|
||||||
// return super.getStreamType();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setStreamType(String streamType) {
|
|
||||||
// super.setStreamType(streamType);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean isStatus() {
|
|
||||||
// return super.isStatus();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setStatus(boolean status) {
|
|
||||||
// super.setStatus(status);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
public void setCommonGbChannelId(int commonGbChannelId) {
|
||||||
|
this.commonGbChannelId = commonGbChannelId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ public interface ICommonGbChannelService {
|
||||||
|
|
||||||
int add(CommonGbChannel channel);
|
int add(CommonGbChannel channel);
|
||||||
|
|
||||||
int addFromGbChannel(DeviceChannel channel);
|
|
||||||
|
|
||||||
int delete(String channelId);
|
int delete(String channelId);
|
||||||
|
|
||||||
int update(CommonGbChannel channel);
|
int update(CommonGbChannel channel);
|
||||||
|
|
|
@ -40,12 +40,6 @@ public interface IDeviceChannelService {
|
||||||
*/
|
*/
|
||||||
ResourceBaseInfo getOverview();
|
ResourceBaseInfo getOverview();
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有未分配的通道
|
|
||||||
* @param platformId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<ChannelReduce> queryAllChannelList(String platformId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据位置信息格式处理
|
* 数据位置信息格式处理
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.service;
|
|
||||||
|
|
||||||
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.StreamPushItem;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 级联国标平台关联流业务接口
|
|
||||||
*/
|
|
||||||
public interface IGbStreamService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页获取所有
|
|
||||||
* @param page
|
|
||||||
* @param count
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId,String query,String mediaServerId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除
|
|
||||||
* @param app
|
|
||||||
* @param stream
|
|
||||||
*/
|
|
||||||
void del(String app, String stream);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存国标关联
|
|
||||||
* @param gbStreams
|
|
||||||
*/
|
|
||||||
boolean addPlatformInfo(List<GbStream> gbStreams, String platformId, String catalogId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除国标关联
|
|
||||||
* @param gbStreams
|
|
||||||
* @param platformId
|
|
||||||
*/
|
|
||||||
boolean delPlatformInfo(String platformId, List<GbStream> gbStreams);
|
|
||||||
|
|
||||||
DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform);
|
|
||||||
|
|
||||||
void sendCatalogMsg(GbStream gbStream, String type);
|
|
||||||
void sendCatalogMsgs(List<GbStream> gbStreams, String type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改gbId或name
|
|
||||||
* @param streamPushItemForUpdate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
|
||||||
|
|
||||||
DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有未分配的通道
|
|
||||||
* @param platformId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<GbStream> getAllGBChannels(String platformId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除所有关联的通道
|
|
||||||
* @param platformId
|
|
||||||
* @param catalogId
|
|
||||||
*/
|
|
||||||
void delAllPlatformInfo(String platformId, String catalogId);
|
|
||||||
|
|
||||||
List<GbStream> getGbChannelWithGbid(String gbId);
|
|
||||||
}
|
|
|
@ -57,4 +57,9 @@ public interface IPlatformService {
|
||||||
void sendNotifyMobilePosition(String platformId);
|
void sendNotifyMobilePosition(String platformId);
|
||||||
|
|
||||||
void addSimulatedSubscribeInfo(ParentPlatform parentPlatform);
|
void addSimulatedSubscribeInfo(ParentPlatform parentPlatform);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除上级平台
|
||||||
|
*/
|
||||||
|
boolean delete(String serverGBId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
|
@ -101,7 +102,7 @@ public interface IStreamPushService {
|
||||||
/**
|
/**
|
||||||
* 增加推流
|
* 增加推流
|
||||||
*/
|
*/
|
||||||
boolean add(StreamPushItem stream);
|
boolean add(StreamPushItem stream, CommonGbChannel commonGbChannel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部的app+Streanm 用于判断推流列表是新增还是修改
|
* 获取全部的app+Streanm 用于判断推流列表是新增还是修改
|
||||||
|
|
|
@ -71,23 +71,13 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int add(CommonGbChannel channel) {
|
public int add(CommonGbChannel channel) {
|
||||||
|
// TODO 给标记了共享所有通道的上级·平台发送数据
|
||||||
return commonGbChannelMapper.add(channel);
|
return commonGbChannelMapper.add(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int addFromGbChannel(DeviceChannel channel) {
|
|
||||||
CommonGbChannel commonGbChannel = commonGbChannelMapper.queryByDeviceID(channel.getChannelId());
|
|
||||||
logger.info("[添加通用通道]来自国标通道,国标编号: {}, 同步所有字段", channel.getChannelId());
|
|
||||||
if (commonGbChannel != null) {
|
|
||||||
logger.info("[添加通用通道]来自国标通道,失败,已存在。国标编号: {}", channel.getChannelId());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CommonGbChannel commonChannelFromDeviceChannel = getCommonChannelFromDeviceChannel(channel, null);
|
|
||||||
return commonGbChannelMapper.add(commonChannelFromDeviceChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(String channelId) {
|
public int delete(String channelId) {
|
||||||
|
|
||||||
return commonGbChannelMapper.deleteByDeviceID(channelId);
|
return commonGbChannelMapper.deleteByDeviceID(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.genersoft.iot.vmp.service.bean.Region;
|
||||||
import com.genersoft.iot.vmp.storager.dao.*;
|
import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -201,12 +200,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
return new ResourceBaseInfo(total, online);
|
return new ResourceBaseInfo(total, online);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ChannelReduce> queryAllChannelList(String platformId) {
|
|
||||||
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateAllGps(Device device) {
|
public boolean updateAllGps(Device device) {
|
||||||
List<DeviceChannel> deviceChannels = channelMapper.getChannelsWithoutTransform(device.getDeviceId());
|
List<DeviceChannel> deviceChannels = channelMapper.getChannelsWithoutTransform(device.getDeviceId());
|
||||||
|
|
|
@ -1,272 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.service.impl;
|
|
||||||
|
|
||||||
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.StreamPushItem;
|
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
|
||||||
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.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class GbStreamServiceImpl implements IGbStreamService {
|
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(GbStreamServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DataSourceTransactionManager dataSourceTransactionManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TransactionDefinition transactionDefinition;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private GbStreamMapper gbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformGbStreamMapper platformGbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SubscribeHolder subscribeHolder;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ParentPlatformMapper platformMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformCatalogMapper catalogMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EventPublisher eventPublisher;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId, String query, String mediaServerId) {
|
|
||||||
PageHelper.startPage(page, count);
|
|
||||||
List<GbStream> all = gbStreamMapper.selectAll(platFormId, catalogId, query, mediaServerId);
|
|
||||||
return new PageInfo<>(all);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void del(String app, String stream) {
|
|
||||||
gbStreamMapper.del(app, stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addPlatformInfo(List<GbStream> gbStreams, String platformId, String catalogId) {
|
|
||||||
// 放在事务内执行
|
|
||||||
boolean result = false;
|
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
|
||||||
ParentPlatform parentPlatform = platformMapper.getParentPlatByServerGBId(platformId);
|
|
||||||
if (catalogId == null) {
|
|
||||||
catalogId = parentPlatform.getCatalogId();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < gbStreams.size(); i++) {
|
|
||||||
GbStream gbStream = gbStreams.get(i);
|
|
||||||
gbStream.setCatalogId(catalogId);
|
|
||||||
gbStream.setPlatformId(platformId);
|
|
||||||
// TODO 修改为批量提交
|
|
||||||
platformGbStreamMapper.add(gbStream);
|
|
||||||
logger.info("[关联通道]直播流通道 平台:{}, 共需关联通道数:{}, 已关联:{}", platformId, gbStreams.size(), i + 1);
|
|
||||||
DeviceChannel deviceChannelListByStream = getDeviceChannelListByStreamWithStatus(gbStream, catalogId, parentPlatform);
|
|
||||||
deviceChannelList.add(deviceChannelListByStream);
|
|
||||||
}
|
|
||||||
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
|
||||||
if (subscribeHolder.getCatalogSubscribe(platformId) != null) {
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.ADD);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = true;
|
|
||||||
}catch (Exception e) {
|
|
||||||
logger.error("批量保存流与平台的关系时错误", e);
|
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
deviceChannel.setName(gbStream.getName());
|
|
||||||
deviceChannel.setLongitude(gbStream.getLongitude());
|
|
||||||
deviceChannel.setLatitude(gbStream.getLatitude());
|
|
||||||
deviceChannel.setDeviceId(platform.getDeviceGBId());
|
|
||||||
deviceChannel.setManufacture("wvp-pro");
|
|
||||||
deviceChannel.setStatus(gbStream.isStatus());
|
|
||||||
|
|
||||||
deviceChannel.setRegisterWay(1);
|
|
||||||
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId);
|
|
||||||
if (catalog != null) {
|
|
||||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
|
||||||
deviceChannel.setParentId(catalog.getParentId());
|
|
||||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
}else {
|
|
||||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
|
||||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
|
||||||
}
|
|
||||||
|
|
||||||
deviceChannel.setModel("live");
|
|
||||||
deviceChannel.setOwner("wvp-pro");
|
|
||||||
deviceChannel.setParental(0);
|
|
||||||
deviceChannel.setSecrecy("0");
|
|
||||||
return deviceChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean delPlatformInfo(String platformId, List<GbStream> gbStreams) {
|
|
||||||
// 放在事务内执行
|
|
||||||
boolean result = false;
|
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
|
||||||
try {
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
platformGbStreamMapper.delByAppAndStreamsByPlatformId(gbStreams, platformId);
|
|
||||||
for (GbStream gbStream : gbStreams) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
|
||||||
result = true;
|
|
||||||
}catch (Exception e) {
|
|
||||||
logger.error("批量移除流与平台的关系时错误", e);
|
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendCatalogMsg(GbStream gbStream, String type) {
|
|
||||||
if (gbStream == null || type == null) {
|
|
||||||
logger.warn("[发送目录订阅]类型:流信息或类型为NULL");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<GbStream> gbStreams = new ArrayList<>();
|
|
||||||
if (gbStream.getGbId() != null) {
|
|
||||||
gbStreams.add(gbStream);
|
|
||||||
}else {
|
|
||||||
GbStream gbStreamIndb = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream());
|
|
||||||
if (gbStreamIndb != null && gbStreamIndb.getGbId() != null){
|
|
||||||
gbStreams.add(gbStreamIndb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendCatalogMsgs(gbStreams, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendCatalogMsgs(List<GbStream> gbStreams, String type) {
|
|
||||||
if (gbStreams.size() > 0) {
|
|
||||||
for (GbStream gs : gbStreams) {
|
|
||||||
if (ObjectUtils.isEmpty(gs.getGbId())){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<ParentPlatform> parentPlatforms = platformGbStreamMapper.selectByAppAndStream(gs.getApp(), gs.getStream());
|
|
||||||
if (parentPlatforms.size() > 0) {
|
|
||||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
|
||||||
if (parentPlatform != null) {
|
|
||||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), gs, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate) {
|
|
||||||
return gbStreamMapper.updateGbIdOrName(streamPushItemForUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
deviceChannel.setName(gbStream.getName());
|
|
||||||
deviceChannel.setLongitude(gbStream.getLongitude());
|
|
||||||
deviceChannel.setLatitude(gbStream.getLatitude());
|
|
||||||
deviceChannel.setDeviceId(platform.getDeviceGBId());
|
|
||||||
deviceChannel.setManufacture("wvp-pro");
|
|
||||||
// todo 目前是每一条查询一次,需要优化
|
|
||||||
Boolean status = null;
|
|
||||||
if ("proxy".equals(gbStream.getStreamType())) {
|
|
||||||
status = gbStreamMapper.selectStatusForProxy(gbStream.getApp(), gbStream.getStream());
|
|
||||||
}else {
|
|
||||||
status = gbStreamMapper.selectStatusForPush(gbStream.getApp(), gbStream.getStream());
|
|
||||||
}
|
|
||||||
deviceChannel.setStatus(status != null && status);
|
|
||||||
|
|
||||||
deviceChannel.setRegisterWay(1);
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId);
|
|
||||||
if (catalog != null) {
|
|
||||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
|
||||||
deviceChannel.setParentId(catalog.getParentId());
|
|
||||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
}else {
|
|
||||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
|
||||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
|
||||||
}
|
|
||||||
|
|
||||||
deviceChannel.setModel("live");
|
|
||||||
deviceChannel.setOwner("wvp-pro");
|
|
||||||
deviceChannel.setParental(0);
|
|
||||||
deviceChannel.setSecrecy("0");
|
|
||||||
return deviceChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GbStream> getAllGBChannels(String platformId) {
|
|
||||||
|
|
||||||
return gbStreamMapper.selectAll(platformId, null, null, null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delAllPlatformInfo(String platformId, String catalogId) {
|
|
||||||
if (platformId == null) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
|
||||||
if (platform == null) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(catalogId)) {
|
|
||||||
catalogId = platform.getDeviceGBId();
|
|
||||||
}
|
|
||||||
if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) {
|
|
||||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (GbStream gbStream : gbStreams) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GbStream> getGbChannelWithGbid(String gbId) {
|
|
||||||
return gbStreamMapper.selectByGBId(gbId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -28,7 +28,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
private final static Logger logger = LoggerFactory.getLogger(PlatformChannelServiceImpl.class);
|
private final static Logger logger = LoggerFactory.getLogger(PlatformChannelServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
private CommonChannelPlatformMapper platformChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonChannelMapper commonGbChannelMapper;
|
private CommonChannelMapper commonGbChannelMapper;
|
||||||
|
@ -42,16 +42,6 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscribeHolder subscribeHolder;
|
private SubscribeHolder subscribeHolder;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DeviceChannelMapper deviceChannelMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformCatalogMapper catalogManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ParentPlatformMapper platformMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EventPublisher eventPublisher;
|
EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
@ -100,6 +90,32 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int removeChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds) {
|
public int removeChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds) {
|
||||||
return 0;
|
assert platform != null;
|
||||||
|
if (commonGbChannelIds.isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "有效待关联通道Id为空");
|
||||||
|
}
|
||||||
|
int allCount = 0;
|
||||||
|
if (commonGbChannelIds.size() > BatchLimit.count) {
|
||||||
|
for (int i = 0; i < commonGbChannelIds.size(); i += BatchLimit.count) {
|
||||||
|
int toIndex = i + BatchLimit.count;
|
||||||
|
if (i + BatchLimit.count > commonGbChannelIds.size()) {
|
||||||
|
toIndex = commonGbChannelIds.size();
|
||||||
|
}
|
||||||
|
int count = platformChannelMapper.removeChannels(platform.getId(), commonGbChannelIds.subList(i, toIndex));
|
||||||
|
allCount += count;
|
||||||
|
logger.info("[关联通道]国标通道 平台:{}, 取消关联通道数:{}, 已关联:{}", platform.getServerGBId(), commonGbChannelIds.size(), allCount);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
allCount = platformChannelMapper.removeChannels(platform.getId(), commonGbChannelIds);
|
||||||
|
logger.info("[关联通道]国标通道 平台:{}, 取消关联通道数:{}", platform.getServerGBId(), commonGbChannelIds.size());
|
||||||
|
}
|
||||||
|
SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||||
|
if (catalogSubscribe != null) {
|
||||||
|
List<CommonGbChannel> channelList = commonGbChannelMapper.queryInIdList(commonGbChannelIds);
|
||||||
|
if (channelList != null) {
|
||||||
|
eventPublisher.catalogEventPublish(platform.getServerGBId(), channelList, CatalogEvent.DEL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.genersoft.iot.vmp.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||||
|
@ -15,6 +17,7 @@ import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.*;
|
import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
|
@ -50,15 +53,6 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ParentPlatformMapper platformMapper;
|
private ParentPlatformMapper platformMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformCatalogMapper catalogMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformGbStreamMapper platformGbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@ -427,4 +421,51 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delete(String serverGBId) {
|
||||||
|
ParentPlatform parentPlatform = platformMapper.getParentPlatByServerGBId(serverGBId);
|
||||||
|
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId);
|
||||||
|
if (parentPlatform == null) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
|
||||||
|
}
|
||||||
|
// TODO 发送取消订阅的消息,等待市场检验后确定需要再添加此项,暂时记录
|
||||||
|
// 可通过发送subscription-state 头域为terminated 的 NOTIFY 消息主动结束订阅, NOTIFY消息体可为空,
|
||||||
|
// 订阅方接收到该消息后回复200 OK 响应。
|
||||||
|
// 停止推流
|
||||||
|
stopAllPush(parentPlatform.getServerGBId());
|
||||||
|
// 停止发送位置订阅定时任务
|
||||||
|
String sendMobilePositionTaskKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
||||||
|
if (dynamicTask.contains(sendMobilePositionTaskKey)) {
|
||||||
|
dynamicTask.stop(sendMobilePositionTaskKey);
|
||||||
|
}
|
||||||
|
// 停止注册
|
||||||
|
final String registerTaskKey = REGISTER_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||||
|
if (dynamicTask.contains(registerTaskKey)) {
|
||||||
|
dynamicTask.stop(registerTaskKey);
|
||||||
|
}
|
||||||
|
// 清除定时心跳
|
||||||
|
final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||||
|
if (dynamicTask.contains(keepaliveTaskKey)) {
|
||||||
|
dynamicTask.stop(keepaliveTaskKey);
|
||||||
|
}
|
||||||
|
// 删除缓存的订阅信息
|
||||||
|
subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
|
||||||
|
|
||||||
|
// 发送注销的请求
|
||||||
|
if (parentPlatformCatch != null && parentPlatformCatch.getSipTransactionInfo() != null) {
|
||||||
|
// 发送离线消息,无论是否成功都删除缓存
|
||||||
|
try {
|
||||||
|
commanderForPlatform.unregister(parentPlatform, parentPlatformCatch.getSipTransactionInfo(), null, null);
|
||||||
|
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||||
|
logger.error("[命令发送失败] 国标级联 注销: {}", e.getMessage());
|
||||||
|
} finally {
|
||||||
|
// 清空redis缓存
|
||||||
|
redisCatchStorage.delPlatformCatchInfo(parentPlatform.getServerGBId());
|
||||||
|
redisCatchStorage.delPlatformKeepalive(parentPlatform.getServerGBId());
|
||||||
|
redisCatchStorage.delPlatformRegister(parentPlatform.getServerGBId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.TypeReference;
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
|
@ -13,9 +14,10 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.*;
|
import com.genersoft.iot.vmp.media.zlm.dto.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.ICommonGbChannelService;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
|
import com.genersoft.iot.vmp.service.bean.CommonGbChannelType;
|
||||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.*;
|
import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
|
@ -30,6 +32,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -40,27 +43,12 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(StreamPushServiceImpl.class);
|
private final static Logger logger = LoggerFactory.getLogger(StreamPushServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private GbStreamMapper gbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StreamPushMapper streamPushMapper;
|
private StreamPushMapper streamPushMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StreamProxyMapper streamProxyMapper;
|
private StreamProxyMapper streamProxyMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ParentPlatformMapper parentPlatformMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformCatalogMapper platformCatalogMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformGbStreamMapper platformGbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IGbStreamService gbStreamService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EventPublisher eventPublisher;
|
private EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
@ -76,6 +64,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaServerService mediaServerService;
|
private IMediaServerService mediaServerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICommonGbChannelService commonGbChannelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DataSourceTransactionManager dataSourceTransactionManager;
|
DataSourceTransactionManager dataSourceTransactionManager;
|
||||||
|
|
||||||
|
@ -126,8 +117,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
streamPushItem.setOriginUrl(item.getOriginUrl());
|
streamPushItem.setOriginUrl(item.getOriginUrl());
|
||||||
streamPushItem.setCreateTime(DateUtil.getNow());
|
streamPushItem.setCreateTime(DateUtil.getNow());
|
||||||
streamPushItem.setAliveSecond(item.getAliveSecond());
|
streamPushItem.setAliveSecond(item.getAliveSecond());
|
||||||
streamPushItem.setStatus(true);
|
|
||||||
streamPushItem.setStreamType("push");
|
|
||||||
streamPushItem.setVhost(item.getVhost());
|
streamPushItem.setVhost(item.getVhost());
|
||||||
streamPushItem.setServerId(item.getSeverId());
|
streamPushItem.setServerId(item.getSeverId());
|
||||||
return streamPushItem;
|
return streamPushItem;
|
||||||
|
@ -145,37 +134,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
return streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
return streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean saveToGB(GbStream stream) {
|
|
||||||
stream.setStreamType("push");
|
|
||||||
stream.setStatus(true);
|
|
||||||
stream.setCreateTime(DateUtil.getNow());
|
|
||||||
stream.setStreamType("push");
|
|
||||||
stream.setMediaServerId(mediaConfig.getId());
|
|
||||||
int add = gbStreamMapper.add(stream);
|
|
||||||
return add > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removeFromGB(GbStream stream) {
|
|
||||||
// 判断是否需要发送事件
|
|
||||||
gbStreamService.sendCatalogMsg(stream, CatalogEvent.DEL);
|
|
||||||
platformGbStreamMapper.delByAppAndStream(stream.getApp(), stream.getStream());
|
|
||||||
int del = gbStreamMapper.del(stream.getApp(), stream.getStream());
|
|
||||||
MediaServerItem mediaInfo = mediaServerService.getOne(stream.getMediaServerId());
|
|
||||||
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, stream.getApp(), stream.getStream());
|
|
||||||
if (mediaList != null) {
|
|
||||||
if (mediaList.getInteger("code") == 0) {
|
|
||||||
JSONArray data = mediaList.getJSONArray("data");
|
|
||||||
if (data == null) {
|
|
||||||
streamPushMapper.del(stream.getApp(), stream.getStream());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return del > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamPushItem getPush(String app, String streamId) {
|
public StreamPushItem getPush(String app, String streamId) {
|
||||||
return streamPushMapper.selectOne(app, streamId);
|
return streamPushMapper.selectOne(app, streamId);
|
||||||
|
@ -456,10 +414,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
if (gbStreams == null || gbStreams.size() == 0) {
|
if (gbStreams == null || gbStreams.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gbStreamService.sendCatalogMsgs(gbStreams, CatalogEvent.DEL);
|
|
||||||
|
|
||||||
platformGbStreamMapper.delByGbStreams(gbStreams);
|
|
||||||
gbStreamMapper.batchDelForGbStream(gbStreams);
|
|
||||||
int delStream = streamPushMapper.delAllForGbStream(gbStreams);
|
int delStream = streamPushMapper.delAllForGbStream(gbStreams);
|
||||||
if (delStream > 0) {
|
if (delStream > 0) {
|
||||||
for (GbStream gbStream : gbStreams) {
|
for (GbStream gbStream : gbStreams) {
|
||||||
|
@ -502,27 +456,25 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(StreamPushItem stream) {
|
@Transactional
|
||||||
stream.setUpdateTime(DateUtil.getNow());
|
public boolean add(StreamPushItem stream, CommonGbChannel commonGbChannel) {
|
||||||
stream.setCreateTime(DateUtil.getNow());
|
assert !ObjectUtils.isEmpty(commonGbChannel.getCommonGbDeviceID());
|
||||||
stream.setServerId(userSetting.getServerId());
|
assert !ObjectUtils.isEmpty(commonGbChannel.getCommonGbName());
|
||||||
|
String now = DateUtil.getNow();
|
||||||
|
commonGbChannel.setCreateTime(now);
|
||||||
|
commonGbChannel.setUpdateTime(now);
|
||||||
|
commonGbChannel.setType(CommonGbChannelType.PUSH);
|
||||||
|
|
||||||
// 放在事务内执行
|
commonGbChannelService.add(commonGbChannel);
|
||||||
boolean result = false;
|
if (commonGbChannel.getCommonGbId() > 0) {
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
stream.setCommonGbChannelId(commonGbChannel.getCommonGbId());
|
||||||
try {
|
}else {
|
||||||
int addStreamResult = streamPushMapper.add(stream);
|
return false;
|
||||||
if (!ObjectUtils.isEmpty(stream.getGbId())) {
|
|
||||||
stream.setStreamType("push");
|
|
||||||
gbStreamMapper.add(stream);
|
|
||||||
}
|
|
||||||
dataSourceTransactionManager.commit(transactionStatus);
|
|
||||||
result = true;
|
|
||||||
}catch (Exception e) {
|
|
||||||
logger.error("批量移除流与平台的关系时错误", e);
|
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
|
||||||
}
|
}
|
||||||
return result;
|
stream.setUpdateTime(now);
|
||||||
|
stream.setCreateTime(now);
|
||||||
|
stream.setServerId(userSetting.getServerId());
|
||||||
|
return streamPushMapper.add(stream) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface IVideoManagerStorage {
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
* @return true:存在 false:不存在
|
* @return true:存在 false:不存在
|
||||||
*/
|
*/
|
||||||
public boolean exists(String deviceId);
|
boolean exists(String deviceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始播放
|
* 开始播放
|
||||||
|
@ -32,14 +32,14 @@ public interface IVideoManagerStorage {
|
||||||
* @param channelId 通道ID
|
* @param channelId 通道ID
|
||||||
* @param streamId 流地址
|
* @param streamId 流地址
|
||||||
*/
|
*/
|
||||||
public void startPlay(String deviceId, String channelId, String streamId);
|
void startPlay(String deviceId, String channelId, String streamId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止播放
|
* 停止播放
|
||||||
* @param deviceId 设备id
|
* @param deviceId 设备id
|
||||||
* @param channelId 通道ID
|
* @param channelId 通道ID
|
||||||
*/
|
*/
|
||||||
public void stopPlay(String deviceId, String channelId);
|
void stopPlay(String deviceId, String channelId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备
|
* 获取设备
|
||||||
|
@ -47,7 +47,7 @@ public interface IVideoManagerStorage {
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
* @return DShadow 设备对象
|
* @return DShadow 设备对象
|
||||||
*/
|
*/
|
||||||
public Device queryVideoDevice(String deviceId);
|
Device queryVideoDevice(String deviceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个设备的通道列表
|
* 获取某个设备的通道列表
|
||||||
|
@ -57,33 +57,24 @@ public interface IVideoManagerStorage {
|
||||||
* @param count 每页数量
|
* @param count 每页数量
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
|
PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
|
||||||
|
|
||||||
public List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, List<String> channelIds, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, List<String> channelIds, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取某个设备的通道列表
|
|
||||||
*
|
|
||||||
* @param deviceId 设备ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId,Boolean online,List<String> channelIds);
|
|
||||||
public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个设备的通道
|
* 获取某个设备的通道
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
* @param channelId 通道ID
|
* @param channelId 通道ID
|
||||||
*/
|
*/
|
||||||
public DeviceChannel queryChannel(String deviceId, String channelId);
|
DeviceChannel queryChannel(String deviceId, String channelId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除通道
|
* 删除通道
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
* @param channelId 通道ID
|
* @param channelId 通道ID
|
||||||
*/
|
*/
|
||||||
public int delChannel(String deviceId, String channelId);
|
int delChannel(String deviceId, String channelId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取多个设备
|
* 获取多个设备
|
||||||
|
@ -91,14 +82,14 @@ public interface IVideoManagerStorage {
|
||||||
* @param count 每页数量
|
* @param count 每页数量
|
||||||
* @return List<Device> 设备对象数组
|
* @return List<Device> 设备对象数组
|
||||||
*/
|
*/
|
||||||
public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online);
|
PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取多个设备
|
* 获取多个设备
|
||||||
*
|
*
|
||||||
* @return List<Device> 设备对象数组
|
* @return List<Device> 设备对象数组
|
||||||
*/
|
*/
|
||||||
public List<Device> queryVideoDeviceList(Boolean online);
|
List<Device> queryVideoDeviceList(Boolean online);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,26 +111,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
void cleanChannelsForDevice(String deviceId);
|
void cleanChannelsForDevice(String deviceId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新上级平台
|
|
||||||
* @param parentPlatform
|
|
||||||
*/
|
|
||||||
boolean updateParentPlatform(ParentPlatform parentPlatform);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加上级平台
|
|
||||||
* @param parentPlatform
|
|
||||||
*/
|
|
||||||
boolean addParentPlatform(ParentPlatform parentPlatform);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除上级平台
|
|
||||||
* @param parentPlatform
|
|
||||||
*/
|
|
||||||
boolean deleteParentPlatform(ParentPlatform parentPlatform);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有已启用的平台
|
* 获取所有已启用的平台
|
||||||
* @return
|
* @return
|
||||||
|
@ -153,36 +124,8 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
ParentPlatform queryParentPlatByServerGBId(String platformGbId);
|
ParentPlatform queryParentPlatByServerGBId(String platformGbId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 所有平台离线
|
|
||||||
*/
|
|
||||||
void outlineForAllParentPlatform();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询通道信息,不区分设备(已关联平台或全部)
|
|
||||||
*/
|
|
||||||
PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询设备的通道信息
|
|
||||||
*/
|
|
||||||
List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除上级平台的通道信息
|
|
||||||
* @param platformId
|
|
||||||
* @param channelReduces
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int delChannelForGB(String platformId, List<ChannelReduce> channelReduces);
|
|
||||||
|
|
||||||
|
|
||||||
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
|
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
|
||||||
|
|
||||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
|
|
||||||
List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId);
|
|
||||||
|
|
||||||
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
||||||
|
|
||||||
|
@ -214,11 +157,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
public MobilePosition queryLatestPosition(String deviceId);
|
public MobilePosition queryLatestPosition(String deviceId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除指定设备的所有移动位置
|
|
||||||
* @param deviceId
|
|
||||||
*/
|
|
||||||
public int clearMobilePositionsByDeviceId(String deviceId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除代理流
|
* 移除代理流
|
||||||
|
@ -228,13 +166,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
public int deleteStreamProxy(String app, String stream);
|
public int deleteStreamProxy(String app, String stream);
|
||||||
|
|
||||||
/**
|
|
||||||
* 按照是否启用获取代理流
|
|
||||||
* @param enable
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照是app和stream获取代理流
|
* 按照是app和stream获取代理流
|
||||||
* @param app
|
* @param app
|
||||||
|
@ -278,16 +209,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
int mediaOffline(String app, String streamId);
|
int mediaOffline(String app, String streamId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置流上线
|
|
||||||
*/
|
|
||||||
int mediaOnline(String app, String streamId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置平台在线/离线
|
|
||||||
*/
|
|
||||||
void updateParentPlatformStatus(String platformGbID, boolean online);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据媒体ID获取启用/不启用的代理列表
|
* 根据媒体ID获取启用/不启用的代理列表
|
||||||
* @param id 媒体ID
|
* @param id 媒体ID
|
||||||
|
@ -296,13 +217,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable);
|
List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据通道ID获取其所在设备
|
|
||||||
* @param channelId 通道ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Device queryVideoDeviceByChannelId(String channelId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通道上线
|
* 通道上线
|
||||||
* @param channelId 通道ID
|
* @param channelId 通道ID
|
||||||
|
@ -323,28 +237,6 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId);
|
StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取目录信息
|
|
||||||
* @param platformId
|
|
||||||
* @param parentId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId);
|
|
||||||
|
|
||||||
int addCatalog(PlatformCatalog platformCatalog);
|
|
||||||
|
|
||||||
PlatformCatalog getCatalog(String platformId, String id);
|
|
||||||
|
|
||||||
int delCatalog(String platformId, String id);
|
|
||||||
|
|
||||||
int updateCatalog(PlatformCatalog platformCatalog);
|
|
||||||
|
|
||||||
int setDefaultCatalog(String platformId, String catalogId);
|
|
||||||
|
|
||||||
List<DeviceChannel> queryCatalogInPlatform(String serverGBId);
|
|
||||||
|
|
||||||
int delRelation(PlatformCatalog platformCatalog);
|
|
||||||
|
|
||||||
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
|
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
|
||||||
|
|
||||||
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
|
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
|
||||||
|
@ -353,19 +245,11 @@ public interface IVideoManagerStorage {
|
||||||
|
|
||||||
GbStream getGbStream(String app, String streamId);
|
GbStream getGbStream(String app, String streamId);
|
||||||
|
|
||||||
void delCatalogByPlatformId(String serverGBId);
|
|
||||||
|
|
||||||
void delRelationByPlatformId(String serverGBId);
|
|
||||||
|
|
||||||
PlatformCatalog queryDefaultCatalogInPlatform(String platformId);
|
|
||||||
|
|
||||||
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
||||||
|
|
||||||
void updateChannelPosition(DeviceChannel deviceChannel);
|
void updateChannelPosition(DeviceChannel deviceChannel);
|
||||||
|
|
||||||
void cleanContentForPlatform(String serverGBId);
|
|
||||||
|
|
||||||
List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
|
|
||||||
|
|
||||||
List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online);
|
List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online);
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ public interface CommonChannelMapper {
|
||||||
" <if test='createTime != null' > ,#{createTime}</if>" +
|
" <if test='createTime != null' > ,#{createTime}</if>" +
|
||||||
")" +
|
")" +
|
||||||
"</script>")
|
"</script>")
|
||||||
|
@Options(useGeneratedKeys=true, keyProperty="commonGbId", keyColumn="common_gb_id")
|
||||||
int add(CommonGbChannel channel);
|
int add(CommonGbChannel channel);
|
||||||
|
|
||||||
@Delete("delete from wvp_common_channel where common_gb_device_id = #{channelId}")
|
@Delete("delete from wvp_common_channel where common_gb_device_id = #{channelId}")
|
||||||
|
|
|
@ -17,4 +17,29 @@ import java.util.Map;
|
||||||
public interface CommonChannelPlatformMapper {
|
public interface CommonChannelPlatformMapper {
|
||||||
|
|
||||||
|
|
||||||
|
@Select(" <script>" +
|
||||||
|
"select * from wvp_common_channel_platform where platform_id = #{platformId} and common_gb_channel_id in " +
|
||||||
|
"<foreach collection='commonGbChannelIds' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
||||||
|
" </script>")
|
||||||
|
List<Integer> findChannelsInDb(@Param("platformId") Integer platformId,
|
||||||
|
@Param("commonGbChannelIds") List<Integer> commonGbChannelIds);
|
||||||
|
|
||||||
|
@Insert("<script> " +
|
||||||
|
"INSERT into wvp_common_channel_platform " +
|
||||||
|
"(platform_id, common_gb_channel_id)" +
|
||||||
|
"values " +
|
||||||
|
"<foreach collection='commonGbChannelIds' index='index' item='item' separator=','> " +
|
||||||
|
"(#{platformId}, #{item}) "+
|
||||||
|
"</foreach> " +
|
||||||
|
"</script>")
|
||||||
|
int addChannels(@Param("platformId") Integer platformId,
|
||||||
|
@Param("commonGbChannelIds") List<Integer> commonGbChannelIds);
|
||||||
|
|
||||||
|
@Delete("<script> " +
|
||||||
|
"delete from wvp_common_channel_platform " +
|
||||||
|
"where platform_id = #{platformId} and common_gb_channel_id in " +
|
||||||
|
"<foreach collection='commonGbChannelIds' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
int removeChannels(@Param("platformId") Integer platformId,
|
||||||
|
@Param("commonGbChannelIds") List<Integer> commonGbChannelIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.storager.dao;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
|
||||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -149,33 +148,6 @@ public interface DeviceChannelMapper {
|
||||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
|
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
|
||||||
void startPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId);
|
void startPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId);
|
||||||
|
|
||||||
|
|
||||||
@Select(value = {" <script>" +
|
|
||||||
"SELECT " +
|
|
||||||
" dc.id,\n" +
|
|
||||||
" dc.channel_id,\n" +
|
|
||||||
" dc.device_id,\n" +
|
|
||||||
" dc.name,\n" +
|
|
||||||
" de.manufacturer,\n" +
|
|
||||||
" de.host_address,\n" +
|
|
||||||
" dc.sub_count,\n" +
|
|
||||||
" pgc.platform_id as platform_id,\n" +
|
|
||||||
" pgc.catalog_id as catalog_id " +
|
|
||||||
" FROM wvp_device_channel dc " +
|
|
||||||
" LEFT JOIN wvp_device de ON dc.device_id = de.device_id " +
|
|
||||||
" LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
|
|
||||||
" WHERE 1=1 " +
|
|
||||||
" <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
|
|
||||||
" <if test='online == true' > AND dc.status=true</if> " +
|
|
||||||
" <if test='online == false' > AND dc.status=false</if> " +
|
|
||||||
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.sub_count > 0</if> " +
|
|
||||||
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.sub_count = 0</if> " +
|
|
||||||
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_gb_channel where platform_id=#{platformId} ) </if> " +
|
|
||||||
" <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
|
|
||||||
" ORDER BY dc.device_id, dc.channel_id ASC" +
|
|
||||||
" </script>"})
|
|
||||||
List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
|
||||||
|
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
"SELECT " +
|
"SELECT " +
|
||||||
" dc.*,\n" +
|
" dc.*,\n" +
|
||||||
|
|
|
@ -1,173 +0,0 @@
|
||||||
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.StreamProxyItem;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Repository
|
|
||||||
public interface GbStreamMapper {
|
|
||||||
|
|
||||||
@Insert("INSERT INTO wvp_gb_stream (app, stream, gb_id, name, " +
|
|
||||||
"longitude, latitude, stream_type,media_server_id,create_time) VALUES" +
|
|
||||||
"(#{app}, #{stream}, #{gbId}, #{name}, " +
|
|
||||||
"#{longitude}, #{latitude}, #{streamType}, " +
|
|
||||||
"#{mediaServerId}, #{createTime})")
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
|
|
||||||
int add(GbStream gbStream);
|
|
||||||
|
|
||||||
@Update("UPDATE wvp_gb_stream " +
|
|
||||||
"SET app=#{app}," +
|
|
||||||
"stream=#{stream}," +
|
|
||||||
"gb_id=#{gbId}," +
|
|
||||||
"name=#{name}," +
|
|
||||||
"stream_type=#{streamType}," +
|
|
||||||
"longitude=#{longitude}, " +
|
|
||||||
"latitude=#{latitude}," +
|
|
||||||
"media_server_id=#{mediaServerId}" +
|
|
||||||
"WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
int updateByAppAndStream(GbStream gbStream);
|
|
||||||
|
|
||||||
@Update("UPDATE wvp_gb_stream " +
|
|
||||||
"SET app=#{app}," +
|
|
||||||
"stream=#{stream}," +
|
|
||||||
"gb_id=#{gbId}," +
|
|
||||||
"name=#{name}," +
|
|
||||||
"stream_type=#{streamType}," +
|
|
||||||
"longitude=#{longitude}, " +
|
|
||||||
"latitude=#{latitude}," +
|
|
||||||
"media_server_id=#{mediaServerId}" +
|
|
||||||
"WHERE gb_stream_id=#{gbStreamId}")
|
|
||||||
int update(GbStream gbStream);
|
|
||||||
|
|
||||||
@Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
int del(@Param("app") String app, @Param("stream") String stream);
|
|
||||||
|
|
||||||
@Select("<script> "+
|
|
||||||
"SELECT gs.* FROM wvp_gb_stream gs " +
|
|
||||||
"WHERE " +
|
|
||||||
"1=1 " +
|
|
||||||
" <if test='catalogId != null'> AND gs.gb_stream_id in" +
|
|
||||||
"(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId} and pgs.catalog_id=#{catalogId})</if> " +
|
|
||||||
" <if test='catalogId == null'> AND gs.gb_stream_id not in" +
|
|
||||||
"(select pgs.gb_stream_id from wvp_platform_gb_stream pgs where pgs.platform_id = #{platformId}) </if> " +
|
|
||||||
" <if test='query != null'> AND (gs.app LIKE concat('%',#{query},'%') OR gs.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
|
|
||||||
" <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" +
|
|
||||||
" order by gs.gb_stream_id asc " +
|
|
||||||
"</script>")
|
|
||||||
List<GbStream> selectAll(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("query") String query, @Param("mediaServerId") String mediaServerId);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
GbStream selectOne(@Param("app") String app, @Param("stream") String stream);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}")
|
|
||||||
List<GbStream> selectByGBId(String gbId);
|
|
||||||
|
|
||||||
@Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " +
|
|
||||||
"LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " +
|
|
||||||
"WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}")
|
|
||||||
GbStream queryStreamInPlatform(@Param("platformId") String platformId, @Param("gbId") String gbId);
|
|
||||||
|
|
||||||
@Select("<script> "+
|
|
||||||
"select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parent_id," +
|
|
||||||
" '1' as register_way, pc.civil_code, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" +
|
|
||||||
" from wvp_gb_stream gt " +
|
|
||||||
" left join (" +
|
|
||||||
" select " +
|
|
||||||
" <if test='usPushingAsStatus != true'> sp.status as status, </if>" +
|
|
||||||
" <if test='usPushingAsStatus == true'> sp.push_ing as status, </if>" +
|
|
||||||
"sp.app, sp.stream from wvp_stream_push sp" +
|
|
||||||
" union all" +
|
|
||||||
" select spxy.status, spxy.app, spxy.stream from wvp_stream_proxy spxy" +
|
|
||||||
" ) st on st.app = gt.app and st.stream = gt.stream" +
|
|
||||||
" left join wvp_platform_gb_stream pgs on gt.gb_stream_id = pgs.gb_stream_id" +
|
|
||||||
" left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" +
|
|
||||||
" where pgs.platform_id=#{platformId}" +
|
|
||||||
"</script>")
|
|
||||||
List<DeviceChannel> queryGbStreamListInPlatform(String platformId, @Param("usPushingAsStatus") boolean usPushingAsStatus);
|
|
||||||
|
|
||||||
|
|
||||||
@Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " +
|
|
||||||
"ON gs.gb_stream_id = pgs.gb_stream_id WHERE pgs.gb_stream_id is NULL")
|
|
||||||
List<GbStream> queryStreamNotInPlatform();
|
|
||||||
|
|
||||||
@Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}")
|
|
||||||
void deleteWithoutGBId(@Param("type") String type, @Param("mediaServerId") String mediaServerId);
|
|
||||||
|
|
||||||
@Delete("<script> "+
|
|
||||||
"DELETE FROM wvp_gb_stream where " +
|
|
||||||
"<foreach collection='streamProxyItemList' item='item' separator='or'>" +
|
|
||||||
"(app=#{item.app} and stream=#{item.stream}) " +
|
|
||||||
"</foreach>" +
|
|
||||||
"</script>")
|
|
||||||
void batchDel(List<StreamProxyItem> streamProxyItemList);
|
|
||||||
|
|
||||||
@Delete("<script> "+
|
|
||||||
"DELETE FROM wvp_gb_stream where " +
|
|
||||||
"<foreach collection='gbStreams' item='item' separator='or'>" +
|
|
||||||
"(app=#{item.app} and stream=#{item.stream}) " +
|
|
||||||
"</foreach>" +
|
|
||||||
"</script>")
|
|
||||||
void batchDelForGbStream(List<GbStream> gbStreams);
|
|
||||||
|
|
||||||
@Insert("<script> " +
|
|
||||||
"INSERT into wvp_gb_stream " +
|
|
||||||
"(app, stream, gb_id, name, " +
|
|
||||||
"longitude, latitude, stream_type,media_server_id,create_time)" +
|
|
||||||
"values " +
|
|
||||||
"<foreach collection='subList' index='index' item='item' separator=','> " +
|
|
||||||
"(#{item.app}, #{item.stream}, #{item.gbId}, #{item.name}, " +
|
|
||||||
"#{item.longitude}, #{item.latitude}, #{item.streamType}, " +
|
|
||||||
"#{item.mediaServerId}, #{item.createTime}) "+
|
|
||||||
"</foreach> " +
|
|
||||||
"</script>")
|
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id")
|
|
||||||
void batchAdd(@Param("subList") List<StreamPushItem> subList);
|
|
||||||
|
|
||||||
@Update({"<script>" +
|
|
||||||
"<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
|
|
||||||
" UPDATE" +
|
|
||||||
" wvp_gb_stream" +
|
|
||||||
" SET longitude=#{item.lng}, latitude=#{item.lat} " +
|
|
||||||
"WHERE gb_id=#{item.id}"+
|
|
||||||
"</foreach>" +
|
|
||||||
"</script>"})
|
|
||||||
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
|
|
||||||
|
|
||||||
@Select("<script> "+
|
|
||||||
"SELECT * FROM wvp_gb_stream where " +
|
|
||||||
"<foreach collection='streamPushItems' item='item' separator='or'>" +
|
|
||||||
"(app=#{item.app} and stream=#{item.stream}) " +
|
|
||||||
"</foreach>" +
|
|
||||||
"</script>")
|
|
||||||
List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
|
|
||||||
|
|
||||||
@Update("UPDATE wvp_gb_stream " +
|
|
||||||
"SET media_server_id=#{mediaServerId}" +
|
|
||||||
"WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
void updateMediaServer(String app, String stream, String mediaServerId);
|
|
||||||
|
|
||||||
@Update("<script> "+
|
|
||||||
" <foreach collection='list' item='item' index='index' separator=';'>"+
|
|
||||||
"UPDATE wvp_gb_stream " +
|
|
||||||
" SET name=#{item.name},"+
|
|
||||||
" gb_id=#{item.gb_id}"+
|
|
||||||
" WHERE app=#{item.app} and stream=#{item.stream}"+
|
|
||||||
"</foreach>"+
|
|
||||||
"</script>")
|
|
||||||
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
|
||||||
|
|
||||||
@Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
Boolean selectStatusForProxy(@Param("app") String app, @Param("stream") String stream);
|
|
||||||
|
|
||||||
@Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
|
|
||||||
Boolean selectStatusForPush(@Param("app") String app, @Param("stream") String stream);
|
|
||||||
|
|
||||||
}
|
|
|
@ -67,12 +67,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ParentPlatformMapper platformMapper;
|
private ParentPlatformMapper platformMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StreamProxyMapper streamProxyMapper;
|
private StreamProxyMapper streamProxyMapper;
|
||||||
|
|
||||||
|
@ -85,18 +79,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSetting userSetting;
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformCatalogMapper catalogMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformGbStreamMapper platformGbStreamMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IGbStreamService gbStreamService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ParentPlatformMapper parentPlatformMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备ID判断设备是否存在
|
* 根据设备ID判断设备是否存在
|
||||||
*
|
*
|
||||||
|
@ -161,12 +143,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, channelIds, null, query, hasSubChannel, online, start, limit);
|
return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, channelIds, null, query, hasSubChannel, online, start, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId,Boolean online,List<String> channelIds) {
|
|
||||||
return deviceChannelMapper.queryChannels(deviceId, null,null, null, online,channelIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceChannelExtend> queryChannelsByDeviceId(String deviceId, List<String> channelIds, Boolean online) {
|
public List<DeviceChannelExtend> queryChannelsByDeviceId(String deviceId, List<String> channelIds, Boolean online) {
|
||||||
return deviceChannelMapper.queryChannelsWithDeviceInfo(deviceId, null,null, null, online,channelIds);
|
return deviceChannelMapper.queryChannelsWithDeviceInfo(deviceId, null,null, null, online,channelIds);
|
||||||
|
@ -245,62 +221,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return deviceMobilePositionMapper.queryPositionByDeviceIdAndTime(deviceId, channelId, startTime, endTime);
|
return deviceMobilePositionMapper.queryPositionByDeviceIdAndTime(deviceId, channelId, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addParentPlatform(ParentPlatform parentPlatform) {
|
|
||||||
if (parentPlatform.getCatalogId() == null) {
|
|
||||||
parentPlatform.setCatalogId(parentPlatform.getServerGBId());
|
|
||||||
}
|
|
||||||
int result = platformMapper.addParentPlatform(parentPlatform);
|
|
||||||
return result > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateParentPlatform(ParentPlatform parentPlatform) {
|
|
||||||
int result = 0;
|
|
||||||
if (parentPlatform.getCatalogGroup() == 0) {
|
|
||||||
parentPlatform.setCatalogGroup(1);
|
|
||||||
}
|
|
||||||
if (parentPlatform.getAdministrativeDivision() == null) {
|
|
||||||
parentPlatform.setAdministrativeDivision(parentPlatform.getAdministrativeDivision());
|
|
||||||
}
|
|
||||||
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
|
|
||||||
if (parentPlatform.getId() == null ) {
|
|
||||||
if (parentPlatform.getCatalogId() == null) {
|
|
||||||
parentPlatform.setCatalogId(parentPlatform.getServerGBId());
|
|
||||||
}
|
|
||||||
result = platformMapper.addParentPlatform(parentPlatform);
|
|
||||||
if (parentPlatformCatch == null) {
|
|
||||||
parentPlatformCatch = new ParentPlatformCatch();
|
|
||||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
|
||||||
parentPlatformCatch.setId(parentPlatform.getServerGBId());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if (parentPlatformCatch == null) { // serverGBId 已变化
|
|
||||||
ParentPlatform parentPlatById = platformMapper.getParentPlatById(parentPlatform.getId());
|
|
||||||
// 使用旧的查出缓存ID
|
|
||||||
parentPlatformCatch = new ParentPlatformCatch();
|
|
||||||
parentPlatformCatch.setId(parentPlatform.getServerGBId());
|
|
||||||
redisCatchStorage.delPlatformCatchInfo(parentPlatById.getServerGBId());
|
|
||||||
}
|
|
||||||
|
|
||||||
result = platformMapper.updateParentPlatform(parentPlatform);
|
|
||||||
}
|
|
||||||
// 更新缓存
|
|
||||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
|
||||||
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
|
||||||
|
|
||||||
return result > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public boolean deleteParentPlatform(ParentPlatform parentPlatform) {
|
|
||||||
int result = platformMapper.delParentPlatform(parentPlatform);
|
|
||||||
// 删除关联的通道
|
|
||||||
platformChannelMapper.cleanChannelForGB(parentPlatform.getServerGBId());
|
|
||||||
return result > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParentPlatform queryParentPlatByServerGBId(String platformGbId) {
|
public ParentPlatform queryParentPlatByServerGBId(String platformGbId) {
|
||||||
return platformMapper.getParentPlatByServerGBId(platformGbId);
|
return platformMapper.getParentPlatByServerGBId(platformGbId);
|
||||||
|
@ -321,41 +241,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return deviceMapper.queryDeviceWithAsMessageChannel();
|
return deviceMapper.queryDeviceWithAsMessageChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void outlineForAllParentPlatform() {
|
|
||||||
platformMapper.outlineForAllParentPlatform();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online,
|
|
||||||
Boolean channelType, String platformId, String catalogId) {
|
|
||||||
PageHelper.startPage(page, count);
|
|
||||||
List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, platformId, catalogId);
|
|
||||||
return new PageInfo<>(all);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId) {
|
|
||||||
|
|
||||||
return deviceChannelMapper.queryChannelByPlatformId(platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int delChannelForGB(String platformId, List<ChannelReduce> channelReduces) {
|
|
||||||
|
|
||||||
int result = platformChannelMapper.delChannelForGB(platformId, channelReduces);
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(channelReduce.getChannelId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceChannel queryChannelInParentPlatform(String platformId, String channelId) {
|
public DeviceChannel queryChannelInParentPlatform(String platformId, String channelId) {
|
||||||
List<DeviceChannel> channels = platformChannelMapper.queryChannelInParentPlatform(platformId, channelId);
|
List<DeviceChannel> channels = platformChannelMapper.queryChannelInParentPlatform(platformId, channelId);
|
||||||
|
@ -370,18 +255,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId) {
|
|
||||||
List<PlatformCatalog> catalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
|
|
||||||
return catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) {
|
|
||||||
List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatalog(platformId, catalogId);
|
|
||||||
return catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) {
|
public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) {
|
||||||
List<Device> devices = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId);
|
List<Device> devices = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId);
|
||||||
|
@ -421,16 +294,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return deviceMobilePositionMapper.queryLatestPositionByDevice(deviceId);
|
return deviceMobilePositionMapper.queryLatestPositionByDevice(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除指定设备的所有移动位置
|
|
||||||
* @param deviceId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int clearMobilePositionsByDeviceId(String deviceId) {
|
|
||||||
return deviceMobilePositionMapper.clearMobilePositionsByDeviceId(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除代理流
|
* 移除代理流
|
||||||
* @param app
|
* @param app
|
||||||
|
@ -442,16 +305,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return streamProxyMapper.del(app, stream);
|
return streamProxyMapper.del(app, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据是否启用获取代理流列表
|
|
||||||
* @param enable
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable) {
|
|
||||||
return streamProxyMapper.selectForEnable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询代理流列表
|
* 分页查询代理流列表
|
||||||
* @param page
|
* @param page
|
||||||
|
@ -514,106 +367,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int mediaOnline(String app, String stream) {
|
|
||||||
GbStream gbStream = gbStreamMapper.selectOne(app, stream);
|
|
||||||
int result;
|
|
||||||
if ("proxy".equals(gbStream.getStreamType())) {
|
|
||||||
result = streamProxyMapper.updateStatus(app, stream, true);
|
|
||||||
}else {
|
|
||||||
result = streamPushMapper.updatePushStatus(app, stream, true);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateParentPlatformStatus(String platformGbID, boolean online) {
|
|
||||||
platformMapper.updateParentPlatformStatus(platformGbID, online);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable) {
|
public List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable) {
|
||||||
return streamProxyMapper.selectForEnableInMediaServer(id, enable);
|
return streamProxyMapper.selectForEnableInMediaServer(id, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Device queryVideoDeviceByChannelId( String channelId) {
|
|
||||||
Device result = null;
|
|
||||||
List<DeviceChannel> channelList = deviceChannelMapper.queryChannelByChannelId(channelId);
|
|
||||||
if (channelList.size() == 1) {
|
|
||||||
result = deviceMapper.getDeviceByDeviceId(channelList.get(0).getDeviceId());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId) {
|
public StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId) {
|
||||||
return streamProxyMapper.selectOne(app, streamId);
|
return streamProxyMapper.selectOne(app, streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId) {
|
|
||||||
return catalogMapper.selectByParentId(platformId, parentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int addCatalog(PlatformCatalog platformCatalog) {
|
|
||||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformCatalog.getPlatformId());
|
|
||||||
if (platform == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (platformCatalog.getId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
if (platformCatalog.getId().length() != 20) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (platformCatalog.getParentId() != null) {
|
|
||||||
switch (Integer.parseInt(platformCatalog.getId().substring(10, 13))){
|
|
||||||
case 200:
|
|
||||||
case 215:
|
|
||||||
if (platformCatalog.getParentId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
|
||||||
if (catalog != null) {
|
|
||||||
platformCatalog.setCivilCode(catalog.getCivilCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 216:
|
|
||||||
if (platformCatalog.getParentId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(),platformCatalog.getParentId());
|
|
||||||
if (catalog == null) {
|
|
||||||
logger.warn("[添加目录] 无法获取目录{}的CivilCode和BusinessGroupId", platformCatalog.getPlatformId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
platformCatalog.setCivilCode(catalog.getCivilCode());
|
|
||||||
if (Integer.parseInt(platformCatalog.getParentId().substring(10, 13)) == 215) {
|
|
||||||
platformCatalog.setBusinessGroupId(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
if (Integer.parseInt(platformCatalog.getParentId().substring(10, 13)) == 216) {
|
|
||||||
platformCatalog.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int result = catalogMapper.add(platformCatalog);
|
|
||||||
if (result > 0) {
|
|
||||||
DeviceChannel deviceChannel = getDeviceChannelByCatalog(platformCatalog);
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.ADD);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlatformCatalog getTopCatalog(String id, String platformId) {
|
private PlatformCatalog getTopCatalog(String id, String platformId) {
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
||||||
if (catalog.getParentId().equals(platformId)) {
|
if (catalog.getParentId().equals(platformId)) {
|
||||||
|
@ -623,90 +386,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlatformCatalog getCatalog(String platformId, String id) {
|
|
||||||
return catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int delCatalog(String platformId, String id) {
|
|
||||||
return delCatalogExecute(id, platformId);
|
|
||||||
}
|
|
||||||
private int delCatalogExecute(String id, String platformId) {
|
|
||||||
int delresult = catalogMapper.del(platformId, id);
|
|
||||||
DeviceChannel deviceChannelForCatalog = new DeviceChannel();
|
|
||||||
if (delresult > 0){
|
|
||||||
deviceChannelForCatalog.setChannelId(id);
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelForCatalog, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, id);
|
|
||||||
if (gbStreams.size() > 0){
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (GbStream gbStream : gbStreams) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
int delStreamresult = platformGbStreamMapper.delByPlatformAndCatalogId(platformId,id);
|
|
||||||
List<PlatformCatalog> platformCatalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, id);
|
|
||||||
if (platformCatalogs.size() > 0){
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (PlatformCatalog platformCatalog : platformCatalogs) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(platformCatalog.getId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
int delChannelresult = platformChannelMapper.delByCatalogId(platformId, id);
|
|
||||||
return delresult + delChannelresult + delStreamresult;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateCatalog(PlatformCatalog platformCatalog) {
|
|
||||||
int result = catalogMapper.update(platformCatalog);
|
|
||||||
if (result > 0) {
|
|
||||||
DeviceChannel deviceChannel = getDeviceChannelByCatalog(platformCatalog);
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.UPDATE);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int setDefaultCatalog(String platformId, String catalogId) {
|
|
||||||
return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeviceChannel> queryCatalogInPlatform(String platformId) {
|
|
||||||
return catalogMapper.queryCatalogInPlatform(platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int delRelation(PlatformCatalog platformCatalog) {
|
|
||||||
if (platformCatalog.getType() == 1) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(platformCatalog.getId());
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
|
||||||
return platformChannelMapper.delByCatalogIdAndChannelIdAndPlatformId(platformCatalog);
|
|
||||||
}else if (platformCatalog.getType() == 2) {
|
|
||||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
|
||||||
for (GbStream gbStream : gbStreams) {
|
|
||||||
if (gbStream.getGbId().equals(platformCatalog.getId())) {
|
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
|
||||||
return platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos) {
|
public int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos) {
|
||||||
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
||||||
|
@ -733,11 +412,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return deviceChannel;
|
return deviceChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId) {
|
|
||||||
return deviceChannelMapper.queryOnlineChannelsByDeviceId(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms) {
|
public List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms) {
|
||||||
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
|
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
|
||||||
|
@ -756,22 +430,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return gbStreamMapper.selectOne(app, streamId);
|
return gbStreamMapper.selectOne(app, streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delCatalogByPlatformId(String serverGBId) {
|
|
||||||
catalogMapper.delByPlatformId(serverGBId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delRelationByPlatformId(String serverGBId) {
|
|
||||||
platformGbStreamMapper.delByPlatformId(serverGBId);
|
|
||||||
platformChannelMapper.delByPlatformId(serverGBId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) {
|
|
||||||
return catalogMapper.selectDefaultByPlatFormId(platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) {
|
public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) {
|
||||||
return platformMapper.getChannelSource(platformId, gbId);
|
return platformMapper.getChannelSource(platformId, gbId);
|
||||||
|
@ -788,27 +446,4 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
|
|
||||||
deviceChannelMapper.updatePosition(deviceChannel);
|
deviceChannelMapper.updatePosition(deviceChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cleanContentForPlatform(String serverGBId) {
|
|
||||||
// List<PlatformCatalog> catalogList = catalogMapper.selectByPlatForm(serverGBId);
|
|
||||||
// if (catalogList.size() > 0) {
|
|
||||||
// int result = catalogMapper.delByPlatformId(serverGBId);
|
|
||||||
// if (result > 0) {
|
|
||||||
// List<DeviceChannel> deviceChannels = new ArrayList<>();
|
|
||||||
// for (PlatformCatalog catalog : catalogList) {
|
|
||||||
// deviceChannels.add(getDeviceChannelByCatalog(catalog));
|
|
||||||
// }
|
|
||||||
// eventPublisher.catalogEventPublish(serverGBId, deviceChannels, CatalogEvent.DEL);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
catalogMapper.delByPlatformId(serverGBId);
|
|
||||||
platformChannelMapper.delByPlatformId(serverGBId);
|
|
||||||
platformGbStreamMapper.delByPlatformId(serverGBId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeviceChannel> queryChannelWithCatalog(String serverGBId) {
|
|
||||||
return deviceChannelMapper.queryChannelWithCatalog(serverGBId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
|
||||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
|
||||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
|
||||||
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.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.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Tag(name = "视频流关联到级联平台")
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/gbStream")
|
|
||||||
public class GbStreamController {
|
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(GbStreamController.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IGbStreamService gbStreamService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询国标通道
|
|
||||||
* @param page 当前页
|
|
||||||
* @param count 每页条数
|
|
||||||
* @param platformId 平台ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "查询国标通道")
|
|
||||||
@Parameter(name = "page", description = "当前页", required = true)
|
|
||||||
@Parameter(name = "count", description = "每页条数", required = true)
|
|
||||||
@Parameter(name = "platformId", description = "平台ID", required = true)
|
|
||||||
@Parameter(name = "catalogId", description = "目录ID")
|
|
||||||
@Parameter(name = "query", description = "查询内容")
|
|
||||||
@Parameter(name = "mediaServerId", description = "流媒体ID")
|
|
||||||
@GetMapping(value = "/list")
|
|
||||||
@ResponseBody
|
|
||||||
public PageInfo<GbStream> list(@RequestParam(required = true)Integer page,
|
|
||||||
@RequestParam(required = true)Integer count,
|
|
||||||
@RequestParam(required = true)String platformId,
|
|
||||||
@RequestParam(required = false)String catalogId,
|
|
||||||
@RequestParam(required = false)String query,
|
|
||||||
@RequestParam(required = false)String mediaServerId){
|
|
||||||
if (ObjectUtils.isEmpty(catalogId)) {
|
|
||||||
catalogId = null;
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(query)) {
|
|
||||||
query = null;
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(mediaServerId)) {
|
|
||||||
mediaServerId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// catalogId 为null 查询未在平台下分配的数据
|
|
||||||
// catalogId 不为null 查询平台下这个,目录下的通道
|
|
||||||
return gbStreamService.getAll(page, count, platformId, catalogId, query, mediaServerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除国标关联
|
|
||||||
* @param gbStreamParam
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "移除国标关联")
|
|
||||||
@DeleteMapping(value = "/del")
|
|
||||||
@ResponseBody
|
|
||||||
public void del(@RequestBody GbStreamParam gbStreamParam){
|
|
||||||
|
|
||||||
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
|
||||||
if (gbStreamParam.isAll()) {
|
|
||||||
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存国标关联
|
|
||||||
* @param gbStreamParam
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "保存国标关联")
|
|
||||||
@PostMapping(value = "/add")
|
|
||||||
@ResponseBody
|
|
||||||
public void add(@RequestBody GbStreamParam gbStreamParam){
|
|
||||||
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
|
||||||
if (gbStreamParam.isAll()) {
|
|
||||||
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
|
|
||||||
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存国标关联
|
|
||||||
* @param gbId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "保存国标关联")
|
|
||||||
@GetMapping(value = "/addWithGbid")
|
|
||||||
@ResponseBody
|
|
||||||
public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){
|
|
||||||
List<GbStream> gbStreams = gbStreamService.getGbChannelWithGbid(gbId);
|
|
||||||
if (gbStreams.isEmpty()) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "gbId的信息未找到");
|
|
||||||
}
|
|
||||||
gbStreamService.addPlatformInfo(gbStreams, platformGbId, catalogGbId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Schema(description = "国标关联参数")
|
|
||||||
public class GbStreamParam {
|
|
||||||
|
|
||||||
@Schema(description = "平台ID")
|
|
||||||
private String platformId;
|
|
||||||
|
|
||||||
@Schema(description = "目录ID")
|
|
||||||
private String catalogId;
|
|
||||||
|
|
||||||
@Schema(description = "关联所有通道")
|
|
||||||
private boolean all;
|
|
||||||
|
|
||||||
@Schema(description = "流国标信息列表")
|
|
||||||
private List<GbStream> gbStreams;
|
|
||||||
|
|
||||||
public String getPlatformId() {
|
|
||||||
return platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalogId() {
|
|
||||||
return catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalogId(String catalogId) {
|
|
||||||
this.catalogId = catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatformId(String platformId) {
|
|
||||||
this.platformId = platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<GbStream> getGbStreams() {
|
|
||||||
return gbStreams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGbStreams(List<GbStream> gbStreams) {
|
|
||||||
this.gbStreams = gbStreams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAll() {
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAll(boolean all) {
|
|
||||||
this.all = all;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -45,27 +45,15 @@ public class PlatformController {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
|
private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserSetting userSetting;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorage storager;
|
private IVideoManagerStorage storager;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscribeHolder subscribeHolder;
|
private SubscribeHolder subscribeHolder;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISIPCommanderForPlatform commanderForPlatform;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipConfig sipConfig;
|
private SipConfig sipConfig;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DynamicTask dynamicTask;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPlatformService platformService;
|
private IPlatformService platformService;
|
||||||
|
|
||||||
|
@ -215,43 +203,10 @@ public class PlatformController {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("删除上级平台API调用");
|
logger.debug("删除上级平台API调用");
|
||||||
}
|
}
|
||||||
if (ObjectUtils.isEmpty(serverGBId)
|
if (ObjectUtils.isEmpty(serverGBId)) {
|
||||||
) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR400);
|
throw new ControllerException(ErrorCode.ERROR400);
|
||||||
}
|
}
|
||||||
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
|
boolean deleteResult = platformService.delete(serverGBId);
|
||||||
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId);
|
|
||||||
if (parentPlatform == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
|
|
||||||
}
|
|
||||||
if (parentPlatformCatch == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
|
|
||||||
}
|
|
||||||
// 发送离线消息,无论是否成功都删除缓存
|
|
||||||
try {
|
|
||||||
commanderForPlatform.unregister(parentPlatform, parentPlatformCatch.getSipTransactionInfo(), (event -> {
|
|
||||||
// 清空redis缓存
|
|
||||||
redisCatchStorage.delPlatformCatchInfo(parentPlatform.getServerGBId());
|
|
||||||
redisCatchStorage.delPlatformKeepalive(parentPlatform.getServerGBId());
|
|
||||||
redisCatchStorage.delPlatformRegister(parentPlatform.getServerGBId());
|
|
||||||
}), (event -> {
|
|
||||||
// 清空redis缓存
|
|
||||||
redisCatchStorage.delPlatformCatchInfo(parentPlatform.getServerGBId());
|
|
||||||
redisCatchStorage.delPlatformKeepalive(parentPlatform.getServerGBId());
|
|
||||||
redisCatchStorage.delPlatformRegister(parentPlatform.getServerGBId());
|
|
||||||
}));
|
|
||||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
|
||||||
logger.error("[命令发送失败] 国标级联 注销: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
|
|
||||||
storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
|
|
||||||
storager.delRelationByPlatformId(parentPlatform.getServerGBId());
|
|
||||||
// 停止发送位置订阅定时任务
|
|
||||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
|
||||||
dynamicTask.stop(key);
|
|
||||||
// 删除缓存的订阅信息
|
|
||||||
subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
|
|
||||||
if (!deleteResult) {
|
if (!deleteResult) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 精简的channel信息展示,主要是选择通道的时候展示列表使用
|
|
||||||
*/
|
|
||||||
@Schema(description = "精简的channel信息展示")
|
|
||||||
public class ChannelReduce {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* deviceChannel的数据库自增ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "deviceChannel的数据库自增ID")
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通道id
|
|
||||||
*/
|
|
||||||
@Schema(description = "通道国标编号")
|
|
||||||
private String channelId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备id
|
|
||||||
*/
|
|
||||||
@Schema(description = "设备国标编号")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通道名
|
|
||||||
*/
|
|
||||||
@Schema(description = "通道名")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生产厂商
|
|
||||||
*/
|
|
||||||
@Schema(description = "生产厂商")
|
|
||||||
private String manufacturer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wan地址
|
|
||||||
*/
|
|
||||||
@Schema(description = "wan地址")
|
|
||||||
private String hostAddress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子节点数
|
|
||||||
*/
|
|
||||||
@Schema(description = "子节点数")
|
|
||||||
private int subCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台Id
|
|
||||||
*/
|
|
||||||
@Schema(description = "平台上级国标编号")
|
|
||||||
private String platformId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 目录Id
|
|
||||||
*/
|
|
||||||
@Schema(description = "目录国标编号")
|
|
||||||
private String catalogId;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChannelId() {
|
|
||||||
return channelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChannelId(String channelId) {
|
|
||||||
this.channelId = channelId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceId() {
|
|
||||||
return deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceId(String deviceId) {
|
|
||||||
this.deviceId = deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getManufacturer() {
|
|
||||||
return manufacturer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManufacturer(String manufacturer) {
|
|
||||||
this.manufacturer = manufacturer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHostAddress() {
|
|
||||||
return hostAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostAddress(String hostAddress) {
|
|
||||||
this.hostAddress = hostAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubCount() {
|
|
||||||
return subCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubCount(int subCount) {
|
|
||||||
this.subCount = subCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.streamPush;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.ExcelReader;
|
import com.alibaba.excel.ExcelReader;
|
||||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
|
@ -17,6 +18,7 @@ import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.streamPush.bean.StreamPushWithCommonChannelParam;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
@ -59,8 +61,6 @@ public class StreamPushController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaService mediaService;
|
private IMediaService mediaService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserSetting userSetting;
|
|
||||||
|
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -86,23 +86,11 @@ public class StreamPushController {
|
||||||
return pushList;
|
return pushList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/save_to_gb")
|
@PostMapping(value = "/save")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@Operation(summary = "将推流添加到国标")
|
@Operation(summary = "将推流添加到资源")
|
||||||
public void saveToGB(@RequestBody GbStream stream){
|
public void saveToCommonChannel(@RequestBody StreamPushWithCommonChannelParam param){
|
||||||
if (!streamPushService.saveToGB(stream)){
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping(value = "/remove_form_gb")
|
|
||||||
@ResponseBody
|
|
||||||
@Operation(summary = "将推流移出到国标")
|
|
||||||
public void removeFormGB(@RequestBody GbStream stream){
|
|
||||||
if (!streamPushService.removeFromGB(stream)){
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,24 +244,19 @@ public class StreamPushController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加推流信息
|
* 添加推流信息
|
||||||
* @param stream 推流信息
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@Operation(summary = "添加推流信息")
|
@Operation(summary = "添加推流信息")
|
||||||
public void add(@RequestBody StreamPushItem stream){
|
public void add(@RequestBody StreamPushWithCommonChannelParam param){
|
||||||
if (ObjectUtils.isEmpty(stream.getGbId())) {
|
if (ObjectUtils.isEmpty(param.getApp()) && ObjectUtils.isEmpty(param.getStream())) {
|
||||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), "国标ID不可为空");
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(stream.getApp()) && ObjectUtils.isEmpty(stream.getStream())) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), "app或stream不可为空");
|
throw new ControllerException(ErrorCode.ERROR400.getCode(), "app或stream不可为空");
|
||||||
}
|
}
|
||||||
stream.setStatus(false);
|
StreamPushItem streamPushItem = new StreamPushItem();
|
||||||
stream.setPushIng(false);
|
streamPushItem.setApp(param.getApp());
|
||||||
stream.setAliveSecond(0L);
|
streamPushItem.setStream(param.getStream());
|
||||||
stream.setTotalReaderCount("0");
|
|
||||||
if (!streamPushService.add(stream)) {
|
if (!streamPushService.add(streamPushItem, param)) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.genersoft.iot.vmp.vmanager.streamPush.bean;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推流信息加入资源库参数
|
||||||
|
*/
|
||||||
|
public class StreamPushWithCommonChannelParam extends CommonGbChannel {
|
||||||
|
|
||||||
|
private Integer pushId;
|
||||||
|
|
||||||
|
private String app;
|
||||||
|
|
||||||
|
private String stream;
|
||||||
|
|
||||||
|
public Integer getPushId() {
|
||||||
|
return pushId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPushId(Integer pushId) {
|
||||||
|
this.pushId = pushId;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue