Commit 377f0f2c8231df27c0d385f3e2a8bcc4bec547de

Authored by 64850858
1 parent 4c4b62cb

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

src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
... ... @@ -21,25 +21,25 @@ public class MediaConfig {
21 21 private String streamIp;
22 22  
23 23 @Value("${media.httpPort}")
24   - private String httpPort;
  24 + private Integer httpPort;
25 25  
26 26 @Value("${media.httpSSlPort:}")
27   - private String httpSSlPort;
  27 + private Integer httpSSlPort;
28 28  
29 29 @Value("${media.rtmpPort:}")
30   - private String rtmpPort;
  30 + private Integer rtmpPort;
31 31  
32 32 @Value("${media.rtmpSSlPort:}")
33   - private String rtmpSSlPort;
  33 + private Integer rtmpSSlPort;
34 34  
35 35 @Value("${media.rtpProxyPort:}")
36   - private String rtpProxyPort;
  36 + private Integer rtpProxyPort;
37 37  
38 38 @Value("${media.rtspPort:}")
39   - private String rtspPort;
  39 + private Integer rtspPort;
40 40  
41 41 @Value("${media.rtspSSLPort:}")
42   - private String rtspSSLPort;
  42 + private Integer rtspSSLPort;
43 43  
44 44 @Value("${media.autoConfig:true}")
45 45 private boolean autoConfig;
... ... @@ -57,73 +57,141 @@ public class MediaConfig {
57 57 private String rtpPortRange;
58 58  
59 59 @Value("${media.recordAssistPort}")
60   - private int recordAssistPort;
  60 + private Integer recordAssistPort;
61 61  
62 62 public String getIp() {
63 63 return ip;
64 64 }
65 65  
  66 + public void setIp(String ip) {
  67 + this.ip = ip;
  68 + }
  69 +
66 70 public String getHookIp() {
67 71 return hookIp;
68 72 }
69 73  
  74 + public void setHookIp(String hookIp) {
  75 + this.hookIp = hookIp;
  76 + }
  77 +
70 78 public String getSdpIp() {
71 79 return sdpIp;
72 80 }
73 81  
  82 + public void setSdpIp(String sdpIp) {
  83 + this.sdpIp = sdpIp;
  84 + }
  85 +
74 86 public String getStreamIp() {
75 87 return streamIp;
76 88 }
77 89  
78   - public String getHttpPort() {
  90 + public void setStreamIp(String streamIp) {
  91 + this.streamIp = streamIp;
  92 + }
  93 +
  94 + public Integer getHttpPort() {
79 95 return httpPort;
80 96 }
81 97  
82   - public String getHttpSSlPort() {
  98 + public void setHttpPort(Integer httpPort) {
  99 + this.httpPort = httpPort;
  100 + }
  101 +
  102 + public Integer getHttpSSlPort() {
83 103 return httpSSlPort;
84 104 }
85 105  
86   - public String getRtmpPort() {
  106 + public void setHttpSSlPort(Integer httpSSlPort) {
  107 + this.httpSSlPort = httpSSlPort;
  108 + }
  109 +
  110 + public Integer getRtmpPort() {
87 111 return rtmpPort;
88 112 }
89 113  
90   - public String getRtmpSSlPort() {
  114 + public void setRtmpPort(Integer rtmpPort) {
  115 + this.rtmpPort = rtmpPort;
  116 + }
  117 +
  118 + public Integer getRtmpSSlPort() {
91 119 return rtmpSSlPort;
92 120 }
93 121  
94   - public String getRtpProxyPort() {
  122 + public void setRtmpSSlPort(Integer rtmpSSlPort) {
  123 + this.rtmpSSlPort = rtmpSSlPort;
  124 + }
  125 +
  126 + public Integer getRtpProxyPort() {
95 127 return rtpProxyPort;
96 128 }
97 129  
98   - public String getRtspPort() {
  130 + public void setRtpProxyPort(Integer rtpProxyPort) {
  131 + this.rtpProxyPort = rtpProxyPort;
  132 + }
  133 +
  134 + public Integer getRtspPort() {
99 135 return rtspPort;
100 136 }
101 137  
102   - public String getRtspSSLPort() {
  138 + public void setRtspPort(Integer rtspPort) {
  139 + this.rtspPort = rtspPort;
  140 + }
  141 +
  142 + public Integer getRtspSSLPort() {
103 143 return rtspSSLPort;
104 144 }
105 145  
  146 + public void setRtspSSLPort(Integer rtspSSLPort) {
  147 + this.rtspSSLPort = rtspSSLPort;
  148 + }
  149 +
106 150 public boolean isAutoConfig() {
107 151 return autoConfig;
108 152 }
109 153  
  154 + public void setAutoConfig(boolean autoConfig) {
  155 + this.autoConfig = autoConfig;
  156 + }
  157 +
110 158 public String getSecret() {
111 159 return secret;
112 160 }
113 161  
  162 + public void setSecret(String secret) {
  163 + this.secret = secret;
  164 + }
  165 +
114 166 public String getStreamNoneReaderDelayMS() {
115 167 return streamNoneReaderDelayMS;
116 168 }
117 169  
  170 + public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) {
  171 + this.streamNoneReaderDelayMS = streamNoneReaderDelayMS;
  172 + }
  173 +
118 174 public boolean isRtpEnable() {
119 175 return rtpEnable;
120 176 }
121 177  
  178 + public void setRtpEnable(boolean rtpEnable) {
  179 + this.rtpEnable = rtpEnable;
  180 + }
  181 +
122 182 public String getRtpPortRange() {
123 183 return rtpPortRange;
124 184 }
125 185  
126   - public int getRecordAssistPort() {
  186 + public void setRtpPortRange(String rtpPortRange) {
  187 + this.rtpPortRange = rtpPortRange;
  188 + }
  189 +
  190 + public Integer getRecordAssistPort() {
127 191 return recordAssistPort;
128 192 }
  193 +
  194 + public void setRecordAssistPort(Integer recordAssistPort) {
  195 + this.recordAssistPort = recordAssistPort;
  196 + }
129 197 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
... ... @@ -109,13 +109,10 @@ public class DigestServerAuthenticationHelper {
109 109 WWWAuthenticateHeader proxyAuthenticate = headerFactory
110 110 .createWWWAuthenticateHeader(DEFAULT_SCHEME);
111 111 proxyAuthenticate.setParameter("realm", realm);
  112 + proxyAuthenticate.setParameter("qop", "auth");
112 113 proxyAuthenticate.setParameter("nonce", generateNonce());
113   -
114   - proxyAuthenticate.setParameter("opaque", "");
115   - proxyAuthenticate.setParameter("stale", "FALSE");
116 114 proxyAuthenticate.setParameter("algorithm", DEFAULT_ALGORITHM);
117 115  
118   -// proxyAuthenticate.setParameter("qop", "auth");
119 116 response.setHeader(proxyAuthenticate);
120 117 } catch (Exception ex) {
121 118 InternalErrorHandler.handleException(ex);
... ... @@ -243,26 +240,26 @@ public class DigestServerAuthenticationHelper {
243 240 }
244 241  
245 242 public static void main(String[] args) throws NoSuchAlgorithmException {
246   - String realm = "4401000000";
247   - String username = "44010000001110008008";
  243 + String realm = "3402000000";
  244 + String username = "44010000001180008012";
248 245  
249 246  
250   - String nonce = "0074b397f86fc263b1b7f9eb72553267";
251   - String uri = "sip:44010000002000000001@4401000000";
  247 + String nonce = "07cab60999fbf643264ace27d3b7de8b";
  248 + String uri = "sip:34020000002000000001@3402000000";
252 249 // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略
253   - String qop = null;
  250 + String qop = "auth";
254 251  
255 252 // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。
256 253 // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护
257 254 //String cNonce = authHeader.getCNonce();
258 255  
259 256 // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量
260   - int nc = -1;
  257 + int nc = 1;
261 258 String ncStr = new DecimalFormat("00000000").format(nc);
262 259 // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
263 260 MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
264   - String A1 = username + ":" + realm + ":" + "crservice@123";
265   - String A2 = "REGISTER" + ":" + uri.toString();
  261 + String A1 = username + ":" + realm + ":" + "12345678";
  262 + String A2 = "REGISTER" + ":" + uri;
266 263 byte mdbytes[] = messageDigest.digest(A1.getBytes());
267 264 String HA1 = toHexString(mdbytes);
268 265 System.out.println("A1: " + A1);
... ... @@ -272,7 +269,7 @@ public class DigestServerAuthenticationHelper {
272 269 String HA2 = toHexString(mdbytes);
273 270 System.out.println("HA1: " + HA1);
274 271 System.out.println("HA2: " + HA2);
275   - String cnonce = null;
  272 + String cnonce = "0a4f113b";
276 273 System.out.println("nonce: " + nonce);
277 274 System.out.println("nc: " + ncStr);
278 275 System.out.println("cnonce: " + cnonce);
... ... @@ -293,7 +290,7 @@ public class DigestServerAuthenticationHelper {
293 290 mdbytes = messageDigest.digest(KD.getBytes());
294 291 String mdString = toHexString(mdbytes);
295 292 System.out.println("mdString: " + mdString);
296   - String response = "fdb1608a7a3b96f0598f40b8ba78d6a9";
  293 + String response = "4f0507d4b87cdecff04bdaf4c96348f0";
297 294 System.out.println("response: " + response);
298 295 }
299 296 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
... ... @@ -356,10 +356,10 @@ public class SIPCommander implements ISIPCommander {
356 356 logger.warn("点播时发现ZLM尚未连接...");
357 357 return;
358 358 }
359   - String mediaPort = null;
  359 + Integer mediaPort = null;
360 360 // 使用动态udp端口
361 361 if (mediaConfig.isRtpEnable()) {
362   - mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + "";
  362 + mediaPort = zlmrtpServerFactory.createRTPServer(streamId);
363 363 }else {
364 364 mediaPort = mediaInfo.getRtpProxyPort();
365 365 }
... ... @@ -485,10 +485,10 @@ public class SIPCommander implements ISIPCommander {
485 485 content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
486 486 content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
487 487 +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
488   - String mediaPort = null;
  488 + Integer mediaPort = null;
489 489 // 使用动态udp端口
490 490 if (mediaConfig.isRtpEnable()) {
491   - mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + "";
  491 + mediaPort = zlmrtpServerFactory.createRTPServer(streamId);
492 492 }else {
493 493 mediaPort = mediaInfo.getRtpProxyPort();
494 494 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
... ... @@ -336,11 +336,6 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
336 336 String username = sdp.getOrigin().getUsername();
337 337 String addressStr = sdp.getOrigin().getAddress();
338 338 logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}", username, addressStr, port, ssrc);
339   -
340   -
341   -
342   -
343   -
344 339  
345 340 } else {
346 341 logger.warn("来自无效设备/平台的请求");
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java
... ... @@ -43,6 +43,8 @@ public class ZLMServerConfig {
43 43  
44 44 private String updateTime;
45 45  
  46 + private String createTime;
  47 +
46 48 @JSONField(name = "hls.fileBufSize")
47 49 private String hlsFileBufSize;
48 50  
... ... @@ -65,7 +67,7 @@ public class ZLMServerConfig {
65 67 private String hookEnable;
66 68  
67 69 @JSONField(name = "hook.on_flow_report")
68   - private String hookOnFlowReport;
  70 + private Integer hookOnFlowReport;
69 71  
70 72 @JSONField(name = "hook.on_http_access")
71 73 private String hookOnHttpAccess;
... ... @@ -116,7 +118,7 @@ public class ZLMServerConfig {
116 118 private String httpNotFound;
117 119  
118 120 @JSONField(name = "http.port")
119   - private String httpPort;
  121 + private Integer httpPort;
120 122  
121 123 @JSONField(name = "http.rootPath")
122 124 private String httpRootPath;
... ... @@ -125,7 +127,7 @@ public class ZLMServerConfig {
125 127 private String httpSendBufSize;
126 128  
127 129 @JSONField(name = "http.sslport")
128   - private String httpSSLport;
  130 + private Integer httpSSLport;
129 131  
130 132 @JSONField(name = "multicast.addrMax")
131 133 private String multicastAddrMax;
... ... @@ -158,10 +160,10 @@ public class ZLMServerConfig {
158 160 private String rtmpModifyStamp;
159 161  
160 162 @JSONField(name = "rtmp.port")
161   - private String rtmpPort;
  163 + private Integer rtmpPort;
162 164  
163 165 @JSONField(name = "rtmp.sslport")
164   - private String rtmpSslPort;
  166 + private Integer rtmpSslPort;
165 167  
166 168 @JSONField(name = "rtp.audioMtuSize")
167 169 private String rtpAudioMtuSize;
... ... @@ -185,7 +187,7 @@ public class ZLMServerConfig {
185 187 private String rtpProxyDumpDir;
186 188  
187 189 @JSONField(name = "rtp_proxy.port")
188   - private String rtpProxyPort;
  190 + private Integer rtpProxyPort;
189 191  
190 192 @JSONField(name = "rtp_proxy.timeoutSec")
191 193 private String rtpProxyTimeoutSec;
... ... @@ -200,10 +202,10 @@ public class ZLMServerConfig {
200 202 private String rtspKeepAliveSecond;
201 203  
202 204 @JSONField(name = "rtsp.port")
203   - private String rtspPort;
  205 + private Integer rtspPort;
204 206  
205 207 @JSONField(name = "rtsp.sslport")
206   - private String rtspSSlport;
  208 + private Integer rtspSSlport;
207 209  
208 210 @JSONField(name = "shell.maxReqSize")
209 211 private String shellMaxReqSize;
... ... @@ -211,7 +213,6 @@ public class ZLMServerConfig {
211 213 @JSONField(name = "shell.shell")
212 214 private String shellPhell;
213 215  
214   -
215 216 public String getApiDebug() {
216 217 return apiDebug;
217 218 }
... ... @@ -260,6 +261,14 @@ public class ZLMServerConfig {
260 261 this.generalEnableVhost = generalEnableVhost;
261 262 }
262 263  
  264 + public String getGeneralMediaServerId() {
  265 + return generalMediaServerId;
  266 + }
  267 +
  268 + public void setGeneralMediaServerId(String generalMediaServerId) {
  269 + this.generalMediaServerId = generalMediaServerId;
  270 + }
  271 +
263 272 public String getGeneralFlowThreshold() {
264 273 return generalFlowThreshold;
265 274 }
... ... @@ -292,6 +301,38 @@ public class ZLMServerConfig {
292 301 this.ip = ip;
293 302 }
294 303  
  304 + public String getSdpIp() {
  305 + return sdpIp;
  306 + }
  307 +
  308 + public void setSdpIp(String sdpIp) {
  309 + this.sdpIp = sdpIp;
  310 + }
  311 +
  312 + public String getStreamIp() {
  313 + return streamIp;
  314 + }
  315 +
  316 + public void setStreamIp(String streamIp) {
  317 + this.streamIp = streamIp;
  318 + }
  319 +
  320 + public String getUpdateTime() {
  321 + return updateTime;
  322 + }
  323 +
  324 + public void setUpdateTime(String updateTime) {
  325 + this.updateTime = updateTime;
  326 + }
  327 +
  328 + public String getCreateTime() {
  329 + return createTime;
  330 + }
  331 +
  332 + public void setCreateTime(String createTime) {
  333 + this.createTime = createTime;
  334 + }
  335 +
295 336 public String getHlsFileBufSize() {
296 337 return hlsFileBufSize;
297 338 }
... ... @@ -348,11 +389,11 @@ public class ZLMServerConfig {
348 389 this.hookEnable = hookEnable;
349 390 }
350 391  
351   - public String getHookOnFlowReport() {
  392 + public Integer getHookOnFlowReport() {
352 393 return hookOnFlowReport;
353 394 }
354 395  
355   - public void setHookOnFlowReport(String hookOnFlowReport) {
  396 + public void setHookOnFlowReport(Integer hookOnFlowReport) {
356 397 this.hookOnFlowReport = hookOnFlowReport;
357 398 }
358 399  
... ... @@ -484,11 +525,11 @@ public class ZLMServerConfig {
484 525 this.httpNotFound = httpNotFound;
485 526 }
486 527  
487   - public String getHttpPort() {
  528 + public Integer getHttpPort() {
488 529 return httpPort;
489 530 }
490 531  
491   - public void setHttpPort(String httpPort) {
  532 + public void setHttpPort(Integer httpPort) {
492 533 this.httpPort = httpPort;
493 534 }
494 535  
... ... @@ -508,11 +549,11 @@ public class ZLMServerConfig {
508 549 this.httpSendBufSize = httpSendBufSize;
509 550 }
510 551  
511   - public String getHttpSSLport() {
  552 + public Integer getHttpSSLport() {
512 553 return httpSSLport;
513 554 }
514 555  
515   - public void setHttpSSLport(String httpSSLport) {
  556 + public void setHttpSSLport(Integer httpSSLport) {
516 557 this.httpSSLport = httpSSLport;
517 558 }
518 559  
... ... @@ -596,14 +637,22 @@ public class ZLMServerConfig {
596 637 this.rtmpModifyStamp = rtmpModifyStamp;
597 638 }
598 639  
599   - public String getRtmpPort() {
  640 + public Integer getRtmpPort() {
600 641 return rtmpPort;
601 642 }
602 643  
603   - public void setRtmpPort(String rtmpPort) {
  644 + public void setRtmpPort(Integer rtmpPort) {
604 645 this.rtmpPort = rtmpPort;
605 646 }
606 647  
  648 + public Integer getRtmpSslPort() {
  649 + return rtmpSslPort;
  650 + }
  651 +
  652 + public void setRtmpSslPort(Integer rtmpSslPort) {
  653 + this.rtmpSslPort = rtmpSslPort;
  654 + }
  655 +
607 656 public String getRtpAudioMtuSize() {
608 657 return rtpAudioMtuSize;
609 658 }
... ... @@ -660,11 +709,11 @@ public class ZLMServerConfig {
660 709 this.rtpProxyDumpDir = rtpProxyDumpDir;
661 710 }
662 711  
663   - public String getRtpProxyPort() {
  712 + public Integer getRtpProxyPort() {
664 713 return rtpProxyPort;
665 714 }
666 715  
667   - public void setRtpProxyPort(String rtpProxyPort) {
  716 + public void setRtpProxyPort(Integer rtpProxyPort) {
668 717 this.rtpProxyPort = rtpProxyPort;
669 718 }
670 719  
... ... @@ -700,19 +749,19 @@ public class ZLMServerConfig {
700 749 this.rtspKeepAliveSecond = rtspKeepAliveSecond;
701 750 }
702 751  
703   - public String getRtspPort() {
  752 + public Integer getRtspPort() {
704 753 return rtspPort;
705 754 }
706 755  
707   - public void setRtspPort(String rtspPort) {
  756 + public void setRtspPort(Integer rtspPort) {
708 757 this.rtspPort = rtspPort;
709 758 }
710 759  
711   - public String getRtspSSlport() {
  760 + public Integer getRtspSSlport() {
712 761 return rtspSSlport;
713 762 }
714 763  
715   - public void setRtspSSlport(String rtspSSlport) {
  764 + public void setRtspSSlport(Integer rtspSSlport) {
716 765 this.rtspSSlport = rtspSSlport;
717 766 }
718 767  
... ... @@ -731,48 +780,4 @@ public class ZLMServerConfig {
731 780 public void setShellPhell(String shellPhell) {
732 781 this.shellPhell = shellPhell;
733 782 }
734   -
735   - public String getUpdateTime() {
736   - return updateTime;
737   - }
738   -
739   - public void setUpdateTime(String updateTime) {
740   - this.updateTime = updateTime;
741   - }
742   -
743   - public String getGeneralMediaServerId() {
744   - return generalMediaServerId;
745   - }
746   -
747   - public void setGeneralMediaServerId(String generalMediaServerId) {
748   - this.generalMediaServerId = generalMediaServerId;
749   - }
750   -
751   - public String getRtmpSslPort() {
752   - return rtmpSslPort;
753   - }
754   -
755   - public void setRtmpSslPort(String rtmpSslPort) {
756   - this.rtmpSslPort = rtmpSslPort;
757   - }
758   -
759   - public String getSdpIp() {
760   - if (StringUtils.isEmpty(sdpIp)) {
761   - return ip;
762   - }else {
763   - return sdpIp;
764   - }
765   - }
766   -
767   - public void setSdpIp(String sdpIp) {
768   - this.sdpIp = sdpIp;
769   - }
770   -
771   - public String getStreamIp() {
772   - return streamIp;
773   - }
774   -
775   - public void setStreamIp(String streamIp) {
776   - this.streamIp = streamIp;
777   - }
778 783 }
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -19,12 +19,12 @@ public interface DeviceChannelMapper {
19 19 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
20 20 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
21 21 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
22   - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, datetime('now','localtime'), datetime('now','localtime'))")
  22 + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')")
23 23 int add(DeviceChannel channel);
24 24  
25 25 @Update(value = {" <script>" +
26 26 "UPDATE device_channel " +
27   - "SET updateTime=datetime('now','localtime')" +
  27 + "SET updateTime='${updateTime}'" +
28 28 "<if test=\"name != null\">, name='${name}'</if>" +
29 29 "<if test=\"manufacture != null\">, manufacture='${manufacture}'</if>" +
30 30 "<if test=\"model != null\">, model='${model}'</if>" +
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
... ... @@ -47,15 +47,15 @@ public interface DeviceMapper {
47 47 "#{expires}," +
48 48 "#{registerTime}," +
49 49 "#{keepaliveTime}," +
50   - "datetime('now','localtime')," +
51   - "datetime('now','localtime')," +
  50 + "#{createTime}," +
  51 + "#{updateTime}," +
52 52 "#{online}" +
53 53 ")")
54 54 int add(Device device);
55 55  
56 56 @Update(value = {" <script>" +
57 57 "UPDATE device " +
58   - "SET updateTime=datetime('now','localtime')" +
  58 + "SET updateTime='${updateTime}'" +
59 59 "<if test=\"name != null\">, name='${name}'</if>" +
60 60 "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
61 61 "<if test=\"model != null\">, model='${model}'</if>" +
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
1 1 package com.genersoft.iot.vmp.storager.impl;
2 2  
  3 +import java.text.SimpleDateFormat;
3 4 import java.util.*;
4 5  
5 6 import com.genersoft.iot.vmp.common.StreamInfo;
... ... @@ -70,6 +71,8 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
70 71 @Autowired
71 72 private VideoStreamSessionManager streamSession;
72 73  
  74 + private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  75 +
73 76  
74 77 /**
75 78 * 根据设备ID判断设备是否存在
... ... @@ -103,8 +106,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
103 106 */
104 107 @Override
105 108 public synchronized boolean updateDevice(Device device) {
  109 + String now = this.format.format(new Date(System.currentTimeMillis()));
  110 + device.setUpdateTime(now);
106 111 Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId());
107 112 if (deviceByDeviceId == null) {
  113 + device.setCreateTime(now);
108 114 return deviceMapper.add(device) > 0;
109 115 }else {
110 116 return deviceMapper.update(device) > 0;
... ... @@ -117,8 +123,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
117 123 String channelId = channel.getChannelId();
118 124 channel.setDeviceId(deviceId);
119 125 channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId()));
  126 + String now = this.format.format(new Date(System.currentTimeMillis()));
  127 + channel.setUpdateTime(now);
120 128 DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
121 129 if (deviceChannel == null) {
  130 + channel.setCreateTime(now);
122 131 deviceChannelMapper.add(channel);
123 132 }else {
124 133 deviceChannelMapper.update(channel);
... ...
src/main/resources/all-application.yml
... ... @@ -19,6 +19,7 @@ spring:
19 19 timeout: 10000
20 20 # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置
21 21 datasource:
  22 + # 使用mysql 打开23-28行注释, 删除29-36行
22 23 # name: wvp
23 24 # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
24 25 # username:
... ...
web_src/src/components/DeviceList.vue
... ... @@ -13,16 +13,13 @@
13 13 </div>
14 14 <!-- <devicePlayer ref="devicePlayer"></devicePlayer> -->
15 15 <!--设备列表-->
16   - <el-table :data="deviceList" border style="width: 100%" :height="winHeight">
  16 + <el-table :data="deviceList" border style="width: 100%;font-size: 12px;" :height="winHeight">
17 17 <el-table-column prop="name" label="名称" align="center">
18 18 </el-table-column>
19 19 <el-table-column prop="deviceId" label="设备编号" width="180" align="center">
20 20 </el-table-column>
21   -
22 21 <el-table-column prop="manufacturer" label="厂家" align="center">
23 22 </el-table-column>
24   - <el-table-column prop="model" label="固件版本" align="center" width="120">
25   - </el-table-column>
26 23 <el-table-column label="流传输模式" align="center" width="120">
27 24 <template slot-scope="scope">
28 25 <el-select size="mini" @change="transportChange(scope.row)" v-model="scope.row.streamMode" placeholder="请选择">
... ...