修复轨迹的储存与查询展示
This commit is contained in:
parent
5d673fb033
commit
10cb58391a
@ -1,6 +1,6 @@
|
|||||||
-- MySQL dump 10.13 Distrib 8.0.29, for Linux (x86_64)
|
-- 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
|
-- Server version 8.0.29-0ubuntu0.22.04.2
|
||||||
|
|
||||||
@ -46,11 +46,11 @@ CREATE TABLE `device` (
|
|||||||
`mobilePositionSubmissionInterval` int DEFAULT '5',
|
`mobilePositionSubmissionInterval` int DEFAULT '5',
|
||||||
`subscribeCycleForAlarm` int DEFAULT NULL,
|
`subscribeCycleForAlarm` int DEFAULT NULL,
|
||||||
`ssrcCheck` int DEFAULT '0',
|
`ssrcCheck` int DEFAULT '0',
|
||||||
`geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`geoCoordSys` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE KEY `device_deviceId_uindex` (`deviceId`) 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 */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -140,7 +140,7 @@ CREATE TABLE `device_channel` (
|
|||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE,
|
UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE,
|
||||||
UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) 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 */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -162,7 +162,7 @@ DROP TABLE IF EXISTS `device_mobile_position`;
|
|||||||
CREATE TABLE `device_mobile_position` (
|
CREATE TABLE `device_mobile_position` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`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,
|
`deviceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
`time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`longitude` double NOT NULL,
|
`longitude` double NOT NULL,
|
||||||
@ -171,11 +171,12 @@ CREATE TABLE `device_mobile_position` (
|
|||||||
`speed` double DEFAULT NULL,
|
`speed` double DEFAULT NULL,
|
||||||
`direction` double DEFAULT NULL,
|
`direction` double DEFAULT NULL,
|
||||||
`reportSource` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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,
|
`longitudeGcj02` double DEFAULT NULL,
|
||||||
`cnLng` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`latitudeGcj02` double DEFAULT NULL,
|
||||||
`cnLat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
`longitudeWgs84` double DEFAULT NULL,
|
||||||
|
`latitudeWgs84` double DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
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 */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -239,7 +240,7 @@ CREATE TABLE `log` (
|
|||||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`createTime` 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
|
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 */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -476,10 +477,10 @@ CREATE TABLE `stream_push` (
|
|||||||
`createStamp` bigint DEFAULT NULL,
|
`createStamp` bigint DEFAULT NULL,
|
||||||
`aliveSecond` int DEFAULT NULL,
|
`aliveSecond` int DEFAULT NULL,
|
||||||
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE KEY `stream_push_pk` (`app`,`stream`) 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 character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -556,4 +557,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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
|
||||||
|
@ -18,4 +18,13 @@ alter table device_channel
|
|||||||
add businessGroupId varchar(50) default null;
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,20 +57,25 @@ public class MobilePosition {
|
|||||||
*/
|
*/
|
||||||
private String reportSource;
|
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() {
|
public String getDeviceId() {
|
||||||
@ -145,30 +150,6 @@ public class MobilePosition {
|
|||||||
this.reportSource = reportSource;
|
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() {
|
public String getChannelId() {
|
||||||
return channelId;
|
return channelId;
|
||||||
}
|
}
|
||||||
@ -176,4 +157,36 @@ public class MobilePosition {
|
|||||||
public void setChannelId(String channelId) {
|
public void setChannelId(String channelId) {
|
||||||
this.channelId = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,16 +173,39 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setReportSource("Mobile Position");
|
mobilePosition.setReportSource("Mobile Position");
|
||||||
// 默认来源坐标系为WGS-84处理
|
// 默认来源坐标系为WGS-84处理
|
||||||
Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);
|
mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
|
||||||
mobilePosition.setGeodeticSystem("GCJ-02");
|
mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLng(gcj02Point[0] + "");
|
Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLat(gcj02Point[1] + "");
|
mobilePosition.setLongitudeGcj02(position[0]);
|
||||||
if (!userSetting.getSavePositionHistory()) {
|
mobilePosition.setLatitudeGcj02(position[1]);
|
||||||
storager.clearMobilePositionsByDeviceId(deviceId);
|
}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.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消息。 通知位置信息的变化
|
// 发送redis消息。 通知位置信息的变化
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("time", time);
|
jsonObject.put("time", time);
|
||||||
@ -209,9 +232,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
|
||||||
|
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
|
||||||
|
|
||||||
Element rootElement = getRootElement(evt);
|
Element rootElement = getRootElement(evt);
|
||||||
Element deviceIdElement = rootElement.element("DeviceID");
|
Element deviceIdElement = rootElement.element("DeviceID");
|
||||||
String deviceId = deviceIdElement.getText().toString();
|
String channelId = deviceIdElement.getText().toString();
|
||||||
|
|
||||||
Device device = redisCatchStorage.getDevice(deviceId);
|
Device device = redisCatchStorage.getDevice(deviceId);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
@ -252,17 +278,39 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||||
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
||||||
mobilePosition.setReportSource("GPS Alarm");
|
mobilePosition.setReportSource("GPS Alarm");
|
||||||
// 默认来源坐标系为WGS-84处理
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
|
||||||
logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);
|
mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
|
||||||
mobilePosition.setGeodeticSystem("GCJ-02");
|
Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLng(gcj02Point[0] + "");
|
mobilePosition.setLongitudeGcj02(position[0]);
|
||||||
mobilePosition.setCnLat(gcj02Point[1] + "");
|
mobilePosition.setLatitudeGcj02(position[1]);
|
||||||
if (!userSetting.getSavePositionHistory()) {
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
storager.clearMobilePositionsByDeviceId(deviceId);
|
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.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: 需要实现存储报警信息、报警分类
|
// TODO: 需要实现存储报警信息、报警分类
|
||||||
|
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
|
@ -80,7 +80,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
Element deviceIdElement = rootElement.element("DeviceID");
|
Element deviceIdElement = rootElement.element("DeviceID");
|
||||||
String channelId = deviceIdElement.getText().toString();
|
String channelId = deviceIdElement.getText().toString();
|
||||||
|
|
||||||
|
|
||||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||||
deviceAlarm.setDeviceId(device.getDeviceId());
|
deviceAlarm.setDeviceId(device.getDeviceId());
|
||||||
deviceAlarm.setChannelId(channelId);
|
deviceAlarm.setChannelId(channelId);
|
||||||
@ -118,17 +117,39 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
|||||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||||
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
||||||
mobilePosition.setReportSource("GPS Alarm");
|
mobilePosition.setReportSource("GPS Alarm");
|
||||||
// 默认来源坐标系为WGS-84处理
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
|
||||||
logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);
|
mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
|
||||||
mobilePosition.setGeodeticSystem("GCJ-02");
|
Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLng(gcj02Point[0] + "");
|
mobilePosition.setLongitudeGcj02(position[0]);
|
||||||
mobilePosition.setCnLat(gcj02Point[1] + "");
|
mobilePosition.setLatitudeGcj02(position[1]);
|
||||||
if (!userSetting.getSavePositionHistory()) {
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
storager.clearMobilePositionsByDeviceId(device.getDeviceId());
|
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.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 (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) {
|
||||||
if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) {
|
if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) {
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
|
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.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
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.transmit.event.request.SIPRequestProcessorParent;
|
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.IMessageHandler;
|
||||||
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;
|
||||||
@ -80,16 +77,38 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
|||||||
mobilePosition.setAltitude(0.0);
|
mobilePosition.setAltitude(0.0);
|
||||||
}
|
}
|
||||||
mobilePosition.setReportSource("Mobile Position");
|
mobilePosition.setReportSource("Mobile Position");
|
||||||
// 默认来源坐标系为WGS-84处理
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
|
||||||
logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);
|
mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
|
||||||
mobilePosition.setGeodeticSystem("GCJ-02");
|
Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLng(gcj02Point[0] + "");
|
mobilePosition.setLongitudeGcj02(position[0]);
|
||||||
mobilePosition.setCnLat(gcj02Point[1] + "");
|
mobilePosition.setLatitudeGcj02(position[1]);
|
||||||
if (!userSetting.getSavePositionHistory()) {
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
storager.clearMobilePositionsByDeviceId(device.getDeviceId());
|
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.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
|
//回复 200 OK
|
||||||
responseAck(evt, Response.OK);
|
responseAck(evt, Response.OK);
|
||||||
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -171,71 +171,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理设备位置的更新
|
|
||||||
*
|
|
||||||
* @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) {
|
public SyncStatus getChannelSyncProgress(String deviceId) {
|
||||||
if (catalogDataCatch.get(deviceId) == null) {
|
if (catalogDataCatch.get(deviceId) == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
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.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
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.transmit.event.request.SIPRequestProcessorParent;
|
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.IMessageHandler;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
||||||
@ -80,16 +77,38 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
|||||||
mobilePosition.setAltitude(0.0);
|
mobilePosition.setAltitude(0.0);
|
||||||
}
|
}
|
||||||
mobilePosition.setReportSource("Mobile Position");
|
mobilePosition.setReportSource("Mobile Position");
|
||||||
// 默认来源坐标系为WGS-84处理
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
Double[] gcj02Point = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude());
|
||||||
logger.info("GCJ02坐标:" + gcj02Point[0] + ", " + gcj02Point[1]);
|
mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude());
|
||||||
mobilePosition.setGeodeticSystem("GCJ-02");
|
Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||||
mobilePosition.setCnLng(gcj02Point[0] + "");
|
mobilePosition.setLongitudeGcj02(position[0]);
|
||||||
mobilePosition.setCnLat(gcj02Point[1] + "");
|
mobilePosition.setLatitudeGcj02(position[1]);
|
||||||
if (!userSetting.getSavePositionHistory()) {
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
storager.clearMobilePositionsByDeviceId(device.getDeviceId());
|
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.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
|
//回复 200 OK
|
||||||
responseAck(evt, Response.OK);
|
responseAck(evt, Response.OK);
|
||||||
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -463,5 +463,5 @@ public interface IVideoManagerStorage {
|
|||||||
|
|
||||||
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
||||||
|
|
||||||
void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude);
|
void updateChannelPosition(DeviceChannel deviceChannel);
|
||||||
}
|
}
|
||||||
|
@ -276,8 +276,19 @@ public interface DeviceChannelMapper {
|
|||||||
" and channelId = #{channelId}")
|
" and channelId = #{channelId}")
|
||||||
int updateChannelSubCount(String deviceId, String channelId);
|
int updateChannelSubCount(String deviceId, String channelId);
|
||||||
|
|
||||||
@Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
|
@Update(value = {" <script>" +
|
||||||
void updatePotion(String deviceId, String channelId, double longitude, double latitude);
|
"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")
|
@Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
|
||||||
List<DeviceChannel> getAllChannelInPlay();
|
List<DeviceChannel> getAllChannelInPlay();
|
||||||
@ -313,4 +324,6 @@ public interface DeviceChannelMapper {
|
|||||||
|
|
||||||
@Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
|
@Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
|
||||||
List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
|
List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,18 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
//import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
//@Repository
|
|
||||||
public interface DeviceMobilePositionMapper {
|
public interface DeviceMobilePositionMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO device_mobile_position (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}', '${geodeticSystem}', '${cnLng}', '${cnLat}')")
|
"VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84})")
|
||||||
int insertNewPosition(MobilePosition mobilePosition);
|
int insertNewPosition(MobilePosition mobilePosition);
|
||||||
|
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
"SELECT * FROM device_mobile_position" +
|
"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=\"startTime != null\"> AND time>=#{startTime}</if>" +
|
||||||
"<if test=\"endTime != null\"> AND time<=#{endTime}</if>" +
|
"<if test=\"endTime != null\"> AND time<=#{endTime}</if>" +
|
||||||
" ORDER BY time ASC" +
|
" ORDER BY time ASC" +
|
||||||
|
@ -472,6 +472,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
|
public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
|
||||||
|
if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) {
|
||||||
|
mobilePosition.setChannelId(null);
|
||||||
|
}
|
||||||
return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
|
return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1119,7 +1122,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) {
|
public void updateChannelPosition(DeviceChannel deviceChannel) {
|
||||||
deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude);
|
if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) {
|
||||||
|
deviceChannel.setChannelId(null);
|
||||||
|
}
|
||||||
|
deviceChannelMapper.updatePosition(deviceChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,13 @@ public class MobilePositionController {
|
|||||||
@ApiOperation("查询历史轨迹")
|
@ApiOperation("查询历史轨迹")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "start", value = "开始时间", required = true, dataTypeClass = String.class),
|
@ApiImplicitParam(name = "channelId", value = "通道ID", required = false, dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "end", value = "结束时间", required = true, 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,
|
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 start,
|
||||||
@RequestParam(required = false) String end) {
|
@RequestParam(required = false) String end) {
|
||||||
// if (logger.isDebugEnabled()) {
|
// if (logger.isDebugEnabled()) {
|
||||||
|
@ -11,6 +11,7 @@ import VectorSource from 'ol/source/Vector';
|
|||||||
import Tile from 'ol/layer/Tile';
|
import Tile from 'ol/layer/Tile';
|
||||||
import VectorLayer from 'ol/layer/Vector';
|
import VectorLayer from 'ol/layer/Vector';
|
||||||
import Style from 'ol/style/Style';
|
import Style from 'ol/style/Style';
|
||||||
|
import Stroke from 'ol/style/Stroke';
|
||||||
import Icon from 'ol/style/Icon';
|
import Icon from 'ol/style/Icon';
|
||||||
import View from 'ol/View';
|
import View from 'ol/View';
|
||||||
import Feature from 'ol/Feature';
|
import Feature from 'ol/Feature';
|
||||||
@ -230,7 +231,12 @@ export default {
|
|||||||
}
|
}
|
||||||
let line = new LineString(points)
|
let line = new LineString(points)
|
||||||
let lineFeature = new Feature(line);
|
let lineFeature = new Feature(line);
|
||||||
|
lineFeature.setStyle(new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
width: 4 ,
|
||||||
|
color: "#0c6d6a",
|
||||||
|
})
|
||||||
|
}))
|
||||||
let source = new VectorSource();
|
let source = new VectorSource();
|
||||||
source.addFeature(lineFeature);
|
source.addFeature(lineFeature);
|
||||||
let vectorLayer = new VectorLayer({
|
let vectorLayer = new VectorLayer({
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
@close="close()"
|
@close="close()"
|
||||||
>
|
>
|
||||||
<div v-loading="isLoging">
|
<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="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" 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>
|
<el-button icon="el-icon-search" size="mini" type="primary" @click="onSubmit">查询</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -72,7 +72,11 @@ export default {
|
|||||||
onSubmit: function () {
|
onSubmit: function () {
|
||||||
console.log("onSubmit");
|
console.log("onSubmit");
|
||||||
this.isLoging = true;
|
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)=> {
|
}).then((res)=> {
|
||||||
this.isLoging = false;
|
this.isLoging = false;
|
||||||
if (typeof this.callback == "function") {
|
if (typeof this.callback == "function") {
|
||||||
|
@ -186,6 +186,14 @@ export default {
|
|||||||
this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler)
|
this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "查询轨迹",
|
||||||
|
icon: "el-icon-map-location",
|
||||||
|
disabled: false,
|
||||||
|
onClick: () => {
|
||||||
|
this.getTrace(data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
event, // 鼠标事件信息
|
event, // 鼠标事件信息
|
||||||
@ -320,8 +328,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
let positions = [];
|
let positions = [];
|
||||||
for (let i = 0; i < channelPositions.length; i++) {
|
for (let i = 0; i < channelPositions.length; i++) {
|
||||||
if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) {
|
if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) {
|
||||||
positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat])
|
positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user