Commit 4c6c77be7a8395a82da4ddb85169e62e130e8713
1 parent
cd117ed2
异常情况打印信息优化
Showing
26 changed files
with
44 additions
and
352 deletions
src/main/java/com/genersoft/iot/vmp/conf/SystemInfoTimerTask.java
| 1 | 1 | package com.genersoft.iot.vmp.conf; |
| 2 | 2 | |
| 3 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.AlarmQueryMessageHandler; | |
| 3 | 4 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 4 | 5 | import com.genersoft.iot.vmp.utils.SystemInfoUtils; |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 9 | import org.springframework.scheduling.annotation.Scheduled; |
| 7 | 10 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -14,6 +17,8 @@ import java.util.Map; |
| 14 | 17 | @Component |
| 15 | 18 | public class SystemInfoTimerTask { |
| 16 | 19 | |
| 20 | + private Logger logger = LoggerFactory.getLogger(SystemInfoTimerTask.class); | |
| 21 | + | |
| 17 | 22 | @Autowired |
| 18 | 23 | private IRedisCatchStorage redisCatchStorage; |
| 19 | 24 | |
| ... | ... | @@ -27,7 +32,7 @@ public class SystemInfoTimerTask { |
| 27 | 32 | Map<String, String> networkInterfaces = SystemInfoUtils.getNetworkInterfaces(); |
| 28 | 33 | redisCatchStorage.addNetInfo(networkInterfaces); |
| 29 | 34 | } catch (InterruptedException e) { |
| 30 | - e.printStackTrace(); | |
| 35 | + logger.error("[获取系统信息失败] {}", e.getMessage()); | |
| 31 | 36 | } |
| 32 | 37 | |
| 33 | 38 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/VersionInfo.java
| ... | ... | @@ -2,35 +2,23 @@ package com.genersoft.iot.vmp.conf; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.VersionPo; |
| 4 | 4 | import com.genersoft.iot.vmp.utils.GitUtil; |
| 5 | -import com.genersoft.iot.vmp.utils.JarFileUtils; | |
| 6 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 6 | import org.springframework.stereotype.Component; |
| 8 | 7 | |
| 9 | -import java.util.Map; | |
| 10 | - | |
| 11 | 8 | @Component |
| 12 | 9 | public class VersionInfo { |
| 13 | 10 | |
| 14 | 11 | @Autowired |
| 15 | - VersionConfig config; | |
| 16 | - @Autowired | |
| 17 | 12 | GitUtil gitUtil; |
| 18 | - @Autowired | |
| 19 | - JarFileUtils jarFileUtils; | |
| 20 | 13 | |
| 21 | 14 | public VersionPo getVersion() { |
| 22 | 15 | VersionPo versionPo = new VersionPo(); |
| 23 | - Map<String,String> map=jarFileUtils.readJarFile(); | |
| 24 | 16 | versionPo.setGIT_Revision(gitUtil.getGitCommitId()); |
| 25 | - versionPo.setCreate_By(map.get("Created-By")); | |
| 26 | 17 | versionPo.setGIT_BRANCH(gitUtil.getBranch()); |
| 27 | 18 | versionPo.setGIT_URL(gitUtil.getGitUrl()); |
| 28 | 19 | versionPo.setBUILD_DATE(gitUtil.getBuildDate()); |
| 29 | - versionPo.setArtifactId(config.getArtifactId()); | |
| 30 | 20 | versionPo.setGIT_Revision_SHORT(gitUtil.getCommitIdShort()); |
| 31 | - versionPo.setVersion(config.getVersion()); | |
| 32 | - versionPo.setProject(config.getDescription()); | |
| 33 | - versionPo.setBuild_Jdk(map.get("Build-Jdk")); | |
| 21 | + versionPo.setVersion(gitUtil.getBuildVersion()); | |
| 34 | 22 | |
| 35 | 23 | return versionPo; |
| 36 | 24 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.gb28181.auth; | |
| 2 | - | |
| 3 | -import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl; | |
| 4 | -import org.slf4j.Logger; | |
| 5 | -import org.slf4j.LoggerFactory; | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | - | |
| 9 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 10 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * @description:注册逻辑处理,当设备注册后触发逻辑。 | |
| 14 | - * @author: swwheihei | |
| 15 | - * @date: 2020年5月8日 下午9:41:46 | |
| 16 | - */ | |
| 17 | -@Component | |
| 18 | -public class RegisterLogicHandler { | |
| 19 | - | |
| 20 | - private Logger logger = LoggerFactory.getLogger(RegisterLogicHandler.class); | |
| 21 | - | |
| 22 | - @Autowired | |
| 23 | - private SIPCommander cmder; | |
| 24 | - | |
| 25 | - @Autowired | |
| 26 | - private VideoManagerStorageImpl storager; | |
| 27 | - | |
| 28 | - public void onRegister(Device device) { | |
| 29 | - // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 | |
| 30 | -// // TODO 此处错误无法获取到通道 | |
| 31 | -// Device device1 = storager.queryVideoDevice(device.getDeviceId()); | |
| 32 | -// if (device.isFirsRegister()) { | |
| 33 | -// logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); | |
| 34 | -// try { | |
| 35 | -// Thread.sleep(100); | |
| 36 | -// cmder.deviceInfoQuery(device); | |
| 37 | -// Thread.sleep(100); | |
| 38 | -// cmder.catalogQuery(device, null); | |
| 39 | -// } catch (InterruptedException e) { | |
| 40 | -// e.printStackTrace(); | |
| 41 | -// } | |
| 42 | -// } | |
| 43 | - } | |
| 44 | -} |
src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| ... | ... | @@ -3,23 +3,15 @@ package com.genersoft.iot.vmp.gb28181.session; |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | -import javax.sip.ClientTransaction; | |
| 7 | -import javax.sip.Dialog; | |
| 8 | - | |
| 9 | 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 10 | 7 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 11 | -import com.genersoft.iot.vmp.gb28181.bean.SipMsgInfo; | |
| 12 | 8 | import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; |
| 13 | 9 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 14 | -import com.genersoft.iot.vmp.utils.SerializeUtils; | |
| 15 | 10 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 16 | -import gov.nist.javax.sip.message.SIPRequest; | |
| 17 | 11 | import gov.nist.javax.sip.message.SIPResponse; |
| 18 | -import gov.nist.javax.sip.stack.SIPDialog; | |
| 19 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 13 | import org.springframework.stereotype.Component; |
| 21 | 14 | import org.springframework.util.ObjectUtils; |
| 22 | -import org.springframework.util.StringUtils; | |
| 23 | 15 | |
| 24 | 16 | /** |
| 25 | 17 | * @description:视频流session管理器,管理视频预览、预览回放的通信句柄 | ... | ... |
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; |
| 13 | 13 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 14 | 14 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 15 | 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | -import com.genersoft.iot.vmp.utils.GitUtil; | |
| 17 | -import com.genersoft.iot.vmp.utils.SerializeUtils; | |
| 18 | -import gov.nist.javax.sip.SIPConstants; | |
| 19 | 16 | import gov.nist.javax.sip.SipProviderImpl; |
| 20 | -import gov.nist.javax.sip.SipStackImpl; | |
| 21 | 17 | import gov.nist.javax.sip.message.MessageFactoryImpl; |
| 22 | 18 | import gov.nist.javax.sip.message.SIPRequest; |
| 23 | 19 | import org.slf4j.Logger; |
| ... | ... | @@ -27,7 +23,6 @@ import org.springframework.beans.factory.annotation.Qualifier; |
| 27 | 23 | import org.springframework.context.annotation.DependsOn; |
| 28 | 24 | import org.springframework.context.annotation.Lazy; |
| 29 | 25 | import org.springframework.lang.Nullable; |
| 30 | -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 31 | 26 | import org.springframework.stereotype.Component; |
| 32 | 27 | import org.springframework.util.ObjectUtils; |
| 33 | 28 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| ... | ... | @@ -661,12 +661,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 661 | 661 | mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream()); |
| 662 | 662 | try { |
| 663 | 663 | responseAck(serverTransaction, Response.TEMPORARILY_UNAVAILABLE, response.getMsg()); |
| 664 | - } catch (SipException e) { | |
| 665 | - throw new RuntimeException(e); | |
| 666 | - } catch (InvalidArgumentException e) { | |
| 667 | - throw new RuntimeException(e); | |
| 668 | - } catch (ParseException e) { | |
| 669 | - throw new RuntimeException(e); | |
| 664 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 665 | + logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); | |
| 670 | 666 | } |
| 671 | 667 | } |
| 672 | 668 | }); |
| ... | ... | @@ -733,12 +729,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 733 | 729 | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| 734 | 730 | } |
| 735 | 731 | } |
| 736 | - } catch (InvalidArgumentException e) { | |
| 737 | - throw new RuntimeException(e); | |
| 738 | - } catch (ParseException e) { | |
| 739 | - throw new RuntimeException(e); | |
| 740 | - } catch (SipException e) { | |
| 741 | - throw new RuntimeException(e); | |
| 732 | + } catch (InvalidArgumentException | ParseException | SipException e) { | |
| 733 | + logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); | |
| 742 | 734 | } |
| 743 | 735 | |
| 744 | 736 | ... | ... |
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 |
| 115 | 115 | // 失败的回复 |
| 116 | 116 | try { |
| 117 | 117 | responseAck(serverTransaction, eventResult.statusCode, eventResult.msg); |
| 118 | - } catch (SipException e) { | |
| 119 | - e.printStackTrace(); | |
| 120 | - } catch (InvalidArgumentException e) { | |
| 121 | - e.printStackTrace(); | |
| 122 | - } catch (ParseException e) { | |
| 123 | - e.printStackTrace(); | |
| 118 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 119 | + logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage()); | |
| 124 | 120 | } |
| 125 | 121 | }, eventResult -> { |
| 126 | 122 | // 成功的回复 |
| 127 | 123 | try { |
| 128 | 124 | responseAck(serverTransaction, eventResult.statusCode); |
| 129 | - } catch (SipException e) { | |
| 130 | - e.printStackTrace(); | |
| 131 | - } catch (InvalidArgumentException e) { | |
| 132 | - e.printStackTrace(); | |
| 133 | - } catch (ParseException e) { | |
| 134 | - e.printStackTrace(); | |
| 125 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 126 | + logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage()); | |
| 135 | 127 | } |
| 136 | 128 | }); |
| 137 | 129 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| ... | ... | @@ -217,12 +217,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 217 | 217 | // 回复200 OK |
| 218 | 218 | try { |
| 219 | 219 | responseAck(getServerTransaction(evt), Response.OK); |
| 220 | - } catch (SipException e) { | |
| 221 | - throw new RuntimeException(e); | |
| 222 | - } catch (InvalidArgumentException e) { | |
| 223 | - throw new RuntimeException(e); | |
| 224 | - } catch (ParseException e) { | |
| 225 | - throw new RuntimeException(e); | |
| 220 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 221 | + logger.error("[命令发送失败] 国标级联 报警通知回复: {}", e.getMessage()); | |
| 226 | 222 | } |
| 227 | 223 | Element deviceIdElement = rootElement.element("DeviceID"); |
| 228 | 224 | String channelId = deviceIdElement.getText().toString(); | ... | ... |
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 |
| 78 | 78 | deviceService.online(device); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | - } catch (SipException e) { | |
| 82 | - e.printStackTrace(); | |
| 83 | - } catch (InvalidArgumentException e) { | |
| 84 | - e.printStackTrace(); | |
| 85 | - } catch (ParseException e) { | |
| 86 | - e.printStackTrace(); | |
| 81 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 82 | + logger.error("[命令发送失败] 国标级联 心跳回复: {}", e.getMessage()); | |
| 87 | 83 | } |
| 88 | 84 | } |
| 89 | 85 | ... | ... |
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 |
| 68 | 68 | // 回复200 OK |
| 69 | 69 | try { |
| 70 | 70 | responseAck(getServerTransaction(evt), Response.OK); |
| 71 | - } catch (SipException e) { | |
| 72 | - e.printStackTrace(); | |
| 73 | - } catch (InvalidArgumentException e) { | |
| 74 | - e.printStackTrace(); | |
| 75 | - } catch (ParseException e) { | |
| 76 | - e.printStackTrace(); | |
| 71 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 72 | + logger.error("[命令发送失败] 国标级联 录像流推送完毕,回复200OK: {}", e.getMessage()); | |
| 77 | 73 | } |
| 78 | 74 | CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME); |
| 79 | 75 | String NotifyType =getText(rootElement, "NotifyType"); | ... | ... |
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 |
| 59 | 59 | logger.info("不支持alarm查询"); |
| 60 | 60 | try { |
| 61 | 61 | responseAck(getServerTransaction(evt), Response.NOT_FOUND, "not support alarm query"); |
| 62 | - } catch (SipException e) { | |
| 63 | - e.printStackTrace(); | |
| 64 | - } catch (InvalidArgumentException e) { | |
| 65 | - e.printStackTrace(); | |
| 66 | - } catch (ParseException e) { | |
| 67 | - e.printStackTrace(); | |
| 62 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 63 | + logger.error("[命令发送失败] 国标级联 alarm查询回复200OK: {}", e.getMessage()); | |
| 68 | 64 | } |
| 69 | 65 | |
| 70 | 66 | } | ... | ... |
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 |
| 100 | 100 | // 回复无通道 |
| 101 | 101 | cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0); |
| 102 | 102 | } |
| 103 | - } catch (SipException e) { | |
| 104 | - e.printStackTrace(); | |
| 105 | - } catch (InvalidArgumentException e) { | |
| 106 | - e.printStackTrace(); | |
| 107 | - } catch (ParseException e) { | |
| 108 | - e.printStackTrace(); | |
| 103 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 104 | + logger.error("[命令发送失败] 国标级联 目录查询: {}", e.getMessage()); | |
| 109 | 105 | } |
| 110 | 106 | |
| 111 | 107 | } | ... | ... |
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 |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | } catch (ParseException | SipException | InvalidArgumentException e) { |
| 66 | - e.printStackTrace(); | |
| 66 | + logger.error("[命令发送失败] 国标级联 语音喊话: {}", e.getMessage()); | |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | ... | ... |
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 |
| 63 | 63 | msg.setKey(key); |
| 64 | 64 | msg.setData(json); |
| 65 | 65 | deferredResultHolder.invokeAllResult(msg); |
| 66 | - } catch (SipException e) { | |
| 67 | - e.printStackTrace(); | |
| 68 | - } catch (InvalidArgumentException e) { | |
| 69 | - e.printStackTrace(); | |
| 70 | - } catch (ParseException e) { | |
| 71 | - e.printStackTrace(); | |
| 66 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 67 | + logger.error("[命令发送失败] 国标级联 设备配置查询: {}", e.getMessage()); | |
| 72 | 68 | } |
| 73 | 69 | |
| 74 | 70 | } | ... | ... |
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 |
| 58 | 58 | msg.setKey(key); |
| 59 | 59 | msg.setData(json); |
| 60 | 60 | deferredResultHolder.invokeAllResult(msg); |
| 61 | - } catch (SipException e) { | |
| 62 | - e.printStackTrace(); | |
| 63 | - } catch (InvalidArgumentException e) { | |
| 64 | - e.printStackTrace(); | |
| 65 | - } catch (ParseException e) { | |
| 66 | - e.printStackTrace(); | |
| 61 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 62 | + logger.error("[命令发送失败] 国标级联 设备控制: {}", e.getMessage()); | |
| 67 | 63 | } |
| 68 | 64 | } |
| 69 | 65 | ... | ... |
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 |
| 60 | 60 | // 回复200 OK |
| 61 | 61 | try { |
| 62 | 62 | responseAck(getServerTransaction(evt), Response.OK); |
| 63 | - } catch (SipException e) { | |
| 64 | - e.printStackTrace(); | |
| 65 | - } catch (InvalidArgumentException e) { | |
| 66 | - e.printStackTrace(); | |
| 67 | - } catch (ParseException e) { | |
| 68 | - e.printStackTrace(); | |
| 63 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 64 | + logger.error("[命令发送失败] 国标级联 设备状态应答回复200OK: {}", e.getMessage()); | |
| 69 | 65 | } |
| 70 | 66 | Element deviceIdElement = element.element("DeviceID"); |
| 71 | 67 | Element onlineElement = element.element("Online"); | ... | ... |
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 |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | } catch (DocumentException e) { |
| 150 | - throw new RuntimeException(e); | |
| 150 | + logger.error("xml解析异常: ", e); | |
| 151 | 151 | } finally { |
| 152 | 152 | taskQueueHandlerRun = false; |
| 153 | 153 | } |
| ... | ... | @@ -155,13 +155,9 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent |
| 155 | 155 | }); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - } catch (SipException e) { | |
| 159 | - e.printStackTrace(); | |
| 160 | - } catch (InvalidArgumentException e) { | |
| 161 | - e.printStackTrace(); | |
| 162 | - } catch (ParseException e) { | |
| 163 | - e.printStackTrace(); | |
| 164 | - }finally { | |
| 158 | + } catch (SipException | InvalidArgumentException | ParseException e) { | |
| 159 | + logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage()); | |
| 160 | + } finally { | |
| 165 | 161 | taskQueueHandlerRun = false; |
| 166 | 162 | } |
| 167 | 163 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.timeout.impl; |
| 2 | 2 | |
| 3 | +import com.genersoft.iot.vmp.conf.SystemInfoTimerTask; | |
| 3 | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 4 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 5 | 6 | import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor; |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 6 | 9 | import org.springframework.beans.factory.InitializingBean; |
| 7 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 11 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -13,6 +16,8 @@ import javax.sip.header.CallIdHeader; |
| 13 | 16 | @Component |
| 14 | 17 | public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor { |
| 15 | 18 | |
| 19 | + private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class); | |
| 20 | + | |
| 16 | 21 | @Autowired |
| 17 | 22 | private SIPProcessorObserver processorObserver; |
| 18 | 23 | |
| ... | ... | @@ -36,7 +41,7 @@ public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor |
| 36 | 41 | sipSubscribe.removeErrorSubscribe(callId); |
| 37 | 42 | sipSubscribe.removeOkSubscribe(callId); |
| 38 | 43 | } catch (Exception e) { |
| 39 | - e.printStackTrace(); | |
| 44 | + logger.error("[超时事件失败]: {}", e.getMessage()); | |
| 40 | 45 | } |
| 41 | 46 | } |
| 42 | 47 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
| ... | ... | @@ -93,7 +93,6 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus |
| 93 | 93 | try { |
| 94 | 94 | gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId()); |
| 95 | 95 | }catch (IllegalArgumentException e) { |
| 96 | - e.printStackTrace(); | |
| 97 | 96 | errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)"); |
| 98 | 97 | return; |
| 99 | 98 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java
| ... | ... | @@ -156,7 +156,7 @@ public class RedisGbPlayMsgListener implements MessageListener { |
| 156 | 156 | try { |
| 157 | 157 | playMsgCallback.handler(responseSendItemMsg); |
| 158 | 158 | } catch (ParseException e) { |
| 159 | - throw new RuntimeException(e); | |
| 159 | + logger.error("[REDIS消息处理异常] ", e); | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | break; | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
| ... | ... | @@ -17,49 +17,6 @@ public class GpsUtil { |
| 17 | 17 | public static BaiduPoint Wgs84ToBd09(String xx, String yy) { |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -// try { | |
| 21 | -// Socket s = new Socket("api.map.baidu.com", 80); | |
| 22 | -// BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8")); | |
| 23 | -// OutputStream out = s.getOutputStream(); | |
| 24 | -// StringBuffer sb = new StringBuffer("GET /ag/coord/convert?from=0&to=4"); | |
| 25 | -// sb.append("&x=" + xx + "&y=" + yy); | |
| 26 | -// sb.append("&callback=BMap.Convertor.cbk_3976 HTTP/1.1\r\n"); | |
| 27 | -// sb.append("User-Agent: Java/1.6.0_20\r\n"); | |
| 28 | -// sb.append("Host: api.map.baidu.com:80\r\n"); | |
| 29 | -// sb.append("Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n"); | |
| 30 | -// sb.append("Connection: Close\r\n"); | |
| 31 | -// sb.append("\r\n"); | |
| 32 | -// out.write(sb.toString().getBytes()); | |
| 33 | -// String json = ""; | |
| 34 | -// String tmp = ""; | |
| 35 | -// while ((tmp = br.readLine()) != null) { | |
| 36 | -// // logger.info(tmp); | |
| 37 | -// json += tmp; | |
| 38 | -// } | |
| 39 | -// | |
| 40 | -// s.close(); | |
| 41 | -// int start = json.indexOf("cbk_3976"); | |
| 42 | -// int end = json.lastIndexOf("}"); | |
| 43 | -// if (start != -1 && end != -1 && json.contains("\"x\":\"")) { | |
| 44 | -// json = json.substring(start, end); | |
| 45 | -// String[] point = json.split(","); | |
| 46 | -// String x = point[1].split(":")[1].replace("\"", ""); | |
| 47 | -// String y = point[2].split(":")[1].replace("\"", ""); | |
| 48 | -// BaiduPoint bdPoint= new BaiduPoint(); | |
| 49 | -// bdPoint.setBdLng(new String(decode(x))); | |
| 50 | -// bdPoint.setBdLat(new String(decode(y))); | |
| 51 | -// return bdPoint; | |
| 52 | -// //return (new String(decode(x)) + "," + new String(decode(y))); | |
| 53 | -// } else { | |
| 54 | -// logger.info("gps坐标无效!!"); | |
| 55 | -// } | |
| 56 | -// out.close(); | |
| 57 | -// br.close(); | |
| 58 | -// } catch (Exception e) { | |
| 59 | -// e.printStackTrace(); | |
| 60 | -// } | |
| 61 | - | |
| 62 | - | |
| 63 | 20 | double lng = Double.parseDouble(xx); |
| 64 | 21 | double lat = Double.parseDouble(yy); |
| 65 | 22 | Double[] gcj02 = Coordtransform.WGS84ToGCJ02(lng, lat); | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/IpUtil.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.utils; | |
| 2 | - | |
| 3 | - | |
| 4 | -import javax.servlet.http.HttpServletRequest; | |
| 5 | -import java.net.InetAddress; | |
| 6 | -import java.net.UnknownHostException; | |
| 7 | - | |
| 8 | -public class IpUtil { | |
| 9 | - public static String getIpAddr(HttpServletRequest request) { | |
| 10 | - String ipAddress = null; | |
| 11 | - try { | |
| 12 | - ipAddress = request.getHeader("x-forwarded-for"); | |
| 13 | - if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { | |
| 14 | - ipAddress = request.getHeader("Proxy-Client-IP"); | |
| 15 | - } | |
| 16 | - if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { | |
| 17 | - ipAddress = request.getHeader("WL-Proxy-Client-IP"); | |
| 18 | - } | |
| 19 | - if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { | |
| 20 | - ipAddress = request.getRemoteAddr(); | |
| 21 | - if (ipAddress.equals("127.0.0.1")) { | |
| 22 | - // 根据网卡取本机配置的IP | |
| 23 | - InetAddress inet = null; | |
| 24 | - try { | |
| 25 | - inet = InetAddress.getLocalHost(); | |
| 26 | - } catch (UnknownHostException e) { | |
| 27 | - e.printStackTrace(); | |
| 28 | - } | |
| 29 | - ipAddress = inet.getHostAddress(); | |
| 30 | - } | |
| 31 | - } | |
| 32 | - // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 | |
| 33 | - if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length() | |
| 34 | - // = 15 | |
| 35 | - if (ipAddress.indexOf(",") > 0) { | |
| 36 | - ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); | |
| 37 | - } | |
| 38 | - } | |
| 39 | - } catch (Exception e) { | |
| 40 | - ipAddress=""; | |
| 41 | - } | |
| 42 | - // ipAddress = this.getRequest().getRemoteAddr(); | |
| 43 | - | |
| 44 | - return ipAddress; | |
| 45 | - } | |
| 46 | -} | |
| 47 | - | |
| 48 | - |
src/main/java/com/genersoft/iot/vmp/utils/JarFileUtils.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.utils; | |
| 2 | - | |
| 3 | -import org.slf4j.Logger; | |
| 4 | -import org.slf4j.LoggerFactory; | |
| 5 | -import org.springframework.stereotype.Component; | |
| 6 | -import org.springframework.util.ClassUtils; | |
| 7 | - | |
| 8 | -import java.io.BufferedReader; | |
| 9 | -import java.io.IOException; | |
| 10 | -import java.io.InputStream; | |
| 11 | -import java.io.InputStreamReader; | |
| 12 | -import java.util.HashMap; | |
| 13 | -import java.util.Map; | |
| 14 | -import java.util.jar.JarEntry; | |
| 15 | -import java.util.jar.JarFile; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 一个优秀的颓废程序猿 | |
| 19 | - */ | |
| 20 | -@Component | |
| 21 | -public class JarFileUtils { | |
| 22 | - private static Logger log = LoggerFactory.getLogger(JarFileUtils.class); | |
| 23 | - private static Map<String, String> map = new HashMap<>(); | |
| 24 | - | |
| 25 | - public Map<String, String> readJarFile() { | |
| 26 | - JarFile jarFile = null; | |
| 27 | - BufferedReader br = null; | |
| 28 | - try { | |
| 29 | - // 获取jar的运行路径,因linux下jar的路径为”file:/app/.../test.jar!/BOOT-INF/class!/“这种格式,所以需要去掉”file:“和”!/BOOT-INF/class!/“ | |
| 30 | - String jarFilePath = ClassUtils.getDefaultClassLoader().getResource("").getPath().replace("!/BOOT-INF/classes!/", ""); | |
| 31 | - if (jarFilePath.startsWith("file")) { | |
| 32 | - jarFilePath = jarFilePath.substring(5); | |
| 33 | - } | |
| 34 | - log.debug("jarFilePath:" + jarFilePath); | |
| 35 | - // 通过JarFile的getJarEntry方法读取META-INF/MANIFEST.MF | |
| 36 | - jarFile = new JarFile(jarFilePath); | |
| 37 | - JarEntry entry = jarFile.getJarEntry("META-INF/MANIFEST.MF"); | |
| 38 | - log.info("读取的内容:" + entry.toString()); | |
| 39 | - // 如果读取到MANIFEST.MF文件内容,则转换为string | |
| 40 | - if (entry != null) { | |
| 41 | - InputStream in = jarFile.getInputStream(entry); | |
| 42 | - | |
| 43 | - StringBuilder sb = new StringBuilder(); | |
| 44 | - br = new BufferedReader(new InputStreamReader(in)); | |
| 45 | - String line = ""; | |
| 46 | - while ((line = br.readLine()) != null) { | |
| 47 | - if (line != null && line.contains(":")) { | |
| 48 | - int index = line.indexOf(":"); | |
| 49 | - map.put(line.substring(0, index).trim(), line.substring(index + 1, line.length()).trim()); | |
| 50 | - } | |
| 51 | - } | |
| 52 | - return map; | |
| 53 | - } | |
| 54 | - } catch (IOException e) { | |
| 55 | - log.debug("读取MANIFEST.MF文件异常:" + e.getMessage()); | |
| 56 | - } finally { | |
| 57 | - try { | |
| 58 | - if (null != br) { | |
| 59 | - br.close(); | |
| 60 | - } | |
| 61 | - if (null != jarFile) { | |
| 62 | - jarFile.close(); | |
| 63 | - } | |
| 64 | - } catch (IOException e) { | |
| 65 | - e.printStackTrace(); | |
| 66 | - } | |
| 67 | - } | |
| 68 | - | |
| 69 | - return map; | |
| 70 | - | |
| 71 | - } | |
| 72 | - | |
| 73 | -} |
src/main/java/com/genersoft/iot/vmp/utils/SerializeUtils.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.utils; | |
| 2 | - | |
| 3 | -import java.io.*; | |
| 4 | - | |
| 5 | -public class SerializeUtils { | |
| 6 | - public static byte[] serialize(Object obj){ | |
| 7 | - byte[] bytes = null; | |
| 8 | - try { | |
| 9 | - ByteArrayOutputStream baos=new ByteArrayOutputStream();; | |
| 10 | - ObjectOutputStream oos=new ObjectOutputStream(baos); | |
| 11 | - oos.writeObject(obj); | |
| 12 | - bytes=baos.toByteArray(); | |
| 13 | - baos.close(); | |
| 14 | - oos.close(); | |
| 15 | - } catch (IOException e) { | |
| 16 | - e.printStackTrace(); | |
| 17 | - } | |
| 18 | - return bytes; | |
| 19 | - } | |
| 20 | - public static Object deSerialize(byte[] bytes){ | |
| 21 | - Object obj=null; | |
| 22 | - try { | |
| 23 | - ByteArrayInputStream bais=new ByteArrayInputStream(bytes); | |
| 24 | - ObjectInputStream ois=new ObjectInputStream(bais); | |
| 25 | - obj=ois.readObject(); | |
| 26 | - } catch (Exception e) { | |
| 27 | - e.printStackTrace(); | |
| 28 | - } | |
| 29 | - return obj; | |
| 30 | - } | |
| 31 | -} |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
| ... | ... | @@ -96,7 +96,7 @@ public class MediaController { |
| 96 | 96 | try { |
| 97 | 97 | Thread.sleep(1000); |
| 98 | 98 | } catch (InterruptedException e) { |
| 99 | - e.printStackTrace(); | |
| 99 | + logger.error("[线程休眠失败], {}", e.getMessage()); | |
| 100 | 100 | } |
| 101 | 101 | if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) { |
| 102 | 102 | String host = request.getHeader("Host"); | ... | ... |