Merge branch 'wvp-28181-2.0' into main-dev

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
This commit is contained in:
648540858
2024-03-08 09:30:48 +08:00
6 changed files with 81 additions and 16 deletions

View File

@@ -77,6 +77,50 @@ public class XmlUtil {
return null == e ? null : e.getText().trim();
}
/**
* 获取element对象的text的值
*
* @param em 节点的对象
* @param tag 节点的tag
* @return 节点
*/
public static Double getDouble(Element em, String tag) {
if (null == em) {
return null;
}
Element e = em.element(tag);
if (null == e) {
return null;
}
String text = e.getText().trim();
if (ObjectUtils.isEmpty(text) || !NumberUtils.isParsable(text)) {
return null;
}
return Double.parseDouble(text);
}
/**
* 获取element对象的text的值
*
* @param em 节点的对象
* @param tag 节点的tag
* @return 节点
*/
public static Integer getInteger(Element em, String tag) {
if (null == em) {
return null;
}
Element e = em.element(tag);
if (null == e) {
return null;
}
String text = e.getText().trim();
if (ObjectUtils.isEmpty(text) || !NumberUtils.isParsable(text)) {
return null;
}
return Integer.parseInt(text);
}
/**
* 递归解析xml节点适用于 多节点数据
*