diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index dc0fd5bc..f6febd83 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -296,13 +296,10 @@ public class DeviceQuery { @Parameter(name = "device", description = "设备", required = true) @PostMapping("/device/update/") public void updateDevice(Device device){ - - if (device != null && device.getDeviceId() != null) { - if (device.getSubscribeCycleForMobilePosition() > 0 && device.getMobilePositionSubmissionInterval() <= 0) { - device.setMobilePositionSubmissionInterval(5); - } - deviceService.updateCustomDevice(device); + if (device == null || device.getDeviceId() == null || device.getId() <= 0) { + throw new ControllerException(ErrorCode.ERROR400); } + deviceService.updateCustomDevice(device); } /** diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java index 7dfb11af..3df8b887 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java @@ -246,24 +246,12 @@ public interface DeviceMapper { @Update(value = {" "}) void updateCustom(Device device); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java index 48616fab..f731ce70 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java @@ -421,34 +421,11 @@ public class DeviceServiceImpl implements IDeviceService { @Override public void updateCustomDevice(Device device) { - Device deviceInStore = deviceMapper.getDeviceByDeviceId(device.getDeviceId()); + Device deviceInStore = deviceMapper.query(device.getId()); if (deviceInStore == null) { log.warn("更新设备时未找到设备信息"); return; } - - if (!ObjectUtils.isEmpty(device.getName())) { - deviceInStore.setName(device.getName()); - } - if (!ObjectUtils.isEmpty(device.getCharset())) { - deviceInStore.setCharset(device.getCharset()); - } - if (!ObjectUtils.isEmpty(device.getMediaServerId())) { - deviceInStore.setMediaServerId(device.getMediaServerId()); - } - if (!ObjectUtils.isEmpty(device.getCharset())) { - deviceInStore.setCharset(device.getCharset()); - } - if (!ObjectUtils.isEmpty(device.getSdpIp())) { - deviceInStore.setSdpIp(device.getSdpIp()); - } - if (!ObjectUtils.isEmpty(device.getPassword())) { - deviceInStore.setPassword(device.getPassword()); - } - if (!ObjectUtils.isEmpty(device.getStreamMode())) { - deviceInStore.setStreamMode(device.getStreamMode()); - } - deviceInStore.setBroadcastPushAfterAck(device.isBroadcastPushAfterAck()); // 目录订阅相关的信息 if (deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { if (device.getSubscribeCycleForCatalog() > 0) { @@ -513,13 +490,9 @@ public class DeviceServiceImpl implements IDeviceService { if (device.getCharset() == null) { deviceInStore.setCharset("GB2312"); } - //SSRC校验 - deviceInStore.setSsrcCheck(device.isSsrcCheck()); - //作为消息通道 - deviceInStore.setAsMessageChannel(device.isAsMessageChannel()); - deviceMapper.updateCustom(deviceInStore); - redisCatchStorage.updateDevice(deviceInStore); + deviceMapper.updateCustom(device); + redisCatchStorage.updateDevice(device); } @Override