From 9ef1a0277b23c0302891d74648e0b559423dcbb8 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 18 五月 2022 15:36:33 +0800
Subject: [PATCH] 更新jessibuca播放器
---
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 63 +++++++++++++++++++++++++++----
1 files changed, 54 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
index 6ae09bd..2caab0f 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
@@ -204,19 +204,64 @@
deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode"));
deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
+ String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
if (XmlUtil.getText(itemDevice, "Parental") == null
- || XmlUtil.getText(itemDevice, "Parental") == "") {
- deviceChannel.setParental(0);
+ || XmlUtil.getText(itemDevice, "Parental").equals("")) {
+ if (deviceChannel.getChannelId().length() <= 10
+ || (deviceChannel.getChannelId().length() == 20 && (
+ Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 215
+ || Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216
+ )
+ )
+ ) {
+ deviceChannel.setParental(1);
+ }else {
+ deviceChannel.setParental(0);
+ }
} else {
- deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")));
+ // 鐢变簬娴峰悍浼氶敊璇殑鍙戦��65535浣滀负杩欓噷鐨勫彇鍊�,鎵�浠ヨ繖閲岄櫎闈炴槸0鍚﹀垯璁や负鏄�1
+ deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")) == 1?1:0);
}
- deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID"));
+ /**
+ * 琛屾斂鍖哄垝灞曠ず璁惧鏍戜笌涓氬姟鍒嗙粍灞曠ず璁惧鏍戞槸涓ょ涓嶅悓鐨勬ā寮�
+ * 琛屾斂鍖哄垝灞曠ず璁惧鏍� 鍚勪釜鐩綍涔嬮棿涓昏闈燿eviceId鍋氬叧鑱�,鎽勫儚澶撮�氳繃CivilCode鎸囧畾鍏跺睘浜庨偅涓鏀垮尯鍒�;閮芥槸涓嶈秴杩囧崄浣嶇殑缂栧彿; 缁撴瀯濡備笅:
+ * 娌冲寳鐪�
+ * --> 鐭冲搴勫競
+ * --> 鎽勫儚澶�
+ * --> 姝e畾鍘�
+ * --> 鎽勫儚澶�
+ * --> 鎽勫儚澶�
+ *
+ * 涓氬姟鍒嗙粍灞曠ず璁惧鏍戞槸椤剁骇鏄笟鍔″垎缁�,鍏朵笅鐨勮櫄鎷熺粍缁囬潬BusinessGroupID鎸囧畾鍏舵墍灞炵殑涓氬姟鍒嗙粍;鎽勫儚澶撮�氳繃ParentId鏉ユ寚瀹氬叾鎵�灞炰簬鐨勮櫄鎷熺粍缁�:
+ * 涓氬姟鍒嗙粍
+ * --> 铏氭嫙缁勭粐
+ * --> 鎽勫儚澶�
+ * --> 铏氭嫙缁勭粐
+ * --> 鎽勫儚澶�
+ * --> 鎽勫儚澶�
+ */
String parentId = XmlUtil.getText(itemDevice, "ParentID");
- if (parentId != null && parentId.contains("/")) {
- String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
- deviceChannel.setParentId(lastParentId);
+ if (parentId != null) {
+ if (parentId.contains("/")) {
+ String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
+ deviceChannel.setParentId(lastParentId);
+ }else {
+ deviceChannel.setParentId(parentId);
+ }
}else {
- deviceChannel.setParentId(parentId);
+ if (deviceChannel.getChannelId().length() <= 10) { // 姝ゆ椂涓鸿鏀垮尯鍒�, 涓婁笅绾ц鏀垮尯鍒掍娇鐢―eviceId鍏宠仈
+ deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
+ }else if (deviceChannel.getChannelId().length() == 20) {
+ if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 铏氭嫙缁勭粐
+ deviceChannel.setParentId(businessGroupID);
+ }else if (deviceChannel.getCivilCode() != null) {
+ // 璁惧锛� 鏃爌arentId鐨�20浣嶆槸浣跨敤CivilCode琛ㄧず涓婄骇鐨勮澶囷紝
+ // 娉細215 涓氬姟鍒嗙粍鏄渶瑕佹湁parentId鐨�
+ deviceChannel.setParentId(deviceChannel.getCivilCode());
+ }
+ }else {
+ deviceChannel.setParentId(deviceChannel.getDeviceId());
+ }
}
if (XmlUtil.getText(itemDevice, "SafetyWay") == null
@@ -277,4 +322,4 @@
deviceChannel.setHasAudio(true); // 榛樿鍚湁闊抽锛屾挱鏀炬椂鍐嶆鏌ユ槸鍚︽湁闊抽鍙婃槸鍚AC
return deviceChannel;
}
-}
+}
\ No newline at end of file
--
Gitblit v1.8.0