Commit 0e2908c1be4ba7d092b4cc4dbba6f6fc9481032e
1 parent
f09f1c9a
#488
Showing
3 changed files
with
22 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | ||
| 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 20 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 20 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 21 | +import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 21 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 22 | import org.dom4j.DocumentException; | 23 | import org.dom4j.DocumentException; |
| 23 | import org.dom4j.Element; | 24 | import org.dom4j.Element; |
| @@ -188,6 +189,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -188,6 +189,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 188 | 189 | ||
| 189 | Device device = redisCatchStorage.getDevice(deviceId); | 190 | Device device = redisCatchStorage.getDevice(deviceId); |
| 190 | if (device == null) { | 191 | if (device == null) { |
| 192 | + responseAck(evt, Response.NOT_FOUND, "device is not found"); | ||
| 191 | return; | 193 | return; |
| 192 | } | 194 | } |
| 193 | rootElement = getRootElement(evt, device.getCharset()); | 195 | rootElement = getRootElement(evt, device.getCharset()); |
| @@ -195,7 +197,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -195,7 +197,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 195 | deviceAlarm.setDeviceId(deviceId); | 197 | deviceAlarm.setDeviceId(deviceId); |
| 196 | deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority")); | 198 | deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority")); |
| 197 | deviceAlarm.setAlarmMethod(XmlUtil.getText(rootElement, "AlarmMethod")); | 199 | deviceAlarm.setAlarmMethod(XmlUtil.getText(rootElement, "AlarmMethod")); |
| 198 | - deviceAlarm.setAlarmTime(XmlUtil.getText(rootElement, "AlarmTime")); | 200 | + String alarmTime = XmlUtil.getText(rootElement, "AlarmTime"); |
| 201 | + if (alarmTime == null) { | ||
| 202 | + responseAck(evt, Response.BAD_REQUEST, "AlarmTime cannot be null"); | ||
| 203 | + return; | ||
| 204 | + } | ||
| 205 | + deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime)); | ||
| 199 | if (XmlUtil.getText(rootElement, "AlarmDescription") == null) { | 206 | if (XmlUtil.getText(rootElement, "AlarmDescription") == null) { |
| 200 | deviceAlarm.setAlarmDescription(""); | 207 | deviceAlarm.setAlarmDescription(""); |
| 201 | } else { | 208 | } else { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| @@ -9,9 +9,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag | @@ -9,9 +9,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; | 10 | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | +import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | ||
| 12 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; | 13 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | +import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 15 | import org.dom4j.Element; | 17 | import org.dom4j.Element; |
| 16 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
| @@ -84,7 +86,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -84,7 +86,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 84 | deviceAlarm.setChannelId(channelId); | 86 | deviceAlarm.setChannelId(channelId); |
| 85 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); | 87 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 86 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); | 88 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); |
| 87 | - deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); | 89 | + String alarmTime = XmlUtil.getText(rootElement, "AlarmTime"); |
| 90 | + if (alarmTime == null) { | ||
| 91 | + return; | ||
| 92 | + } | ||
| 93 | + deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime)); | ||
| 88 | String alarmDescription = getText(rootElement, "AlarmDescription"); | 94 | String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 89 | if (alarmDescription == null) { | 95 | if (alarmDescription == null) { |
| 90 | deviceAlarm.setAlarmDescription(""); | 96 | deviceAlarm.setAlarmDescription(""); |
| @@ -175,7 +181,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -175,7 +181,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 175 | deviceAlarm.setChannelId(channelId); | 181 | deviceAlarm.setChannelId(channelId); |
| 176 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); | 182 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 177 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); | 183 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); |
| 178 | - deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); | 184 | + String alarmTime = XmlUtil.getText(rootElement, "AlarmTime"); |
| 185 | + if (alarmTime == null) { | ||
| 186 | + return; | ||
| 187 | + } | ||
| 188 | + deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime)); | ||
| 179 | String alarmDescription = getText(rootElement, "AlarmDescription"); | 189 | String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 180 | if (alarmDescription == null) { | 190 | if (alarmDescription == null) { |
| 181 | deviceAlarm.setAlarmDescription(""); | 191 | deviceAlarm.setAlarmDescription(""); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
| @@ -69,8 +69,8 @@ public class AlarmController { | @@ -69,8 +69,8 @@ public class AlarmController { | ||
| 69 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), | 69 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), |
| 70 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), | 70 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), |
| 71 | @ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class), | 71 | @ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class), |
| 72 | - @ApiImplicitParam(name="startTime", value = "查询内容" ,dataTypeClass = String.class), | ||
| 73 | - @ApiImplicitParam(name="endTime", value = "查询内容" ,dataTypeClass = String.class), | 72 | + @ApiImplicitParam(name="startTime", value = "开始时间" ,dataTypeClass = String.class), |
| 73 | + @ApiImplicitParam(name="endTime", value = "结束时间" ,dataTypeClass = String.class), | ||
| 74 | }) | 74 | }) |
| 75 | public ResponseEntity<PageInfo<DeviceAlarm>> getAll( | 75 | public ResponseEntity<PageInfo<DeviceAlarm>> getAll( |
| 76 | @RequestParam int page, | 76 | @RequestParam int page, |