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 | 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 19 | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 20 | 20 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 21 | +import com.genersoft.iot.vmp.utils.DateUtil; | |
| 21 | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 22 | 23 | import org.dom4j.DocumentException; |
| 23 | 24 | import org.dom4j.Element; |
| ... | ... | @@ -188,6 +189,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 188 | 189 | |
| 189 | 190 | Device device = redisCatchStorage.getDevice(deviceId); |
| 190 | 191 | if (device == null) { |
| 192 | + responseAck(evt, Response.NOT_FOUND, "device is not found"); | |
| 191 | 193 | return; |
| 192 | 194 | } |
| 193 | 195 | rootElement = getRootElement(evt, device.getCharset()); |
| ... | ... | @@ -195,7 +197,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 195 | 197 | deviceAlarm.setDeviceId(deviceId); |
| 196 | 198 | deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority")); |
| 197 | 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 | 206 | if (XmlUtil.getText(rootElement, "AlarmDescription") == null) { |
| 200 | 207 | deviceAlarm.setAlarmDescription(""); |
| 201 | 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 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 10 | 10 | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | +import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | |
| 12 | 13 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 13 | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | +import com.genersoft.iot.vmp.utils.DateUtil; | |
| 15 | 17 | import org.dom4j.Element; |
| 16 | 18 | import org.slf4j.Logger; |
| 17 | 19 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -84,7 +86,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 84 | 86 | deviceAlarm.setChannelId(channelId); |
| 85 | 87 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 86 | 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 | 94 | String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 89 | 95 | if (alarmDescription == null) { |
| 90 | 96 | deviceAlarm.setAlarmDescription(""); |
| ... | ... | @@ -175,7 +181,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme |
| 175 | 181 | deviceAlarm.setChannelId(channelId); |
| 176 | 182 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 177 | 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 | 189 | String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 180 | 190 | if (alarmDescription == null) { |
| 181 | 191 | deviceAlarm.setAlarmDescription(""); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
| ... | ... | @@ -69,8 +69,8 @@ public class AlarmController { |
| 69 | 69 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), |
| 70 | 70 | @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), |
| 71 | 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 | 75 | public ResponseEntity<PageInfo<DeviceAlarm>> getAll( |
| 76 | 76 | @RequestParam int page, | ... | ... |