Commit 1c95f1b4aa45f5fbe16b3ff2e00c560dd5d84550

Authored by 648540858
1 parent 5cfaad2d

移除多余字段

DOCKERFILE
@@ -85,7 +85,7 @@ RUN echo '#!/bin/bash' > run.sh && \ @@ -85,7 +85,7 @@ RUN echo '#!/bin/bash' > run.sh && \
85 echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \ 85 echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
86 echo 'cd /opt/wvp' >> run.sh && \ 86 echo 'cd /opt/wvp' >> run.sh && \
87 echo 'if [${WVP_CONFIG}]; then' >> run.sh && \ 87 echo 'if [${WVP_CONFIG}]; then' >> run.sh && \
88 - echo ' java -jar *.jar --spring.confi g.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \ 88 + echo ' java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
89 echo 'else' >> run.sh && \ 89 echo 'else' >> run.sh && \
90 echo ' java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 --media.ip=127.0.0.1 --media.sdp-ip=${WVP_IP} --sip.ip=${WVP_IP} --media.stream-ip=${WVP_IP}' >> run.sh && \ 90 echo ' java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 --media.ip=127.0.0.1 --media.sdp-ip=${WVP_IP} --sip.ip=${WVP_IP} --media.stream-ip=${WVP_IP}' >> run.sh && \
91 echo 'fi' >> run.sh 91 echo 'fi' >> run.sh
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java
@@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.gb28181.bean; @@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.gb28181.bean;
2 2
3 import org.springframework.stereotype.Component; 3 import org.springframework.stereotype.Component;
4 4
  5 +import java.util.ArrayList;
  6 +import java.util.List;
5 import java.util.concurrent.ConcurrentHashMap; 7 import java.util.concurrent.ConcurrentHashMap;
6 8
7 @Component 9 @Component
@@ -34,4 +36,14 @@ public class SubscribeHolder { @@ -34,4 +36,14 @@ public class SubscribeHolder {
34 public void removeMobilePositionSubscribe(String platformId) { 36 public void removeMobilePositionSubscribe(String platformId) {
35 mobilePositionMap.remove(platformId); 37 mobilePositionMap.remove(platformId);
36 } 38 }
  39 +
  40 + public List<String> getAllCatalogSubscribePlatform() {
  41 + List<String> platforms = new ArrayList<>();
  42 + if(catalogMap.size() > 0) {
  43 + for (String key : catalogMap.keySet()) {
  44 + platforms.add(catalogMap.get(key).getId());
  45 + }
  46 + }
  47 + return platforms;
  48 + }
37 } 49 }
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java
@@ -14,17 +14,11 @@ public class SubscribeInfo { @@ -14,17 +14,11 @@ public class SubscribeInfo {
14 public SubscribeInfo(RequestEvent evt, String id) { 14 public SubscribeInfo(RequestEvent evt, String id) {
15 this.id = id; 15 this.id = id;
16 Request request = evt.getRequest(); 16 Request request = evt.getRequest();
17 - CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);  
18 - this.callId = callIdHeader.getCallId();  
19 - FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME);  
20 - this.fromTag = fromHeader.getTag();  
21 ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME); 17 ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
22 this.expires = expiresHeader.getExpires(); 18 this.expires = expiresHeader.getExpires();
23 EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME); 19 EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME);
24 this.eventId = eventHeader.getEventId(); 20 this.eventId = eventHeader.getEventId();
25 this.eventType = eventHeader.getEventType(); 21 this.eventType = eventHeader.getEventType();
26 - ViaHeader viaHeader = (ViaHeader)request.getHeader(ViaHeader.NAME);  
27 - this.branch = viaHeader.getBranch();  
28 this.transaction = evt.getServerTransaction(); 22 this.transaction = evt.getServerTransaction();
29 this.dialog = evt.getDialog(); 23 this.dialog = evt.getDialog();
30 } 24 }
@@ -34,9 +28,6 @@ public class SubscribeInfo { @@ -34,9 +28,6 @@ public class SubscribeInfo {
34 private String callId; 28 private String callId;
35 private String eventId; 29 private String eventId;
36 private String eventType; 30 private String eventType;
37 - private String fromTag;  
38 - private String toTag;  
39 - private String branch;  
40 private ServerTransaction transaction; 31 private ServerTransaction transaction;
41 private Dialog dialog; 32 private Dialog dialog;
42 33
@@ -52,18 +43,6 @@ public class SubscribeInfo { @@ -52,18 +43,6 @@ public class SubscribeInfo {
52 return callId; 43 return callId;
53 } 44 }
54 45
55 - public String getFromTag() {  
56 - return fromTag;  
57 - }  
58 -  
59 - public void setToTag(String toTag) {  
60 - this.toTag = toTag;  
61 - }  
62 -  
63 - public String getToTag() {  
64 - return toTag;  
65 - }  
66 -  
67 public void setId(String id) { 46 public void setId(String id) {
68 this.id = id; 47 this.id = id;
69 } 48 }
@@ -76,10 +55,6 @@ public class SubscribeInfo { @@ -76,10 +55,6 @@ public class SubscribeInfo {
76 this.callId = callId; 55 this.callId = callId;
77 } 56 }
78 57
79 - public void setFromTag(String fromTag) {  
80 - this.fromTag = fromTag;  
81 - }  
82 -  
83 public String getEventId() { 58 public String getEventId() {
84 return eventId; 59 return eventId;
85 } 60 }
@@ -96,14 +71,6 @@ public class SubscribeInfo { @@ -96,14 +71,6 @@ public class SubscribeInfo {
96 this.eventType = eventType; 71 this.eventType = eventType;
97 } 72 }
98 73
99 - public String getBranch() {  
100 - return branch;  
101 - }  
102 -  
103 - public void setBranch(String branch) {  
104 - this.branch = branch;  
105 - }  
106 -  
107 public ServerTransaction getTransaction() { 74 public ServerTransaction getTransaction() {
108 return transaction; 75 return transaction;
109 } 76 }
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -74,7 +74,7 @@ public class CatalogEventLister implements ApplicationListener&lt;CatalogEvent&gt; { @@ -74,7 +74,7 @@ public class CatalogEventLister implements ApplicationListener&lt;CatalogEvent&gt; {
74 } 74 }
75 }else { 75 }else {
76 // 获取所用订阅 76 // 获取所用订阅
77 - List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); 77 + List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform();
78 if (event.getDeviceChannels() != null) { 78 if (event.getDeviceChannels() != null) {
79 if (platforms.size() > 0) { 79 if (platforms.size() > 0) {
80 for (DeviceChannel deviceChannel : event.getDeviceChannels()) { 80 for (DeviceChannel deviceChannel : event.getDeviceChannels()) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
@@ -158,20 +158,14 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme @@ -158,20 +158,14 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
158 String interval = XmlUtil.getText(rootElement, "Interval"); // GPS上报时间间隔 158 String interval = XmlUtil.getText(rootElement, "Interval"); // GPS上报时间间隔
159 dynamicTask.startCron(key, new GPSSubscribeTask(redisCatchStorage, sipCommanderForPlatform, storager, platformId, sn, key, subscribeHolder), Integer.parseInt(interval)); 159 dynamicTask.startCron(key, new GPSSubscribeTask(redisCatchStorage, sipCommanderForPlatform, storager, platformId, sn, key, subscribeHolder), Integer.parseInt(interval));
160 subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo); 160 subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo);
161 -// redisCatchStorage.updateSubscribe(key, subscribeInfo);  
162 }else if (subscribeInfo.getExpires() == 0) { 161 }else if (subscribeInfo.getExpires() == 0) {
163 dynamicTask.stop(key); 162 dynamicTask.stop(key);
164 -// redisCatchStorage.delSubscribe(key);  
165 subscribeHolder.removeMobilePositionSubscribe(platformId); 163 subscribeHolder.removeMobilePositionSubscribe(platformId);
166 } 164 }
167 165
168 try { 166 try {
169 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); 167 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
170 - Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);  
171 - ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);  
172 - subscribeInfo.setToTag(toHeader.getTag());  
173 - redisCatchStorage.updateSubscribe(key, subscribeInfo);  
174 - 168 + responseXmlAck(evt, resultXml.toString(), parentPlatform);
175 } catch (SipException e) { 169 } catch (SipException e) {
176 e.printStackTrace(); 170 e.printStackTrace();
177 } catch (InvalidArgumentException e) { 171 } catch (InvalidArgumentException e) {
@@ -211,21 +205,14 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme @@ -211,21 +205,14 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
211 .append("</Response>\r\n"); 205 .append("</Response>\r\n");
212 206
213 if (subscribeInfo.getExpires() > 0) { 207 if (subscribeInfo.getExpires() > 0) {
214 -// redisCatchStorage.updateSubscribe(key, subscribeInfo);  
215 subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo); 208 subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo);
216 }else if (subscribeInfo.getExpires() == 0) { 209 }else if (subscribeInfo.getExpires() == 0) {
217 -// redisCatchStorage.delSubscribe(key);  
218 subscribeHolder.removeCatalogSubscribe(platformId); 210 subscribeHolder.removeCatalogSubscribe(platformId);
219 } 211 }
220 212
221 try { 213 try {
222 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); 214 ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
223 - Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);  
224 - ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);  
225 - subscribeInfo.setToTag(toHeader.getTag());  
226 -// redisCatchStorage.updateSubscribe(key, subscribeInfo);  
227 - subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo);  
228 - 215 + responseXmlAck(evt, resultXml.toString(), parentPlatform);
229 } catch (SipException e) { 216 } catch (SipException e) {
230 e.printStackTrace(); 217 e.printStackTrace();
231 } catch (InvalidArgumentException e) { 218 } catch (InvalidArgumentException e) {
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -204,18 +204,8 @@ public interface IRedisCatchStorage { @@ -204,18 +204,8 @@ public interface IRedisCatchStorage {
204 204
205 void resetAllSN(); 205 void resetAllSN();
206 206
207 - void updateSubscribe(String key, SubscribeInfo subscribeInfo);  
208 -  
209 - SubscribeInfo getSubscribe(String key);  
210 -  
211 - void delSubscribe(String key);  
212 -  
213 MediaItem getStreamInfo(String app, String streamId, String mediaServerId); 207 MediaItem getStreamInfo(String app, String streamId, String mediaServerId);
214 208
215 - List<SubscribeInfo> getAllSubscribe();  
216 -  
217 - List<String> getAllSubscribePlatform();  
218 -  
219 void addCpuInfo(double cpuInfo); 209 void addCpuInfo(double cpuInfo);
220 210
221 void addMemInfo(double memInfo); 211 void addMemInfo(double memInfo);
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -491,21 +491,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -491,21 +491,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
491 } 491 }
492 492
493 @Override 493 @Override
494 - public void updateSubscribe(String key, SubscribeInfo subscribeInfo) {  
495 - redis.set(key, subscribeInfo, subscribeInfo.getExpires());  
496 - }  
497 -  
498 - @Override  
499 - public SubscribeInfo getSubscribe(String key) {  
500 - return (SubscribeInfo)redis.get(key);  
501 - }  
502 -  
503 - @Override  
504 - public void delSubscribe(String key) {  
505 - redis.del(key);  
506 - }  
507 -  
508 - @Override  
509 public List<GPSMsgInfo> getAllGpsMsgInfo() { 494 public List<GPSMsgInfo> getAllGpsMsgInfo() {
510 String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*"; 495 String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*";
511 List<GPSMsgInfo> result = new ArrayList<>(); 496 List<GPSMsgInfo> result = new ArrayList<>();
@@ -536,32 +521,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -536,32 +521,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
536 } 521 }
537 522
538 @Override 523 @Override
539 - public List<SubscribeInfo> getAllSubscribe() {  
540 - String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_*";  
541 - List<SubscribeInfo> result = new ArrayList<>();  
542 - List<Object> keys = redis.scan(scanKey);  
543 - for (int i = 0; i < keys.size(); i++) {  
544 - String key = (String) keys.get(i);  
545 - SubscribeInfo subscribeInfo = (SubscribeInfo) redis.get(key);  
546 - result.add(subscribeInfo);  
547 - }  
548 - return result;  
549 - }  
550 -  
551 - @Override  
552 - public List<String> getAllSubscribePlatform() {  
553 - String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_*";  
554 - List<String> result = new ArrayList<>();  
555 - List<Object> keys = redis.scan(scanKey);  
556 - for (int i = 0; i < keys.size(); i++) {  
557 - String key = (String) keys.get(i);  
558 - String platformId = key.substring(scanKey.length() - 1);  
559 - result.add(platformId);  
560 - }  
561 - return result;  
562 - }  
563 -  
564 - @Override  
565 public void addCpuInfo(double cpuInfo) { 524 public void addCpuInfo(double cpuInfo) {
566 String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId(); 525 String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId();
567 SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); 526 SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();