Commit e4754af417b176f5e0ab998e6594d875bc0a069c

Authored by 648540858
1 parent e163cf4d

修复数据错误导致无法转成JSON返回 #919

src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
@@ -244,6 +244,9 @@ public class Device { @@ -244,6 +244,9 @@ public class Device {
244 } 244 }
245 245
246 public Integer getStreamModeForParam() { 246 public Integer getStreamModeForParam() {
  247 + if (streamMode == null) {
  248 + return 0;
  249 + }
247 if (streamMode.equalsIgnoreCase("UDP")) { 250 if (streamMode.equalsIgnoreCase("UDP")) {
248 return 0; 251 return 0;
249 }else if (streamMode.equalsIgnoreCase("TCP-PASSIVE")) { 252 }else if (streamMode.equalsIgnoreCase("TCP-PASSIVE")) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
@@ -166,7 +166,18 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen @@ -166,7 +166,18 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
166 device.setGeoCoordSys("WGS84"); 166 device.setGeoCoordSys("WGS84");
167 device.setDeviceId(deviceId); 167 device.setDeviceId(deviceId);
168 device.setOnLine(false); 168 device.setOnLine(false);
  169 + }else {
  170 + if (ObjectUtils.isEmpty(device.getStreamMode())) {
  171 + device.setStreamMode("UDP");
  172 + }
  173 + if (ObjectUtils.isEmpty(device.getCharset())) {
  174 + device.setCharset("GB2312");
  175 + }
  176 + if (ObjectUtils.isEmpty(device.getGeoCoordSys())) {
  177 + device.setGeoCoordSys("WGS84");
  178 + }
169 } 179 }
  180 +
170 device.setIp(remoteAddressInfo.getIp()); 181 device.setIp(remoteAddressInfo.getIp());
171 device.setPort(remoteAddressInfo.getPort()); 182 device.setPort(remoteAddressInfo.getPort());
172 device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort()))); 183 device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -493,8 +493,12 @@ public class DeviceServiceImpl implements IDeviceService { @@ -493,8 +493,12 @@ public class DeviceServiceImpl implements IDeviceService {
493 if (!ObjectUtils.isEmpty(device.getMediaServerId())) { 493 if (!ObjectUtils.isEmpty(device.getMediaServerId())) {
494 deviceInStore.setMediaServerId(device.getMediaServerId()); 494 deviceInStore.setMediaServerId(device.getMediaServerId());
495 } 495 }
496 - deviceInStore.setSdpIp(device.getSdpIp());  
497 - deviceInStore.setCharset(device.getCharset()); 496 + if (!ObjectUtils.isEmpty(device.getCharset())) {
  497 + deviceInStore.setCharset(device.getCharset());
  498 + }
  499 + if (!ObjectUtils.isEmpty(device.getSdpIp())) {
  500 + deviceInStore.setSdpIp(device.getSdpIp());
  501 + }
498 502
499 // 目录订阅相关的信息 503 // 目录订阅相关的信息
500 if (device.getSubscribeCycleForCatalog() > 0) { 504 if (device.getSubscribeCycleForCatalog() > 0) {
@@ -525,10 +529,18 @@ public class DeviceServiceImpl implements IDeviceService { @@ -525,10 +529,18 @@ public class DeviceServiceImpl implements IDeviceService {
525 removeMobilePositionSubscribe(deviceInStore); 529 removeMobilePositionSubscribe(deviceInStore);
526 } 530 }
527 } 531 }
528 - // 坐标系变化,需要重新计算GCJ02坐标和WGS84坐标  
529 - if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {  
530 - updateDeviceChannelGeoCoordSys(device); 532 + if (deviceInStore.getGeoCoordSys() != null) {
  533 + // 坐标系变化,需要重新计算GCJ02坐标和WGS84坐标
  534 + if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {
  535 + updateDeviceChannelGeoCoordSys(device);
  536 + }
  537 + }else {
  538 + device.setGeoCoordSys("WGS84");
531 } 539 }
  540 + if (device.getCharset() == null) {
  541 + device.setCharset("GB2312");
  542 + }
  543 +
532 // 更新redis 544 // 更新redis
533 redisCatchStorage.updateDevice(device); 545 redisCatchStorage.updateDevice(device);
534 deviceMapper.updateCustom(device); 546 deviceMapper.updateCustom(device);