Commit 4e0a463f883816d78a4c4241ab23e79b2e805f98

Authored by 648540858
1 parent 102aad1f

优化对Parental字段的判断

src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -206,8 +206,18 @@ public class XmlUtil {
206 206 deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
207 207 String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
208 208 if (XmlUtil.getText(itemDevice, "Parental") == null
209   - || XmlUtil.getText(itemDevice, "Parental") == "") {
210   - deviceChannel.setParental(0);
  209 + || XmlUtil.getText(itemDevice, "Parental").equals("")) {
  210 + if (deviceChannel.getChannelId().length() <= 10
  211 + || (deviceChannel.getChannelId().length() == 20 && (
  212 + Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 215
  213 + || Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216
  214 + )
  215 + )
  216 + ) {
  217 + deviceChannel.setParental(1);
  218 + }else {
  219 + deviceChannel.setParental(0);
  220 + }
211 221 } else {
212 222 deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")));
213 223 }
... ...