提高注册兼容性, 修复sql兼容mysql

This commit is contained in:
64850858 2021-06-08 18:44:15 +08:00
parent 4c4b62cb3a
commit 377f0f2c82
10 changed files with 187 additions and 115 deletions

View File

@ -21,25 +21,25 @@ public class MediaConfig {
private String streamIp; private String streamIp;
@Value("${media.httpPort}") @Value("${media.httpPort}")
private String httpPort; private Integer httpPort;
@Value("${media.httpSSlPort:}") @Value("${media.httpSSlPort:}")
private String httpSSlPort; private Integer httpSSlPort;
@Value("${media.rtmpPort:}") @Value("${media.rtmpPort:}")
private String rtmpPort; private Integer rtmpPort;
@Value("${media.rtmpSSlPort:}") @Value("${media.rtmpSSlPort:}")
private String rtmpSSlPort; private Integer rtmpSSlPort;
@Value("${media.rtpProxyPort:}") @Value("${media.rtpProxyPort:}")
private String rtpProxyPort; private Integer rtpProxyPort;
@Value("${media.rtspPort:}") @Value("${media.rtspPort:}")
private String rtspPort; private Integer rtspPort;
@Value("${media.rtspSSLPort:}") @Value("${media.rtspSSLPort:}")
private String rtspSSLPort; private Integer rtspSSLPort;
@Value("${media.autoConfig:true}") @Value("${media.autoConfig:true}")
private boolean autoConfig; private boolean autoConfig;
@ -57,73 +57,141 @@ public class MediaConfig {
private String rtpPortRange; private String rtpPortRange;
@Value("${media.recordAssistPort}") @Value("${media.recordAssistPort}")
private int recordAssistPort; private Integer recordAssistPort;
public String getIp() { public String getIp() {
return ip; return ip;
} }
public void setIp(String ip) {
this.ip = ip;
}
public String getHookIp() { public String getHookIp() {
return hookIp; return hookIp;
} }
public void setHookIp(String hookIp) {
this.hookIp = hookIp;
}
public String getSdpIp() { public String getSdpIp() {
return sdpIp; return sdpIp;
} }
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
public String getStreamIp() { public String getStreamIp() {
return streamIp; return streamIp;
} }
public String getHttpPort() { public void setStreamIp(String streamIp) {
this.streamIp = streamIp;
}
public Integer getHttpPort() {
return httpPort; return httpPort;
} }
public String getHttpSSlPort() { public void setHttpPort(Integer httpPort) {
this.httpPort = httpPort;
}
public Integer getHttpSSlPort() {
return httpSSlPort; return httpSSlPort;
} }
public String getRtmpPort() { public void setHttpSSlPort(Integer httpSSlPort) {
this.httpSSlPort = httpSSlPort;
}
public Integer getRtmpPort() {
return rtmpPort; return rtmpPort;
} }
public String getRtmpSSlPort() { public void setRtmpPort(Integer rtmpPort) {
this.rtmpPort = rtmpPort;
}
public Integer getRtmpSSlPort() {
return rtmpSSlPort; return rtmpSSlPort;
} }
public String getRtpProxyPort() { public void setRtmpSSlPort(Integer rtmpSSlPort) {
this.rtmpSSlPort = rtmpSSlPort;
}
public Integer getRtpProxyPort() {
return rtpProxyPort; return rtpProxyPort;
} }
public String getRtspPort() { public void setRtpProxyPort(Integer rtpProxyPort) {
this.rtpProxyPort = rtpProxyPort;
}
public Integer getRtspPort() {
return rtspPort; return rtspPort;
} }
public String getRtspSSLPort() { public void setRtspPort(Integer rtspPort) {
this.rtspPort = rtspPort;
}
public Integer getRtspSSLPort() {
return rtspSSLPort; return rtspSSLPort;
} }
public void setRtspSSLPort(Integer rtspSSLPort) {
this.rtspSSLPort = rtspSSLPort;
}
public boolean isAutoConfig() { public boolean isAutoConfig() {
return autoConfig; return autoConfig;
} }
public void setAutoConfig(boolean autoConfig) {
this.autoConfig = autoConfig;
}
public String getSecret() { public String getSecret() {
return secret; return secret;
} }
public void setSecret(String secret) {
this.secret = secret;
}
public String getStreamNoneReaderDelayMS() { public String getStreamNoneReaderDelayMS() {
return streamNoneReaderDelayMS; return streamNoneReaderDelayMS;
} }
public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) {
this.streamNoneReaderDelayMS = streamNoneReaderDelayMS;
}
public boolean isRtpEnable() { public boolean isRtpEnable() {
return rtpEnable; return rtpEnable;
} }
public void setRtpEnable(boolean rtpEnable) {
this.rtpEnable = rtpEnable;
}
public String getRtpPortRange() { public String getRtpPortRange() {
return rtpPortRange; return rtpPortRange;
} }
public int getRecordAssistPort() { public void setRtpPortRange(String rtpPortRange) {
this.rtpPortRange = rtpPortRange;
}
public Integer getRecordAssistPort() {
return recordAssistPort; return recordAssistPort;
} }
public void setRecordAssistPort(Integer recordAssistPort) {
this.recordAssistPort = recordAssistPort;
}
} }

View File

@ -109,13 +109,10 @@ public class DigestServerAuthenticationHelper {
WWWAuthenticateHeader proxyAuthenticate = headerFactory WWWAuthenticateHeader proxyAuthenticate = headerFactory
.createWWWAuthenticateHeader(DEFAULT_SCHEME); .createWWWAuthenticateHeader(DEFAULT_SCHEME);
proxyAuthenticate.setParameter("realm", realm); proxyAuthenticate.setParameter("realm", realm);
proxyAuthenticate.setParameter("qop", "auth");
proxyAuthenticate.setParameter("nonce", generateNonce()); proxyAuthenticate.setParameter("nonce", generateNonce());
proxyAuthenticate.setParameter("opaque", "");
proxyAuthenticate.setParameter("stale", "FALSE");
proxyAuthenticate.setParameter("algorithm", DEFAULT_ALGORITHM); proxyAuthenticate.setParameter("algorithm", DEFAULT_ALGORITHM);
// proxyAuthenticate.setParameter("qop", "auth");
response.setHeader(proxyAuthenticate); response.setHeader(proxyAuthenticate);
} catch (Exception ex) { } catch (Exception ex) {
InternalErrorHandler.handleException(ex); InternalErrorHandler.handleException(ex);
@ -243,26 +240,26 @@ public class DigestServerAuthenticationHelper {
} }
public static void main(String[] args) throws NoSuchAlgorithmException { public static void main(String[] args) throws NoSuchAlgorithmException {
String realm = "4401000000"; String realm = "3402000000";
String username = "44010000001110008008"; String username = "44010000001180008012";
String nonce = "0074b397f86fc263b1b7f9eb72553267"; String nonce = "07cab60999fbf643264ace27d3b7de8b";
String uri = "sip:44010000002000000001@4401000000"; String uri = "sip:34020000002000000001@3402000000";
// qop 保护质量 包含auth默认的和auth-int增加了报文完整性检测两种策略 // qop 保护质量 包含auth默认的和auth-int增加了报文完整性检测两种策略
String qop = null; String qop = "auth";
// 客户端随机数这是一个不透明的字符串值由客户端提供并且客户端和服务器都会使用以避免用明文文本 // 客户端随机数这是一个不透明的字符串值由客户端提供并且客户端和服务器都会使用以避免用明文文本
// 这使得双方都可以查验对方的身份并对消息的完整性提供一些保护 // 这使得双方都可以查验对方的身份并对消息的完整性提供一些保护
//String cNonce = authHeader.getCNonce(); //String cNonce = authHeader.getCNonce();
// nonce计数器是一个16进制的数值表示同一nonce下客户端发送出请求的数量 // nonce计数器是一个16进制的数值表示同一nonce下客户端发送出请求的数量
int nc = -1; int nc = 1;
String ncStr = new DecimalFormat("00000000").format(nc); String ncStr = new DecimalFormat("00000000").format(nc);
// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM); MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
String A1 = username + ":" + realm + ":" + "crservice@123"; String A1 = username + ":" + realm + ":" + "12345678";
String A2 = "REGISTER" + ":" + uri.toString(); String A2 = "REGISTER" + ":" + uri;
byte mdbytes[] = messageDigest.digest(A1.getBytes()); byte mdbytes[] = messageDigest.digest(A1.getBytes());
String HA1 = toHexString(mdbytes); String HA1 = toHexString(mdbytes);
System.out.println("A1: " + A1); System.out.println("A1: " + A1);
@ -272,7 +269,7 @@ public class DigestServerAuthenticationHelper {
String HA2 = toHexString(mdbytes); String HA2 = toHexString(mdbytes);
System.out.println("HA1: " + HA1); System.out.println("HA1: " + HA1);
System.out.println("HA2: " + HA2); System.out.println("HA2: " + HA2);
String cnonce = null; String cnonce = "0a4f113b";
System.out.println("nonce: " + nonce); System.out.println("nonce: " + nonce);
System.out.println("nc: " + ncStr); System.out.println("nc: " + ncStr);
System.out.println("cnonce: " + cnonce); System.out.println("cnonce: " + cnonce);
@ -293,7 +290,7 @@ public class DigestServerAuthenticationHelper {
mdbytes = messageDigest.digest(KD.getBytes()); mdbytes = messageDigest.digest(KD.getBytes());
String mdString = toHexString(mdbytes); String mdString = toHexString(mdbytes);
System.out.println("mdString: " + mdString); System.out.println("mdString: " + mdString);
String response = "fdb1608a7a3b96f0598f40b8ba78d6a9"; String response = "4f0507d4b87cdecff04bdaf4c96348f0";
System.out.println("response: " + response); System.out.println("response: " + response);
} }
} }

View File

@ -356,10 +356,10 @@ public class SIPCommander implements ISIPCommander {
logger.warn("点播时发现ZLM尚未连接..."); logger.warn("点播时发现ZLM尚未连接...");
return; return;
} }
String mediaPort = null; Integer mediaPort = null;
// 使用动态udp端口 // 使用动态udp端口
if (mediaConfig.isRtpEnable()) { if (mediaConfig.isRtpEnable()) {
mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + ""; mediaPort = zlmrtpServerFactory.createRTPServer(streamId);
}else { }else {
mediaPort = mediaInfo.getRtpProxyPort(); mediaPort = mediaInfo.getRtpProxyPort();
} }
@ -485,10 +485,10 @@ public class SIPCommander implements ISIPCommander {
content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
String mediaPort = null; Integer mediaPort = null;
// 使用动态udp端口 // 使用动态udp端口
if (mediaConfig.isRtpEnable()) { if (mediaConfig.isRtpEnable()) {
mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + ""; mediaPort = zlmrtpServerFactory.createRTPServer(streamId);
}else { }else {
mediaPort = mediaInfo.getRtpProxyPort(); mediaPort = mediaInfo.getRtpProxyPort();
} }

View File

@ -337,11 +337,6 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
String addressStr = sdp.getOrigin().getAddress(); String addressStr = sdp.getOrigin().getAddress();
logger.info("设备{}请求语音流,地址:{}:{}ssrc{}", username, addressStr, port, ssrc); logger.info("设备{}请求语音流,地址:{}:{}ssrc{}", username, addressStr, port, ssrc);
} else { } else {
logger.warn("来自无效设备/平台的请求"); logger.warn("来自无效设备/平台的请求");
responseAck(evt, Response.BAD_REQUEST); responseAck(evt, Response.BAD_REQUEST);

View File

@ -43,6 +43,8 @@ public class ZLMServerConfig {
private String updateTime; private String updateTime;
private String createTime;
@JSONField(name = "hls.fileBufSize") @JSONField(name = "hls.fileBufSize")
private String hlsFileBufSize; private String hlsFileBufSize;
@ -65,7 +67,7 @@ public class ZLMServerConfig {
private String hookEnable; private String hookEnable;
@JSONField(name = "hook.on_flow_report") @JSONField(name = "hook.on_flow_report")
private String hookOnFlowReport; private Integer hookOnFlowReport;
@JSONField(name = "hook.on_http_access") @JSONField(name = "hook.on_http_access")
private String hookOnHttpAccess; private String hookOnHttpAccess;
@ -116,7 +118,7 @@ public class ZLMServerConfig {
private String httpNotFound; private String httpNotFound;
@JSONField(name = "http.port") @JSONField(name = "http.port")
private String httpPort; private Integer httpPort;
@JSONField(name = "http.rootPath") @JSONField(name = "http.rootPath")
private String httpRootPath; private String httpRootPath;
@ -125,7 +127,7 @@ public class ZLMServerConfig {
private String httpSendBufSize; private String httpSendBufSize;
@JSONField(name = "http.sslport") @JSONField(name = "http.sslport")
private String httpSSLport; private Integer httpSSLport;
@JSONField(name = "multicast.addrMax") @JSONField(name = "multicast.addrMax")
private String multicastAddrMax; private String multicastAddrMax;
@ -158,10 +160,10 @@ public class ZLMServerConfig {
private String rtmpModifyStamp; private String rtmpModifyStamp;
@JSONField(name = "rtmp.port") @JSONField(name = "rtmp.port")
private String rtmpPort; private Integer rtmpPort;
@JSONField(name = "rtmp.sslport") @JSONField(name = "rtmp.sslport")
private String rtmpSslPort; private Integer rtmpSslPort;
@JSONField(name = "rtp.audioMtuSize") @JSONField(name = "rtp.audioMtuSize")
private String rtpAudioMtuSize; private String rtpAudioMtuSize;
@ -185,7 +187,7 @@ public class ZLMServerConfig {
private String rtpProxyDumpDir; private String rtpProxyDumpDir;
@JSONField(name = "rtp_proxy.port") @JSONField(name = "rtp_proxy.port")
private String rtpProxyPort; private Integer rtpProxyPort;
@JSONField(name = "rtp_proxy.timeoutSec") @JSONField(name = "rtp_proxy.timeoutSec")
private String rtpProxyTimeoutSec; private String rtpProxyTimeoutSec;
@ -200,10 +202,10 @@ public class ZLMServerConfig {
private String rtspKeepAliveSecond; private String rtspKeepAliveSecond;
@JSONField(name = "rtsp.port") @JSONField(name = "rtsp.port")
private String rtspPort; private Integer rtspPort;
@JSONField(name = "rtsp.sslport") @JSONField(name = "rtsp.sslport")
private String rtspSSlport; private Integer rtspSSlport;
@JSONField(name = "shell.maxReqSize") @JSONField(name = "shell.maxReqSize")
private String shellMaxReqSize; private String shellMaxReqSize;
@ -211,7 +213,6 @@ public class ZLMServerConfig {
@JSONField(name = "shell.shell") @JSONField(name = "shell.shell")
private String shellPhell; private String shellPhell;
public String getApiDebug() { public String getApiDebug() {
return apiDebug; return apiDebug;
} }
@ -260,6 +261,14 @@ public class ZLMServerConfig {
this.generalEnableVhost = generalEnableVhost; this.generalEnableVhost = generalEnableVhost;
} }
public String getGeneralMediaServerId() {
return generalMediaServerId;
}
public void setGeneralMediaServerId(String generalMediaServerId) {
this.generalMediaServerId = generalMediaServerId;
}
public String getGeneralFlowThreshold() { public String getGeneralFlowThreshold() {
return generalFlowThreshold; return generalFlowThreshold;
} }
@ -292,6 +301,38 @@ public class ZLMServerConfig {
this.ip = 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() { public String getHlsFileBufSize() {
return hlsFileBufSize; return hlsFileBufSize;
} }
@ -348,11 +389,11 @@ public class ZLMServerConfig {
this.hookEnable = hookEnable; this.hookEnable = hookEnable;
} }
public String getHookOnFlowReport() { public Integer getHookOnFlowReport() {
return hookOnFlowReport; return hookOnFlowReport;
} }
public void setHookOnFlowReport(String hookOnFlowReport) { public void setHookOnFlowReport(Integer hookOnFlowReport) {
this.hookOnFlowReport = hookOnFlowReport; this.hookOnFlowReport = hookOnFlowReport;
} }
@ -484,11 +525,11 @@ public class ZLMServerConfig {
this.httpNotFound = httpNotFound; this.httpNotFound = httpNotFound;
} }
public String getHttpPort() { public Integer getHttpPort() {
return httpPort; return httpPort;
} }
public void setHttpPort(String httpPort) { public void setHttpPort(Integer httpPort) {
this.httpPort = httpPort; this.httpPort = httpPort;
} }
@ -508,11 +549,11 @@ public class ZLMServerConfig {
this.httpSendBufSize = httpSendBufSize; this.httpSendBufSize = httpSendBufSize;
} }
public String getHttpSSLport() { public Integer getHttpSSLport() {
return httpSSLport; return httpSSLport;
} }
public void setHttpSSLport(String httpSSLport) { public void setHttpSSLport(Integer httpSSLport) {
this.httpSSLport = httpSSLport; this.httpSSLport = httpSSLport;
} }
@ -596,14 +637,22 @@ public class ZLMServerConfig {
this.rtmpModifyStamp = rtmpModifyStamp; this.rtmpModifyStamp = rtmpModifyStamp;
} }
public String getRtmpPort() { public Integer getRtmpPort() {
return rtmpPort; return rtmpPort;
} }
public void setRtmpPort(String rtmpPort) { public void setRtmpPort(Integer rtmpPort) {
this.rtmpPort = rtmpPort; this.rtmpPort = rtmpPort;
} }
public Integer getRtmpSslPort() {
return rtmpSslPort;
}
public void setRtmpSslPort(Integer rtmpSslPort) {
this.rtmpSslPort = rtmpSslPort;
}
public String getRtpAudioMtuSize() { public String getRtpAudioMtuSize() {
return rtpAudioMtuSize; return rtpAudioMtuSize;
} }
@ -660,11 +709,11 @@ public class ZLMServerConfig {
this.rtpProxyDumpDir = rtpProxyDumpDir; this.rtpProxyDumpDir = rtpProxyDumpDir;
} }
public String getRtpProxyPort() { public Integer getRtpProxyPort() {
return rtpProxyPort; return rtpProxyPort;
} }
public void setRtpProxyPort(String rtpProxyPort) { public void setRtpProxyPort(Integer rtpProxyPort) {
this.rtpProxyPort = rtpProxyPort; this.rtpProxyPort = rtpProxyPort;
} }
@ -700,19 +749,19 @@ public class ZLMServerConfig {
this.rtspKeepAliveSecond = rtspKeepAliveSecond; this.rtspKeepAliveSecond = rtspKeepAliveSecond;
} }
public String getRtspPort() { public Integer getRtspPort() {
return rtspPort; return rtspPort;
} }
public void setRtspPort(String rtspPort) { public void setRtspPort(Integer rtspPort) {
this.rtspPort = rtspPort; this.rtspPort = rtspPort;
} }
public String getRtspSSlport() { public Integer getRtspSSlport() {
return rtspSSlport; return rtspSSlport;
} }
public void setRtspSSlport(String rtspSSlport) { public void setRtspSSlport(Integer rtspSSlport) {
this.rtspSSlport = rtspSSlport; this.rtspSSlport = rtspSSlport;
} }
@ -731,48 +780,4 @@ public class ZLMServerConfig {
public void setShellPhell(String shellPhell) { public void setShellPhell(String shellPhell) {
this.shellPhell = shellPhell; this.shellPhell = shellPhell;
} }
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getGeneralMediaServerId() {
return generalMediaServerId;
}
public void setGeneralMediaServerId(String generalMediaServerId) {
this.generalMediaServerId = generalMediaServerId;
}
public String getRtmpSslPort() {
return rtmpSslPort;
}
public void setRtmpSslPort(String rtmpSslPort) {
this.rtmpSslPort = rtmpSslPort;
}
public String getSdpIp() {
if (StringUtils.isEmpty(sdpIp)) {
return ip;
}else {
return sdpIp;
}
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
public String getStreamIp() {
return streamIp;
}
public void setStreamIp(String streamIp) {
this.streamIp = streamIp;
}
} }

View File

@ -19,12 +19,12 @@ public interface DeviceChannelMapper {
"ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " + "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, datetime('now','localtime'), datetime('now','localtime'))") "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')")
int add(DeviceChannel channel); int add(DeviceChannel channel);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device_channel " + "UPDATE device_channel " +
"SET updateTime=datetime('now','localtime')" + "SET updateTime='${updateTime}'" +
"<if test=\"name != null\">, name='${name}'</if>" + "<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"manufacture != null\">, manufacture='${manufacture}'</if>" + "<if test=\"manufacture != null\">, manufacture='${manufacture}'</if>" +
"<if test=\"model != null\">, model='${model}'</if>" + "<if test=\"model != null\">, model='${model}'</if>" +

View File

@ -47,15 +47,15 @@ public interface DeviceMapper {
"#{expires}," + "#{expires}," +
"#{registerTime}," + "#{registerTime}," +
"#{keepaliveTime}," + "#{keepaliveTime}," +
"datetime('now','localtime')," + "#{createTime}," +
"datetime('now','localtime')," + "#{updateTime}," +
"#{online}" + "#{online}" +
")") ")")
int add(Device device); int add(Device device);
@Update(value = {" <script>" + @Update(value = {" <script>" +
"UPDATE device " + "UPDATE device " +
"SET updateTime=datetime('now','localtime')" + "SET updateTime='${updateTime}'" +
"<if test=\"name != null\">, name='${name}'</if>" + "<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" + "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
"<if test=\"model != null\">, model='${model}'</if>" + "<if test=\"model != null\">, model='${model}'</if>" +

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.storager.impl; package com.genersoft.iot.vmp.storager.impl;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
@ -70,6 +71,8 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
@Autowired @Autowired
private VideoStreamSessionManager streamSession; private VideoStreamSessionManager streamSession;
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/** /**
* 根据设备ID判断设备是否存在 * 根据设备ID判断设备是否存在
@ -103,8 +106,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
*/ */
@Override @Override
public synchronized boolean updateDevice(Device device) { public synchronized boolean updateDevice(Device device) {
String now = this.format.format(new Date(System.currentTimeMillis()));
device.setUpdateTime(now);
Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId()); Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId());
if (deviceByDeviceId == null) { if (deviceByDeviceId == null) {
device.setCreateTime(now);
return deviceMapper.add(device) > 0; return deviceMapper.add(device) > 0;
}else { }else {
return deviceMapper.update(device) > 0; return deviceMapper.update(device) > 0;
@ -117,8 +123,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
String channelId = channel.getChannelId(); String channelId = channel.getChannelId();
channel.setDeviceId(deviceId); channel.setDeviceId(deviceId);
channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId()));
String now = this.format.format(new Date(System.currentTimeMillis()));
channel.setUpdateTime(now);
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
if (deviceChannel == null) { if (deviceChannel == null) {
channel.setCreateTime(now);
deviceChannelMapper.add(channel); deviceChannelMapper.add(channel);
}else { }else {
deviceChannelMapper.update(channel); deviceChannelMapper.update(channel);

View File

@ -19,6 +19,7 @@ spring:
timeout: 10000 timeout: 10000
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置 # [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置
datasource: datasource:
# 使用mysql 打开23-28行注释 删除29-36行
# name: wvp # name: wvp
# url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
# username: # username:

View File

@ -13,16 +13,13 @@
</div> </div>
<!-- <devicePlayer ref="devicePlayer"></devicePlayer> --> <!-- <devicePlayer ref="devicePlayer"></devicePlayer> -->
<!--设备列表--> <!--设备列表-->
<el-table :data="deviceList" border style="width: 100%" :height="winHeight"> <el-table :data="deviceList" border style="width: 100%;font-size: 12px;" :height="winHeight">
<el-table-column prop="name" label="名称" align="center"> <el-table-column prop="name" label="名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deviceId" label="设备编号" width="180" align="center"> <el-table-column prop="deviceId" label="设备编号" width="180" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="manufacturer" label="厂家" align="center"> <el-table-column prop="manufacturer" label="厂家" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="model" label="固件版本" align="center" width="120">
</el-table-column>
<el-table-column label="流传输模式" align="center" width="120"> <el-table-column label="流传输模式" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select size="mini" @change="transportChange(scope.row)" v-model="scope.row.streamMode" placeholder="请选择"> <el-select size="mini" @change="transportChange(scope.row)" v-model="scope.row.streamMode" placeholder="请选择">