chenjialing
2022-03-02 fe0b5c33f92e11f51574deb2c589a31b34a6e720
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetup;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector;
@@ -21,7 +22,7 @@
import javax.sip.RequestEvent;
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.*;
@Component
public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
@@ -39,6 +40,9 @@
    private UserSetup userSetup;
    @Autowired
    private SipConfig sipConfig;
    @Autowired
    private IVideoManagerStorager storager;
    @Autowired
@@ -54,6 +58,9 @@
    @Override
    public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
        if (!sipConfig.isAlarm()) {
            return;
        }
        Element deviceIdElement = rootElement.element("DeviceID");
        String channelId = deviceIdElement.getText().toString();
        DeviceAlarm deviceAlarm = new DeviceAlarm();
@@ -98,6 +105,11 @@
                storager.insertMobilePosition(mobilePosition);
            }
        }
        if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) {
            if (deviceAlarm.getAlarmMethod().equals("5")) {
                deviceAlarm.setAlarmType(getText(rootElement.element("Info"), "AlarmType"));
            }
        }
        logger.debug("存储报警信息、报警分类");
        // 存储报警信息、报警分类
        deviceAlarmService.add(deviceAlarm);