From e44e3dc9400a0c11572ec62651cb586640dc1725 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 23 Sep 2022 23:08:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E4=BF=A1=E6=81=AF=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/conf/SystemInfoTimerTask.java | 7 +- .../genersoft/iot/vmp/conf/VersionInfo.java | 14 +--- .../gb28181/auth/RegisterLogicHandler.java | 44 ----------- .../event/alarm/AlarmEventListener.java | 1 - .../session/VideoStreamSessionManager.java | 8 -- .../cmd/impl/SIPCommanderFroPlatform.java | 5 -- .../request/impl/InviteRequestProcessor.java | 16 +--- .../impl/info/InfoRequestProcessor.java | 16 +--- .../notify/cmd/AlarmNotifyMessageHandler.java | 8 +- .../cmd/KeepaliveNotifyMessageHandler.java | 8 +- .../cmd/MediaStatusNotifyMessageHandler.java | 8 +- .../query/cmd/AlarmQueryMessageHandler.java | 8 +- .../query/cmd/CatalogQueryMessageHandler.java | 8 +- .../cmd/BroadcastResponseMessageHandler.java | 2 +- .../ConfigDownloadResponseMessageHandler.java | 8 +- .../DeviceControlResponseMessageHandler.java | 8 +- .../DeviceStatusResponseMessageHandler.java | 8 +- .../cmd/RecordInfoResponseMessageHandler.java | 12 +-- .../timeout/impl/TimeoutProcessorImpl.java | 7 +- .../impl/StreamPushUploadFileHandler.java | 1 - .../redisMsg/RedisGbPlayMsgListener.java | 2 +- .../com/genersoft/iot/vmp/utils/GpsUtil.java | 43 ----------- .../com/genersoft/iot/vmp/utils/IpUtil.java | 48 ------------ .../genersoft/iot/vmp/utils/JarFileUtils.java | 73 ------------------- .../iot/vmp/utils/SerializeUtils.java | 31 -------- .../gb28181/media/MediaController.java | 2 +- 26 files changed, 44 insertions(+), 352 deletions(-) delete mode 100644 src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/utils/IpUtil.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/utils/JarFileUtils.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java b/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java index 13ec6927..74a90c24 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java @@ -1,7 +1,10 @@ package com.genersoft.iot.vmp.conf; +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.AlarmQueryMessageHandler; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.utils.SystemInfoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -14,6 +17,8 @@ import java.util.Map; @Component public class SystemInfoTimerTask { + private Logger logger = LoggerFactory.getLogger(SystemInfoTimerTask.class); + @Autowired private IRedisCatchStorage redisCatchStorage; @@ -27,7 +32,7 @@ public class SystemInfoTimerTask { Map networkInterfaces = SystemInfoUtils.getNetworkInterfaces(); redisCatchStorage.addNetInfo(networkInterfaces); } catch (InterruptedException e) { - e.printStackTrace(); + logger.error("[获取系统信息失败] {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java b/src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java index 4ff5eba6..5551b4f3 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java @@ -2,35 +2,23 @@ package com.genersoft.iot.vmp.conf; import com.genersoft.iot.vmp.common.VersionPo; import com.genersoft.iot.vmp.utils.GitUtil; -import com.genersoft.iot.vmp.utils.JarFileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Map; - @Component public class VersionInfo { - @Autowired - VersionConfig config; @Autowired GitUtil gitUtil; - @Autowired - JarFileUtils jarFileUtils; public VersionPo getVersion() { VersionPo versionPo = new VersionPo(); - Map map=jarFileUtils.readJarFile(); versionPo.setGIT_Revision(gitUtil.getGitCommitId()); - versionPo.setCreate_By(map.get("Created-By")); versionPo.setGIT_BRANCH(gitUtil.getBranch()); versionPo.setGIT_URL(gitUtil.getGitUrl()); versionPo.setBUILD_DATE(gitUtil.getBuildDate()); - versionPo.setArtifactId(config.getArtifactId()); versionPo.setGIT_Revision_SHORT(gitUtil.getCommitIdShort()); - versionPo.setVersion(config.getVersion()); - versionPo.setProject(config.getDescription()); - versionPo.setBuild_Jdk(map.get("Build-Jdk")); + versionPo.setVersion(gitUtil.getBuildVersion()); return versionPo; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java deleted file mode 100644 index 8731228a..00000000 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.genersoft.iot.vmp.gb28181.auth; - -import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; - -/** - * @description:注册逻辑处理,当设备注册后触发逻辑。 - * @author: swwheihei - * @date: 2020年5月8日 下午9:41:46 - */ -@Component -public class RegisterLogicHandler { - - private Logger logger = LoggerFactory.getLogger(RegisterLogicHandler.class); - - @Autowired - private SIPCommander cmder; - - @Autowired - private VideoManagerStorageImpl storager; - - public void onRegister(Device device) { - // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 -// // TODO 此处错误无法获取到通道 -// Device device1 = storager.queryVideoDevice(device.getDeviceId()); -// if (device.isFirsRegister()) { -// logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); -// try { -// Thread.sleep(100); -// cmder.deviceInfoQuery(device); -// Thread.sleep(100); -// cmder.catalogQuery(device, null); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// } - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java index 2b563269..9ee64773 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java @@ -51,7 +51,6 @@ public class AlarmEventListener implements ApplicationListener { } // 移除已关闭的连接 it.remove(); - // e.printStackTrace(); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java index 6e7b3dcc..9bd3d57d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java @@ -3,23 +3,15 @@ package com.genersoft.iot.vmp.gb28181.session; import java.util.ArrayList; import java.util.List; -import javax.sip.ClientTransaction; -import javax.sip.Dialog; - import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.bean.SipMsgInfo; import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; -import com.genersoft.iot.vmp.utils.SerializeUtils; import com.genersoft.iot.vmp.utils.redis.RedisUtil; -import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPResponse; -import gov.nist.javax.sip.stack.SIPDialog; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; /** * @description:视频流session管理器,管理视频预览、预览回放的通信句柄 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index bfc1ea9d..4b67c1b2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -13,11 +13,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.utils.GitUtil; -import com.genersoft.iot.vmp.utils.SerializeUtils; -import gov.nist.javax.sip.SIPConstants; import gov.nist.javax.sip.SipProviderImpl; -import gov.nist.javax.sip.SipStackImpl; import gov.nist.javax.sip.message.MessageFactoryImpl; import gov.nist.javax.sip.message.SIPRequest; import org.slf4j.Logger; @@ -27,7 +23,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.Lazy; import org.springframework.lang.Nullable; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index 09436edb..57231810 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -661,12 +661,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream()); try { responseAck(serverTransaction, Response.TEMPORARILY_UNAVAILABLE, response.getMsg()); - } catch (SipException e) { - throw new RuntimeException(e); - } catch (InvalidArgumentException e) { - throw new RuntimeException(e); - } catch (ParseException e) { - throw new RuntimeException(e); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); } } }); @@ -733,12 +729,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); } } - } catch (InvalidArgumentException e) { - throw new RuntimeException(e); - } catch (ParseException e) { - throw new RuntimeException(e); - } catch (SipException e) { - throw new RuntimeException(e); + } catch (InvalidArgumentException | ParseException | SipException e) { + logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java index b5f16ac9..66f54420 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java @@ -115,23 +115,15 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I // 失败的回复 try { responseAck(serverTransaction, eventResult.statusCode, eventResult.msg); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage()); } }, eventResult -> { // 成功的回复 try { responseAck(serverTransaction, eventResult.statusCode); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage()); } }); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java index da2cb9c3..bc80c589 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java @@ -216,12 +216,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme // 回复200 OK try { responseAck(getServerTransaction(evt), Response.OK); - } catch (SipException e) { - throw new RuntimeException(e); - } catch (InvalidArgumentException e) { - throw new RuntimeException(e); - } catch (ParseException e) { - throw new RuntimeException(e); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 报警通知回复: {}", e.getMessage()); } Element deviceIdElement = rootElement.element("DeviceID"); String channelId = deviceIdElement.getText().toString(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java index 63dc7d8f..289f1628 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java @@ -78,12 +78,8 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp deviceService.online(device); } } - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 心跳回复: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java index 98d42d6e..041f7391 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java @@ -68,12 +68,8 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i // 回复200 OK try { responseAck(getServerTransaction(evt), Response.OK); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 录像流推送完毕,回复200OK: {}", e.getMessage()); } CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME); String NotifyType =getText(rootElement, "NotifyType"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java index e35da0ea..be24faa2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java @@ -59,12 +59,8 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen logger.info("不支持alarm查询"); try { responseAck(getServerTransaction(evt), Response.NOT_FOUND, "not support alarm query"); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 alarm查询回复200OK: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java index cd98094d..82f4a257 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java @@ -100,12 +100,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem // 回复无通道 cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0); } - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 目录查询: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java index b1bd489d..8192043c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java @@ -63,7 +63,7 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i } catch (ParseException | SipException | InvalidArgumentException e) { - e.printStackTrace(); + logger.error("[命令发送失败] 国标级联 语音喊话: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java index 200677a1..1c4aa8a8 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java @@ -63,12 +63,8 @@ public class ConfigDownloadResponseMessageHandler extends SIPRequestProcessorPar msg.setKey(key); msg.setData(json); deferredResultHolder.invokeAllResult(msg); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 设备配置查询: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java index cd6d1b83..12c84686 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java @@ -58,12 +58,8 @@ public class DeviceControlResponseMessageHandler extends SIPRequestProcessorPare msg.setKey(key); msg.setData(json); deferredResultHolder.invokeAllResult(msg); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 设备控制: {}", e.getMessage()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java index b324b5d2..e96ecec9 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java @@ -60,12 +60,8 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen // 回复200 OK try { responseAck(getServerTransaction(evt), Response.OK); - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 设备状态应答回复200OK: {}", e.getMessage()); } Element deviceIdElement = element.element("DeviceID"); Element onlineElement = element.element("Online"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java index e9ee32d9..fa741de4 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java @@ -147,7 +147,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent } } } catch (DocumentException e) { - throw new RuntimeException(e); + logger.error("xml解析异常: ", e); } finally { taskQueueHandlerRun = false; } @@ -155,13 +155,9 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent }); } - } catch (SipException e) { - e.printStackTrace(); - } catch (InvalidArgumentException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); - }finally { + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage()); + } finally { taskQueueHandlerRun = false; } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java index 86861af1..531505d2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java @@ -1,8 +1,11 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.timeout.impl; +import com.genersoft.iot.vmp.conf.SystemInfoTimerTask; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -13,6 +16,8 @@ import javax.sip.header.CallIdHeader; @Component public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor { + private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class); + @Autowired private SIPProcessorObserver processorObserver; @@ -36,7 +41,7 @@ public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor sipSubscribe.removeErrorSubscribe(callId); sipSubscribe.removeOkSubscribe(callId); } catch (Exception e) { - e.printStackTrace(); + logger.error("[超时事件失败]: {}", e.getMessage()); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java index 3e13f48e..1b21995b 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java @@ -93,7 +93,6 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener 15) { // "***.***.***.***".length() - // = 15 - if (ipAddress.indexOf(",") > 0) { - ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); - } - } - } catch (Exception e) { - ipAddress=""; - } - // ipAddress = this.getRequest().getRemoteAddr(); - - return ipAddress; - } -} - - diff --git a/src/main/java/com/genersoft/iot/vmp/utils/JarFileUtils.java b/src/main/java/com/genersoft/iot/vmp/utils/JarFileUtils.java deleted file mode 100644 index 686b562d..00000000 --- a/src/main/java/com/genersoft/iot/vmp/utils/JarFileUtils.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.genersoft.iot.vmp.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.util.ClassUtils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/** - * 一个优秀的颓废程序猿 - */ -@Component -public class JarFileUtils { - private static Logger log = LoggerFactory.getLogger(JarFileUtils.class); - private static Map map = new HashMap<>(); - - public Map readJarFile() { - JarFile jarFile = null; - BufferedReader br = null; - try { - // 获取jar的运行路径,因linux下jar的路径为”file:/app/.../test.jar!/BOOT-INF/class!/“这种格式,所以需要去掉”file:“和”!/BOOT-INF/class!/“ - String jarFilePath = ClassUtils.getDefaultClassLoader().getResource("").getPath().replace("!/BOOT-INF/classes!/", ""); - if (jarFilePath.startsWith("file")) { - jarFilePath = jarFilePath.substring(5); - } - log.debug("jarFilePath:" + jarFilePath); - // 通过JarFile的getJarEntry方法读取META-INF/MANIFEST.MF - jarFile = new JarFile(jarFilePath); - JarEntry entry = jarFile.getJarEntry("META-INF/MANIFEST.MF"); - log.info("读取的内容:" + entry.toString()); - // 如果读取到MANIFEST.MF文件内容,则转换为string - if (entry != null) { - InputStream in = jarFile.getInputStream(entry); - - StringBuilder sb = new StringBuilder(); - br = new BufferedReader(new InputStreamReader(in)); - String line = ""; - while ((line = br.readLine()) != null) { - if (line != null && line.contains(":")) { - int index = line.indexOf(":"); - map.put(line.substring(0, index).trim(), line.substring(index + 1, line.length()).trim()); - } - } - return map; - } - } catch (IOException e) { - log.debug("读取MANIFEST.MF文件异常:" + e.getMessage()); - } finally { - try { - if (null != br) { - br.close(); - } - if (null != jarFile) { - jarFile.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - return map; - - } - -} diff --git a/src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java b/src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java deleted file mode 100644 index ae91ad59..00000000 --- a/src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.genersoft.iot.vmp.utils; - -import java.io.*; - -public class SerializeUtils { - public static byte[] serialize(Object obj){ - byte[] bytes = null; - try { - ByteArrayOutputStream baos=new ByteArrayOutputStream();; - ObjectOutputStream oos=new ObjectOutputStream(baos); - oos.writeObject(obj); - bytes=baos.toByteArray(); - baos.close(); - oos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - return bytes; - } - public static Object deSerialize(byte[] bytes){ - Object obj=null; - try { - ByteArrayInputStream bais=new ByteArrayInputStream(bytes); - ObjectInputStream ois=new ObjectInputStream(bais); - obj=ois.readObject(); - } catch (Exception e) { - e.printStackTrace(); - } - return obj; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java index b876cf9c..6f7132e7 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java @@ -96,7 +96,7 @@ public class MediaController { try { Thread.sleep(1000); } catch (InterruptedException e) { - e.printStackTrace(); + logger.error("[线程休眠失败], {}", e.getMessage()); } if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) { String host = request.getHeader("Host");