648540858
2022-03-11 1c95f1b4aa45f5fbe16b3ff2e00c560dd5d84550
移除多余字段
7个文件已修改
117 ■■■■ 已修改文件
DOCKERFILE 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DOCKERFILE
@@ -85,7 +85,7 @@
        echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
        echo 'cd /opt/wvp' >> run.sh && \
        echo 'if [${WVP_CONFIG}]; then' >> run.sh && \
        echo '        java -jar *.jar --spring.confi    g.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
        echo '        java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
        echo 'else' >> run.sh && \
        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  && \
        echo 'fi' >> run.sh
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java
@@ -2,6 +2,8 @@
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@Component
@@ -34,4 +36,14 @@
    public void removeMobilePositionSubscribe(String platformId) {
        mobilePositionMap.remove(platformId);
    }
    public List<String> getAllCatalogSubscribePlatform() {
        List<String> platforms = new ArrayList<>();
        if(catalogMap.size() > 0) {
            for (String key : catalogMap.keySet()) {
                platforms.add(catalogMap.get(key).getId());
            }
        }
        return platforms;
    }
}
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java
@@ -14,17 +14,11 @@
    public SubscribeInfo(RequestEvent evt, String id) {
        this.id = id;
        Request request = evt.getRequest();
        CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
        this.callId = callIdHeader.getCallId();
        FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME);
        this.fromTag = fromHeader.getTag();
        ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
        this.expires = expiresHeader.getExpires();
        EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME);
        this.eventId = eventHeader.getEventId();
        this.eventType = eventHeader.getEventType();
        ViaHeader viaHeader = (ViaHeader)request.getHeader(ViaHeader.NAME);
        this.branch = viaHeader.getBranch();
        this.transaction = evt.getServerTransaction();
        this.dialog = evt.getDialog();
    }
@@ -34,9 +28,6 @@
    private String callId;
    private String eventId;
    private String eventType;
    private String fromTag;
    private String toTag;
    private String branch;
    private ServerTransaction transaction;
    private Dialog dialog;
@@ -52,18 +43,6 @@
        return callId;
    }
    public String getFromTag() {
        return fromTag;
    }
    public void setToTag(String toTag) {
        this.toTag = toTag;
    }
    public String getToTag() {
        return toTag;
    }
    public void setId(String id) {
        this.id = id;
    }
@@ -74,10 +53,6 @@
    public void setCallId(String callId) {
        this.callId = callId;
    }
    public void setFromTag(String fromTag) {
        this.fromTag = fromTag;
    }
    public String getEventId() {
@@ -94,14 +69,6 @@
    public void setEventType(String eventType) {
        this.eventType = eventType;
    }
    public String getBranch() {
        return branch;
    }
    public void setBranch(String branch) {
        this.branch = branch;
    }
    public ServerTransaction getTransaction() {
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -74,7 +74,7 @@
            }
        }else {
            // 获取所用订阅
            List<String> platforms = redisCatchStorage.getAllSubscribePlatform();
            List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform();
            if (event.getDeviceChannels() != null) {
                if (platforms.size() > 0) {
                    for (DeviceChannel deviceChannel : event.getDeviceChannels()) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
@@ -158,20 +158,14 @@
            String interval = XmlUtil.getText(rootElement, "Interval"); // GPS上报时间间隔
            dynamicTask.startCron(key, new GPSSubscribeTask(redisCatchStorage, sipCommanderForPlatform, storager,  platformId, sn, key, subscribeHolder), Integer.parseInt(interval));
            subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo);
//            redisCatchStorage.updateSubscribe(key, subscribeInfo);
        }else if (subscribeInfo.getExpires() == 0) {
            dynamicTask.stop(key);
//            redisCatchStorage.delSubscribe(key);
            subscribeHolder.removeMobilePositionSubscribe(platformId);
        }
        try {
            ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
            Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);
            ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
            subscribeInfo.setToTag(toHeader.getTag());
            redisCatchStorage.updateSubscribe(key, subscribeInfo);
            responseXmlAck(evt, resultXml.toString(), parentPlatform);
        } catch (SipException e) {
            e.printStackTrace();
        } catch (InvalidArgumentException e) {
@@ -211,21 +205,14 @@
                .append("</Response>\r\n");
        if (subscribeInfo.getExpires() > 0) {
//            redisCatchStorage.updateSubscribe(key, subscribeInfo);
            subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo);
        }else if (subscribeInfo.getExpires() == 0) {
//            redisCatchStorage.delSubscribe(key);
            subscribeHolder.removeCatalogSubscribe(platformId);
        }
        try {
            ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
            Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);
            ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
            subscribeInfo.setToTag(toHeader.getTag());
//            redisCatchStorage.updateSubscribe(key, subscribeInfo);
            subscribeHolder.putCatalogSubscribe(platformId, subscribeInfo);
            responseXmlAck(evt, resultXml.toString(), parentPlatform);
        } catch (SipException e) {
            e.printStackTrace();
        } catch (InvalidArgumentException e) {
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
@@ -204,17 +204,7 @@
    void resetAllSN();
    void updateSubscribe(String key, SubscribeInfo subscribeInfo);
    SubscribeInfo getSubscribe(String key);
    void delSubscribe(String key);
    MediaItem getStreamInfo(String app, String streamId, String mediaServerId);
    List<SubscribeInfo> getAllSubscribe();
    List<String> getAllSubscribePlatform();
    void addCpuInfo(double cpuInfo);
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -491,21 +491,6 @@
    }
    @Override
    public void updateSubscribe(String key, SubscribeInfo subscribeInfo) {
        redis.set(key, subscribeInfo, subscribeInfo.getExpires());
    }
    @Override
    public SubscribeInfo getSubscribe(String key) {
        return (SubscribeInfo)redis.get(key);
    }
    @Override
    public void delSubscribe(String key) {
        redis.del(key);
    }
    @Override
    public List<GPSMsgInfo> getAllGpsMsgInfo() {
        String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*";
        List<GPSMsgInfo> result = new ArrayList<>();
@@ -532,32 +517,6 @@
            result = (MediaItem)redis.get(key);
        }
        return result;
    }
    @Override
    public List<SubscribeInfo> getAllSubscribe() {
        String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() +  "_Catalog_*";
        List<SubscribeInfo> result = new ArrayList<>();
        List<Object> keys = redis.scan(scanKey);
        for (int i = 0; i < keys.size(); i++) {
            String key = (String) keys.get(i);
            SubscribeInfo subscribeInfo = (SubscribeInfo) redis.get(key);
            result.add(subscribeInfo);
        }
        return result;
    }
    @Override
    public List<String> getAllSubscribePlatform() {
        String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() +  "_Catalog_*";
        List<String> result = new ArrayList<>();
        List<Object> keys = redis.scan(scanKey);
        for (int i = 0; i < keys.size(); i++) {
            String key = (String) keys.get(i);
            String platformId = key.substring(scanKey.length() - 1);
            result.add(platformId);
        }
        return result;
    }