Commit a8603075d4bfb6ebc3248e6662eb700261c0fa56
1 parent
6868577e
去除冗余代码,修正编译报警项
Showing
42 changed files
with
114 additions
and
217 deletions
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
| ... | ... | @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp; |
| 3 | 3 | import java.util.logging.LogManager; |
| 4 | 4 | |
| 5 | 5 | import org.springframework.boot.SpringApplication; |
| 6 | -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
| 7 | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 8 | 7 | |
| 9 | 8 | @SpringBootApplication | ... | ... |
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
src/main/java/com/genersoft/iot/vmp/conf/VManagerConfig.java
| ... | ... | @@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Value; |
| 4 | 4 | import org.springframework.context.annotation.Configuration; |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * @Description:TODO(这里用一句话描述这个类的作用) | |
| 7 | + * @Description: 获取数据库配置 | |
| 8 | 8 | * @author: swwheihei |
| 9 | 9 | * @date: 2020年5月6日 下午2:46:00 |
| 10 | 10 | */ | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
| ... | ... | @@ -91,8 +91,10 @@ public class DigestServerAuthenticationHelper { |
| 91 | 91 | long time = date.getTime(); |
| 92 | 92 | Random rand = new Random(); |
| 93 | 93 | long pad = rand.nextLong(); |
| 94 | - String nonceString = (new Long(time)).toString() | |
| 95 | - + (new Long(pad)).toString(); | |
| 94 | + // String nonceString = (new Long(time)).toString() | |
| 95 | + // + (new Long(pad)).toString(); | |
| 96 | + String nonceString = Long.valueOf(time).toString() | |
| 97 | + + Long.valueOf(pad).toString(); | |
| 96 | 98 | byte mdbytes[] = messageDigest.digest(nonceString.getBytes()); |
| 97 | 99 | // Convert the mdbytes array into a hex string. |
| 98 | 100 | return toHexString(mdbytes); |
| ... | ... | @@ -191,7 +193,7 @@ public class DigestServerAuthenticationHelper { |
| 191 | 193 | |
| 192 | 194 | // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 |
| 193 | 195 | // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 |
| 194 | - String cNonce = authHeader.getCNonce(); | |
| 196 | + //String cNonce = authHeader.getCNonce(); | |
| 195 | 197 | |
| 196 | 198 | // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量 |
| 197 | 199 | int nc = authHeader.getNonceCount(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java
src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java
src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSONObject; | |
| 4 | -import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | |
| 5 | -import org.slf4j.Logger; | |
| 6 | -import org.slf4j.LoggerFactory; | |
| 7 | 3 | import org.springframework.stereotype.Component; |
| 8 | 4 | |
| 9 | 5 | import javax.sip.ResponseEvent; |
| 10 | -import javax.sip.message.Request; | |
| 11 | -import java.util.EventObject; | |
| 12 | 6 | import java.util.Map; |
| 13 | 7 | import java.util.concurrent.ConcurrentHashMap; |
| 14 | 8 | |
| 15 | 9 | @Component |
| 16 | 10 | public class SipSubscribe { |
| 17 | 11 | |
| 18 | - private final static Logger logger = LoggerFactory.getLogger(SipSubscribe.class); | |
| 19 | - | |
| 20 | 12 | private Map<String, SipSubscribe.Event> errorSubscribes = new ConcurrentHashMap<>(); |
| 21 | 13 | |
| 22 | 14 | private Map<String, SipSubscribe.Event> okSubscribes = new ConcurrentHashMap<>(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEvent.java
| ... | ... | @@ -10,6 +10,11 @@ import org.springframework.context.ApplicationEvent; |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | public class AlarmEvent extends ApplicationEvent { |
| 13 | + /** | |
| 14 | + * | |
| 15 | + */ | |
| 16 | + private static final long serialVersionUID = 1L; | |
| 17 | + | |
| 13 | 18 | public AlarmEvent(Object source) { |
| 14 | 19 | super(source); |
| 15 | 20 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEvent.java
| ... | ... | @@ -3,18 +3,17 @@ package com.genersoft.iot.vmp.gb28181.event.offline; |
| 3 | 3 | import org.springframework.context.ApplicationEvent; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * @Description:TODO(这里用一句话描述这个类的作用) | |
| 6 | + * @Description: 离线事件类 | |
| 7 | 7 | * @author: swwheihei |
| 8 | 8 | * @date: 2020年5月6日 上午11:33:13 |
| 9 | 9 | */ |
| 10 | 10 | public class OfflineEvent extends ApplicationEvent { |
| 11 | 11 | |
| 12 | - /** | |
| 13 | - * @Title: OutlineEvent | |
| 14 | - * @Description: TODO(这里用一句话描述这个方法的作用) | |
| 15 | - * @param: @param source | |
| 16 | - * @throws | |
| 17 | - */ | |
| 12 | + /** | |
| 13 | + * | |
| 14 | + */ | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 18 | 17 | public OfflineEvent(Object source) { |
| 19 | 18 | super(source); |
| 20 | 19 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEvent.java
| ... | ... | @@ -3,18 +3,17 @@ package com.genersoft.iot.vmp.gb28181.event.online; |
| 3 | 3 | import org.springframework.context.ApplicationEvent; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * @Description:TODO(这里用一句话描述这个类的作用) | |
| 6 | + * @Description: 在线事件类 | |
| 7 | 7 | * @author: swwheihei |
| 8 | 8 | * @date: 2020年5月6日 上午11:32:56 |
| 9 | 9 | */ |
| 10 | 10 | public class OnlineEvent extends ApplicationEvent { |
| 11 | 11 | |
| 12 | - /** | |
| 13 | - * @Title: OnlineEvent | |
| 14 | - * @Description: TODO(这里用一句话描述这个方法的作用) | |
| 15 | - * @param: @param source | |
| 16 | - * @throws | |
| 17 | - */ | |
| 12 | + /** | |
| 13 | + * | |
| 14 | + */ | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 18 | 17 | public OnlineEvent(Object source) { |
| 19 | 18 | super(source); |
| 20 | 19 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorFactory.java
| ... | ... | @@ -8,10 +8,9 @@ import javax.sip.message.Request; |
| 8 | 8 | import javax.sip.message.Response; |
| 9 | 9 | |
| 10 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 11 | -import org.slf4j.Logger; | |
| 12 | -import org.slf4j.LoggerFactory; | |
| 11 | +// import org.slf4j.Logger; | |
| 12 | +// import org.slf4j.LoggerFactory; | |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | -import org.springframework.beans.factory.annotation.Qualifier; | |
| 15 | 14 | import org.springframework.stereotype.Component; |
| 16 | 15 | |
| 17 | 16 | import com.genersoft.iot.vmp.conf.SipConfig; |
| ... | ... | @@ -40,14 +39,14 @@ import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| 40 | 39 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 41 | 40 | |
| 42 | 41 | /** |
| 43 | - * @Description:TODO(这里用一句话描述这个类的作用) | |
| 42 | + * @Description: SIP信令处理分配 | |
| 44 | 43 | * @author: swwheihei |
| 45 | 44 | * @date: 2020年5月3日 下午4:24:37 |
| 46 | 45 | */ |
| 47 | 46 | @Component |
| 48 | 47 | public class SIPProcessorFactory { |
| 49 | 48 | |
| 50 | - private final static Logger logger = LoggerFactory.getLogger(SIPProcessorFactory.class); | |
| 49 | + // private final static Logger logger = LoggerFactory.getLogger(SIPProcessorFactory.class); | |
| 51 | 50 | |
| 52 | 51 | @Autowired |
| 53 | 52 | private SipConfig sipConfig; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.callback; |
| 2 | 2 | |
| 3 | -import java.util.HashMap; | |
| 4 | 3 | import java.util.Map; |
| 5 | 4 | import java.util.concurrent.ConcurrentHashMap; |
| 6 | 5 | |
| ... | ... | @@ -10,10 +9,11 @@ import org.springframework.stereotype.Component; |
| 10 | 9 | import org.springframework.web.context.request.async.DeferredResult; |
| 11 | 10 | |
| 12 | 11 | /** |
| 13 | - * @Description:TODO(这里用一句话描述这个类的作用) | |
| 12 | + * @Description: 异步请求处理 | |
| 14 | 13 | * @author: swwheihei |
| 15 | 14 | * @date: 2020年5月8日 下午7:59:05 |
| 16 | 15 | */ |
| 16 | +@SuppressWarnings(value = {"rawtypes", "unchecked"}) | |
| 17 | 17 | @Component |
| 18 | 18 | public class DeferredResultHolder { |
| 19 | 19 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
| ... | ... | @@ -18,7 +18,6 @@ import org.springframework.stereotype.Component; |
| 18 | 18 | |
| 19 | 19 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 20 | 20 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 21 | -import com.genersoft.iot.vmp.gb28181.bean.Host; | |
| 22 | 21 | |
| 23 | 22 | /** |
| 24 | 23 | * @Description:摄像头命令request创造器 TODO 冗余代码太多待优化 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl; |
| 2 | 2 | |
| 3 | 3 | import java.text.ParseException; |
| 4 | -import java.util.UUID; | |
| 5 | 4 | import java.util.regex.Matcher; |
| 6 | 5 | import java.util.regex.Pattern; |
| 7 | 6 | |
| 8 | 7 | import javax.sip.*; |
| 9 | 8 | import javax.sip.address.SipURI; |
| 10 | 9 | import javax.sip.header.CallIdHeader; |
| 11 | -import javax.sip.header.Header; | |
| 12 | 10 | import javax.sip.header.ViaHeader; |
| 13 | 11 | import javax.sip.message.Request; |
| 14 | 12 | |
| 15 | 13 | import com.alibaba.fastjson.JSONObject; |
| 16 | 14 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 17 | 15 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 18 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 19 | 16 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 20 | 17 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| 21 | 18 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/NotifyRequestProcessor.java
| ... | ... | @@ -50,26 +50,20 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 50 | 50 | |
| 51 | 51 | private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class); |
| 52 | 52 | |
| 53 | - private SIPCommander cmder; | |
| 54 | - | |
| 55 | 53 | private IVideoManagerStorager storager; |
| 56 | 54 | |
| 57 | 55 | private IRedisCatchStorage redisCatchStorage; |
| 58 | 56 | |
| 59 | 57 | private EventPublisher publisher; |
| 60 | 58 | |
| 61 | - private RedisUtil redis; | |
| 62 | - | |
| 63 | - private DeferredResultHolder deferredResultHolder; | |
| 64 | - | |
| 65 | 59 | private DeviceOffLineDetector offLineDetector; |
| 66 | 60 | |
| 67 | 61 | private static final String NOTIFY_CATALOG = "Catalog"; |
| 68 | 62 | private static final String NOTIFY_ALARM = "Alarm"; |
| 69 | 63 | private static final String NOTIFY_MOBILE_POSITION = "MobilePosition"; |
| 70 | 64 | |
| 71 | - @Override | |
| 72 | - public void process(RequestEvent evt) { | |
| 65 | + @Override | |
| 66 | + public void process(RequestEvent evt) { | |
| 73 | 67 | try { |
| 74 | 68 | Element rootElement = getRootElement(evt); |
| 75 | 69 | String cmd = XmlUtil.getText(rootElement, "CmdType"); |
| ... | ... | @@ -87,18 +81,19 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 87 | 81 | logger.info("接收到消息:" + cmd); |
| 88 | 82 | response200Ok(evt); |
| 89 | 83 | } |
| 90 | - } catch (DocumentException | SipException |InvalidArgumentException | ParseException e) { | |
| 84 | + } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { | |
| 91 | 85 | e.printStackTrace(); |
| 92 | 86 | } |
| 93 | - } | |
| 87 | + } | |
| 94 | 88 | |
| 95 | 89 | /** |
| 96 | 90 | * 处理MobilePosition移动位置Notify |
| 91 | + * | |
| 97 | 92 | * @param evt |
| 98 | 93 | */ |
| 99 | 94 | private void processNotifyMobilePosition(RequestEvent evt) { |
| 100 | 95 | try { |
| 101 | - //回复 200 OK | |
| 96 | + // 回复 200 OK | |
| 102 | 97 | Element rootElement = getRootElement(evt); |
| 103 | 98 | MobilePosition mobilePosition = new MobilePosition(); |
| 104 | 99 | Element deviceIdElement = rootElement.element("DeviceID"); |
| ... | ... | @@ -112,8 +107,8 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 112 | 107 | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); |
| 113 | 108 | mobilePosition.setTime(XmlUtil.getText(rootElement, "Time")); |
| 114 | 109 | mobilePosition.setLongitude(Double.parseDouble(XmlUtil.getText(rootElement, "Longitude"))); |
| 115 | - mobilePosition.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude"))); | |
| 116 | - if (NumericUtil.isDouble(XmlUtil.getText(rootElement, "Speed"))) { | |
| 110 | + mobilePosition.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude"))); | |
| 111 | + if (NumericUtil.isDouble(XmlUtil.getText(rootElement, "Speed"))) { | |
| 117 | 112 | mobilePosition.setSpeed(Double.parseDouble(XmlUtil.getText(rootElement, "Speed"))); |
| 118 | 113 | } else { |
| 119 | 114 | mobilePosition.setSpeed(0.0); |
| ... | ... | @@ -147,6 +142,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 147 | 142 | |
| 148 | 143 | /*** |
| 149 | 144 | * 处理alarm设备报警Notify |
| 145 | + * | |
| 150 | 146 | * @param evt |
| 151 | 147 | */ |
| 152 | 148 | private void processNotifyAlarm(RequestEvent evt) { |
| ... | ... | @@ -180,7 +176,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 180 | 176 | deviceAlarm.setLatitude(0.00); |
| 181 | 177 | } |
| 182 | 178 | |
| 183 | - if ( deviceAlarm.getAlarmMethod().equals("4")) { | |
| 179 | + if (deviceAlarm.getAlarmMethod().equals("4")) { | |
| 184 | 180 | MobilePosition mobilePosition = new MobilePosition(); |
| 185 | 181 | mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); |
| 186 | 182 | mobilePosition.setTime(deviceAlarm.getAlarmTime()); |
| ... | ... | @@ -245,7 +241,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 245 | 241 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 246 | 242 | deviceChannel.setName(channelName); |
| 247 | 243 | deviceChannel.setChannelId(channelDeviceId); |
| 248 | - // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 | |
| 244 | + // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 | |
| 249 | 245 | if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { |
| 250 | 246 | deviceChannel.setStatus(1); |
| 251 | 247 | } |
| ... | ... | @@ -259,29 +255,34 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 259 | 255 | deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); |
| 260 | 256 | deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); |
| 261 | 257 | deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); |
| 262 | - if (XmlUtil.getText(itemDevice, "Parental") == null || XmlUtil.getText(itemDevice, "Parental") == "") { | |
| 258 | + if (XmlUtil.getText(itemDevice, "Parental") == null | |
| 259 | + || XmlUtil.getText(itemDevice, "Parental") == "") { | |
| 263 | 260 | deviceChannel.setParental(0); |
| 264 | 261 | } else { |
| 265 | 262 | deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental"))); |
| 266 | - } | |
| 263 | + } | |
| 267 | 264 | deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); |
| 268 | - if (XmlUtil.getText(itemDevice, "SafetyWay") == null || XmlUtil.getText(itemDevice, "SafetyWay")== "") { | |
| 265 | + if (XmlUtil.getText(itemDevice, "SafetyWay") == null | |
| 266 | + || XmlUtil.getText(itemDevice, "SafetyWay") == "") { | |
| 269 | 267 | deviceChannel.setSafetyWay(0); |
| 270 | 268 | } else { |
| 271 | 269 | deviceChannel.setSafetyWay(Integer.parseInt(XmlUtil.getText(itemDevice, "SafetyWay"))); |
| 272 | 270 | } |
| 273 | - if (XmlUtil.getText(itemDevice, "RegisterWay") == null || XmlUtil.getText(itemDevice, "RegisterWay") =="") { | |
| 271 | + if (XmlUtil.getText(itemDevice, "RegisterWay") == null | |
| 272 | + || XmlUtil.getText(itemDevice, "RegisterWay") == "") { | |
| 274 | 273 | deviceChannel.setRegisterWay(1); |
| 275 | 274 | } else { |
| 276 | 275 | deviceChannel.setRegisterWay(Integer.parseInt(XmlUtil.getText(itemDevice, "RegisterWay"))); |
| 277 | 276 | } |
| 278 | 277 | deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum")); |
| 279 | - if (XmlUtil.getText(itemDevice, "Certifiable") == null || XmlUtil.getText(itemDevice, "Certifiable") == "") { | |
| 278 | + if (XmlUtil.getText(itemDevice, "Certifiable") == null | |
| 279 | + || XmlUtil.getText(itemDevice, "Certifiable") == "") { | |
| 280 | 280 | deviceChannel.setCertifiable(0); |
| 281 | 281 | } else { |
| 282 | 282 | deviceChannel.setCertifiable(Integer.parseInt(XmlUtil.getText(itemDevice, "Certifiable"))); |
| 283 | 283 | } |
| 284 | - if (XmlUtil.getText(itemDevice, "ErrCode") == null || XmlUtil.getText(itemDevice, "ErrCode") == "") { | |
| 284 | + if (XmlUtil.getText(itemDevice, "ErrCode") == null | |
| 285 | + || XmlUtil.getText(itemDevice, "ErrCode") == "") { | |
| 285 | 286 | deviceChannel.setErrCode(0); |
| 286 | 287 | } else { |
| 287 | 288 | deviceChannel.setErrCode(Integer.parseInt(XmlUtil.getText(itemDevice, "ErrCode"))); |
| ... | ... | @@ -289,7 +290,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 289 | 290 | deviceChannel.setEndTime(XmlUtil.getText(itemDevice, "EndTime")); |
| 290 | 291 | deviceChannel.setSecrecy(XmlUtil.getText(itemDevice, "Secrecy")); |
| 291 | 292 | deviceChannel.setIpAddress(XmlUtil.getText(itemDevice, "IPAddress")); |
| 292 | - if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") =="") { | |
| 293 | + if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") == "") { | |
| 293 | 294 | deviceChannel.setPort(0); |
| 294 | 295 | } else { |
| 295 | 296 | deviceChannel.setPort(Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); |
| ... | ... | @@ -305,7 +306,8 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 305 | 306 | } else { |
| 306 | 307 | deviceChannel.setLatitude(0.00); |
| 307 | 308 | } |
| 308 | - if (XmlUtil.getText(itemDevice, "PTZType") == null || XmlUtil.getText(itemDevice, "PTZType") == "") { | |
| 309 | + if (XmlUtil.getText(itemDevice, "PTZType") == null | |
| 310 | + || XmlUtil.getText(itemDevice, "PTZType") == "") { | |
| 309 | 311 | deviceChannel.setPTZType(0); |
| 310 | 312 | } else { |
| 311 | 313 | deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); |
| ... | ... | @@ -330,9 +332,9 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 330 | 332 | } |
| 331 | 333 | } |
| 332 | 334 | |
| 333 | - | |
| 334 | - /*** | |
| 335 | + /*** | |
| 335 | 336 | * 回复200 OK |
| 337 | + * | |
| 336 | 338 | * @param evt |
| 337 | 339 | * @throws SipException |
| 338 | 340 | * @throws InvalidArgumentException |
| ... | ... | @@ -343,7 +345,7 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 343 | 345 | getServerTransaction(evt).sendResponse(response); |
| 344 | 346 | } |
| 345 | 347 | |
| 346 | - private Element getRootElement(RequestEvent evt) throws DocumentException { | |
| 348 | + private Element getRootElement(RequestEvent evt) throws DocumentException { | |
| 347 | 349 | Request request = evt.getRequest(); |
| 348 | 350 | SAXReader reader = new SAXReader(); |
| 349 | 351 | reader.setEncoding("gbk"); |
| ... | ... | @@ -352,7 +354,6 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 352 | 354 | } |
| 353 | 355 | |
| 354 | 356 | public void setCmder(SIPCommander cmder) { |
| 355 | - this.cmder = cmder; | |
| 356 | 357 | } |
| 357 | 358 | |
| 358 | 359 | public void setStorager(IVideoManagerStorager storager) { |
| ... | ... | @@ -364,11 +365,9 @@ public class NotifyRequestProcessor extends SIPRequestAbstractProcessor { |
| 364 | 365 | } |
| 365 | 366 | |
| 366 | 367 | public void setRedis(RedisUtil redis) { |
| 367 | - this.redis = redis; | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | public void setDeferredResultHolder(DeferredResultHolder deferredResultHolder) { |
| 371 | - this.deferredResultHolder = deferredResultHolder; | |
| 372 | 371 | } |
| 373 | 372 | |
| 374 | 373 | public void setOffLineDetector(DeviceOffLineDetector offLineDetector) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/RegisterRequestProcessor.java
| ... | ... | @@ -145,7 +145,7 @@ public class RegisterRequestProcessor extends SIPRequestAbstractProcessor { |
| 145 | 145 | // 下发catelog查询目录 |
| 146 | 146 | if (registerFlag == 1 && device != null) { |
| 147 | 147 | logger.info("注册成功! deviceId:" + device.getDeviceId()); |
| 148 | - boolean exists = storager.exists(device.getDeviceId()); | |
| 148 | + // boolean exists = storager.exists(device.getDeviceId()); | |
| 149 | 149 | device.setRegisterTimeMillis(System.currentTimeMillis()); |
| 150 | 150 | storager.updateDevice(device); |
| 151 | 151 | publisher.onlineEventPublish(device.getDeviceId(), VideoManagerConstants.EVENT_ONLINE_REGISTER); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java
| ... | ... | @@ -12,14 +12,12 @@ import javax.sip.header.ViaHeader; |
| 12 | 12 | import javax.sip.message.Request; |
| 13 | 13 | import javax.sip.message.Response; |
| 14 | 14 | |
| 15 | -import gov.nist.javax.sip.header.CSeq; | |
| 16 | -import org.slf4j.Logger; | |
| 17 | -import org.slf4j.LoggerFactory; | |
| 15 | +// import org.slf4j.Logger; | |
| 16 | +// import org.slf4j.LoggerFactory; | |
| 18 | 17 | import org.springframework.stereotype.Component; |
| 19 | 18 | |
| 20 | 19 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 21 | 20 | import com.genersoft.iot.vmp.gb28181.SipLayer; |
| 22 | -import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorFactory; | |
| 23 | 21 | import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; |
| 24 | 22 | |
| 25 | 23 | |
| ... | ... | @@ -31,7 +29,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; |
| 31 | 29 | @Component |
| 32 | 30 | public class InviteResponseProcessor implements ISIPResponseProcessor { |
| 33 | 31 | |
| 34 | - private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); | |
| 32 | + // private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); | |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * 处理invite响应 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java
| ... | ... | @@ -15,10 +15,10 @@ public class NumericUtil { |
| 15 | 15 | public static boolean isDouble(String str) { |
| 16 | 16 | try { |
| 17 | 17 | Double num2 = Double.valueOf(str); |
| 18 | - System.out.println(num2 + " Is an Integer!"); | |
| 18 | + System.out.println(num2 + " is a valid numeric string!"); | |
| 19 | 19 | return true; |
| 20 | 20 | } catch (Exception e) { |
| 21 | - System.out.println(str + " Is not an Integer!"); | |
| 21 | + System.out.println(str + " is an invalid numeric string!"); | |
| 22 | 22 | return false; |
| 23 | 23 | } |
| 24 | 24 | } |
| ... | ... | @@ -31,10 +31,10 @@ public class NumericUtil { |
| 31 | 31 | public static boolean isInteger(String str) { |
| 32 | 32 | try { |
| 33 | 33 | int num2 = Integer.valueOf(str); |
| 34 | - System.out.println(num2 + " Is Number!"); | |
| 34 | + System.out.println(num2 + " is an integer!"); | |
| 35 | 35 | return true; |
| 36 | 36 | } catch (Exception e) { |
| 37 | - System.out.println(str + " Is not Number!"); | |
| 37 | + System.out.println(str + " is not an integer!"); | |
| 38 | 38 | return false; |
| 39 | 39 | } |
| 40 | 40 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java
| 1 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSONObject; | |
| 4 | 3 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 5 | 4 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 6 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 7 | -import org.slf4j.Logger; | |
| 8 | -import org.slf4j.LoggerFactory; | |
| 5 | +// import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 6 | +// import org.slf4j.Logger; | |
| 7 | +// import org.slf4j.LoggerFactory; | |
| 9 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 9 | import org.springframework.beans.factory.annotation.Value; |
| 11 | -import org.springframework.http.HttpHeaders; | |
| 12 | -import org.springframework.http.HttpRequest; | |
| 13 | -import org.springframework.http.HttpStatus; | |
| 14 | -import org.springframework.http.ResponseEntity; | |
| 15 | 10 | import org.springframework.web.bind.annotation.*; |
| 16 | 11 | import org.springframework.web.client.HttpClientErrorException; |
| 17 | 12 | import org.springframework.web.client.RestTemplate; |
| 18 | 13 | |
| 19 | 14 | import javax.servlet.http.HttpServletRequest; |
| 20 | 15 | import javax.servlet.http.HttpServletResponse; |
| 21 | -import java.util.Enumeration; | |
| 22 | 16 | |
| 23 | 17 | @RestController |
| 24 | 18 | @RequestMapping("/zlm") |
| 25 | 19 | public class ZLMHTTPProxyController { |
| 26 | 20 | |
| 27 | 21 | |
| 28 | - private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class); | |
| 22 | + // private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class); | |
| 29 | 23 | |
| 30 | - @Autowired | |
| 31 | - private IVideoManagerStorager storager; | |
| 24 | + // @Autowired | |
| 25 | + // private IVideoManagerStorager storager; | |
| 32 | 26 | |
| 33 | 27 | @Autowired |
| 34 | 28 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
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; |
| ... | ... | @@ -86,9 +80,6 @@ public class ZLMHttpHookListener { |
| 86 | 80 | if (logger.isDebugEnabled()) { |
| 87 | 81 | logger.debug("ZLM HOOK on_flow_report API调用,参数:" + json.toString()); |
| 88 | 82 | } |
| 89 | - // TODO Auto-generated method stub | |
| 90 | - | |
| 91 | - | |
| 92 | 83 | JSONObject ret = new JSONObject(); |
| 93 | 84 | ret.put("code", 0); |
| 94 | 85 | ret.put("msg", "success"); |
| ... | ... | @@ -106,8 +97,6 @@ public class ZLMHttpHookListener { |
| 106 | 97 | if (logger.isDebugEnabled()) { |
| 107 | 98 | logger.debug("ZLM HOOK on_http_access API 调用,参数:" + json.toString()); |
| 108 | 99 | } |
| 109 | - // TODO Auto-generated method stub | |
| 110 | - | |
| 111 | 100 | JSONObject ret = new JSONObject(); |
| 112 | 101 | ret.put("code", 0); |
| 113 | 102 | ret.put("err", ""); |
| ... | ... | @@ -127,8 +116,6 @@ public class ZLMHttpHookListener { |
| 127 | 116 | if (logger.isDebugEnabled()) { |
| 128 | 117 | logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString()); |
| 129 | 118 | } |
| 130 | - // TODO Auto-generated method stub | |
| 131 | - | |
| 132 | 119 | JSONObject ret = new JSONObject(); |
| 133 | 120 | ret.put("code", 0); |
| 134 | 121 | ret.put("msg", "success"); |
| ... | ... | @@ -146,15 +133,12 @@ public class ZLMHttpHookListener { |
| 146 | 133 | if (logger.isDebugEnabled()) { |
| 147 | 134 | logger.debug("ZLM HOOK on_publish API调用,参数:" + json.toString()); |
| 148 | 135 | } |
| 149 | - String app = json.getString("app"); | |
| 150 | - String streamId = json.getString("id"); | |
| 136 | + // String app = json.getString("app"); | |
| 137 | + // String streamId = json.getString("id"); | |
| 151 | 138 | |
| 152 | 139 | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); |
| 153 | 140 | if (subscribe != null) subscribe.response(json); |
| 154 | 141 | |
| 155 | - | |
| 156 | - // TODO Auto-generated method stub | |
| 157 | - | |
| 158 | 142 | JSONObject ret = new JSONObject(); |
| 159 | 143 | ret.put("code", 0); |
| 160 | 144 | ret.put("msg", "success"); |
| ... | ... | @@ -175,8 +159,6 @@ public class ZLMHttpHookListener { |
| 175 | 159 | if (logger.isDebugEnabled()) { |
| 176 | 160 | logger.debug("ZLM HOOK on_record_mp4 API调用,参数:" + json.toString()); |
| 177 | 161 | } |
| 178 | - // TODO Auto-generated method stub | |
| 179 | - | |
| 180 | 162 | JSONObject ret = new JSONObject(); |
| 181 | 163 | ret.put("code", 0); |
| 182 | 164 | ret.put("msg", "success"); |
| ... | ... | @@ -194,8 +176,6 @@ public class ZLMHttpHookListener { |
| 194 | 176 | if (logger.isDebugEnabled()) { |
| 195 | 177 | logger.debug("ZLM HOOK on_rtsp_realm API调用,参数:" + json.toString()); |
| 196 | 178 | } |
| 197 | - // TODO Auto-generated method stub | |
| 198 | - | |
| 199 | 179 | JSONObject ret = new JSONObject(); |
| 200 | 180 | ret.put("code", 0); |
| 201 | 181 | ret.put("realm", ""); |
| ... | ... | @@ -214,8 +194,6 @@ public class ZLMHttpHookListener { |
| 214 | 194 | if (logger.isDebugEnabled()) { |
| 215 | 195 | logger.debug("ZLM HOOK on_rtsp_auth API调用,参数:" + json.toString()); |
| 216 | 196 | } |
| 217 | - // TODO Auto-generated method stub | |
| 218 | - | |
| 219 | 197 | JSONObject ret = new JSONObject(); |
| 220 | 198 | ret.put("code", 0); |
| 221 | 199 | ret.put("encrypted", false); |
| ... | ... | @@ -234,8 +212,6 @@ public class ZLMHttpHookListener { |
| 234 | 212 | if (logger.isDebugEnabled()) { |
| 235 | 213 | logger.debug("ZLM HOOK on_shell_login API调用,参数:" + json.toString()); |
| 236 | 214 | } |
| 237 | - // TODO Auto-generated method stub | |
| 238 | - | |
| 239 | 215 | JSONObject ret = new JSONObject(); |
| 240 | 216 | ret.put("code", 0); |
| 241 | 217 | ret.put("msg", "success"); |
| ... | ... | @@ -267,8 +243,6 @@ public class ZLMHttpHookListener { |
| 267 | 243 | redisCatchStorage.stopPlayback(streamInfo); |
| 268 | 244 | } |
| 269 | 245 | } |
| 270 | - | |
| 271 | - | |
| 272 | 246 | JSONObject ret = new JSONObject(); |
| 273 | 247 | ret.put("code", 0); |
| 274 | 248 | ret.put("msg", "success"); |
| ... | ... | @@ -316,8 +290,6 @@ public class ZLMHttpHookListener { |
| 316 | 290 | if (logger.isDebugEnabled()) { |
| 317 | 291 | logger.debug("ZLM HOOK on_stream_not_found API调用,参数:" + json.toString()); |
| 318 | 292 | } |
| 319 | - // TODO Auto-generated method stub | |
| 320 | - | |
| 321 | 293 | if (autoApplyPlay) { |
| 322 | 294 | String app = json.getString("app"); |
| 323 | 295 | String streamId = json.getString("stream"); |
| ... | ... | @@ -367,8 +339,6 @@ public class ZLMHttpHookListener { |
| 367 | 339 | mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp); |
| 368 | 340 | mediaServerConfig.setLocalIP(mediaIp); |
| 369 | 341 | redisCatchStorage.updateMediaInfo(mediaServerConfig); |
| 370 | - // TODO Auto-generated method stub | |
| 371 | - | |
| 372 | 342 | JSONObject ret = new JSONObject(); |
| 373 | 343 | ret.put("code", 0); |
| 374 | 344 | ret.put("msg", "success"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
| 1 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.alibaba.fastjson.JSONObject; |
| 5 | -import com.genersoft.iot.vmp.common.StreamInfo; | |
| 6 | -import com.genersoft.iot.vmp.conf.MediaServerConfig; | |
| 7 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 9 | -import org.slf4j.Logger; | |
| 10 | -import org.slf4j.LoggerFactory; | |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | -import org.springframework.beans.factory.annotation.Value; | |
| 13 | -import org.springframework.http.HttpStatus; | |
| 14 | -import org.springframework.http.ResponseEntity; | |
| 15 | 4 | import org.springframework.stereotype.Component; |
| 16 | -import org.springframework.util.ConcurrentReferenceHashMap; | |
| 17 | -import org.springframework.web.bind.annotation.*; | |
| 18 | 5 | |
| 19 | -import javax.servlet.http.HttpServletRequest; | |
| 20 | -import java.math.BigInteger; | |
| 21 | -import java.text.DecimalFormat; | |
| 22 | 6 | import java.util.HashMap; |
| 23 | 7 | import java.util.Map; |
| 24 | 8 | import java.util.concurrent.ConcurrentHashMap; |
| ... | ... | @@ -31,8 +15,6 @@ import java.util.concurrent.ConcurrentHashMap; |
| 31 | 15 | @Component |
| 32 | 16 | public class ZLMHttpHookSubscribe { |
| 33 | 17 | |
| 34 | - private final static Logger logger = LoggerFactory.getLogger(ZLMHttpHookSubscribe.class); | |
| 35 | - | |
| 36 | 18 | public enum HookType{ |
| 37 | 19 | on_flow_report, |
| 38 | 20 | on_http_access, |
| ... | ... | @@ -72,8 +54,6 @@ public class ZLMHttpHookSubscribe { |
| 72 | 54 | for (JSONObject key : eventMap.keySet()) { |
| 73 | 55 | Boolean result = null; |
| 74 | 56 | for (String s : key.keySet()) { |
| 75 | - String string = hookResponse.getString(s); | |
| 76 | - String string1 = key.getString(s); | |
| 77 | 57 | if (result == null) { |
| 78 | 58 | result = key.getString(s).equals(hookResponse.getString(s)); |
| 79 | 59 | }else { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
| ... | ... | @@ -5,8 +5,7 @@ import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 7 | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 9 | -import okhttp3.*; | |
| 8 | +//import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | |
| 10 | 9 | import org.slf4j.Logger; |
| 11 | 10 | import org.slf4j.LoggerFactory; |
| 12 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -16,9 +15,6 @@ import org.springframework.core.annotation.Order; |
| 16 | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | import org.springframework.util.StringUtils; |
| 18 | 17 | |
| 19 | -import java.io.IOException; | |
| 20 | -import java.io.UnsupportedEncodingException; | |
| 21 | -import java.net.URLEncoder; | |
| 22 | 18 | import java.util.HashMap; |
| 23 | 19 | import java.util.Map; |
| 24 | 20 | |
| ... | ... | @@ -28,8 +24,8 @@ public class ZLMRunner implements CommandLineRunner { |
| 28 | 24 | |
| 29 | 25 | private final static Logger logger = LoggerFactory.getLogger(ZLMRunner.class); |
| 30 | 26 | |
| 31 | - @Autowired | |
| 32 | - private IVideoManagerStorager storager; | |
| 27 | + // @Autowired | |
| 28 | + // private IVideoManagerStorager storager; | |
| 33 | 29 | |
| 34 | 30 | @Autowired |
| 35 | 31 | private IRedisCatchStorage redisCatchStorage; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| ... | ... | @@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 11 | import org.springframework.stereotype.Component; |
| 12 | 12 | |
| 13 | 13 | import java.util.HashMap; |
| 14 | -import java.util.HashSet; | |
| 15 | 14 | import java.util.List; |
| 16 | 15 | import java.util.Map; |
| 17 | 16 | |
| ... | ... | @@ -144,9 +143,9 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 144 | 143 | |
| 145 | 144 | @Override |
| 146 | 145 | public StreamInfo queryPlaybackByDevice(String deviceId, String code) { |
| 147 | - String format = String.format("%S_*_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 148 | - deviceId, | |
| 149 | - code); | |
| 146 | + // String format = String.format("%S_*_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | |
| 147 | + // deviceId, | |
| 148 | + // code); | |
| 150 | 149 | List<Object> playLeys = redis.scan(String.format("%S_*_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 151 | 150 | deviceId, |
| 152 | 151 | code)); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| ... | ... | @@ -9,19 +9,18 @@ import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| 9 | 9 | import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper; |
| 10 | 10 | import com.github.pagehelper.PageHelper; |
| 11 | 11 | import com.github.pagehelper.PageInfo; |
| 12 | -import io.swagger.models.auth.In; | |
| 13 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 13 | import org.springframework.stereotype.Component; |
| 15 | 14 | |
| 16 | 15 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 17 | 16 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 18 | -import org.springframework.util.StringUtils; | |
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * @Description:视频设备数据存储-jdbc实现 |
| 22 | 20 | * @author: swwheihei |
| 23 | 21 | * @date: 2020年5月6日 下午2:31:42 |
| 24 | 22 | */ |
| 23 | +@SuppressWarnings("rawtypes") | |
| 25 | 24 | @Component |
| 26 | 25 | public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 27 | 26 | |
| ... | ... | @@ -183,11 +182,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 183 | 182 | @Override |
| 184 | 183 | public synchronized boolean online(String deviceId) { |
| 185 | 184 | Device device = deviceMapper.getDeviceByDeviceId(deviceId); |
| 186 | - device.setOnline(1); | |
| 187 | - System.out.println("更新设备在线"); | |
| 188 | 185 | if (device == null) { |
| 189 | 186 | return false; |
| 190 | 187 | } |
| 188 | + device.setOnline(1); | |
| 189 | + System.out.println("更新设备在线"); | |
| 191 | 190 | return deviceMapper.update(device) > 0; |
| 192 | 191 | } |
| 193 | 192 | |
| ... | ... | @@ -211,7 +210,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 211 | 210 | */ |
| 212 | 211 | @Override |
| 213 | 212 | public void cleanChannelsForDevice(String deviceId) { |
| 214 | - int result = deviceChannelMapper.cleanChannelsByDeviceId(deviceId); | |
| 213 | + deviceChannelMapper.cleanChannelsByDeviceId(deviceId); | |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | 216 | /** | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
| ... | ... | @@ -4,8 +4,6 @@ import java.util.*; |
| 4 | 4 | import java.util.concurrent.TimeUnit; |
| 5 | 5 | |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.dao.DataAccessException; | |
| 8 | -import org.springframework.data.redis.connection.RedisConnection; | |
| 9 | 7 | import org.springframework.data.redis.core.*; |
| 10 | 8 | import org.springframework.stereotype.Component; |
| 11 | 9 | import org.springframework.util.CollectionUtils; |
| ... | ... | @@ -16,6 +14,7 @@ import org.springframework.util.CollectionUtils; |
| 16 | 14 | * @date: 2020年5月6日 下午8:27:29 |
| 17 | 15 | */ |
| 18 | 16 | @Component |
| 17 | +@SuppressWarnings(value = {"rawtypes", "unchecked"}) | |
| 19 | 18 | public class RedisUtil { |
| 20 | 19 | |
| 21 | 20 | @Autowired | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceConfig.java
| ... | ... | @@ -20,7 +20,6 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 20 | 20 | import org.slf4j.Logger; |
| 21 | 21 | import org.slf4j.LoggerFactory; |
| 22 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | -import org.springframework.http.HttpStatus; | |
| 24 | 23 | import org.springframework.http.ResponseEntity; |
| 25 | 24 | import org.springframework.web.bind.annotation.*; |
| 26 | 25 | import org.springframework.web.context.request.async.DeferredResult; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceQuery.java
| ... | ... | @@ -17,11 +17,11 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 17 | 17 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 18 | 18 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 19 | 19 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 20 | -import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | |
| 21 | 20 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 22 | 21 | |
| 23 | 22 | import javax.sip.message.Response; |
| 24 | 23 | |
| 24 | +@SuppressWarnings("rawtypes") | |
| 25 | 25 | @CrossOrigin |
| 26 | 26 | @RestController |
| 27 | 27 | @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 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.alibaba.fastjson.JSONArray; | |
| 5 | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | 5 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 7 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 8 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 9 | 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 10 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 11 | -import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | |
| 12 | 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | 10 | import com.genersoft.iot.vmp.vmanager.service.IPlayService; |
| 14 | 11 | import org.slf4j.Logger; |
| 15 | 12 | import org.slf4j.LoggerFactory; |
| 16 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | -import org.springframework.beans.factory.annotation.Value; | |
| 18 | 14 | import org.springframework.http.HttpStatus; |
| 19 | 15 | import org.springframework.http.ResponseEntity; |
| 20 | 16 | import org.springframework.web.bind.annotation.CrossOrigin; |
| ... | ... | @@ -31,7 +27,6 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 31 | 27 | import org.springframework.web.context.request.async.DeferredResult; |
| 32 | 28 | |
| 33 | 29 | import javax.sip.message.Response; |
| 34 | -import java.text.DecimalFormat; | |
| 35 | 30 | import java.util.UUID; |
| 36 | 31 | |
| 37 | 32 | @CrossOrigin |
| ... | ... | @@ -145,7 +140,7 @@ public class PlayController { |
| 145 | 140 | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); |
| 146 | 141 | RequestMessage msg = new RequestMessage(); |
| 147 | 142 | msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid); |
| 148 | - Response response = event.getResponse(); | |
| 143 | + //Response response = event.getResponse(); | |
| 149 | 144 | msg.setData(String.format("success")); |
| 150 | 145 | resultHolder.invokeResult(msg); |
| 151 | 146 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/playback/PlaybackController.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.playback; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | -import com.alibaba.fastjson.JSONArray; | |
| 5 | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 7 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 8 | -import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | |
| 6 | +//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | |
| 9 | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 10 | 8 | import com.genersoft.iot.vmp.vmanager.service.IPlayService; |
| 11 | 9 | import org.slf4j.Logger; |
| 12 | 10 | import org.slf4j.LoggerFactory; |
| 13 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | -import org.springframework.beans.factory.annotation.Value; | |
| 15 | 12 | import org.springframework.http.HttpStatus; |
| 16 | 13 | import org.springframework.http.ResponseEntity; |
| 17 | -import org.springframework.util.StringUtils; | |
| 18 | 14 | import org.springframework.web.bind.annotation.CrossOrigin; |
| 19 | 15 | import org.springframework.web.bind.annotation.GetMapping; |
| 20 | 16 | import org.springframework.web.bind.annotation.PathVariable; |
| 21 | -import org.springframework.web.bind.annotation.PostMapping; | |
| 22 | 17 | import org.springframework.web.bind.annotation.RequestMapping; |
| 23 | 18 | import org.springframework.web.bind.annotation.RestController; |
| 24 | 19 | |
| ... | ... | @@ -47,8 +42,8 @@ public class PlaybackController { |
| 47 | 42 | @Autowired |
| 48 | 43 | private IRedisCatchStorage redisCatchStorage; |
| 49 | 44 | |
| 50 | - @Autowired | |
| 51 | - private ZLMRESTfulUtils zlmresTfulUtils; | |
| 45 | + // @Autowired | |
| 46 | + // private ZLMRESTfulUtils zlmresTfulUtils; | |
| 52 | 47 | |
| 53 | 48 | @Autowired |
| 54 | 49 | private IPlayService playService; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/service/IPlayService.java
src/main/java/com/genersoft/iot/vmp/vmanager/service/impl/PlayServiceImpl.java
| ... | ... | @@ -9,15 +9,12 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 10 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 11 | 11 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 12 | -import com.genersoft.iot.vmp.vmanager.play.PlayController; | |
| 13 | 12 | import com.genersoft.iot.vmp.vmanager.service.IPlayService; |
| 14 | 13 | import org.slf4j.Logger; |
| 15 | 14 | import org.slf4j.LoggerFactory; |
| 16 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | 16 | import org.springframework.stereotype.Service; |
| 18 | 17 | |
| 19 | -import java.text.DecimalFormat; | |
| 20 | - | |
| 21 | 18 | @Service |
| 22 | 19 | public class PlayServiceImpl implements IPlayService { |
| 23 | 20 | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.user; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.vmanager.play.PlayController; | |
| 4 | -import org.slf4j.Logger; | |
| 5 | -import org.slf4j.LoggerFactory; | |
| 6 | 3 | import org.springframework.beans.factory.annotation.Value; |
| 7 | 4 | import org.springframework.util.StringUtils; |
| 8 | 5 | import org.springframework.web.bind.annotation.CrossOrigin; |
| ... | ... | @@ -14,9 +11,6 @@ import org.springframework.web.bind.annotation.RestController; |
| 14 | 11 | @RequestMapping("/api") |
| 15 | 12 | public class UserController { |
| 16 | 13 | |
| 17 | - private final static Logger logger = LoggerFactory.getLogger(UserController.class); | |
| 18 | - | |
| 19 | - | |
| 20 | 14 | @Value("${auth.username}") |
| 21 | 15 | private String usernameConfig; |
| 22 | 16 | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/ApiControlController.java
| ... | ... | @@ -4,12 +4,9 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 6 | 6 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 7 | -import com.genersoft.iot.vmp.vmanager.ptz.PtzController; | |
| 8 | 7 | import org.slf4j.Logger; |
| 9 | 8 | import org.slf4j.LoggerFactory; |
| 10 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | -import org.springframework.http.HttpStatus; | |
| 12 | -import org.springframework.http.ResponseEntity; | |
| 13 | 10 | import org.springframework.web.bind.annotation.*; |
| 14 | 11 | |
| 15 | 12 | /** | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/ApiController.java
| ... | ... | @@ -5,11 +5,9 @@ import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | 5 | import org.slf4j.Logger; |
| 6 | 6 | import org.slf4j.LoggerFactory; |
| 7 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | -import org.springframework.beans.factory.annotation.Value; | |
| 9 | 8 | import org.springframework.stereotype.Controller; |
| 10 | 9 | import org.springframework.web.bind.annotation.CrossOrigin; |
| 11 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 12 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 13 | 11 | import org.springframework.web.bind.annotation.ResponseBody; |
| 14 | 12 | |
| 15 | 13 | /** | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/ApiDeviceController.java
| ... | ... | @@ -4,9 +4,9 @@ import com.alibaba.fastjson.JSONArray; |
| 4 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | |
| 8 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | |
| 9 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | |
| 7 | +// import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | |
| 8 | +// import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | |
| 9 | +// import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | |
| 10 | 10 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 11 | 11 | import com.github.pagehelper.PageInfo; |
| 12 | 12 | import org.slf4j.Logger; |
| ... | ... | @@ -19,6 +19,7 @@ import java.util.List; |
| 19 | 19 | /** |
| 20 | 20 | * 兼容LiveGBS的API:设备信息 |
| 21 | 21 | */ |
| 22 | +@SuppressWarnings("unchecked") | |
| 22 | 23 | @CrossOrigin |
| 23 | 24 | @RestController |
| 24 | 25 | @RequestMapping(value = "/api/v1/device") |
| ... | ... | @@ -29,14 +30,14 @@ public class ApiDeviceController { |
| 29 | 30 | @Autowired |
| 30 | 31 | private IVideoManagerStorager storager; |
| 31 | 32 | |
| 32 | - @Autowired | |
| 33 | - private SIPCommander cmder; | |
| 33 | + // @Autowired | |
| 34 | + // private SIPCommander cmder; | |
| 34 | 35 | |
| 35 | - @Autowired | |
| 36 | - private DeferredResultHolder resultHolder; | |
| 36 | + // @Autowired | |
| 37 | + // private DeferredResultHolder resultHolder; | |
| 37 | 38 | |
| 38 | - @Autowired | |
| 39 | - private DeviceOffLineDetector offLineDetector; | |
| 39 | + // @Autowired | |
| 40 | + // private DeviceOffLineDetector offLineDetector; | |
| 40 | 41 | |
| 41 | 42 | /** |
| 42 | 43 | * 分页获取设备列表 TODO 现在直接返回,尚未实现分页 | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java
| 1 | 1 | package com.genersoft.iot.vmp.web; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.alibaba.fastjson.JSONArray; | |
| 5 | 4 | import com.alibaba.fastjson.JSONObject; |
| 6 | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 10 | -import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | |
| 9 | +// import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | |
| 11 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | 11 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 13 | 12 | import com.genersoft.iot.vmp.vmanager.play.PlayController; |
| 14 | 13 | import org.slf4j.Logger; |
| 15 | 14 | import org.slf4j.LoggerFactory; |
| 16 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | -import org.springframework.beans.factory.annotation.Value; | |
| 18 | -import org.springframework.http.HttpStatus; | |
| 19 | 16 | import org.springframework.http.ResponseEntity; |
| 20 | 17 | import org.springframework.web.bind.annotation.*; |
| 21 | 18 | import org.springframework.web.context.request.async.DeferredResult; |
| ... | ... | @@ -23,6 +20,7 @@ import org.springframework.web.context.request.async.DeferredResult; |
| 23 | 20 | /** |
| 24 | 21 | * 兼容LiveGBS的API:实时直播 |
| 25 | 22 | */ |
| 23 | +@SuppressWarnings(value = {"rawtypes", "unchecked"}) | |
| 26 | 24 | @CrossOrigin |
| 27 | 25 | @RestController |
| 28 | 26 | @RequestMapping(value = "/api/v1/stream") |
| ... | ... | @@ -40,8 +38,8 @@ public class ApiStreamController { |
| 40 | 38 | private IRedisCatchStorage redisCatchStorage; |
| 41 | 39 | |
| 42 | 40 | |
| 43 | - @Autowired | |
| 44 | - private ZLMRESTfulUtils zlmresTfulUtils; | |
| 41 | + // @Autowired | |
| 42 | + // private ZLMRESTfulUtils zlmresTfulUtils; | |
| 45 | 43 | |
| 46 | 44 | |
| 47 | 45 | @Autowired | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/AuthController.java
| 1 | 1 | package com.genersoft.iot.vmp.web; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 4 | 3 | import org.springframework.beans.factory.annotation.Value; |
| 5 | -import org.springframework.http.ResponseEntity; | |
| 6 | -import org.springframework.stereotype.Controller; | |
| 7 | 4 | import org.springframework.util.StringUtils; |
| 8 | 5 | import org.springframework.web.bind.annotation.*; |
| 9 | 6 | ... | ... |