Commit b7857027d51eca627a3f092415aa2e0d3b51313c

Authored by lawrencehj
1 parent 2f165d59

去除冗余代码和死代码

Showing 19 changed files with 36 additions and 82 deletions
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
... ... @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.conf;
3 3 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
4 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
5 5 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
6   -import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
7 6 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
8 7 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
9 8 import org.springframework.beans.factory.annotation.Autowired;
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
1 1 package com.genersoft.iot.vmp.gb28181.event.offline;
2 2  
3   -import org.slf4j.Logger;
4   -import org.slf4j.LoggerFactory;
5 3 import org.springframework.beans.factory.annotation.Autowired;
6   -import org.springframework.beans.factory.annotation.Value;
7 4 import org.springframework.data.redis.connection.Message;
8   -import org.springframework.data.redis.connection.MessageListener;
9 5 import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
10 6 import org.springframework.data.redis.listener.RedisMessageListenerContainer;
11 7 import org.springframework.stereotype.Component;
... ... @@ -13,8 +9,6 @@ import org.springframework.stereotype.Component;
13 9 import com.genersoft.iot.vmp.common.VideoManagerConstants;
14 10 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
15 11  
16   -import java.nio.charset.StandardCharsets;
17   -
18 12 /**
19 13 * @Description:设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件
20 14 * @author: swwheihei
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEvent.java
... ... @@ -7,6 +7,11 @@ import org.springframework.context.ApplicationEvent;
7 7 */
8 8 public class PlatformKeepaliveExpireEvent extends ApplicationEvent {
9 9  
  10 + /**
  11 + * Add default serial version ID
  12 + */
  13 + private static final long serialVersionUID = 1L;
  14 +
10 15 private String platformGbID;
11 16  
12 17 public PlatformKeepaliveExpireEvent(Object source) {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
... ... @@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
4 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
5   -import com.genersoft.iot.vmp.gb28181.bean.PlatformRegister;
6 5 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
7 6 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
8 7 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
... ... @@ -52,14 +51,14 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener<P
52 51 }
53 52 ParentPlatform parentPlatform = storager.queryParentPlatById(event.getPlatformGbID());
54 53 ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(event.getPlatformGbID());
55   - parentPlatformCatch.setParentPlatform(parentPlatform);
56   - if (parentPlatform == null) {
57   - logger.debug("平台心跳到期事件事件触发,但平台已经删除!!! 平台国标ID:" + event.getPlatformGbID());
  54 + if (parentPlatformCatch == null) {
58 55 return;
59 56 }
60   - if (parentPlatformCatch == null) {
  57 + if (parentPlatform == null) {
  58 + logger.debug("平台心跳到期事件事件触发,但平台已经删除!!! 平台国标ID:" + event.getPlatformGbID());
61 59 return;
62 60 }
  61 + parentPlatformCatch.setParentPlatform(parentPlatform);
63 62 // 发送心跳
64 63 if (parentPlatformCatch.getKeepAliveReply() >= 3) {
65 64 // 有3次未收到心跳回复, 设置平台状态为离线, 开始重新注册
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEvent.java
1 1 package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
2 2  
3   -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
4 3 import org.springframework.context.ApplicationEvent;
5 4  
6 5 public class PlatformNotRegisterEvent extends ApplicationEvent {
7 6  
  7 + /**
  8 + * Add default serial version ID
  9 + */
  10 + private static final long serialVersionUID = 1L;
  11 +
8 12 private String platformGbID;
9 13  
10 14 public PlatformNotRegisterEvent(Object source) {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
1 1 package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
4   -import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent;
5   -import com.genersoft.iot.vmp.gb28181.event.online.OnlineEventListener;
6 4 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
7 5 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
8   -import com.genersoft.iot.vmp.utils.redis.RedisUtil;
9 6 import org.slf4j.Logger;
10 7 import org.slf4j.LoggerFactory;
11 8 import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.context.ApplicationEvent;
13 9 import org.springframework.context.ApplicationListener;
14 10 import org.springframework.stereotype.Component;
15 11  
... ... @@ -27,11 +23,12 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
27 23  
28 24 @Autowired
29 25 private IVideoManagerStorager storager;
  26 +
30 27 @Autowired
31 28 private SIPCommanderFroPlatform sipCommanderFroPlatform;
32 29  
33   - @Autowired
34   - private RedisUtil redis;
  30 + // @Autowired
  31 + // private RedisUtil redis;
35 32  
36 33 @Override
37 34 public void onApplicationEvent(PlatformNotRegisterEvent event) {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java
... ... @@ -5,8 +5,6 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 5 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
6 6  
7 7 import javax.sip.header.WWWAuthenticateHeader;
8   -import java.nio.channels.Channel;
9   -import java.util.List;
10 8  
11 9 public interface ISIPCommanderForPlatform {
12 10  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.cmd;
2 2  
3 3 import com.genersoft.iot.vmp.conf.SipConfig;
4   -import com.genersoft.iot.vmp.gb28181.bean.Device;
5   -import com.genersoft.iot.vmp.gb28181.bean.Host;
6 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
7   -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
8 5 import org.springframework.beans.factory.annotation.Autowired;
9 6 import org.springframework.beans.factory.annotation.Qualifier;
10 7 import org.springframework.stereotype.Component;
... ... @@ -16,10 +13,8 @@ import javax.sip.address.SipURI;
16 13 import javax.sip.header.*;
17 14 import javax.sip.message.Request;
18 15 import javax.validation.constraints.NotNull;
19   -import java.nio.channels.Channel;
20 16 import java.text.ParseException;
21 17 import java.util.ArrayList;
22   -import java.util.List;
23 18 import java.util.UUID;
24 19  
25 20 /**
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
... ... @@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
2 2  
3 3 import java.text.ParseException;
4 4 import java.util.ArrayList;
5   -import java.util.UUID;
6 5  
7 6 import javax.sip.InvalidArgumentException;
8 7 import javax.sip.PeerUnavailableException;
... ... @@ -12,17 +11,13 @@ import javax.sip.address.Address;
12 11 import javax.sip.address.SipURI;
13 12 import javax.sip.header.*;
14 13 import javax.sip.message.Request;
15   -import javax.validation.constraints.NotNull;
16 14  
17   -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
18 15 import org.springframework.beans.factory.annotation.Autowired;
19 16 import org.springframework.beans.factory.annotation.Qualifier;
20 17 import org.springframework.stereotype.Component;
21 18  
22 19 import com.genersoft.iot.vmp.conf.SipConfig;
23 20 import com.genersoft.iot.vmp.gb28181.bean.Device;
24   -import com.genersoft.iot.vmp.gb28181.bean.Host;
25   -import org.springframework.util.DigestUtils;
26 21  
27 22 /**
28 23 * @Description:摄像头命令request创造器 TODO 冗余代码太多待优化
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl;
2 2  
3   -import com.genersoft.iot.vmp.conf.SipConfig;
4   -import com.genersoft.iot.vmp.gb28181.bean.Device;
  3 +//import com.genersoft.iot.vmp.conf.SipConfig;
  4 +//import com.genersoft.iot.vmp.gb28181.bean.Device;
5 5 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
6 6 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
7 7 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
8 8 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
9   -import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
  9 +//import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
10 10 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
11 11 import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider;
12   -import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider;
  12 +//import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider;
13 13 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
14   -import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
  14 +//import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
15 15 import org.springframework.beans.factory.annotation.Autowired;
16 16 import org.springframework.beans.factory.annotation.Qualifier;
17 17 import org.springframework.beans.factory.annotation.Value;
... ... @@ -22,28 +22,26 @@ import javax.sip.*;
22 22 import javax.sip.header.CallIdHeader;
23 23 import javax.sip.header.WWWAuthenticateHeader;
24 24 import javax.sip.message.Request;
25   -import java.nio.channels.Channel;
26 25 import java.text.ParseException;
27   -import java.util.List;
28 26 import java.util.UUID;
29 27  
30 28 @Component
31 29 public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
32 30  
33   - @Autowired
34   - private SipConfig sipConfig;
  31 + // @Autowired
  32 + // private SipConfig sipConfig;
35 33  
36   - @Autowired
37   - private SIPRequestHeaderProvider headerProvider;
  34 + // @Autowired
  35 + // private SIPRequestHeaderProvider headerProvider;
38 36  
39 37 @Autowired
40 38 private SIPRequestHeaderPlarformProvider headerProviderPlarformProvider;
41 39  
42   - @Autowired
43   - private VideoStreamSessionManager streamSession;
  40 + // @Autowired
  41 + // private VideoStreamSessionManager streamSession;
44 42  
45   - @Autowired
46   - private IVideoManagerStorager storager;
  43 + // @Autowired
  44 + // private IVideoManagerStorager storager;
47 45  
48 46 @Autowired
49 47 private IRedisCatchStorage redisCatchStorage;
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
... ... @@ -9,24 +9,15 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.impl.RegisterRequestProces
9 9 import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor;
10 10 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
11 11 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
12   -import gov.nist.core.Host;
13   -import gov.nist.javax.sip.address.AddressImpl;
14   -import gov.nist.javax.sip.address.SipUri;
15   -import gov.nist.javax.sip.header.To;
16 12 import org.slf4j.Logger;
17 13 import org.slf4j.LoggerFactory;
18 14 import org.springframework.beans.factory.annotation.Autowired;
19 15 import org.springframework.stereotype.Component;
20 16  
21 17 import javax.sip.ResponseEvent;
22   -import javax.sip.address.Address;
23   -import javax.sip.address.URI;
24 18 import javax.sip.header.CallIdHeader;
25   -import javax.sip.header.ExpiresHeader;
26   -import javax.sip.header.ToHeader;
27 19 import javax.sip.header.WWWAuthenticateHeader;
28 20 import javax.sip.message.Response;
29   -import java.util.UUID;
30 21  
31 22 /**
32 23 * @Description:Register响应处理器
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
1 1 package com.genersoft.iot.vmp.media.zlm;
2 2  
3   -import java.math.BigInteger;
4   -import java.text.DecimalFormat;
5   -import java.util.ArrayList;
6   -import java.util.List;
7 3 import java.util.UUID;
8 4  
9 5 import com.alibaba.fastjson.JSON;
10   -import com.alibaba.fastjson.JSONArray;
11 6 import com.genersoft.iot.vmp.common.StreamInfo;
12 7 import com.genersoft.iot.vmp.conf.MediaServerConfig;
13 8 import com.genersoft.iot.vmp.gb28181.bean.Device;
14 9 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
15 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
16   -import com.genersoft.iot.vmp.utils.IpUtil;
17 11 import com.genersoft.iot.vmp.vmanager.service.IPlayService;
18 12 import org.slf4j.Logger;
19 13 import org.slf4j.LoggerFactory;
... ... @@ -57,8 +51,8 @@ public class ZLMHttpHookListener {
57 51 @Autowired
58 52 private IRedisCatchStorage redisCatchStorage;
59 53  
60   - @Autowired
61   - private ZLMRESTfulUtils zlmresTfulUtils;
  54 + // @Autowired
  55 + // private ZLMRESTfulUtils zlmresTfulUtils;
62 56  
63 57 @Autowired
64 58 private ZLMHttpHookSubscribe subscribe;
... ... @@ -217,8 +211,8 @@ public class ZLMHttpHookListener {
217 211 logger.debug("ZLM HOOK on_shell_login API调用,参数:" + json.toString());
218 212 }
219 213 // TODO 如果是带有rtpstream则开启按需拉流
220   - String app = json.getString("app");
221   - String stream = json.getString("stream");
  214 + // String app = json.getString("app");
  215 + // String stream = json.getString("stream");
222 216  
223 217 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
224 218 if (subscribe != null) subscribe.response(json);
... ...
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
1 1 package com.genersoft.iot.vmp.storager;
2 2  
3 3 import java.util.List;
4   -import java.util.Map;
5 4  
6   -import com.genersoft.iot.vmp.common.StreamInfo;
7 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
8 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
9 7 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
10 8 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
11 9 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
12 10 import com.github.pagehelper.PageInfo;
13   -import gov.nist.javax.sip.stack.NioTcpMessageProcessor;
14   -
15   -import javax.swing.event.ChangeEvent;
16 11  
17 12 /**
18 13 * @Description:视频设备数据存储接口
19 14 * @author: swwheihei
20 15 * @date: 2020年5月6日 下午2:14:31
21 16 */
  17 +@SuppressWarnings("rawtypes")
22 18 public interface IVideoManagerStorager {
23 19  
24 20 /**
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
1 1 package com.genersoft.iot.vmp.storager.dao;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4   -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 4 import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
6 5 import org.apache.ibatis.annotations.*;
7 6 import org.springframework.stereotype.Repository;
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
1 1 package com.genersoft.iot.vmp.storager.dao;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.Device;
4   -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 4 import org.apache.ibatis.annotations.*;
6 5 import org.springframework.stereotype.Repository;
7 6  
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
... ... @@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
27 27 * @author: swwheihei
28 28 * @date: 2020年5月6日 下午2:31:42
29 29 */
  30 +@SuppressWarnings("rawtypes")
30 31 @Component
31 32 public class VideoManagerStoragerImpl implements IVideoManagerStorager {
32 33  
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java
1 1 package com.genersoft.iot.vmp.vmanager.platform;
2 2  
3   -import com.alibaba.fastjson.JSON;
4 3 import com.alibaba.fastjson.JSONObject;
5 4 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
6 5 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
... ... @@ -18,10 +17,6 @@ import org.springframework.util.StringUtils;
18 17 import org.springframework.web.bind.annotation.*;
19 18 import com.genersoft.iot.vmp.conf.SipConfig;
20 19  
21   -import java.util.List;
22   -import java.util.Map;
23   -
24   -
25 20 @CrossOrigin
26 21 @RestController
27 22 @RequestMapping("/api")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java
1 1 package com.genersoft.iot.vmp.vmanager.play;
2 2  
3   -import com.alibaba.fastjson.JSON;
4 3 import com.genersoft.iot.vmp.common.StreamInfo;
5 4 import com.genersoft.iot.vmp.conf.MediaServerConfig;
6 5 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
... ... @@ -22,12 +21,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
22 21 import org.springframework.web.bind.annotation.RestController;
23 22  
24 23 import com.alibaba.fastjson.JSONObject;
25   -import com.genersoft.iot.vmp.gb28181.bean.Device;
26 24 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
27 25 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
28 26 import org.springframework.web.context.request.async.DeferredResult;
29 27  
30   -import javax.sip.message.Response;
31 28 import java.util.UUID;
32 29  
33 30 @CrossOrigin
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/service/impl/PlayServiceImpl.java
... ... @@ -14,7 +14,6 @@ import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
14 14 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
15 15 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
16 16 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
17   -import com.genersoft.iot.vmp.vmanager.play.PlayController;
18 17 import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
19 18 import com.genersoft.iot.vmp.vmanager.service.IPlayService;
20 19 import org.slf4j.Logger;
... ... @@ -25,7 +24,6 @@ import org.springframework.stereotype.Service;
25 24 import org.springframework.web.context.request.async.DeferredResult;
26 25  
27 26 import javax.sip.message.Response;
28   -import java.text.DecimalFormat;
29 27 import java.util.UUID;
30 28  
31 29 @Service
... ...