This commit is contained in:
648540858 2022-05-27 23:14:17 +08:00
parent 30d959b1ee
commit 94793cc19d
3 changed files with 22 additions and 5 deletions

View File

@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.utils.redis.RedisUtil; import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.Element; import org.dom4j.Element;
@ -188,6 +189,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
Device device = redisCatchStorage.getDevice(deviceId); Device device = redisCatchStorage.getDevice(deviceId);
if (device == null) { if (device == null) {
responseAck(evt, Response.NOT_FOUND, "device is not found");
return; return;
} }
rootElement = getRootElement(evt, device.getCharset()); rootElement = getRootElement(evt, device.getCharset());
@ -195,7 +197,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
deviceAlarm.setDeviceId(deviceId); deviceAlarm.setDeviceId(deviceId);
deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority")); deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority"));
deviceAlarm.setAlarmMethod(XmlUtil.getText(rootElement, "AlarmMethod")); deviceAlarm.setAlarmMethod(XmlUtil.getText(rootElement, "AlarmMethod"));
deviceAlarm.setAlarmTime(XmlUtil.getText(rootElement, "AlarmTime")); String alarmTime = XmlUtil.getText(rootElement, "AlarmTime");
if (alarmTime == null) {
responseAck(evt, Response.BAD_REQUEST, "AlarmTime cannot be null");
return;
}
deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
if (XmlUtil.getText(rootElement, "AlarmDescription") == null) { if (XmlUtil.getText(rootElement, "AlarmDescription") == null) {
deviceAlarm.setAlarmDescription(""); deviceAlarm.setAlarmDescription("");
} else { } else {

View File

@ -9,9 +9,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import com.genersoft.iot.vmp.service.IDeviceAlarmService; import com.genersoft.iot.vmp.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import org.dom4j.Element; import org.dom4j.Element;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -84,7 +86,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
deviceAlarm.setChannelId(channelId); deviceAlarm.setChannelId(channelId);
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod"));
deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); String alarmTime = XmlUtil.getText(rootElement, "AlarmTime");
if (alarmTime == null) {
return;
}
deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
String alarmDescription = getText(rootElement, "AlarmDescription"); String alarmDescription = getText(rootElement, "AlarmDescription");
if (alarmDescription == null) { if (alarmDescription == null) {
deviceAlarm.setAlarmDescription(""); deviceAlarm.setAlarmDescription("");
@ -175,7 +181,11 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
deviceAlarm.setChannelId(channelId); deviceAlarm.setChannelId(channelId);
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod"));
deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); String alarmTime = XmlUtil.getText(rootElement, "AlarmTime");
if (alarmTime == null) {
return;
}
deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
String alarmDescription = getText(rootElement, "AlarmDescription"); String alarmDescription = getText(rootElement, "AlarmDescription");
if (alarmDescription == null) { if (alarmDescription == null) {
deviceAlarm.setAlarmDescription(""); deviceAlarm.setAlarmDescription("");

View File

@ -69,8 +69,8 @@ public class AlarmController {
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class), @ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class), @ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="startTime", value = "查询内容" ,dataTypeClass = String.class), @ApiImplicitParam(name="startTime", value = "开始时间" ,dataTypeClass = String.class),
@ApiImplicitParam(name="endTime", value = "查询内容" ,dataTypeClass = String.class), @ApiImplicitParam(name="endTime", value = "结束时间" ,dataTypeClass = String.class),
}) })
public ResponseEntity<PageInfo<DeviceAlarm>> getAll( public ResponseEntity<PageInfo<DeviceAlarm>> getAll(
@RequestParam int page, @RequestParam int page,