| | |
| | |
|
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.RecordItem;
|
| | |
| | | // storager.queryChannel(deviceId)
|
| | | return;
|
| | | }
|
| | | device.setName(XmlUtil.getText(rootElement, "DeviceName"));
|
| | | device.setManufacturer(XmlUtil.getText(rootElement, "Manufacturer"));
|
| | | device.setModel(XmlUtil.getText(rootElement, "Model"));
|
| | | device.setFirmware(XmlUtil.getText(rootElement, "Firmware"));
|
| | | if (StringUtils.isEmpty(device.getStreamMode())) {
|
| | | device.setStreamMode("UDP");
|
| | |
|
| | | DeviceAlarm deviceAlarm = new DeviceAlarm();
|
| | | deviceAlarm.setDeviceId(deviceId);
|
| | | deviceAlarm.setAlarmPriority(XmlUtil.getText(rootElement, "AlarmPriority"));
|
| | | deviceAlarm.setAlarmMethod(XmlUtil.getText(rootElement, "AlarmMethod"));
|
| | | deviceAlarm.setAlarmTime(XmlUtil.getText(rootElement, "AlarmTime"));
|
| | | if (XmlUtil.getText(rootElement, "AlarmDescription") == null) {
|
| | | deviceAlarm.setAlarmDescription("");
|
| | | } else {
|
| | | deviceAlarm.setAlarmDescription(XmlUtil.getText(rootElement, "AlarmDescription"));
|
| | | }
|
| | | storager.updateDevice(device);
|
| | | if (XmlUtil.getText(rootElement, "Longitude") == null || XmlUtil.getText(rootElement, "Longitude") == "") {
|
| | | deviceAlarm.setLongitude(0.00);
|
| | | } else {
|
| | | deviceAlarm.setLongitude(Double.parseDouble(XmlUtil.getText(rootElement, "Longitude")));
|
| | | }
|
| | | if (XmlUtil.getText(rootElement, "Latitude") == null || XmlUtil.getText(rootElement, "Latitude") =="") {
|
| | | deviceAlarm.setLatitude(0.00);
|
| | | } else {
|
| | | deviceAlarm.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude")));
|
| | | }
|
| | |
|
| | | // device.setName(XmlUtil.getText(rootElement, "DeviceName"));
|
| | | // device.setManufacturer(XmlUtil.getText(rootElement, "Manufacturer"));
|
| | | // device.setModel(XmlUtil.getText(rootElement, "Model"));
|
| | | // device.setFirmware(XmlUtil.getText(rootElement, "Firmware"));
|
| | | // if (StringUtils.isEmpty(device.getStreamMode())) {
|
| | | // device.setStreamMode("UDP");
|
| | | // }
|
| | | // storager.updateDevice(device);
|
| | | //cmder.catalogQuery(device, null);
|
| | | // 回复200 OK
|
| | | responseAck(evt);
|
| | | if (offLineDetector.isOnline(deviceId)) {
|
| | | publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
|
| | | publisher.deviceAlarmEventPublish(deviceAlarm);
|
| | | }
|
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
| | | // } catch (DocumentException e) {
|
| | |
| | | try {
|
| | | // 回复200 OK
|
| | | responseAck(evt);
|
| | | String seqNo = String.valueOf(System.currentTimeMillis());
|
| | | String uuid = UUID.randomUUID().toString().replace("-", "");
|
| | | RecordInfo recordInfo = new RecordInfo();
|
| | | Element rootElement = getRootElement(evt);
|
| | | Element deviceIdElement = rootElement.element("DeviceID");
|
| | |
| | | // 为防止连续请求该设备的录像数据,返回数据错乱,特增加sn进行区分
|
| | | String cacheKey = CACHE_RECORDINFO_KEY + deviceId + sn;
|
| | |
|
| | | redis.set(cacheKey + "_" + seqNo, recordList, 90);
|
| | | redis.set(cacheKey + "_" + uuid, recordList, 90);
|
| | | List<Object> cacheKeys = redis.scan(cacheKey + "_*");
|
| | | List<RecordItem> totalRecordList = new ArrayList<RecordItem>();
|
| | | for (int i = 0; i < cacheKeys.size(); i++) {
|