Commit 1c95f1b4aa45f5fbe16b3ff2e00c560dd5d84550

Authored by 648540858
1 parent 5cfaad2d

移除多余字段

DOCKERFILE
... ... @@ -85,7 +85,7 @@ RUN echo '#!/bin/bash' > run.sh && \
85 85 echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
86 86 echo 'cd /opt/wvp' >> run.sh && \
87 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 89 echo 'else' >> run.sh && \
90 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 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 2  
3 3 import org.springframework.stereotype.Component;
4 4  
  5 +import java.util.ArrayList;
  6 +import java.util.List;
5 7 import java.util.concurrent.ConcurrentHashMap;
6 8  
7 9 @Component
... ... @@ -34,4 +36,14 @@ public class SubscribeHolder {
34 36 public void removeMobilePositionSubscribe(String platformId) {
35 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 14 public SubscribeInfo(RequestEvent evt, String id) {
15 15 this.id = id;
16 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 17 ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
22 18 this.expires = expiresHeader.getExpires();
23 19 EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME);
24 20 this.eventId = eventHeader.getEventId();
25 21 this.eventType = eventHeader.getEventType();
26   - ViaHeader viaHeader = (ViaHeader)request.getHeader(ViaHeader.NAME);
27   - this.branch = viaHeader.getBranch();
28 22 this.transaction = evt.getServerTransaction();
29 23 this.dialog = evt.getDialog();
30 24 }
... ... @@ -34,9 +28,6 @@ public class SubscribeInfo {
34 28 private String callId;
35 29 private String eventId;
36 30 private String eventType;
37   - private String fromTag;
38   - private String toTag;
39   - private String branch;
40 31 private ServerTransaction transaction;
41 32 private Dialog dialog;
42 33  
... ... @@ -52,18 +43,6 @@ public class SubscribeInfo {
52 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 46 public void setId(String id) {
68 47 this.id = id;
69 48 }
... ... @@ -76,10 +55,6 @@ public class SubscribeInfo {
76 55 this.callId = callId;
77 56 }
78 57  
79   - public void setFromTag(String fromTag) {
80   - this.fromTag = fromTag;
81   - }
82   -
83 58 public String getEventId() {
84 59 return eventId;
85 60 }
... ... @@ -96,14 +71,6 @@ public class SubscribeInfo {
96 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 74 public ServerTransaction getTransaction() {
108 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 74 }
75 75 }else {
76 76 // 获取所用订阅
77   - List<String> platforms = redisCatchStorage.getAllSubscribePlatform();
  77 + List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform();
78 78 if (event.getDeviceChannels() != null) {
79 79 if (platforms.size() > 0) {
80 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 158 String interval = XmlUtil.getText(rootElement, "Interval"); // GPS上报时间间隔
159 159 dynamicTask.startCron(key, new GPSSubscribeTask(redisCatchStorage, sipCommanderForPlatform, storager, platformId, sn, key, subscribeHolder), Integer.parseInt(interval));
160 160 subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo);
161   -// redisCatchStorage.updateSubscribe(key, subscribeInfo);
162 161 }else if (subscribeInfo.getExpires() == 0) {
163 162 dynamicTask.stop(key);
164   -// redisCatchStorage.delSubscribe(key);
165 163 subscribeHolder.removeMobilePositionSubscribe(platformId);
166 164 }
167 165  
168 166 try {
169 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 169 } catch (SipException e) {
176 170 e.printStackTrace();
177 171 } catch (InvalidArgumentException e) {
... ... @@ -211,21 +205,14 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
211 205 .append("</Response>\r\n");
212 206  
213 207 if (subscribeInfo.getExpires() > 0) {
214   -// redisCatchStorage.updateSubscribe(key, subscribeInfo);
215 208 subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo);
216 209 }else if (subscribeInfo.getExpires() == 0) {
217   -// redisCatchStorage.delSubscribe(key);
218 210 subscribeHolder.removeCatalogSubscribe(platformId);
219 211 }
220 212  
221 213 try {
222 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 216 } catch (SipException e) {
230 217 e.printStackTrace();
231 218 } catch (InvalidArgumentException e) {
... ...
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
... ... @@ -204,18 +204,8 @@ public interface IRedisCatchStorage {
204 204  
205 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 207 MediaItem getStreamInfo(String app, String streamId, String mediaServerId);
214 208  
215   - List<SubscribeInfo> getAllSubscribe();
216   -
217   - List<String> getAllSubscribePlatform();
218   -
219 209 void addCpuInfo(double cpuInfo);
220 210  
221 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 491 }
492 492  
493 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 494 public List<GPSMsgInfo> getAllGpsMsgInfo() {
510 495 String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*";
511 496 List<GPSMsgInfo> result = new ArrayList<>();
... ... @@ -536,32 +521,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
536 521 }
537 522  
538 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 524 public void addCpuInfo(double cpuInfo) {
566 525 String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId();
567 526 SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
... ...