Merge branch 'master' into 重构/1078

This commit is contained in:
lin
2025-03-24 15:19:07 +08:00
39 changed files with 1382 additions and 1379 deletions

View File

@@ -1,5 +0,0 @@
package com.genersoft.iot.vmp.common;
public interface GeneralCallback<T>{
void run(int code, String msg, T data);
}

View File

@@ -1,4 +1,4 @@
package com.genersoft.iot.vmp.gb28181.bean;
package com.genersoft.iot.vmp.common;
public class RemoteAddressInfo {
private String ip;

View File

@@ -34,5 +34,5 @@ public class SipConfig {
private boolean alarm = false;
private long timeout = 150;
private long timeout = 500;
}

View File

@@ -190,5 +190,11 @@ public class UserSetting {
*/
private boolean autoRegisterPlatform = false;
/**
* 按需发送推流设备位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送
*/
private boolean sendPositionOnDemand = true;
}

View File

@@ -86,6 +86,18 @@ public class CommonGBChannel {
@Schema(description = "国标-纬度 WGS-84坐标系")
private Double gbLatitude;
@Schema(description = "")
private Double gpsAltitude;
@Schema(description = "")
private Double gpsSpeed;
@Schema(description = "")
private Double gpsDirection;
@Schema(description = "")
private String gpsTime;
@Schema(description = "国标-虚拟组织所属的业务分组ID")
private String gbBusinessGroupId;

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@@ -451,13 +452,18 @@ public interface CommonGBChannelMapper {
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
@Update(value = {" <script>" +
" <foreach collection='channels' item='item' separator=';' >" +
" <foreach collection='gpsMsgInfoList' item='item' separator=';' >" +
" UPDATE wvp_device_channel " +
" SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude} " +
" WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId} "+
" SET gb_longitude=#{item.lng}" +
", gb_latitude=#{item.lat} " +
", gps_speed=#{item.speed} " +
", gps_altitude=#{item.altitude} " +
", gps_direction=#{item.direction} " +
", gps_time=#{item.time} " +
" WHERE gb_device_id=#{item.id} "+
"</foreach>"+
" </script>"})
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
void updateGpsByDeviceId(List<GPSMsgInfo> gpsMsgInfoList);
@SelectProvider(type = ChannelProvider.class, method = "queryList")
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,

View File

@@ -262,6 +262,10 @@ public interface PlatformChannelMapper {
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" wdc.gps_altitude,\n" +
" wdc.gps_speed,\n" +
" wdc.gps_direction,\n" +
" wdc.gps_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +

View File

@@ -373,7 +373,7 @@ public class ChannelProvider {
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL);
sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
Collection<StreamPush> ids = (Collection<StreamPush>)params.get("streamPushList");
boolean first = true;
for (StreamPush streamPush : ids) {

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import com.github.pagehelper.PageInfo;
@@ -84,8 +85,6 @@ public interface IGbChannelService {
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
@@ -97,4 +96,7 @@ public interface IGbChannelService {
PageInfo<CommonGBChannel> queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType);
void clearChannelParent(Boolean all, List<Integer> channelIds);
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
}

View File

@@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@@ -715,11 +716,6 @@ public class GbChannelServiceImpl implements IGbChannelService {
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList);
}
@Override
public void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels) {
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(ChannelDataType.STREAM_PUSH.value, channels);
}
@Override
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
PageHelper.startPage(page, count);
@@ -797,4 +793,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear);
}
@Override
public void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList) {
if (gpsMsgInfoList == null || gpsMsgInfoList.isEmpty()) {
return;
}
commonGBChannelMapper.updateGpsByDeviceId(gpsMsgInfoList);
}
}

View File

@@ -559,12 +559,26 @@ public class PlatformServiceImpl implements IPlatformService {
}
for (CommonGBChannel channel : channelList) {
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId());
// 无最新位置则发送当前位置
if (gpsMsgInfo != null && (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0)) {
gpsMsgInfo = null;
}
if (gpsMsgInfo == null && !userSetting.isSendPositionOnDemand()){
gpsMsgInfo = new GPSMsgInfo();
gpsMsgInfo.setId(channel.getGbDeviceId());
gpsMsgInfo.setLng(channel.getGbLongitude());
gpsMsgInfo.setLat(channel.getGbLatitude());
gpsMsgInfo.setAltitude(channel.getGpsAltitude());
gpsMsgInfo.setSpeed(channel.getGpsSpeed());
gpsMsgInfo.setDirection(channel.getGpsDirection());
gpsMsgInfo.setTime(channel.getGpsTime());
}
// 无最新位置不发送
if (gpsMsgInfo != null) {
// 经纬度都为0不发送
if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
continue;
}
// 发送GPS消息
try {
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe);

View File

@@ -84,18 +84,16 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
// Success
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
if (status != Response.UNAUTHORIZED && responseEvent.getResponse() != null && !sipSubscribe.isEmpty() ) {
CallIdHeader callIdHeader = response.getCallIdHeader();
CSeqHeader cSeqHeader = response.getCSeqHeader();
if (callIdHeader != null) {
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
if (sipEvent != null) {
if (sipEvent.getOkEvent() != null) {
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
sipEvent.getOkEvent().response(eventResult);
}
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
CallIdHeader callIdHeader = response.getCallIdHeader();
CSeqHeader cSeqHeader = response.getCSeqHeader();
if (callIdHeader != null) {
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
if (sipEvent != null) {
if (sipEvent.getOkEvent() != null) {
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
sipEvent.getOkEvent().response(eventResult);
}
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
}
}
ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(response.getCSeqHeader().getMethod());

View File

@@ -136,7 +136,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
if (errorEvent != null ) {
errorEvent.response(event);
}
}, okEvent, 5L);
}, okEvent, 2000L);
}
@Override
@@ -369,7 +369,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
.append("<CmdType>MobilePosition</CmdType>\r\n")
.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n")
.append("<DeviceID>" + channel.getGbDeviceId() + "</DeviceID>\r\n")
.append("<Time>" + gpsMsgInfo.getTime() + "</Time>\r\n")
.append("<Time>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(gpsMsgInfo.getTime()) + "</Time>\r\n")
.append("<Longitude>" + gpsMsgInfo.getLng() + "</Longitude>\r\n")
.append("<Latitude>" + gpsMsgInfo.getLat() + "</Latitude>\r\n")
.append("<Speed>" + gpsMsgInfo.getSpeed() + "</Speed>\r\n")

View File

@@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.GbSipDate;
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
import com.genersoft.iot.vmp.common.RemoteAddressInfo;
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;

View File

@@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
import com.genersoft.iot.vmp.common.RemoteAddressInfo;
import com.genersoft.iot.vmp.gb28181.bean.SipMsgInfo;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;

View File

@@ -78,7 +78,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
String channelId = getText(rootElementAfterCharset, "DeviceID");
DeviceChannel deviceChannel = deviceChannelService.getOne(device.getDeviceId(), channelId);
if (deviceChannel == null) {
log.warn("[解析报警消息] 未找到通道:{}/{}", device.getDeviceId(), channelId);
log.warn("[解析移动位置通知] 未找到通道:{}/{}", device.getDeviceId(), channelId);
continue;
}

View File

@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.gb28181.utils;
import com.genersoft.iot.vmp.gb28181.bean.Gb28181Sdp;
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
import com.genersoft.iot.vmp.common.RemoteAddressInfo;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.utils.GitUtil;
import gov.nist.javax.sip.address.AddressImpl;

View File

@@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.media.bean;
import com.genersoft.iot.vmp.media.zlm.dto.ZLMServerConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.util.ObjectUtils;
@Schema(description = "流媒体服务信息")
@Data
public class MediaServer {
@Schema(description = "ID")
@@ -135,268 +137,4 @@ public class MediaServer {
transcodeSuffix = zlmServerConfig.getTranscodeSuffix();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getHookIp() {
return hookIp;
}
public void setHookIp(String hookIp) {
this.hookIp = hookIp;
}
public String getSdpIp() {
return sdpIp;
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
public String getStreamIp() {
return streamIp;
}
public void setStreamIp(String streamIp) {
this.streamIp = streamIp;
}
public int getHttpPort() {
return httpPort;
}
public void setHttpPort(int httpPort) {
this.httpPort = httpPort;
}
public int getHttpSSlPort() {
return httpSSlPort;
}
public void setHttpSSlPort(int httpSSlPort) {
this.httpSSlPort = httpSSlPort;
}
public int getRtmpPort() {
return rtmpPort;
}
public void setRtmpPort(int rtmpPort) {
this.rtmpPort = rtmpPort;
}
public int getRtmpSSlPort() {
return rtmpSSlPort;
}
public void setRtmpSSlPort(int rtmpSSlPort) {
this.rtmpSSlPort = rtmpSSlPort;
}
public int getRtpProxyPort() {
return rtpProxyPort;
}
public void setRtpProxyPort(int rtpProxyPort) {
this.rtpProxyPort = rtpProxyPort;
}
public int getRtspPort() {
return rtspPort;
}
public void setRtspPort(int rtspPort) {
this.rtspPort = rtspPort;
}
public int getRtspSSLPort() {
return rtspSSLPort;
}
public void setRtspSSLPort(int rtspSSLPort) {
this.rtspSSLPort = rtspSSLPort;
}
public boolean isAutoConfig() {
return autoConfig;
}
public void setAutoConfig(boolean autoConfig) {
this.autoConfig = autoConfig;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public boolean isRtpEnable() {
return rtpEnable;
}
public void setRtpEnable(boolean rtpEnable) {
this.rtpEnable = rtpEnable;
}
public String getRtpPortRange() {
return rtpPortRange;
}
public void setRtpPortRange(String rtpPortRange) {
this.rtpPortRange = rtpPortRange;
}
public int getRecordAssistPort() {
return recordAssistPort;
}
public void setRecordAssistPort(int recordAssistPort) {
this.recordAssistPort = recordAssistPort;
}
public boolean isDefaultServer() {
return defaultServer;
}
public void setDefaultServer(boolean defaultServer) {
this.defaultServer = defaultServer;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public String getLastKeepaliveTime() {
return lastKeepaliveTime;
}
public void setLastKeepaliveTime(String lastKeepaliveTime) {
this.lastKeepaliveTime = lastKeepaliveTime;
}
public Float getHookAliveInterval() {
return hookAliveInterval;
}
public void setHookAliveInterval(Float hookAliveInterval) {
this.hookAliveInterval = hookAliveInterval;
}
public String getSendRtpPortRange() {
return sendRtpPortRange;
}
public void setSendRtpPortRange(String sendRtpPortRange) {
this.sendRtpPortRange = sendRtpPortRange;
}
public int getRecordDay() {
return recordDay;
}
public void setRecordDay(int recordDay) {
this.recordDay = recordDay;
}
public String getRecordPath() {
return recordPath;
}
public void setRecordPath(String recordPath) {
this.recordPath = recordPath;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getFlvPort() {
return flvPort;
}
public void setFlvPort(int flvPort) {
this.flvPort = flvPort;
}
public int getFlvSSLPort() {
return flvSSLPort;
}
public void setFlvSSLPort(int flvSSLPort) {
this.flvSSLPort = flvSSLPort;
}
public int getWsFlvPort() {
return wsFlvPort;
}
public void setWsFlvPort(int wsFlvPort) {
this.wsFlvPort = wsFlvPort;
}
public int getWsFlvSSLPort() {
return wsFlvSSLPort;
}
public void setWsFlvSSLPort(int wsFlvSSLPort) {
this.wsFlvSSLPort = wsFlvSSLPort;
}
public String getTranscodeSuffix() {
return transcodeSuffix;
}
public void setTranscodeSuffix(String transcodeSuffix) {
this.transcodeSuffix = transcodeSuffix;
}
public String getServerId() {
return serverId;
}
public void setServerId(String serverId) {
this.serverId = serverId;
}
}

View File

@@ -794,7 +794,11 @@ public class MediaServerServiceImpl implements IMediaServerService {
if (streamInfoList == null || streamInfoList.isEmpty()) {
return null;
}else {
return streamInfoList.get(0);
StreamInfo streamInfo = streamInfoList.get(0);
if (addr != null && !addr.isEmpty()) {
streamInfo.changeStreamIp(addr);
}
return streamInfo;
}
}

View File

@@ -177,6 +177,9 @@ public class ZLMHttpHookListener {
ret.put("code", 0);
return ret;
}
if (mediaInfo.getTranscodeSuffix() != null && param.getStream().endsWith(mediaInfo.getTranscodeSuffix())) {
param.setStream(param.getStream().substring(0, param.getStream().lastIndexOf(mediaInfo.getTranscodeSuffix()) - 1));
}
if (!ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix())
&& !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())
&& param.getStream().endsWith(mediaInfo.getTranscodeSuffix()) ) {

View File

@@ -186,7 +186,6 @@ public class ZLMMediaServerStatusManager {
log.info("[ZLM-连接成功] ID{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort());
mediaServerItem.setStatus(true);
mediaServerItem.setHookAliveInterval(10F);
mediaServerService.update(mediaServerItem);
// 发送上线通知
eventPublisher.mediaServerOnlineEventPublish(mediaServerItem);
if(mediaServerItem.isAutoConfig()) {
@@ -243,6 +242,11 @@ public class ZLMMediaServerStatusManager {
if (mediaServerItem.getWsFlvSSLPort() == 0) {
mediaServerItem.setWsFlvSSLPort(zlmServerConfig.getHttpSSLport());
}
if (Objects.isNull(zlmServerConfig.getTranscodeSuffix())) {
mediaServerItem.setTranscodeSuffix(null);
}else {
mediaServerItem.setTranscodeSuffix(zlmServerConfig.getTranscodeSuffix());
}
mediaServerItem.setHookAliveInterval(10F);
}

View File

@@ -2,7 +2,11 @@ package com.genersoft.iot.vmp.media.zlm.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class ZLMServerConfig extends HookParam {
@JSONField(name = "api.apiDebug")
@@ -334,892 +338,4 @@ public class ZLMServerConfig extends HookParam {
@JSONField(name = "transcode.suffix")
private String transcodeSuffix;
public String getHookIp() {
return hookIp;
}
public void setHookIp(String hookIp) {
this.hookIp = hookIp;
}
public String getApiDebug() {
return apiDebug;
}
public void setApiDebug(String apiDebug) {
this.apiDebug = apiDebug;
}
public String getApiSecret() {
return apiSecret;
}
public void setApiSecret(String apiSecret) {
this.apiSecret = apiSecret;
}
public String getFfmpegBin() {
return ffmpegBin;
}
public void setFfmpegBin(String ffmpegBin) {
this.ffmpegBin = ffmpegBin;
}
public String getFfmpegCmd() {
return ffmpegCmd;
}
public void setFfmpegCmd(String ffmpegCmd) {
this.ffmpegCmd = ffmpegCmd;
}
public String getFfmpegLog() {
return ffmpegLog;
}
public void setFfmpegLog(String ffmpegLog) {
this.ffmpegLog = ffmpegLog;
}
public String getGeneralEnableVhost() {
return generalEnableVhost;
}
public void setGeneralEnableVhost(String generalEnableVhost) {
this.generalEnableVhost = generalEnableVhost;
}
public String getGeneralMediaServerId() {
return generalMediaServerId;
}
public void setGeneralMediaServerId(String generalMediaServerId) {
this.generalMediaServerId = generalMediaServerId;
}
public String getGeneralFlowThreshold() {
return generalFlowThreshold;
}
public void setGeneralFlowThreshold(String generalFlowThreshold) {
this.generalFlowThreshold = generalFlowThreshold;
}
public String getGeneralMaxStreamWaitMS() {
return generalMaxStreamWaitMS;
}
public void setGeneralMaxStreamWaitMS(String generalMaxStreamWaitMS) {
this.generalMaxStreamWaitMS = generalMaxStreamWaitMS;
}
public int getGeneralStreamNoneReaderDelayMS() {
return generalStreamNoneReaderDelayMS;
}
public void setGeneralStreamNoneReaderDelayMS(int generalStreamNoneReaderDelayMS) {
this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getSdpIp() {
return sdpIp;
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
public String getStreamIp() {
return streamIp;
}
public void setStreamIp(String streamIp) {
this.streamIp = streamIp;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getHlsFileBufSize() {
return hlsFileBufSize;
}
public void setHlsFileBufSize(String hlsFileBufSize) {
this.hlsFileBufSize = hlsFileBufSize;
}
public String getHlsFilePath() {
return hlsFilePath;
}
public void setHlsFilePath(String hlsFilePath) {
this.hlsFilePath = hlsFilePath;
}
public String getHlsSegDur() {
return hlsSegDur;
}
public void setHlsSegDur(String hlsSegDur) {
this.hlsSegDur = hlsSegDur;
}
public String getHlsSegNum() {
return hlsSegNum;
}
public void setHlsSegNum(String hlsSegNum) {
this.hlsSegNum = hlsSegNum;
}
public String getHookAccessFileExceptHLS() {
return hookAccessFileExceptHLS;
}
public void setHookAccessFileExceptHLS(String hookAccessFileExceptHLS) {
this.hookAccessFileExceptHLS = hookAccessFileExceptHLS;
}
public String getHookAdminParams() {
return hookAdminParams;
}
public void setHookAdminParams(String hookAdminParams) {
this.hookAdminParams = hookAdminParams;
}
public String getHookEnable() {
return hookEnable;
}
public void setHookEnable(String hookEnable) {
this.hookEnable = hookEnable;
}
public String getHookOnFlowReport() {
return hookOnFlowReport;
}
public void setHookOnFlowReport(String hookOnFlowReport) {
this.hookOnFlowReport = hookOnFlowReport;
}
public String getHookOnHttpAccess() {
return hookOnHttpAccess;
}
public void setHookOnHttpAccess(String hookOnHttpAccess) {
this.hookOnHttpAccess = hookOnHttpAccess;
}
public String getHookOnPlay() {
return hookOnPlay;
}
public void setHookOnPlay(String hookOnPlay) {
this.hookOnPlay = hookOnPlay;
}
public String getHookOnPublish() {
return hookOnPublish;
}
public void setHookOnPublish(String hookOnPublish) {
this.hookOnPublish = hookOnPublish;
}
public String getHookOnRecordMp4() {
return hookOnRecordMp4;
}
public void setHookOnRecordMp4(String hookOnRecordMp4) {
this.hookOnRecordMp4 = hookOnRecordMp4;
}
public String getHookOnRtspAuth() {
return hookOnRtspAuth;
}
public void setHookOnRtspAuth(String hookOnRtspAuth) {
this.hookOnRtspAuth = hookOnRtspAuth;
}
public String getHookOnRtspRealm() {
return hookOnRtspRealm;
}
public void setHookOnRtspRealm(String hookOnRtspRealm) {
this.hookOnRtspRealm = hookOnRtspRealm;
}
public String getHookOnShellLogin() {
return hookOnShellLogin;
}
public void setHookOnShellLogin(String hookOnShellLogin) {
this.hookOnShellLogin = hookOnShellLogin;
}
public String getHookOnStreamChanged() {
return hookOnStreamChanged;
}
public void setHookOnStreamChanged(String hookOnStreamChanged) {
this.hookOnStreamChanged = hookOnStreamChanged;
}
public String getHookOnStreamNoneReader() {
return hookOnStreamNoneReader;
}
public void setHookOnStreamNoneReader(String hookOnStreamNoneReader) {
this.hookOnStreamNoneReader = hookOnStreamNoneReader;
}
public String getHookOnStreamNotFound() {
return hookOnStreamNotFound;
}
public void setHookOnStreamNotFound(String hookOnStreamNotFound) {
this.hookOnStreamNotFound = hookOnStreamNotFound;
}
public String getHookTimeoutSec() {
return hookTimeoutSec;
}
public void setHookTimeoutSec(String hookTimeoutSec) {
this.hookTimeoutSec = hookTimeoutSec;
}
public String getHttpCharSet() {
return httpCharSet;
}
public void setHttpCharSet(String httpCharSet) {
this.httpCharSet = httpCharSet;
}
public String getHttpKeepAliveSecond() {
return httpKeepAliveSecond;
}
public void setHttpKeepAliveSecond(String httpKeepAliveSecond) {
this.httpKeepAliveSecond = httpKeepAliveSecond;
}
public String getHttpMaxReqCount() {
return httpMaxReqCount;
}
public void setHttpMaxReqCount(String httpMaxReqCount) {
this.httpMaxReqCount = httpMaxReqCount;
}
public String getHttpMaxReqSize() {
return httpMaxReqSize;
}
public void setHttpMaxReqSize(String httpMaxReqSize) {
this.httpMaxReqSize = httpMaxReqSize;
}
public String getHttpNotFound() {
return httpNotFound;
}
public void setHttpNotFound(String httpNotFound) {
this.httpNotFound = httpNotFound;
}
public int getHttpPort() {
return httpPort;
}
public void setHttpPort(int httpPort) {
this.httpPort = httpPort;
}
public String getHttpRootPath() {
return httpRootPath;
}
public void setHttpRootPath(String httpRootPath) {
this.httpRootPath = httpRootPath;
}
public String getHttpSendBufSize() {
return httpSendBufSize;
}
public void setHttpSendBufSize(String httpSendBufSize) {
this.httpSendBufSize = httpSendBufSize;
}
public int getHttpSSLport() {
return httpSSLport;
}
public void setHttpSSLport(int httpSSLport) {
this.httpSSLport = httpSSLport;
}
public String getMulticastAddrMax() {
return multicastAddrMax;
}
public void setMulticastAddrMax(String multicastAddrMax) {
this.multicastAddrMax = multicastAddrMax;
}
public String getMulticastAddrMin() {
return multicastAddrMin;
}
public void setMulticastAddrMin(String multicastAddrMin) {
this.multicastAddrMin = multicastAddrMin;
}
public String getMulticastUdpTTL() {
return multicastUdpTTL;
}
public void setMulticastUdpTTL(String multicastUdpTTL) {
this.multicastUdpTTL = multicastUdpTTL;
}
public String getRecordAppName() {
return recordAppName;
}
public void setRecordAppName(String recordAppName) {
this.recordAppName = recordAppName;
}
public String getRecordFilePath() {
return recordFilePath;
}
public void setRecordFilePath(String recordFilePath) {
this.recordFilePath = recordFilePath;
}
public String getRecordFileSecond() {
return recordFileSecond;
}
public void setRecordFileSecond(String recordFileSecond) {
this.recordFileSecond = recordFileSecond;
}
public String getRecordFileSampleMS() {
return recordFileSampleMS;
}
public void setRecordFileSampleMS(String recordFileSampleMS) {
this.recordFileSampleMS = recordFileSampleMS;
}
public String getRtmpHandshakeSecond() {
return rtmpHandshakeSecond;
}
public void setRtmpHandshakeSecond(String rtmpHandshakeSecond) {
this.rtmpHandshakeSecond = rtmpHandshakeSecond;
}
public String getRtmpKeepAliveSecond() {
return rtmpKeepAliveSecond;
}
public void setRtmpKeepAliveSecond(String rtmpKeepAliveSecond) {
this.rtmpKeepAliveSecond = rtmpKeepAliveSecond;
}
public String getRtmpModifyStamp() {
return rtmpModifyStamp;
}
public void setRtmpModifyStamp(String rtmpModifyStamp) {
this.rtmpModifyStamp = rtmpModifyStamp;
}
public int getRtmpPort() {
return rtmpPort;
}
public void setRtmpPort(int rtmpPort) {
this.rtmpPort = rtmpPort;
}
public int getRtmpSslPort() {
return rtmpSslPort;
}
public void setRtmpSslPort(int rtmpSslPort) {
this.rtmpSslPort = rtmpSslPort;
}
public String getRtpAudioMtuSize() {
return rtpAudioMtuSize;
}
public void setRtpAudioMtuSize(String rtpAudioMtuSize) {
this.rtpAudioMtuSize = rtpAudioMtuSize;
}
public String getRtpClearCount() {
return rtpClearCount;
}
public void setRtpClearCount(String rtpClearCount) {
this.rtpClearCount = rtpClearCount;
}
public String getRtpCycleMS() {
return rtpCycleMS;
}
public void setRtpCycleMS(String rtpCycleMS) {
this.rtpCycleMS = rtpCycleMS;
}
public String getRtpMaxRtpCount() {
return rtpMaxRtpCount;
}
public void setRtpMaxRtpCount(String rtpMaxRtpCount) {
this.rtpMaxRtpCount = rtpMaxRtpCount;
}
public String getRtpVideoMtuSize() {
return rtpVideoMtuSize;
}
public void setRtpVideoMtuSize(String rtpVideoMtuSize) {
this.rtpVideoMtuSize = rtpVideoMtuSize;
}
public String getRtpProxyCheckSource() {
return rtpProxyCheckSource;
}
public void setRtpProxyCheckSource(String rtpProxyCheckSource) {
this.rtpProxyCheckSource = rtpProxyCheckSource;
}
public String getRtpProxyDumpDir() {
return rtpProxyDumpDir;
}
public void setRtpProxyDumpDir(String rtpProxyDumpDir) {
this.rtpProxyDumpDir = rtpProxyDumpDir;
}
public int getRtpProxyPort() {
return rtpProxyPort;
}
public void setRtpProxyPort(int rtpProxyPort) {
this.rtpProxyPort = rtpProxyPort;
}
public String getRtpProxyTimeoutSec() {
return rtpProxyTimeoutSec;
}
public void setRtpProxyTimeoutSec(String rtpProxyTimeoutSec) {
this.rtpProxyTimeoutSec = rtpProxyTimeoutSec;
}
public String getRtspAuthBasic() {
return rtspAuthBasic;
}
public void setRtspAuthBasic(String rtspAuthBasic) {
this.rtspAuthBasic = rtspAuthBasic;
}
public String getRtspHandshakeSecond() {
return rtspHandshakeSecond;
}
public void setRtspHandshakeSecond(String rtspHandshakeSecond) {
this.rtspHandshakeSecond = rtspHandshakeSecond;
}
public String getRtspKeepAliveSecond() {
return rtspKeepAliveSecond;
}
public void setRtspKeepAliveSecond(String rtspKeepAliveSecond) {
this.rtspKeepAliveSecond = rtspKeepAliveSecond;
}
public int getRtspPort() {
return rtspPort;
}
public void setRtspPort(int rtspPort) {
this.rtspPort = rtspPort;
}
public int getRtspSSlport() {
return rtspSSlport;
}
public void setRtspSSlport(int rtspSSlport) {
this.rtspSSlport = rtspSSlport;
}
public String getShellMaxReqSize() {
return shellMaxReqSize;
}
public void setShellMaxReqSize(String shellMaxReqSize) {
this.shellMaxReqSize = shellMaxReqSize;
}
public String getShellPhell() {
return shellPhell;
}
public void setShellPhell(String shellPhell) {
this.shellPhell = shellPhell;
}
public Float getHookAliveInterval() {
return hookAliveInterval;
}
public void setHookAliveInterval(Float hookAliveInterval) {
this.hookAliveInterval = hookAliveInterval;
}
public String getPortRange() {
return portRange;
}
public void setPortRange(String portRange) {
this.portRange = portRange;
}
public String getApiSnapRoot() {
return apiSnapRoot;
}
public void setApiSnapRoot(String apiSnapRoot) {
this.apiSnapRoot = apiSnapRoot;
}
public String getApiDefaultSnap() {
return apiDefaultSnap;
}
public void setApiDefaultSnap(String apiDefaultSnap) {
this.apiDefaultSnap = apiDefaultSnap;
}
public String getFfmpegSnap() {
return ffmpegSnap;
}
public void setFfmpegSnap(String ffmpegSnap) {
this.ffmpegSnap = ffmpegSnap;
}
public String getFfmpegRestartSec() {
return ffmpegRestartSec;
}
public void setFfmpegRestartSec(String ffmpegRestartSec) {
this.ffmpegRestartSec = ffmpegRestartSec;
}
public String getProtocolModifyStamp() {
return protocolModifyStamp;
}
public void setProtocolModifyStamp(String protocolModifyStamp) {
this.protocolModifyStamp = protocolModifyStamp;
}
public String getProtocolEnableAudio() {
return protocolEnableAudio;
}
public void setProtocolEnableAudio(String protocolEnableAudio) {
this.protocolEnableAudio = protocolEnableAudio;
}
public String getProtocolAddMuteAudio() {
return protocolAddMuteAudio;
}
public void setProtocolAddMuteAudio(String protocolAddMuteAudio) {
this.protocolAddMuteAudio = protocolAddMuteAudio;
}
public String getProtocolContinuePushMs() {
return protocolContinuePushMs;
}
public void setProtocolContinuePushMs(String protocolContinuePushMs) {
this.protocolContinuePushMs = protocolContinuePushMs;
}
public String getProtocolEnableHls() {
return protocolEnableHls;
}
public void setProtocolEnableHls(String protocolEnableHls) {
this.protocolEnableHls = protocolEnableHls;
}
public String getProtocolEnableMp4() {
return protocolEnableMp4;
}
public void setProtocolEnableMp4(String protocolEnableMp4) {
this.protocolEnableMp4 = protocolEnableMp4;
}
public String getProtocolEnableRtsp() {
return protocolEnableRtsp;
}
public void setProtocolEnableRtsp(String protocolEnableRtsp) {
this.protocolEnableRtsp = protocolEnableRtsp;
}
public String getProtocolEnableRtmp() {
return protocolEnableRtmp;
}
public void setProtocolEnableRtmp(String protocolEnableRtmp) {
this.protocolEnableRtmp = protocolEnableRtmp;
}
public String getProtocolEnableTs() {
return protocolEnableTs;
}
public void setProtocolEnableTs(String protocolEnableTs) {
this.protocolEnableTs = protocolEnableTs;
}
public String getProtocolEnableFmp4() {
return protocolEnableFmp4;
}
public void setProtocolEnableFmp4(String protocolEnableFmp4) {
this.protocolEnableFmp4 = protocolEnableFmp4;
}
public String getProtocolMp4AsPlayer() {
return protocolMp4AsPlayer;
}
public void setProtocolMp4AsPlayer(String protocolMp4AsPlayer) {
this.protocolMp4AsPlayer = protocolMp4AsPlayer;
}
public String getProtocolMp4MaxSecond() {
return protocolMp4MaxSecond;
}
public void setProtocolMp4MaxSecond(String protocolMp4MaxSecond) {
this.protocolMp4MaxSecond = protocolMp4MaxSecond;
}
public String getProtocolMp4SavePath() {
return protocolMp4SavePath;
}
public void setProtocolMp4SavePath(String protocolMp4SavePath) {
this.protocolMp4SavePath = protocolMp4SavePath;
}
public String getProtocolHlsSavePath() {
return protocolHlsSavePath;
}
public void setProtocolHlsSavePath(String protocolHlsSavePath) {
this.protocolHlsSavePath = protocolHlsSavePath;
}
public String getProtocolHlsDemand() {
return protocolHlsDemand;
}
public void setProtocolHlsDemand(String protocolHlsDemand) {
this.protocolHlsDemand = protocolHlsDemand;
}
public String getProtocolRtspDemand() {
return protocolRtspDemand;
}
public void setProtocolRtspDemand(String protocolRtspDemand) {
this.protocolRtspDemand = protocolRtspDemand;
}
public String getProtocolRtmpDemand() {
return protocolRtmpDemand;
}
public void setProtocolRtmpDemand(String protocolRtmpDemand) {
this.protocolRtmpDemand = protocolRtmpDemand;
}
public String getProtocolTsDemand() {
return protocolTsDemand;
}
public void setProtocolTsDemand(String protocolTsDemand) {
this.protocolTsDemand = protocolTsDemand;
}
public String getProtocolFmp4Demand() {
return protocolFmp4Demand;
}
public void setProtocolFmp4Demand(String protocolFmp4Demand) {
this.protocolFmp4Demand = protocolFmp4Demand;
}
public String getGeneralResetWhenRePlay() {
return generalResetWhenRePlay;
}
public void setGeneralResetWhenRePlay(String generalResetWhenRePlay) {
this.generalResetWhenRePlay = generalResetWhenRePlay;
}
public String getGeneralMergeWriteMS() {
return generalMergeWriteMS;
}
public void setGeneralMergeWriteMS(String generalMergeWriteMS) {
this.generalMergeWriteMS = generalMergeWriteMS;
}
public String getGeneralWaitTrackReadyMs() {
return generalWaitTrackReadyMs;
}
public void setGeneralWaitTrackReadyMs(String generalWaitTrackReadyMs) {
this.generalWaitTrackReadyMs = generalWaitTrackReadyMs;
}
public String getGeneralWaitAddTrackMs() {
return generalWaitAddTrackMs;
}
public void setGeneralWaitAddTrackMs(String generalWaitAddTrackMs) {
this.generalWaitAddTrackMs = generalWaitAddTrackMs;
}
public String getGeneralUnreadyFrameCache() {
return generalUnreadyFrameCache;
}
public void setGeneralUnreadyFrameCache(String generalUnreadyFrameCache) {
this.generalUnreadyFrameCache = generalUnreadyFrameCache;
}
public String getHlsSegRetain() {
return hlsSegRetain;
}
public void setHlsSegRetain(String hlsSegRetain) {
this.hlsSegRetain = hlsSegRetain;
}
public String getHlsBroadcastRecordTs() {
return hlsBroadcastRecordTs;
}
public void setHlsBroadcastRecordTs(String hlsBroadcastRecordTs) {
this.hlsBroadcastRecordTs = hlsBroadcastRecordTs;
}
public String getHlsDeleteDelaySec() {
return hlsDeleteDelaySec;
}
public void setHlsDeleteDelaySec(String hlsDeleteDelaySec) {
this.hlsDeleteDelaySec = hlsDeleteDelaySec;
}
public String getHlsSegKeep() {
return hlsSegKeep;
}
public void setHlsSegKeep(String hlsSegKeep) {
this.hlsSegKeep = hlsSegKeep;
}
public String getHookOnServerStarted() {
return hookOnServerStarted;
}
public void setHookOnServerStarted(String hookOnServerStarted) {
this.hookOnServerStarted = hookOnServerStarted;
}
public String getHookOnServerKeepalive() {
return hookOnServerKeepalive;
}
public void setHookOnServerKeepalive(String hookOnServerKeepalive) {
this.hookOnServerKeepalive = hookOnServerKeepalive;
}
public String getHookOnSendRtpStopped() {
return hookOnSendRtpStopped;
}
public void setHookOnSendRtpStopped(String hookOnSendRtpStopped) {
this.hookOnSendRtpStopped = hookOnSendRtpStopped;
}
public String getHookOnRtpServerTimeout() {
return hookOnRtpServerTimeout;
}
public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) {
this.hookOnRtpServerTimeout = hookOnRtpServerTimeout;
}
public String getTranscodeSuffix() {
return transcodeSuffix;
}
public void setTranscodeSuffix(String transcodeSuffix) {
this.transcodeSuffix = transcodeSuffix;
}
}

View File

@@ -30,7 +30,7 @@ public class GPSMsgInfo {
/**
* 速度,单位:km/h (可选)
*/
private double speed;
private Double speed;
/**
* 产生通知时间, 时间格式: 2020-01-14T14:32:12
@@ -40,23 +40,23 @@ public class GPSMsgInfo {
/**
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
*/
private String direction;
private Double direction;
/**
* 海拔高度,单位:m(可选)
*/
private String altitude;
private Double altitude;
private boolean stored;
public static GPSMsgInfo getInstance(MobilePosition mobilePosition) {
GPSMsgInfo gpsMsgInfo = new GPSMsgInfo();
gpsMsgInfo.setChannelId(mobilePosition.getChannelId());
gpsMsgInfo.setAltitude(mobilePosition.getAltitude() + "");
gpsMsgInfo.setAltitude(mobilePosition.getAltitude());
gpsMsgInfo.setLng(mobilePosition.getLongitude());
gpsMsgInfo.setLat(mobilePosition.getLatitude());
gpsMsgInfo.setSpeed(mobilePosition.getSpeed());
gpsMsgInfo.setDirection(mobilePosition.getDirection() + "");
gpsMsgInfo.setDirection(mobilePosition.getDirection());
gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
return gpsMsgInfo;
}

View File

@@ -1,9 +1,11 @@
package com.genersoft.iot.vmp.service.redisMsg;
import com.alibaba.fastjson2.JSON;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
import com.genersoft.iot.vmp.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,9 +17,11 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 接收来自redis的GPS更新通知, 此处只针对推流设备
* 接收来自redis的GPS更新通知
*
* @author lin
* 监听: SUBSCRIBE VM_MSG_GPS
@@ -33,6 +37,9 @@ public class RedisGpsMsgListener implements MessageListener {
@Autowired
private IStreamPushService streamPushService;
@Autowired
private IGbChannelService channelService;
private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
@@ -42,7 +49,7 @@ public class RedisGpsMsgListener implements MessageListener {
taskQueue.offer(message);
}
@Scheduled(fixedDelay = 200) //每400毫秒执行一次
@Scheduled(fixedDelay = 200, timeUnit = TimeUnit.MILLISECONDS) //每400毫秒执行一次
public void executeTaskQueue() {
if (taskQueue.isEmpty()) {
return;
@@ -61,6 +68,7 @@ public class RedisGpsMsgListener implements MessageListener {
for (Message msg : messageDataList) {
try {
GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class);
gpsMsgInfo.setTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(gpsMsgInfo.getTime()));
log.info("[REDIS的位置变化通知], {}", JSON.toJSONString(gpsMsgInfo));
// 只是放入redis缓存起来
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
@@ -74,15 +82,18 @@ public class RedisGpsMsgListener implements MessageListener {
/**
* 定时将经纬度更新到数据库
*/
@Scheduled(fixedDelay = 2 * 1000) //每2秒执行一次
@Scheduled(fixedDelay = 2, timeUnit = TimeUnit.SECONDS) //每2秒执行一次
public void execute() {
// 需要查询到
List<GPSMsgInfo> gpsMsgInfoList = redisCatchStorage.getAllGpsMsgInfo();
if (!gpsMsgInfoList.isEmpty()) {
streamPushService.updateGPSFromGPSMsgInfo(gpsMsgInfoList);
for (GPSMsgInfo msgInfo : gpsMsgInfoList) {
msgInfo.setStored(true);
redisCatchStorage.updateGpsMsgInfo(msgInfo);
gpsMsgInfoList = gpsMsgInfoList.stream().filter(gpsMsgInfo -> !gpsMsgInfo.isStored()).collect(Collectors.toList());;
if (!gpsMsgInfoList.isEmpty()) {
channelService.updateGPSFromGPSMsgInfo(gpsMsgInfoList);
for (GPSMsgInfo msgInfo : gpsMsgInfoList) {
msgInfo.setStored(true);
redisCatchStorage.updateGpsMsgInfo(msgInfo);
}
}
}
}

View File

@@ -92,7 +92,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
streamPushService.online(streamStatusMessage.getOnlineStreams());
}
} catch (Exception e) {
log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.toJSONString(msg));
log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.parseObject(msg.getBody()));
log.error("[REDIS消息-推流设备状态变化] 异常内容: ", e);
}
}

View File

@@ -81,7 +81,7 @@ public interface MediaServerMapper {
@Update(value = {" <script>" +
"UPDATE wvp_media_server " +
"SET update_time=#{updateTime}" +
"SET update_time=#{updateTime}, transcode_suffix=#{transcodeSuffix} " +
"<if test=\"ip != null\">, ip=#{ip}</if>" +
"<if test=\"hookIp != null\">, hook_ip=#{hookIp}</if>" +
"<if test=\"sdpIp != null\">, sdp_ip=#{sdpIp}</if>" +
@@ -106,7 +106,6 @@ public interface MediaServerMapper {
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
"<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" +
"<if test=\"serverId != null\">, server_id=#{serverId}</if>" +
"<if test=\"type != null\">, type=#{type}</if>" +
"WHERE id=#{id}"+

View File

@@ -500,7 +500,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
public void removePushListItem(String app, String stream, String mediaServerId) {
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
MediaInfo param = (MediaInfo)redisTemplate.opsForValue().get(key);
if (param != null && param.getMediaServer().getId().equalsIgnoreCase(mediaServerId)) {
if (param != null) {
redisTemplate.delete(key);
}
}

View File

@@ -77,6 +77,30 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
@Schema(description = "拉起离线推流")
private boolean startOfflinePush;
/**
* 速度,单位:km/h (可选)
*/
@Schema(description = "GPS的速度")
private Double gpsSpeed;
/**
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
*/
@Schema(description = "GPS的方向")
private Double gpsDirection;
/**
* 海拔高度,单位:m(可选)
*/
@Schema(description = "GPS的海拔高度")
private Double gpsAltitude;
/**
* GPS的更新时间
*/
@Schema(description = "GPS的更新时间")
private String gpsTime;
private String uniqueKey;
private Integer dataType = ChannelDataType.STREAM_PUSH.value;

View File

@@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.streamPush.service;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
@@ -98,5 +97,4 @@ public interface IStreamPushService {
void batchRemove(Set<Integer> ids);
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
}

View File

@@ -16,7 +16,6 @@ import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
import com.genersoft.iot.vmp.service.ISendRtpServerService;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
@@ -471,6 +470,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
public void online(List<StreamPushItemFromRedis> onlineStreams) {
// 更新部分设备上线streamPushService
List<StreamPush> streamPushList = streamPushMapper.getListFromRedis(onlineStreams);
if (streamPushList.isEmpty()) {
return;
}
List<CommonGBChannel> commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList);
gbChannelService.online(commonGBChannelList);
}
@@ -583,17 +585,4 @@ public class StreamPushServiceImpl implements IStreamPushService {
streamPushMapper.batchDel(streamPushList);
gbChannelService.delete(ids);
}
@Override
public void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList) {
List<CommonGBChannel> channels = new ArrayList<>();
for (GPSMsgInfo gpsMsgInfo : gpsMsgInfoList) {
CommonGBChannel channel = new CommonGBChannel();
channel.setGbDeviceId(gpsMsgInfo.getId());
channel.setGbLongitude(gpsMsgInfo.getLng());
channel.setGbLatitude(gpsMsgInfo.getLat());
channels.add(channel);
}
gbChannelService.updateGpsByDeviceIdForStreamPush(channels);
}
}

View File

@@ -249,6 +249,8 @@ user-settings:
jwk-file: classpath:jwk.json
# wvp集群模式下如果注册向上级的wvp奔溃则自动选择一个其他wvp继续注册到上级
auto-register-platform: true
# 按需发送位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送
send-position-on-demand: true
# 关闭在线文档(生产环境建议关闭)
springdoc:

View File

@@ -65,7 +65,7 @@
<!-- </el-table-column>-->
<el-table-column prop="manufacturer" label="厂家" min-width="100">
</el-table-column>
<el-table-column label="位置信息" min-width="120">
<el-table-column label="位置信息" min-width="150">
<template v-slot:default="scope">
<span size="medium" v-if="scope.row.longitude && scope.row.latitude">{{scope.row.longitude}}<br/>{{scope.row.latitude}}</span>
<span size="medium" v-if="!scope.row.longitude || !scope.row.latitude"></span>

View File

@@ -1,5 +1,6 @@
/*建表*/
create table wvp_device
drop table IF EXISTS wvp_device;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
@@ -39,7 +40,8 @@ create table wvp_device
constraint uk_device_device unique (device_id)
);
create table wvp_device_alarm
drop table IF EXISTS wvp_device_alarm;
create table IF NOT EXISTS wvp_device_alarm
(
id serial primary key,
device_id character varying(50) not null,
@@ -54,7 +56,8 @@ create table wvp_device_alarm
create_time character varying(50) not null
);
create table wvp_device_mobile_position
drop table IF EXISTS wvp_device_mobile_position;
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
@@ -70,7 +73,8 @@ create table wvp_device_mobile_position
create_time character varying(50)
);
create table wvp_device_channel
drop table IF EXISTS wvp_device_channel;
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
@@ -152,10 +156,14 @@ create table wvp_device_channel
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table wvp_media_server
drop table IF EXISTS wvp_media_server;
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
@@ -191,7 +199,8 @@ create table wvp_media_server
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table wvp_platform
drop table IF EXISTS wvp_platform;
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
@@ -231,8 +240,8 @@ create table wvp_platform
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table wvp_platform_channel
drop table IF EXISTS wvp_platform_channel;
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
@@ -275,7 +284,8 @@ create table wvp_platform_channel
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table wvp_platform_group
drop table IF EXISTS wvp_platform_group;
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
@@ -283,7 +293,8 @@ create table wvp_platform_group
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table wvp_platform_region
drop table IF EXISTS wvp_platform_region;
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
@@ -291,7 +302,8 @@ create table wvp_platform_region
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table wvp_stream_proxy
drop table IF EXISTS wvp_stream_proxy;
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
@@ -317,7 +329,8 @@ create table wvp_stream_proxy
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table wvp_stream_push
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
@@ -333,7 +346,9 @@ create table wvp_stream_push
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table wvp_cloud_record
drop table IF EXISTS wvp_cloud_record;
create table IF NOT EXISTS wvp_cloud_record
(
id serial primary key,
app character varying(255),
@@ -351,7 +366,8 @@ create table wvp_cloud_record
time_len bigint
);
create table wvp_user
drop table IF EXISTS wvp_user;
create table IF NOT EXISTS wvp_user
(
id serial primary key,
username character varying(255),
@@ -363,7 +379,8 @@ create table wvp_user
constraint uk_user_username unique (username)
);
create table wvp_user_role
drop table IF EXISTS wvp_user_role;
create table IF NOT EXISTS wvp_user_role
(
id serial primary key,
name character varying(50),
@@ -371,18 +388,10 @@ create table wvp_user_role
create_time character varying(50),
update_time character varying(50)
);
create table wvp_resources_tree
(
id serial primary key,
is_catalog bool default true,
device_channel_id integer,
gb_stream_id integer,
name character varying(255),
parentId integer,
path character varying(255)
);
create table wvp_user_api_key
drop table IF EXISTS wvp_user_api_key;
create table IF NOT EXISTS wvp_user_api_key
(
id serial primary key,
user_id bigint,
@@ -403,7 +412,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57'
INSERT INTO wvp_user_role
VALUES (1, 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57');
CREATE TABLE wvp_common_group
drop table IF EXISTS wvp_common_group;
create table IF NOT EXISTS wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -417,7 +427,8 @@ CREATE TABLE wvp_common_group
constraint uk_common_group_device_platform unique (device_id)
);
CREATE TABLE wvp_common_region
drop table IF EXISTS wvp_common_region;
create table IF NOT EXISTS wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -429,7 +440,8 @@ CREATE TABLE wvp_common_region
constraint uk_common_region_device_id unique (device_id)
);
create table wvp_record_plan
drop table IF EXISTS wvp_record_plan;
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
@@ -438,7 +450,8 @@ create table wvp_record_plan
update_time character varying(50)
);
create table wvp_record_plan_item
drop table IF EXISTS wvp_record_plan_item;
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
start int,

View File

@@ -1,5 +1,6 @@
/*建表*/
create table wvp_device
drop table IF EXISTS wvp_device;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
@@ -25,7 +26,7 @@ create table wvp_device
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
@@ -39,7 +40,8 @@ create table wvp_device
constraint uk_device_device unique (device_id)
);
create table wvp_device_alarm
drop table IF EXISTS wvp_device_alarm;
create table IF NOT EXISTS wvp_device_alarm
(
id serial primary key,
device_id character varying(50) not null,
@@ -54,7 +56,8 @@ create table wvp_device_alarm
create_time character varying(50) not null
);
create table wvp_device_mobile_position
drop table IF EXISTS wvp_device_mobile_position;
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
@@ -70,7 +73,8 @@ create table wvp_device_mobile_position
create_time character varying(50)
);
create table wvp_device_channel
drop table IF EXISTS wvp_device_channel;
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
@@ -152,10 +156,14 @@ create table wvp_device_channel
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table wvp_media_server
drop table IF EXISTS wvp_media_server;
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
@@ -191,7 +199,8 @@ create table wvp_media_server
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table wvp_platform
drop table IF EXISTS wvp_platform;
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
@@ -231,8 +240,8 @@ create table wvp_platform
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table wvp_platform_channel
drop table IF EXISTS wvp_platform_channel;
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
@@ -275,7 +284,8 @@ create table wvp_platform_channel
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table wvp_platform_group
drop table IF EXISTS wvp_platform_group;
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
@@ -283,7 +293,8 @@ create table wvp_platform_group
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table wvp_platform_region
drop table IF EXISTS wvp_platform_region;
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
@@ -291,7 +302,8 @@ create table wvp_platform_region
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table wvp_stream_proxy
drop table IF EXISTS wvp_stream_proxy;
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
@@ -317,7 +329,8 @@ create table wvp_stream_proxy
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table wvp_stream_push
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
@@ -333,7 +346,9 @@ create table wvp_stream_push
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table wvp_cloud_record
drop table IF EXISTS wvp_cloud_record;
create table IF NOT EXISTS wvp_cloud_record
(
id serial primary key,
app character varying(255),
@@ -348,11 +363,11 @@ create table wvp_cloud_record
file_path character varying(500),
collect bool default false,
file_size int8,
time_len int8,
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
time_len int8
);
create table wvp_user
drop table IF EXISTS wvp_user;
create table IF NOT EXISTS wvp_user
(
id serial primary key,
username character varying(255),
@@ -364,7 +379,8 @@ create table wvp_user
constraint uk_user_username unique (username)
);
create table wvp_user_role
drop table IF EXISTS wvp_user_role;
create table IF NOT EXISTS wvp_user_role
(
id serial primary key,
name character varying(50),
@@ -372,18 +388,10 @@ create table wvp_user_role
create_time character varying(50),
update_time character varying(50)
);
create table wvp_resources_tree
(
id serial primary key,
is_catalog bool default true,
device_channel_id integer,
gb_stream_id integer,
name character varying(255),
parentId integer,
path character varying(255)
);
create table wvp_user_api_key
drop table IF EXISTS wvp_user_api_key;
create table IF NOT EXISTS wvp_user_api_key
(
id serial primary key,
user_id int8,
@@ -404,7 +412,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57'
INSERT INTO wvp_user_role
VALUES (1, 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57');
CREATE TABLE wvp_common_group
drop table IF EXISTS wvp_common_group;
create table IF NOT EXISTS wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -418,7 +427,8 @@ CREATE TABLE wvp_common_group
constraint uk_common_group_device_platform unique (device_id)
);
CREATE TABLE wvp_common_region
drop table IF EXISTS wvp_common_region;
create table IF NOT EXISTS wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
@@ -430,7 +440,8 @@ CREATE TABLE wvp_common_region
constraint uk_common_region_device_id unique (device_id)
);
create table wvp_record_plan
drop table IF EXISTS wvp_record_plan;
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
@@ -439,7 +450,8 @@ create table wvp_record_plan
update_time character varying(50)
);
create table wvp_record_plan_item
drop table IF EXISTS wvp_record_plan_item;
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
"start" int,

View File

@@ -1,13 +0,0 @@
/*
* WVP RPC 调用
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";

View File

@@ -0,0 +1,426 @@
drop table if exists wvp_resources_tree;
drop table if exists wvp_platform_catalog;
drop table if exists wvp_platform_gb_stream;
drop table if exists wvp_platform_gb_channel;
drop table if exists wvp_gb_stream;
drop table if exists wvp_log;
drop table IF EXISTS wvp_device;
drop table IF EXISTS wvp_platform;
drop table IF EXISTS wvp_media_server;
drop table IF EXISTS wvp_device_mobile_position;
drop table IF EXISTS wvp_device_channel;
drop table IF EXISTS wvp_stream_proxy;
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
name character varying(255),
manufacturer character varying(255),
model character varying(255),
firmware character varying(255),
transport character varying(50),
stream_mode character varying(50),
on_line bool default false,
register_time character varying(50),
keepalive_time character varying(50),
ip character varying(50),
create_time character varying(50),
update_time character varying(50),
port integer,
expires integer,
subscribe_cycle_for_catalog integer DEFAULT 0,
subscribe_cycle_for_mobile_position integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5,
subscribe_cycle_for_alarm integer DEFAULT 0,
host_address character varying(50),
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
password character varying(255),
as_message_channel bool default false,
heart_beat_interval integer,
heart_beat_count integer,
position_capability integer,
broadcast_push_after_ack bool default false,
server_id character varying(50),
constraint uk_device_device unique (device_id)
);
create table if not exists wvp_common_group
(
id bigint unsigned auto_increment primary key,
device_id varchar(50) not null,
name varchar(255) not null,
parent_id int null,
parent_device_id varchar(50) null,
business_group varchar(50) not null,
create_time varchar(50) not null,
update_time varchar(50) not null,
civil_code varchar(50) null,
constraint id
unique (id),
constraint uk_common_group_device_platform
unique (device_id)
);
create table if not exists wvp_common_region
(
id bigint unsigned auto_increment
primary key,
device_id varchar(50) not null,
name varchar(255) not null,
parent_id int null,
parent_device_id varchar(50) null,
create_time varchar(50) not null,
update_time varchar(50) not null,
constraint id
unique (id),
constraint uk_common_region_device_id
unique (device_id)
);
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
name character varying(255),
manufacturer character varying(50),
model character varying(50),
owner character varying(50),
civil_code character varying(50),
block character varying(50),
address character varying(50),
parental integer,
parent_id character varying(50),
safety_way integer,
register_way integer,
cert_num character varying(50),
certifiable integer,
err_code integer,
end_time character varying(50),
secrecy integer,
ip_address character varying(50),
port integer,
password character varying(255),
status character varying(50),
longitude double precision,
latitude double precision,
ptz_type integer,
position_type integer,
room_type integer,
use_type integer,
supply_light_type integer,
direction_type integer,
resolution character varying(255),
business_group_id character varying(255),
download_speed character varying(255),
svc_space_support_mod integer,
svc_time_support_mode integer,
create_time character varying(50) not null,
update_time character varying(50) not null,
sub_count integer,
stream_id character varying(255),
has_audio bool default false,
gps_time character varying(50),
stream_identification character varying(50),
channel_type int default 0 not null,
gb_device_id character varying(50),
gb_name character varying(255),
gb_manufacturer character varying(255),
gb_model character varying(255),
gb_owner character varying(255),
gb_civil_code character varying(255),
gb_block character varying(255),
gb_address character varying(255),
gb_parental integer,
gb_parent_id character varying(255),
gb_safety_way integer,
gb_register_way integer,
gb_cert_num character varying(50),
gb_certifiable integer,
gb_err_code integer,
gb_end_time character varying(50),
gb_secrecy integer,
gb_ip_address character varying(50),
gb_port integer,
gb_password character varying(50),
gb_status character varying(50),
gb_longitude double,
gb_latitude double,
gb_business_group_id character varying(50),
gb_ptz_type integer,
gb_position_type integer,
gb_room_type integer,
gb_use_type integer,
gb_supply_light_type integer,
gb_direction_type integer,
gb_resolution character varying(255),
gb_download_speed character varying(255),
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
channel_id character varying(50) not null,
device_name character varying(255),
time character varying(50),
longitude double precision,
latitude double precision,
altitude double precision,
speed double precision,
direction double precision,
report_source character varying(50),
create_time character varying(50)
);
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
hook_ip character varying(50),
sdp_ip character varying(50),
stream_ip character varying(50),
http_port integer,
http_ssl_port integer,
rtmp_port integer,
rtmp_ssl_port integer,
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',
rtp_enable bool default false,
rtp_port_range character varying(50),
send_rtp_port_range character varying(50),
record_assist_port integer,
default_server bool default false,
create_time character varying(50),
update_time character varying(50),
hook_alive_interval integer,
record_path character varying(255),
record_day integer default 7,
transcode_suffix character varying(255),
server_id character varying(50),
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
name character varying(255),
server_gb_id character varying(50),
server_gb_domain character varying(50),
server_ip character varying(50),
server_port integer,
device_gb_id character varying(50),
device_ip character varying(50),
device_port character varying(50),
username character varying(255),
password character varying(50),
expires character varying(50),
keep_timeout character varying(50),
transport character varying(50),
civil_code character varying(50),
manufacturer character varying(255),
model character varying(255),
address character varying(255),
character_set character varying(50),
ptz bool default false,
rtcp bool default false,
status bool default false,
catalog_group integer,
register_way integer,
secrecy integer,
create_time character varying(50),
update_time character varying(50),
as_message_channel bool default false,
catalog_with_platform integer default 1,
catalog_with_group integer default 1,
catalog_with_region integer default 1,
auto_push_channel bool default true,
send_stream_ip character varying(50),
server_id character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
app character varying(255),
stream character varying(255),
src_url character varying(255),
timeout integer,
ffmpeg_cmd_key character varying(255),
rtsp_type character varying(50),
media_server_id character varying(50),
enable_audio bool default false,
enable_mp4 bool default false,
pulling bool default false,
enable bool default false,
enable_remove_none_reader bool default false,
create_time character varying(50),
name character varying(255),
update_time character varying(50),
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
stream character varying(255),
create_time character varying(50),
media_server_id character varying(50),
server_id character varying(50),
push_time character varying(50),
status bool default false,
update_time character varying(50),
pushing bool default false,
self bool default false,
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
device_channel_id integer,
custom_device_id character varying(50),
custom_name character varying(255),
custom_manufacturer character varying(50),
custom_model character varying(50),
custom_owner character varying(50),
custom_civil_code character varying(50),
custom_block character varying(50),
custom_address character varying(50),
custom_parental integer,
custom_parent_id character varying(50),
custom_safety_way integer,
custom_register_way integer,
custom_cert_num character varying(50),
custom_certifiable integer,
custom_err_code integer,
custom_end_time character varying(50),
custom_secrecy integer,
custom_ip_address character varying(50),
custom_port integer,
custom_password character varying(255),
custom_status character varying(50),
custom_longitude double precision,
custom_latitude double precision,
custom_ptz_type integer,
custom_position_type integer,
custom_room_type integer,
custom_use_type integer,
custom_supply_light_type integer,
custom_direction_type integer,
custom_resolution character varying(255),
custom_business_group_id character varying(255),
custom_download_speed character varying(255),
custom_svc_space_support_mod integer,
custom_svc_time_support_mode integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, device_channel_id),
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
group_id integer,
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
region_id integer,
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
name varchar(255) NOT NULL,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
start int,
stop int,
week_day int,
plan_id int,
create_time character varying(50),
update_time character varying(50)
);
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250111`()
BEGIN
DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID';
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path')
THEN
alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder')
THEN
alter table wvp_cloud_record modify folder varchar(500) null;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path')
THEN
alter table wvp_cloud_record modify file_path varchar(500) null;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id')
THEN
alter table wvp_cloud_record add server_id character varying(50);
update wvp_cloud_record set server_id = serverId;
END IF;
END;//
call wvp_20250111();
DROP PROCEDURE wvp_20250111;
DELIMITER ;

View File

@@ -1,64 +1,271 @@
/*
* 20240528
*/
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20240528`()
BEGIN
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'transcode_suffix')
THEN
ALTER TABLE wvp_media_server ADD transcode_suffix character varying(255);
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'type')
THEN
alter table wvp_media_server
add type character varying(50) default 'zlm';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_port')
THEN
alter table wvp_media_server add flv_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_ssl_port')
THEN
alter table wvp_media_server add flv_ssl_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_port')
THEN
alter table wvp_media_server add ws_flv_port integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_ssl_port')
THEN
alter table wvp_media_server add ws_flv_ssl_port integer;
END IF;
END; //
call wvp_20240528();
DROP PROCEDURE wvp_20240528;
DELIMITER ;
create table IF NOT EXISTS wvp_user_api_key (
id serial primary key ,
user_id bigint,
app character varying(255) ,
api_key text,
expired_at bigint,
remark character varying(255),
enable bool default true,
create_time character varying(50),
update_time character varying(50)
);
/*
* 20241222
*/
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20241222`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_device_channel_unique_device_channel')
THEN
alter table wvp_device_channel drop index uk_wvp_device_channel_unique_device_channel;
END IF;
alter table wvp_device_channel
add data_type integer not null;
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_push_id')
THEN
alter table wvp_device_channel drop index uk_wvp_unique_stream_push_id;
END IF;
alter table wvp_device_channel
add data_device_id integer not null;
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_proxy_id')
THEN
alter table wvp_device_channel drop index uk_wvp_unique_stream_proxy_id;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_type')
THEN
alter table wvp_device_channel add data_type integer not null;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_device_id')
THEN
alter table wvp_device_channel add data_device_id integer not null;
END IF;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
alter table wvp_device_channel drop device_db_id;
END IF;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
alter table wvp_device_channel drop stream_push_id;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id')
THEN
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null;
alter table wvp_device_channel drop stream_proxy_id;
END IF;
END; //
call wvp_20241222();
DROP PROCEDURE wvp_20241222;
DELIMITER ;
/*
* 20241231
*/
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
DELIMITER //
CREATE PROCEDURE `wvp_20241231`()
BEGIN
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'relates_media_server_id')
THEN
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
END IF;
END; //
call wvp_20241231();
DROP PROCEDURE wvp_20241231;
DELIMITER ;
/*
* 20250111
*/
drop index uk_stream_push_app_stream_path on wvp_cloud_record;
alter table wvp_cloud_record change folder folder varchar(500) null;
alter table wvp_cloud_record change file_path file_path varchar(500) null;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250111`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path')
THEN
alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder')
THEN
alter table wvp_cloud_record modify folder varchar(500) null;
END IF;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path')
THEN
alter table wvp_cloud_record modify file_path varchar(500) null;
END IF;
END; //
call wvp_20250111();
DROP PROCEDURE wvp_20250111;
DELIMITER ;
/*
* 20250211
*/
alter table wvp_device change keepalive_interval_time heart_beat_interval integer;
alter table wvp_device add heart_beat_count integer;
alter table wvp_device add position_capability integer;
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250211`()
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'keepalive_interval_time')
THEN
alter table wvp_device change keepalive_interval_time heart_beat_interval integer after as_message_channel;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'heart_beat_count')
THEN
alter table wvp_device add heart_beat_count integer;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'position_capability')
THEN
alter table wvp_device add position_capability integer;
END IF;
END; //
call wvp_20250211();
DROP PROCEDURE wvp_20250211;
DELIMITER ;
/**
* 20250312
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250312`()
BEGIN
DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID';
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'server_id')
THEN
alter table wvp_device add server_id character varying(50);
update wvp_device set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'server_id')
THEN
alter table wvp_media_server add server_id character varying(50);
update wvp_media_server set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'server_id')
THEN
alter table wvp_stream_proxy add server_id character varying(50);
update wvp_stream_proxy set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id')
THEN
alter table wvp_cloud_record add server_id character varying(50);
update wvp_cloud_record set server_id = serverId;
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_platform' and column_name = 'server_id')
THEN
alter table wvp_platform add server_id character varying(50);
END IF;
END; //
call wvp_20250312();
DROP PROCEDURE wvp_20250312;
DELIMITER ;
/*
* 20250319
*/
DELIMITER // -- 重定义分隔符避免分号冲突
CREATE PROCEDURE `wvp_20250319`()
BEGIN
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_speed')
THEN
alter table wvp_device_channel add gps_speed double precision;
END IF;
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_altitude')
THEN
alter table wvp_device_channel add gps_altitude double precision;
END IF;
IF NOT EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_direction')
THEN
alter table wvp_device_channel add gps_direction double precision;
END IF;
END; //
call wvp_20250319();
DROP PROCEDURE wvp_20250319;
DELIMITER ;
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";

View File

@@ -0,0 +1,387 @@
drop table if exists wvp_resources_tree;
drop table if exists wvp_platform_catalog;
drop table if exists wvp_platform_gb_stream;
drop table if exists wvp_platform_gb_channel;
drop table if exists wvp_gb_stream;
drop table if exists wvp_log;
drop table IF EXISTS wvp_device;
drop table IF EXISTS wvp_platform;
drop table IF EXISTS wvp_media_server;
drop table IF EXISTS wvp_device_mobile_position;
drop table IF EXISTS wvp_device_channel;
drop table IF EXISTS wvp_stream_proxy;
drop table IF EXISTS wvp_stream_push;
create table IF NOT EXISTS wvp_device
(
id serial primary key,
device_id character varying(50) not null,
name character varying(255),
manufacturer character varying(255),
model character varying(255),
firmware character varying(255),
transport character varying(50),
stream_mode character varying(50),
on_line bool default false,
register_time character varying(50),
keepalive_time character varying(50),
ip character varying(50),
create_time character varying(50),
update_time character varying(50),
port integer,
expires integer,
subscribe_cycle_for_catalog integer DEFAULT 0,
subscribe_cycle_for_mobile_position integer DEFAULT 0,
mobile_position_submission_interval integer DEFAULT 5,
subscribe_cycle_for_alarm integer DEFAULT 0,
host_address character varying(50),
charset character varying(50),
ssrc_check bool default false,
geo_coord_sys character varying(50),
media_server_id character varying(50) default 'auto',
custom_name character varying(255),
sdp_ip character varying(50),
local_ip character varying(50),
password character varying(255),
as_message_channel bool default false,
heart_beat_interval integer,
heart_beat_count integer,
position_capability integer,
broadcast_push_after_ack bool default false,
server_id character varying(50),
constraint uk_device_device unique (device_id)
);
create table IF NOT EXISTS wvp_device_channel
(
id serial primary key,
device_id character varying(50),
name character varying(255),
manufacturer character varying(50),
model character varying(50),
owner character varying(50),
civil_code character varying(50),
block character varying(50),
address character varying(50),
parental integer,
parent_id character varying(50),
safety_way integer,
register_way integer,
cert_num character varying(50),
certifiable integer,
err_code integer,
end_time character varying(50),
secrecy integer,
ip_address character varying(50),
port integer,
password character varying(255),
status character varying(50),
longitude double precision,
latitude double precision,
ptz_type integer,
position_type integer,
room_type integer,
use_type integer,
supply_light_type integer,
direction_type integer,
resolution character varying(255),
business_group_id character varying(255),
download_speed character varying(255),
svc_space_support_mod integer,
svc_time_support_mode integer,
create_time character varying(50) not null,
update_time character varying(50) not null,
sub_count integer,
stream_id character varying(255),
has_audio bool default false,
gps_time character varying(50),
stream_identification character varying(50),
channel_type int default 0 not null,
gb_device_id character varying(50),
gb_name character varying(255),
gb_manufacturer character varying(255),
gb_model character varying(255),
gb_owner character varying(255),
gb_civil_code character varying(255),
gb_block character varying(255),
gb_address character varying(255),
gb_parental integer,
gb_parent_id character varying(255),
gb_safety_way integer,
gb_register_way integer,
gb_cert_num character varying(50),
gb_certifiable integer,
gb_err_code integer,
gb_end_time character varying(50),
gb_secrecy integer,
gb_ip_address character varying(50),
gb_port integer,
gb_password character varying(50),
gb_status character varying(50),
gb_longitude double precision,
gb_latitude double precision,
gb_business_group_id character varying(50),
gb_ptz_type integer,
gb_position_type integer,
gb_room_type integer,
gb_use_type integer,
gb_supply_light_type integer,
gb_direction_type integer,
gb_resolution character varying(255),
gb_download_speed character varying(255),
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
data_type integer not null,
data_device_id integer not null,
gps_speed double precision,
gps_altitude double precision,
gps_direction double precision,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create table IF NOT EXISTS wvp_device_mobile_position
(
id serial primary key,
device_id character varying(50) not null,
channel_id character varying(50) not null,
device_name character varying(255),
time character varying(50),
longitude double precision,
latitude double precision,
altitude double precision,
speed double precision,
direction double precision,
report_source character varying(50),
create_time character varying(50)
);
create table IF NOT EXISTS wvp_media_server
(
id character varying(255) primary key,
ip character varying(50),
hook_ip character varying(50),
sdp_ip character varying(50),
stream_ip character varying(50),
http_port integer,
http_ssl_port integer,
rtmp_port integer,
rtmp_ssl_port integer,
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',
rtp_enable bool default false,
rtp_port_range character varying(50),
send_rtp_port_range character varying(50),
record_assist_port integer,
default_server bool default false,
create_time character varying(50),
update_time character varying(50),
hook_alive_interval integer,
record_path character varying(255),
record_day integer default 7,
transcode_suffix character varying(255),
server_id character varying(50),
constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id)
);
create table IF NOT EXISTS wvp_common_group
(
id serial primary key,
device_id varchar(50) NOT NULL,
name varchar(255) NOT NULL,
parent_id int,
parent_device_id varchar(50) DEFAULT NULL,
business_group varchar(50) NOT NULL,
create_time varchar(50) NOT NULL,
update_time varchar(50) NOT NULL,
civil_code varchar(50) default null,
constraint uk_common_group_device_platform unique (device_id)
);
create table IF NOT EXISTS wvp_common_region
(
id serial primary key,
device_id varchar(50) NOT NULL,
name varchar(255) NOT NULL,
parent_id int,
parent_device_id varchar(50) DEFAULT NULL,
create_time varchar(50) NOT NULL,
update_time varchar(50) NOT NULL,
constraint uk_common_region_device_id unique (device_id)
);
create table IF NOT EXISTS wvp_record_plan
(
id serial primary key,
snap bool default false,
name varchar(255) NOT NULL,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_record_plan_item
(
id serial primary key,
"start" int,
stop int,
week_day int,
plan_id int,
create_time character varying(50),
update_time character varying(50)
);
create table IF NOT EXISTS wvp_platform
(
id serial primary key,
enable bool default false,
name character varying(255),
server_gb_id character varying(50),
server_gb_domain character varying(50),
server_ip character varying(50),
server_port integer,
device_gb_id character varying(50),
device_ip character varying(50),
device_port character varying(50),
username character varying(255),
password character varying(50),
expires character varying(50),
keep_timeout character varying(50),
transport character varying(50),
civil_code character varying(50),
manufacturer character varying(255),
model character varying(255),
address character varying(255),
character_set character varying(50),
ptz bool default false,
rtcp bool default false,
status bool default false,
catalog_group integer,
register_way integer,
secrecy integer,
create_time character varying(50),
update_time character varying(50),
as_message_channel bool default false,
catalog_with_platform integer default 1,
catalog_with_group integer default 1,
catalog_with_region integer default 1,
auto_push_channel bool default true,
send_stream_ip character varying(50),
server_id character varying(50),
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);
create table IF NOT EXISTS wvp_platform_channel
(
id serial primary key,
platform_id integer,
device_channel_id integer,
custom_device_id character varying(50),
custom_name character varying(255),
custom_manufacturer character varying(50),
custom_model character varying(50),
custom_owner character varying(50),
custom_civil_code character varying(50),
custom_block character varying(50),
custom_address character varying(50),
custom_parental integer,
custom_parent_id character varying(50),
custom_safety_way integer,
custom_register_way integer,
custom_cert_num character varying(50),
custom_certifiable integer,
custom_err_code integer,
custom_end_time character varying(50),
custom_secrecy integer,
custom_ip_address character varying(50),
custom_port integer,
custom_password character varying(255),
custom_status character varying(50),
custom_longitude double precision,
custom_latitude double precision,
custom_ptz_type integer,
custom_position_type integer,
custom_room_type integer,
custom_use_type integer,
custom_supply_light_type integer,
custom_direction_type integer,
custom_resolution character varying(255),
custom_business_group_id character varying(255),
custom_download_speed character varying(255),
custom_svc_space_support_mod integer,
custom_svc_time_support_mode integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, device_channel_id),
constraint uk_platform_gb_channel_device_id unique (custom_device_id)
);
create table IF NOT EXISTS wvp_platform_group
(
id serial primary key,
platform_id integer,
group_id integer,
constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id)
);
create table IF NOT EXISTS wvp_platform_region
(
id serial primary key,
platform_id integer,
region_id integer,
constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id)
);
create table IF NOT EXISTS wvp_stream_proxy
(
id serial primary key,
type character varying(50),
app character varying(255),
stream character varying(255),
src_url character varying(255),
timeout integer,
ffmpeg_cmd_key character varying(255),
rtsp_type character varying(50),
media_server_id character varying(50),
enable_audio bool default false,
enable_mp4 bool default false,
pulling bool default false,
enable bool default false,
enable_remove_none_reader bool default false,
create_time character varying(50),
name character varying(255),
update_time character varying(50),
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);
create table IF NOT EXISTS wvp_stream_push
(
id serial primary key,
app character varying(255),
stream character varying(255),
create_time character varying(50),
media_server_id character varying(50),
server_id character varying(50),
push_time character varying(50),
status bool default false,
update_time character varying(50),
pushing bool default false,
self bool default false,
start_offline_push bool default true,
constraint uk_stream_push_app_stream unique (app, stream)
);
alter table wvp_cloud_record add column if not exists server_id character varying(50);
ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path;
alter table wvp_cloud_record alter folder type varchar(500);
alter table wvp_cloud_record alter file_path type varchar(500);
update wvp_cloud_record set server_id = '你的服务ID';

View File

@@ -1,63 +1,105 @@
/*
* 20240528
*/
ALTER TABLE wvp_media_server ADD COLUMN IF NOT EXISTS transcode_suffix character varying(255);
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS type character varying(50) default 'zlm';
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_ssl_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_port integer;
ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_ssl_port integer;
create table IF NOT EXISTS wvp_user_api_key (
id serial primary key ,
user_id bigint,
app character varying(255) ,
api_key text,
expired_at bigint,
remark character varying(255),
enable bool default true,
create_time character varying(50),
update_time character varying(50)
);
/*
* 20241222
*/
ALTER TABLE wvp_device_channel drop CONSTRAINT IF EXISTS uk_wvp_device_channel_unique_device_channel;
ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_push_id;
ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_proxy_id;
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_type integer not null;
ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_device_id integer not null;
alter table wvp_device_channel
add data_type integer not null;
DO $$
BEGIN
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id')
THEN
update wvp_device_channel wdc set data_type = 1, data_device_id =
(SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id )
where device_db_id is not null;
END IF;
alter table wvp_device_channel
add data_device_id integer not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id')
THEN
update wvp_device_channel wdc set data_type = 2, data_device_id =
(SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id )
where stream_push_id is not null;
END IF;
update wvp_device_channel wdc
set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null;
IF EXISTS (SELECT column_name FROM information_schema.columns
WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id')
THEN
update wvp_device_channel wdc set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id )
where stream_proxy_id is not null;
END IF;
END $$;
update wvp_device_channel wdc
set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null;
update wvp_device_channel wdc
set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;
alter table wvp_device_channel drop column IF EXISTS device_db_id;
alter table wvp_device_channel drop column IF EXISTS stream_push_id;
alter table wvp_device_channel drop column IF EXISTS stream_proxy_id;
/*
* 20241231
*/
alter table wvp_stream_proxy add relates_media_server_id character varying(50);
alter table wvp_stream_proxy add column IF NOT EXISTS relates_media_server_id character varying(50);
/*
* 20250111
*/
drop index uk_stream_push_app_stream_path on wvp_cloud_record;
alter table wvp_cloud_record change folder folder varchar(500) null;
alter table wvp_cloud_record change file_path file_path varchar(500) null;
ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path;
alter table wvp_cloud_record alter folder type varchar(500);
alter table wvp_cloud_record alter file_path type varchar(500);
/*
* 20250211
*/
alter table wvp_device change keepalive_interval_time heart_beat_interval integer;
alter table wvp_device add heart_beat_count integer;
alter table wvp_device add position_capability integer;
alter table wvp_device rename keepalive_interval_time to heart_beat_interval;
alter table wvp_device add column if not exists heart_beat_count integer;
alter table wvp_device add column if not exists position_capability integer;
/**
* 20250312
*/
alter table wvp_device add server_id character varying(50);
alter table wvp_media_server add server_id character varying(50);
alter table wvp_stream_proxy add server_id character varying(50);
alter table wvp_cloud_record add server_id character varying(50);
alter table wvp_platform add server_id character varying(50);
alter table wvp_device add column if not exists server_id character varying(50);
alter table wvp_media_server add column if not exists server_id character varying(50);
alter table wvp_stream_proxy add column if not exists server_id character varying(50);
alter table wvp_cloud_record add column if not exists server_id character varying(50);
alter table wvp_platform add column if not exists server_id character varying(50);
update wvp_device set server_id = '你的服务ID';
update wvp_media_server set server_id = '你的服务ID';
update wvp_stream_proxy set server_id = '你的服务ID';
update wvp_cloud_record set server_id = '你的服务ID';
/*
* 20250319
*/
alter table wvp_device_channel add column if not exists gps_speed double precision;
alter table wvp_device_channel add column if not exists gps_altitude double precision;
alter table wvp_device_channel add column if not exists gps_direction double precision;
update wvp_device set server_id = "你服务的ID";
update wvp_media_server set server_id = "你服务的ID";
update wvp_stream_proxy set server_id = "你服务的ID";
update wvp_cloud_record set server_id = "你服务的ID";