Lawrence
2020-11-16 e4e6209835eaae8eab9e6210f3bdf52b23de4c7a
修正处理Catalog信息时遇到空字段的错误
1个文件已修改
27 ■■■■ 已修改文件
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
@@ -215,12 +215,27 @@
                    deviceChannel.setPort(itemDevice.element("Port") == null ? 0
                            : Integer.parseInt(XmlUtil.getText(itemDevice, "Port")));
                    deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password"));
                    deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00
                            : Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
                    deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00
                            : Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
                    deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0
                            : Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
                    if (itemDevice.element("Longitute")==null) {
                        deviceChannel.setLongitude(0.00);
                    } else {
                        deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
                    }
                    if (itemDevice.element("Latitute") == null) {
                        deviceChannel.setLatitude(0.00);
                    } else {
                        deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
                    }
                    if (itemDevice.element("PTZType") == null) {
                        deviceChannel.setPTZType(0);
                    } else {
                        deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
                    }
                    // deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00
                    //         : Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
                    // deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00
                    //         : Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
                    // deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0
                    //         : Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
                    deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC
                    storager.updateChannel(device.getDeviceId(), deviceChannel);
                }