数据库优化
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ public class MobilePosition {
|
||||
*/
|
||||
private double latitudeWgs84;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
@@ -189,4 +194,12 @@ public class MobilePosition {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -205,6 +206,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -273,6 +275,7 @@ 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());
|
||||
@@ -309,6 +312,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
// TODO: 需要实现存储报警信息、报警分类
|
||||
|
||||
@@ -81,6 +81,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
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"));
|
||||
@@ -112,6 +113,7 @@ 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());
|
||||
@@ -148,6 +150,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
|
||||
deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
|
||||
deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
|
||||
deviceChannel.setGpsTime(mobilePosition.getTime());
|
||||
storager.updateChannelPosition(deviceChannel);
|
||||
}
|
||||
}
|
||||
@@ -198,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"));
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.
|
||||
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;
|
||||
@@ -53,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());
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
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);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons
|
||||
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;
|
||||
@@ -53,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());
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
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);
|
||||
|
||||
@@ -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