Merge remote-tracking branch 'origin/wvp-28181-2.0' into liujie-20220712
# Conflicts: # src/main/java/com/genersoft/iot/vmp/service/IMediaService.java # src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
This commit is contained in:
@@ -77,6 +77,8 @@ public class DeviceAlarm {
|
||||
*/
|
||||
private String alarmType;
|
||||
|
||||
private String createTime;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
@@ -157,4 +159,12 @@ public class DeviceAlarm {
|
||||
public void setChannelId(String channelId) {
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +199,11 @@ public class DeviceChannel {
|
||||
*/
|
||||
private String businessGroupId;
|
||||
|
||||
/**
|
||||
* GPS的更新时间
|
||||
*/
|
||||
private String gpsTime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -519,4 +524,12 @@ public class DeviceChannel {
|
||||
public void setBusinessGroupId(String businessGroupId) {
|
||||
this.businessGroupId = businessGroupId;
|
||||
}
|
||||
|
||||
public String getGpsTime() {
|
||||
return gpsTime;
|
||||
}
|
||||
|
||||
public void setGpsTime(String gpsTime) {
|
||||
this.gpsTime = gpsTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,8 @@ public class GbStream extends PlatformGbStream{
|
||||
private double latitude;
|
||||
private String streamType;
|
||||
private boolean status;
|
||||
/**
|
||||
* GMT unix系统时间戳,单位秒
|
||||
*/
|
||||
public Long createStamp;
|
||||
|
||||
public String createTime;
|
||||
|
||||
@Override
|
||||
public Integer getGbStreamId() {
|
||||
@@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{
|
||||
this.mediaServerId = mediaServerId;
|
||||
}
|
||||
|
||||
|
||||
public Long getCreateStamp() {
|
||||
return createStamp;
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateStamp(Long createStamp) {
|
||||
this.createStamp = createStamp;
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,20 +57,30 @@ public class MobilePosition {
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
|
||||
public String getDeviceId() {
|
||||
@@ -145,30 +155,6 @@ public class MobilePosition {
|
||||
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;
|
||||
}
|
||||
@@ -176,4 +162,44 @@ public class MobilePosition {
|
||||
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;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,16 @@ public class ParentPlatform {
|
||||
*/
|
||||
private String administrativeDivision;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -368,4 +378,20 @@ public class ParentPlatform {
|
||||
public void setAdministrativeDivision(String administrativeDivision) {
|
||||
this.administrativeDivision = administrativeDivision;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
|
||||
/**
|
||||
* @author chenjialing
|
||||
*/
|
||||
public class PresetQuerySipReq {
|
||||
|
||||
private String presetId;
|
||||
|
||||
private String presetName;
|
||||
|
||||
public String getPresetId() {
|
||||
return presetId;
|
||||
}
|
||||
|
||||
public void setPresetId(String presetId) {
|
||||
this.presetId = presetId;
|
||||
}
|
||||
|
||||
public String getPresetName() {
|
||||
return presetName;
|
||||
}
|
||||
|
||||
public void setPresetName(String presetName) {
|
||||
this.presetName = presetName;
|
||||
}
|
||||
}
|
||||
@@ -140,6 +140,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
Element rootElement = getRootElement(evt);
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
Element deviceIdElement = rootElement.element("DeviceID");
|
||||
String channelId = deviceIdElement.getTextTrim().toString();
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
@@ -173,16 +174,40 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
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);
|
||||
}
|
||||
storager.insertMobilePosition(mobilePosition);
|
||||
storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() );
|
||||
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());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", time);
|
||||
@@ -209,9 +234,12 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
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) {
|
||||
@@ -247,21 +275,45 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId());
|
||||
if ("4".equals(deviceAlarm.getAlarmMethod())) {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
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);
|
||||
}
|
||||
storager.insertMobilePosition(mobilePosition);
|
||||
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());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
// TODO: 需要实现存储报警信息、报警分类
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
Element deviceIdElement = rootElement.element("DeviceID");
|
||||
String channelId = deviceIdElement.getText().toString();
|
||||
|
||||
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||
deviceAlarm.setDeviceId(device.getDeviceId());
|
||||
deviceAlarm.setChannelId(channelId);
|
||||
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
|
||||
@@ -113,21 +113,45 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
|
||||
if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
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);
|
||||
}
|
||||
storager.insertMobilePosition(mobilePosition);
|
||||
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());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) {
|
||||
@@ -177,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
|
||||
|
||||
DeviceAlarm deviceAlarm = new DeviceAlarm();
|
||||
deviceAlarm.setCreateTime(DateUtil.getNow());
|
||||
deviceAlarm.setDeviceId(parentPlatform.getServerGBId());
|
||||
deviceAlarm.setChannelId(channelId);
|
||||
deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
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;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.GpsUtil;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -56,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
rootElement = getRootElement(evt, device.getCharset());
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
if (!StringUtils.isEmpty(device.getName())) {
|
||||
mobilePosition.setDeviceName(device.getName());
|
||||
}
|
||||
@@ -80,16 +79,39 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
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);
|
||||
}
|
||||
storager.insertMobilePosition(mobilePosition);
|
||||
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());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
//回复 200 OK
|
||||
responseAck(evt, Response.OK);
|
||||
} 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) {
|
||||
if (catalogDataCatch.get(deviceId) == null) {
|
||||
return null;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
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;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.GpsUtil;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -56,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
rootElement = getRootElement(evt, device.getCharset());
|
||||
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
if (!StringUtils.isEmpty(device.getName())) {
|
||||
mobilePosition.setDeviceName(device.getName());
|
||||
}
|
||||
@@ -80,16 +79,39 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
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);
|
||||
}
|
||||
storager.insertMobilePosition(mobilePosition);
|
||||
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());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
//回复 200 OK
|
||||
responseAck(evt, Response.OK);
|
||||
} catch (DocumentException | SipException | InvalidArgumentException | ParseException e) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
||||
|
||||
import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
@@ -314,6 +315,7 @@ public class XmlUtil {
|
||||
} else {
|
||||
deviceChannel.setLatitude(0.00);
|
||||
}
|
||||
deviceChannel.setGpsTime(DateUtil.getNow());
|
||||
if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
||||
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||
|
||||
Reference in New Issue
Block a user