From 728e60ce8431fe5a70e44a1da2d4835425ce83a5 Mon Sep 17 00:00:00 2001
From: pei <ayp199645aabb@qq.com>
Date: 星期五, 29 三月 2024 11:55:44 +0800
Subject: [PATCH] 处理可能会出现的空指针异常
---
src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
index 2cfe16e..c646058 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
@@ -125,7 +125,7 @@
strTmp = String.format("%02X", moveSpeed);
builder.append(strTmp, 0, 2);
builder.append(strTmp, 0, 2);
-
+
//浼樺寲zoom浣庡�嶉�熶笅鐨勫彉鍊嶉�熺巼
if ((zoomSpeed > 0) && (zoomSpeed <16))
{
@@ -140,6 +140,26 @@
return builder.toString();
}
+ public static String getNewCallId() {
+ return (int) Math.floor(Math.random() * 1000000000) + "";
+ }
+
+ public static int getTypeCodeFromGbCode(String deviceId) {
+ if (ObjectUtils.isEmpty(deviceId)) {
+ return 0;
+ }
+ return Integer.parseInt(deviceId.substring(10, 13));
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁鏄墠绔鍥磋澶�
+ * @param deviceId
+ * @return
+ */
+ public static boolean isFrontEnd(String deviceId) {
+ int typeCodeFromGbCode = getTypeCodeFromGbCode(deviceId);
+ return typeCodeFromGbCode > 130 && typeCodeFromGbCode < 199;
+ }
/**
* 浠庤姹備腑鑾峰彇璁惧ip鍦板潃鍜岀鍙e彿
* @param request 璇锋眰
@@ -250,7 +270,6 @@
if (ObjectUtils.isEmpty(timeStr)){
return null;
}
- System.out.println(timeStr);
LocalDateTime localDateTime;
try {
localDateTime = LocalDateTime.parse(timeStr);
@@ -262,6 +281,6 @@
return null;
}
}
- return localDateTime.format(DateUtil.formatterISO8601);
+ return localDateTime.format(DateUtil.formatter);
}
-}
+}
\ No newline at end of file
--
Gitblit v1.8.0