| | |
| | | -- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64) |
| | | -- |
| | | -- Host: 127.0.0.1 Database: wvp3 |
| | | -- Host: 127.0.0.1 Database: wvp2 |
| | | -- ------------------------------------------------------ |
| | | -- Server version 8.0.29-0ubuntu0.22.04.2 |
| | | |
| | |
| | | `mobilePositionSubmissionInterval` int DEFAULT '5', |
| | | `subscribeCycleForAlarm` int DEFAULT NULL, |
| | | `ssrcCheck` int DEFAULT '0', |
| | | `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `geoCoordSys` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19314 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19317 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | CREATE TABLE `device_mobile_position` ( |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `channelId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `longitude` double NOT NULL, |
| | |
| | | `speed` double DEFAULT NULL, |
| | | `direction` double DEFAULT NULL, |
| | | `reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `geodeticSystem` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `cnLng` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `cnLat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `longitudeGcj02` double DEFAULT NULL, |
| | | `latitudeGcj02` double DEFAULT NULL, |
| | | `longitudeWgs84` double DEFAULT NULL, |
| | | `latitudeWgs84` double DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=1508 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=21611 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=22051 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `createStamp` bigint DEFAULT NULL, |
| | | `aliveSecond` int DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `serverId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305291 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305304 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
| | | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
| | | |
| | | -- Dump completed on 2022-06-26 17:33:30 |
| | | -- Dump completed on 2022-07-04 1:07:19 |
| | |
| | | add businessGroupId varchar(50) default null; |
| | | |
| | | |
| | | alter table device_mobile_position change cnLng longitudeGcj02 double default null; |
| | | alter table device_mobile_position change cnLat latitudeGcj02 double default null; |
| | | alter table device_mobile_position |
| | | add longitudeWgs84 double default null; |
| | | alter table device_mobile_position |
| | | add latitudeWgs84 double default null; |
| | | alter table device_mobile_position drop geodeticSystem; |
| | | |
| | | |
| | | |
| | |
| | | private String reportSource; |
| | | |
| | | /** |
| | | * 国内地理坐标系(GCJ-02 / BD-09) |
| | | */ |
| | | private String GeodeticSystem; |
| | | |
| | | /** |
| | | * 国内坐标系:经度坐标 |
| | | */ |
| | | private String cnLng; |
| | | private double longitudeGcj02; |
| | | |
| | | /** |
| | | * 国内坐标系:纬度坐标 |
| | | */ |
| | | private String cnLat; |
| | | private double latitudeGcj02; |
| | | |
| | | /** |
| | | * 国内坐标系:经度坐标 |
| | | */ |
| | | private double longitudeWgs84; |
| | | |
| | | /** |
| | | * 国内坐标系:纬度坐标 |
| | | */ |
| | | private double latitudeWgs84; |
| | | |
| | | |
| | | public String getDeviceId() { |
| | |
| | | this.reportSource = reportSource; |
| | | } |
| | | |
| | | public String getGeodeticSystem() { |
| | | return GeodeticSystem; |
| | | } |
| | | |
| | | public void setGeodeticSystem(String geodeticSystem) { |
| | | GeodeticSystem = geodeticSystem; |
| | | } |
| | | |
| | | public String getCnLng() { |
| | | return cnLng; |
| | | } |
| | | |
| | | public void setCnLng(String cnLng) { |
| | | this.cnLng = cnLng; |
| | | } |
| | | |
| | | public String getCnLat() { |
| | | return cnLat; |
| | | } |
| | | |
| | | public void setCnLat(String cnLat) { |
| | | this.cnLat = cnLat; |
| | | } |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public double getLongitudeGcj02() { |
| | | return longitudeGcj02; |
| | | } |
| | | |
| | | public void setLongitudeGcj02(double longitudeGcj02) { |
| | | this.longitudeGcj02 = longitudeGcj02; |
| | | } |
| | | |
| | | public double getLatitudeGcj02() { |
| | | return latitudeGcj02; |
| | | } |
| | | |
| | | public void setLatitudeGcj02(double latitudeGcj02) { |
| | | this.latitudeGcj02 = latitudeGcj02; |
| | | } |
| | | |
| | | public double getLongitudeWgs84() { |
| | | return longitudeWgs84; |
| | | } |
| | | |
| | | public void setLongitudeWgs84(double longitudeWgs84) { |
| | | this.longitudeWgs84 = longitudeWgs84; |
| | | } |
| | | |
| | | public double getLatitudeWgs84() { |
| | | return latitudeWgs84; |
| | | } |
| | | |
| | | public void setLatitudeWgs84(double latitudeWgs84) { |
| | | this.latitudeWgs84 = latitudeWgs84; |
| | | } |
| | | } |
| | |
| | | mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() ); |
| | | } |
| | | |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | // 发送redis消息。 通知位置信息的变化 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", time); |
| | |
| | | return; |
| | | } |
| | | try { |
| | | FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
| | | String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); |
| | | |
| | | Element rootElement = getRootElement(evt); |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String deviceId = deviceIdElement.getText().toString(); |
| | | String channelId = deviceIdElement.getText().toString(); |
| | | |
| | | Device device = redisCatchStorage.getDevice(deviceId); |
| | | if (device == null) { |
| | |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | // TODO: 需要实现存储报警信息、报警分类 |
| | | |
| | | // 回复200 OK |
| | |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String channelId = deviceIdElement.getText().toString(); |
| | | |
| | | |
| | | DeviceAlarm deviceAlarm = new DeviceAlarm(); |
| | | deviceAlarm.setDeviceId(device.getDeviceId()); |
| | | deviceAlarm.setChannelId(channelId); |
| | |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) { |
| | | if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) { |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //回复 200 OK |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 处理设备位置的更新 |
| | | * |
| | | * @param evt, itemDevice |
| | | */ |
| | | private void processNotifyMobilePosition(RequestEvent evt, Element itemDevice) { |
| | | try { |
| | | // 回复 200 OK |
| | | Element rootElement = getRootElement(evt); |
| | | MobilePosition mobilePosition = new MobilePosition(); |
| | | Element deviceIdElement = rootElement.element("DeviceID"); |
| | | String deviceId = deviceIdElement.getTextTrim().toString(); |
| | | Device device = redisCatchStorage.getDevice(deviceId); |
| | | if (device != null) { |
| | | if (!StringUtils.isEmpty(device.getName())) { |
| | | mobilePosition.setDeviceName(device.getName()); |
| | | } |
| | | } |
| | | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); |
| | | |
| | | String time = XmlUtil.getText(itemDevice, "Time"); |
| | | if(time==null){ |
| | | time = XmlUtil.getText(itemDevice, "EndTime"); |
| | | } |
| | | mobilePosition.setTime(time); |
| | | String longitude = XmlUtil.getText(itemDevice, "Longitude"); |
| | | if(longitude!=null) { |
| | | mobilePosition.setLongitude(Double.parseDouble(longitude)); |
| | | } |
| | | String latitude = XmlUtil.getText(itemDevice, "Latitude"); |
| | | if(latitude!=null) { |
| | | mobilePosition.setLatitude(Double.parseDouble(latitude)); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Speed"))) { |
| | | mobilePosition.setSpeed(Double.parseDouble(XmlUtil.getText(itemDevice, "Speed"))); |
| | | } else { |
| | | mobilePosition.setSpeed(0.0); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Direction"))) { |
| | | mobilePosition.setDirection(Double.parseDouble(XmlUtil.getText(itemDevice, "Direction"))); |
| | | } else { |
| | | mobilePosition.setDirection(0.0); |
| | | } |
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Altitude"))) { |
| | | mobilePosition.setAltitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Altitude"))); |
| | | } else { |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(deviceId); |
| | | } |
| | | storager.insertMobilePosition(mobilePosition); |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public SyncStatus getChannelSyncProgress(String deviceId) { |
| | | if (catalogDataCatch.get(deviceId) == null) { |
| | | return null; |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // 默认来源坐标系为WGS-84处理 |
| | | Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]); |
| | | mobilePosition.setGeodeticSystem("GCJ-02"); |
| | | mobilePosition.setCnLng(gcj02Point[0] + ""); |
| | | mobilePosition.setCnLat(gcj02Point[1] + ""); |
| | | if (!userSetting.getSavePositionHistory()) { |
| | | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | // 更新device channel 的经纬度 |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //回复 200 OK |
| | | responseAck(evt, Response.OK); |
| | | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| | |
| | | |
| | | List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); |
| | | |
| | | void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude); |
| | | void updateChannelPosition(DeviceChannel deviceChannel); |
| | | } |
| | |
| | | " and channelId = #{channelId}") |
| | | int updateChannelSubCount(String deviceId, String channelId); |
| | | |
| | | @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) |
| | | void updatePotion(String deviceId, String channelId, double longitude, double latitude); |
| | | @Update(value = {" <script>" + |
| | | "UPDATE device_channel " + |
| | | "SET " + |
| | | "latitude=${latitude}, " + |
| | | "longitude=${longitude}, " + |
| | | "longitudeGcj02=${longitudeGcj02}," + |
| | | "latitudeGcj02=${latitudeGcj02}," + |
| | | "longitudeWgs84=${longitudeWgs84}," + |
| | | "latitudeWgs84=${latitudeWgs84} " + |
| | | "WHERE deviceId=#{deviceId} " + |
| | | " <if test='channelId != null' > AND channelId=#{channelId}</if>" + |
| | | " </script>"}) |
| | | void updatePosition(DeviceChannel deviceChannel); |
| | | |
| | | @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0") |
| | | List<DeviceChannel> getAllChannelInPlay(); |
| | |
| | | |
| | | @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") |
| | | List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import org.apache.ibatis.annotations.*; |
| | | //import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | //@Repository |
| | | public interface DeviceMobilePositionMapper { |
| | | |
| | | @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, geodeticSystem, cnLng, cnLat) " + |
| | | "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', '${geodeticSystem}', '${cnLng}', '${cnLat}')") |
| | | @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84) " + |
| | | "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84})") |
| | | int insertNewPosition(MobilePosition mobilePosition); |
| | | |
| | | @Select(value = {" <script>" + |
| | | "SELECT * FROM device_mobile_position" + |
| | | " WHERE deviceId = #{deviceId} and channelId = #{channelId} " + |
| | | " WHERE deviceId = #{deviceId}" + |
| | | "<if test=\"channelId != null\"> and channelId = #{channelId}</if>" + |
| | | "<if test=\"startTime != null\"> AND time>=#{startTime}</if>" + |
| | | "<if test=\"endTime != null\"> AND time<=#{endTime}</if>" + |
| | | " ORDER BY time ASC" + |
| | |
| | | */ |
| | | @Override |
| | | public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) { |
| | | if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) { |
| | | mobilePosition.setChannelId(null); |
| | | } |
| | | return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) { |
| | | deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude); |
| | | public void updateChannelPosition(DeviceChannel deviceChannel) { |
| | | if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) { |
| | | deviceChannel.setChannelId(null); |
| | | } |
| | | deviceChannelMapper.updatePosition(deviceChannel); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("查询历史轨迹") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "start", value = "开始时间", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "start", value = "开始时间", required = false, dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "end", value = "结束时间", required = false, dataTypeClass = String.class), |
| | | }) |
| | | @GetMapping("/history/{deviceId}/{channelId}") |
| | | @GetMapping("/history/{deviceId}") |
| | | public ResponseEntity<WVPResult<List<MobilePosition>>> positions(@PathVariable String deviceId, |
| | | @PathVariable String channelId, |
| | | @RequestParam(required = false) String channelId, |
| | | @RequestParam(required = false) String start, |
| | | @RequestParam(required = false) String end) { |
| | | // if (logger.isDebugEnabled()) { |
| | |
| | | import Tile from 'ol/layer/Tile'; |
| | | import VectorLayer from 'ol/layer/Vector'; |
| | | import Style from 'ol/style/Style'; |
| | | import Stroke from 'ol/style/Stroke'; |
| | | import Icon from 'ol/style/Icon'; |
| | | import View from 'ol/View'; |
| | | import Feature from 'ol/Feature'; |
| | |
| | | } |
| | | let line = new LineString(points) |
| | | let lineFeature = new Feature(line); |
| | | |
| | | lineFeature.setStyle(new Style({ |
| | | stroke: new Stroke({ |
| | | width: 4 , |
| | | color: "#0c6d6a", |
| | | }) |
| | | })) |
| | | let source = new VectorSource(); |
| | | source.addFeature(lineFeature); |
| | | let vectorLayer = new VectorLayer({ |
| | |
| | | @close="close()" |
| | | > |
| | | <div v-loading="isLoging"> |
| | | <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchFrom" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-date-picker v-model="searchTo" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00" value-format="yyyy-MM-dd HH:mm:ss" size="mini" style="width: 11rem;" align="right" :picker-options="pickerOptions"></el-date-picker> |
| | | <el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button> |
| | | </div> |
| | | |
| | |
| | | onSubmit: function () { |
| | | console.log("onSubmit"); |
| | | this.isLoging = true; |
| | | this.$axios.get(`/api/position/history/${this.channel.deviceId}/${this.channel.channelId}`, { |
| | | let url = `/api/position/history/${this.channel.deviceId}?start=${this.searchFrom}&end=${this.searchTo}`; |
| | | if (this.channel.channelId) { |
| | | url+="&channelId=${this.channel.channelId}" |
| | | } |
| | | this.$axios.get(url, { |
| | | }).then((res)=> { |
| | | this.isLoging = false; |
| | | if (typeof this.callback == "function") { |
| | |
| | | this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler) |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: "查询轨迹", |
| | | icon: "el-icon-map-location", |
| | | disabled: false, |
| | | onClick: () => { |
| | | this.getTrace(data) |
| | | } |
| | | } |
| | | ], |
| | | event, // 鼠标事件信息 |
| | |
| | | } else { |
| | | let positions = []; |
| | | for (let i = 0; i < channelPositions.length; i++) { |
| | | if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) { |
| | | positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat]) |
| | | if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) { |
| | | positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]]) |
| | | } |
| | | |
| | | } |