设备支持设置地理坐标系,并将级联输出坐标系统一为wgs84
parent
be9533dead
commit
c022213972
|
@ -1,4 +1,16 @@
|
||||||
alter table stream_push
|
alter table stream_push
|
||||||
add serverId varchar(50) not null;
|
add serverId varchar(50) not null;
|
||||||
|
alter table device
|
||||||
|
add geoCoordSys varchar(50) not null;
|
||||||
|
update device set device.geoCoordSys='WGS84';
|
||||||
|
alter table device_channel
|
||||||
|
add longitudeGcj02 double default null;
|
||||||
|
alter table device_channel
|
||||||
|
add latitudeGcj02 double default null;
|
||||||
|
alter table device_channel
|
||||||
|
add longitudeWgs84 double default null;
|
||||||
|
alter table device_channel
|
||||||
|
add latitudeWgs84 double default null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.bean;
|
package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国标设备/平台
|
||||||
|
* @author lin
|
||||||
|
*/
|
||||||
public class Device {
|
public class Device {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,6 +133,11 @@ public class Device {
|
||||||
*/
|
*/
|
||||||
private boolean ssrcCheck;
|
private boolean ssrcCheck;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地理坐标系, 目前支持 WGS84,GCJ02 TODO CGCS2000
|
||||||
|
*/
|
||||||
|
private String geoCoordSys;
|
||||||
|
|
||||||
|
|
||||||
public String getDeviceId() {
|
public String getDeviceId() {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
|
@ -321,4 +330,12 @@ public class Device {
|
||||||
public void setSsrcCheck(boolean ssrcCheck) {
|
public void setSsrcCheck(boolean ssrcCheck) {
|
||||||
this.ssrcCheck = ssrcCheck;
|
this.ssrcCheck = ssrcCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGeoCoordSys() {
|
||||||
|
return geoCoordSys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeoCoordSys(String geoCoordSys) {
|
||||||
|
this.geoCoordSys = geoCoordSys;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,26 @@ public class DeviceChannel {
|
||||||
*/
|
*/
|
||||||
private double latitude;
|
private double latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度 GCJ02
|
||||||
|
*/
|
||||||
|
private double longitudeGcj02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度 GCJ02
|
||||||
|
*/
|
||||||
|
private double latitudeGcj02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度 WGS84
|
||||||
|
*/
|
||||||
|
private double longitudeWgs84;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度 WGS84
|
||||||
|
*/
|
||||||
|
private double latitudeWgs84;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子设备数
|
* 子设备数
|
||||||
*/
|
*/
|
||||||
|
@ -407,6 +427,38 @@ public class DeviceChannel {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 int getSubCount() {
|
public int getSubCount() {
|
||||||
return subCount;
|
return subCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,8 +277,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
|
catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
|
||||||
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
||||||
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
||||||
catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
|
catalogXml.append("<Longitude>" + channel.getLongitudeWgs84() + "</Longitude>\r\n");
|
||||||
catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
|
catalogXml.append("<Latitude>" + channel.getLatitudeWgs84() + "</Latitude>\r\n");
|
||||||
catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
|
catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
|
||||||
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
|
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
|
||||||
catalogXml.append("<Info>\r\n");
|
catalogXml.append("<Info>\r\n");
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request;
|
|
||||||
|
|
||||||
import gov.nist.javax.sip.SipProviderImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description:处理接收IPCamera发来的SIP协议请求消息
|
|
||||||
* @author: songww
|
|
||||||
* @date: 2020年5月3日 下午4:42:22
|
|
||||||
*/
|
|
||||||
public abstract class SIPRequestProcessorAbstract {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Qualifier(value="tcpSipProvider")
|
|
||||||
private SipProviderImpl tcpSipProvider;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Qualifier(value="udpSipProvider")
|
|
||||||
private SipProviderImpl udpSipProvider;
|
|
||||||
|
|
||||||
}
|
|
|
@ -312,7 +312,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
}else {
|
}else {
|
||||||
event = eventElement.getText().toUpperCase();
|
event = eventElement.getText().toUpperCase();
|
||||||
}
|
}
|
||||||
DeviceChannel channel = XmlUtil.channelContentHander(itemDevice);
|
DeviceChannel channel = XmlUtil.channelContentHander(itemDevice, device);
|
||||||
channel.setDeviceId(device.getDeviceId());
|
channel.setDeviceId(device.getDeviceId());
|
||||||
logger.info("[收到 目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
|
logger.info("[收到 目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
|
@ -140,6 +140,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||||
device = new Device();
|
device = new Device();
|
||||||
device.setStreamMode("UDP");
|
device.setStreamMode("UDP");
|
||||||
device.setCharset("GB2312");
|
device.setCharset("GB2312");
|
||||||
|
device.setGeoCoordSys("WGS84");
|
||||||
device.setDeviceId(deviceId);
|
device.setDeviceId(deviceId);
|
||||||
}
|
}
|
||||||
device.setIp(received);
|
device.setIp(received);
|
||||||
|
|
|
@ -82,7 +82,6 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||||
@Override
|
@Override
|
||||||
public void process(RequestEvent evt) {
|
public void process(RequestEvent evt) {
|
||||||
Request request = evt.getRequest();
|
Request request = evt.getRequest();
|
||||||
System.out.println("收到订阅");
|
|
||||||
try {
|
try {
|
||||||
Element rootElement = getRootElement(evt);
|
Element rootElement = getRootElement(evt);
|
||||||
String cmd = XmlUtil.getText(rootElement, "CmdType");
|
String cmd = XmlUtil.getText(rootElement, "CmdType");
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||||
// if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {//如果包含位置信息,就更新一下位置
|
// if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {//如果包含位置信息,就更新一下位置
|
||||||
// processNotifyMobilePosition(evt, itemDevice);
|
// processNotifyMobilePosition(evt, itemDevice);
|
||||||
// }
|
// }
|
||||||
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice);
|
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device);
|
||||||
deviceChannel.setDeviceId(take.getDevice().getDeviceId());
|
deviceChannel.setDeviceId(take.getDevice().getDeviceId());
|
||||||
|
|
||||||
channelList.add(deviceChannel);
|
channelList.add(deviceChannel);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.gb28181.bean.DeviceChannel;
|
||||||
import org.dom4j.Attribute;
|
import org.dom4j.Attribute;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
|
@ -180,7 +181,7 @@ public class XmlUtil {
|
||||||
return xml.getRootElement();
|
return xml.getRootElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DeviceChannel channelContentHander(Element itemDevice){
|
public static DeviceChannel channelContentHander(Element itemDevice, Device device){
|
||||||
Element channdelNameElement = itemDevice.element("Name");
|
Element channdelNameElement = itemDevice.element("Name");
|
||||||
String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : "";
|
String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : "";
|
||||||
Element statusElement = itemDevice.element("Status");
|
Element statusElement = itemDevice.element("Status");
|
||||||
|
@ -308,6 +309,31 @@ public class XmlUtil {
|
||||||
} else {
|
} else {
|
||||||
deviceChannel.setLatitude(0.00);
|
deviceChannel.setLatitude(0.00);
|
||||||
}
|
}
|
||||||
|
if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
||||||
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
|
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||||
|
Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||||
|
deviceChannel.setLongitudeGcj02(position[0]);
|
||||||
|
deviceChannel.setLatitudeGcj02(position[1]);
|
||||||
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
|
deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
||||||
|
Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||||
|
deviceChannel.setLongitudeWgs84(position[0]);
|
||||||
|
deviceChannel.setLatitudeWgs84(position[1]);
|
||||||
|
}else {
|
||||||
|
deviceChannel.setLongitudeGcj02(0.00);
|
||||||
|
deviceChannel.setLatitudeGcj02(0.00);
|
||||||
|
deviceChannel.setLongitudeWgs84(0.00);
|
||||||
|
deviceChannel.setLatitudeWgs84(0.00);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
||||||
|
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||||
|
}
|
||||||
if (XmlUtil.getText(itemDevice, "PTZType") == null || "".equals(XmlUtil.getText(itemDevice, "PTZType"))) {
|
if (XmlUtil.getText(itemDevice, "PTZType") == null || "".equals(XmlUtil.getText(itemDevice, "PTZType"))) {
|
||||||
//兼容INFO中的信息
|
//兼容INFO中的信息
|
||||||
Element info = itemDevice.element("Info");
|
Element info = itemDevice.element("Info");
|
||||||
|
|
|
@ -2,17 +2,21 @@ package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
|
||||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
|
import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -50,6 +54,12 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceMapper deviceMapper;
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceChannelMapper deviceChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVideoManagerStorage storage;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISIPCommander commander;
|
private ISIPCommander commander;
|
||||||
|
|
||||||
|
@ -292,6 +302,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
removeMobilePositionSubscribe(deviceInStore);
|
removeMobilePositionSubscribe(deviceInStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 坐标系变化,需要重新计算GCJ02坐标和WGS84坐标
|
||||||
|
if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {
|
||||||
|
updateDeviceChannelGeoCoordSys(device);
|
||||||
|
}
|
||||||
|
|
||||||
String now = DateUtil.getNow();
|
String now = DateUtil.getNow();
|
||||||
device.setUpdateTime(now);
|
device.setUpdateTime(now);
|
||||||
|
@ -299,6 +313,32 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||||
device.setUpdateTime(DateUtil.getNow());
|
device.setUpdateTime(DateUtil.getNow());
|
||||||
if (deviceMapper.update(device) > 0) {
|
if (deviceMapper.update(device) > 0) {
|
||||||
redisCatchStorage.updateDevice(device);
|
redisCatchStorage.updateDevice(device);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新通道坐标系
|
||||||
|
*/
|
||||||
|
private void updateDeviceChannelGeoCoordSys(Device device) {
|
||||||
|
List<DeviceChannel> deviceChannels = deviceChannelMapper.getAllChannelWithCoordinate(device.getDeviceId());
|
||||||
|
if (deviceChannels.size() > 0) {
|
||||||
|
for (DeviceChannel deviceChannel : deviceChannels) {
|
||||||
|
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||||
|
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||||
|
Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||||
|
deviceChannel.setLongitudeGcj02(position[0]);
|
||||||
|
deviceChannel.setLatitudeGcj02(position[1]);
|
||||||
|
}else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
||||||
|
deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
||||||
|
deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
||||||
|
Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||||
|
deviceChannel.setLongitudeWgs84(position[0]);
|
||||||
|
deviceChannel.setLatitudeWgs84(position[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storage.updateChannels(device.getDeviceId(), deviceChannels);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ public interface DeviceChannelMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
|
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
|
||||||
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
||||||
"ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
|
"ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime, updateTime) " +
|
||||||
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
|
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
|
||||||
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
|
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
|
||||||
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')")
|
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}')")
|
||||||
int add(DeviceChannel channel);
|
int add(DeviceChannel channel);
|
||||||
|
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
|
@ -50,6 +50,10 @@ public interface DeviceChannelMapper {
|
||||||
"<if test='hasAudio != null'>, hasAudio=${hasAudio}</if>" +
|
"<if test='hasAudio != null'>, hasAudio=${hasAudio}</if>" +
|
||||||
"<if test='longitude != null'>, longitude=${longitude}</if>" +
|
"<if test='longitude != null'>, longitude=${longitude}</if>" +
|
||||||
"<if test='latitude != null'>, latitude=${latitude}</if>" +
|
"<if test='latitude != null'>, latitude=${latitude}</if>" +
|
||||||
|
"<if test='longitudeGcj02 != null'>, longitudeGcj02=${longitudeGcj02}</if>" +
|
||||||
|
"<if test='latitudeGcj02 != null'>, latitudeGcj02=${latitudeGcj02}</if>" +
|
||||||
|
"<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
|
||||||
|
"<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
|
||||||
"WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
|
"WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int update(DeviceChannel channel);
|
int update(DeviceChannel channel);
|
||||||
|
@ -138,7 +142,8 @@ public interface DeviceChannelMapper {
|
||||||
"insert into device_channel " +
|
"insert into device_channel " +
|
||||||
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
|
"(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
|
||||||
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
" address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
|
||||||
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
|
" ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
|
||||||
|
" longitudeWgs84, latitudeWgs84, createTime, updateTime) " +
|
||||||
"values " +
|
"values " +
|
||||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||||
"('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
|
"('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
|
||||||
|
@ -146,7 +151,8 @@ public interface DeviceChannelMapper {
|
||||||
"'${item.address}', ${item.parental}, '${item.parentId}', ${item.safetyWay}, ${item.registerWay}, " +
|
"'${item.address}', ${item.parental}, '${item.parentId}', ${item.safetyWay}, ${item.registerWay}, " +
|
||||||
"'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
|
"'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
|
||||||
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
|
"'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
|
||||||
"'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" +
|
"'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
|
||||||
|
"${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}')" +
|
||||||
"</foreach> " +
|
"</foreach> " +
|
||||||
"ON DUPLICATE KEY UPDATE " +
|
"ON DUPLICATE KEY UPDATE " +
|
||||||
"updateTime=VALUES(updateTime), " +
|
"updateTime=VALUES(updateTime), " +
|
||||||
|
@ -173,7 +179,11 @@ public interface DeviceChannelMapper {
|
||||||
"status=VALUES(status), " +
|
"status=VALUES(status), " +
|
||||||
"streamId=VALUES(streamId), " +
|
"streamId=VALUES(streamId), " +
|
||||||
"longitude=VALUES(longitude), " +
|
"longitude=VALUES(longitude), " +
|
||||||
"latitude=VALUES(latitude)" +
|
"latitude=VALUES(latitude), " +
|
||||||
|
"longitudeGcj02=VALUES(longitudeGcj02), " +
|
||||||
|
"latitudeGcj02=VALUES(latitudeGcj02), " +
|
||||||
|
"longitudeWgs84=VALUES(longitudeWgs84), " +
|
||||||
|
"latitudeWgs84=VALUES(latitudeWgs84) " +
|
||||||
"</script>")
|
"</script>")
|
||||||
int batchAdd(List<DeviceChannel> addChannels);
|
int batchAdd(List<DeviceChannel> addChannels);
|
||||||
|
|
||||||
|
@ -207,7 +217,11 @@ public interface DeviceChannelMapper {
|
||||||
"<if test='item.hasAudio != null'>, hasAudio=${item.hasAudio}</if>" +
|
"<if test='item.hasAudio != null'>, hasAudio=${item.hasAudio}</if>" +
|
||||||
"<if test='item.longitude != null'>, longitude=${item.longitude}</if>" +
|
"<if test='item.longitude != null'>, longitude=${item.longitude}</if>" +
|
||||||
"<if test='item.latitude != null'>, latitude=${item.latitude}</if>" +
|
"<if test='item.latitude != null'>, latitude=${item.latitude}</if>" +
|
||||||
"WHERE deviceId=#{item.deviceId} AND channelId=#{item.channelId}"+
|
"<if test='item.longitudeGcj02 != null'>, longitudeGcj02=${item.longitudeGcj02}</if>" +
|
||||||
|
"<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +
|
||||||
|
"<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
|
||||||
|
"<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
|
||||||
|
"WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>"})
|
"</script>"})
|
||||||
int batchUpdate(List<DeviceChannel> updateChannels);
|
int batchUpdate(List<DeviceChannel> updateChannels);
|
||||||
|
@ -261,4 +275,6 @@ public interface DeviceChannelMapper {
|
||||||
@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();
|
||||||
|
|
||||||
|
@Select("select * from device_channel where longitude*latitude > 0 and deviceId = #{deviceId}")
|
||||||
|
List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public interface DeviceMapper {
|
||||||
"mobilePositionSubmissionInterval," +
|
"mobilePositionSubmissionInterval," +
|
||||||
"subscribeCycleForAlarm," +
|
"subscribeCycleForAlarm," +
|
||||||
"ssrcCheck," +
|
"ssrcCheck," +
|
||||||
|
"geoCoordSys," +
|
||||||
"online" +
|
"online" +
|
||||||
") VALUES (" +
|
") VALUES (" +
|
||||||
"#{deviceId}," +
|
"#{deviceId}," +
|
||||||
|
@ -61,6 +62,7 @@ public interface DeviceMapper {
|
||||||
"#{mobilePositionSubmissionInterval}," +
|
"#{mobilePositionSubmissionInterval}," +
|
||||||
"#{subscribeCycleForAlarm}," +
|
"#{subscribeCycleForAlarm}," +
|
||||||
"#{ssrcCheck}," +
|
"#{ssrcCheck}," +
|
||||||
|
"#{geoCoordSys}," +
|
||||||
"#{online}" +
|
"#{online}" +
|
||||||
")")
|
")")
|
||||||
int add(Device device);
|
int add(Device device);
|
||||||
|
@ -87,6 +89,7 @@ public interface DeviceMapper {
|
||||||
"<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" +
|
"<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" +
|
||||||
"<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +
|
"<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" +
|
||||||
"<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
|
"<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
|
||||||
|
"<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
|
||||||
"WHERE deviceId='${deviceId}'"+
|
"WHERE deviceId='${deviceId}'"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int update(Device device);
|
int update(Device device);
|
||||||
|
|
|
@ -317,12 +317,7 @@ public class DeviceQuery {
|
||||||
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
|
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
|
||||||
|
|
||||||
if (device != null && device.getDeviceId() != null) {
|
if (device != null && device.getDeviceId() != null) {
|
||||||
|
|
||||||
|
|
||||||
// TODO 报警订阅相关的信息
|
|
||||||
|
|
||||||
deviceService.updateDevice(device);
|
deviceService.updateDevice(device);
|
||||||
// cmder.deviceInfoQuery(device);
|
|
||||||
}
|
}
|
||||||
WVPResult<String> result = new WVPResult<>();
|
WVPResult<String> result = new WVPResult<>();
|
||||||
result.setCode(0);
|
result.setCode(0);
|
||||||
|
|
|
@ -146,8 +146,8 @@ public class ApiDeviceController {
|
||||||
// 2-基于口令的双向认证,
|
// 2-基于口令的双向认证,
|
||||||
// 3-基于数字证书的双向认证
|
// 3-基于数字证书的双向认证
|
||||||
deviceJOSNChannel.put("Status", deviceChannel.getStatus());
|
deviceJOSNChannel.put("Status", deviceChannel.getStatus());
|
||||||
deviceJOSNChannel.put("Longitude", deviceChannel.getLongitude());
|
deviceJOSNChannel.put("Longitude", deviceChannel.getLongitudeWgs84());
|
||||||
deviceJOSNChannel.put("Latitude", deviceChannel.getLatitude());
|
deviceJOSNChannel.put("Latitude", deviceChannel.getLatitudeWgs84());
|
||||||
deviceJOSNChannel.put("PTZType ", deviceChannel.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球,
|
deviceJOSNChannel.put("PTZType ", deviceChannel.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球,
|
||||||
// 3 - 固定枪机, 4 - 遥控枪机
|
// 3 - 固定枪机, 4 - 遥控枪机
|
||||||
deviceJOSNChannel.put("CustomPTZType", "");
|
deviceJOSNChannel.put("CustomPTZType", "");
|
||||||
|
|
|
@ -32,7 +32,7 @@ spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
|
url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: root123
|
password: root123
|
||||||
druid:
|
druid:
|
||||||
|
|
|
@ -20,7 +20,7 @@ spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
|
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
druid:
|
druid:
|
||||||
|
|
|
@ -20,7 +20,7 @@ spring:
|
||||||
datasource:
|
datasource:
|
||||||
# 使用mysql 打开23-28行注释, 删除29-36行
|
# 使用mysql 打开23-28行注释, 删除29-36行
|
||||||
name: wvp
|
name: wvp
|
||||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
|
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
<el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option>
|
<el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="地理坐标系" prop="geoCoordSys" >
|
||||||
|
<el-select v-model="form.geoCoordSys" style="float: left; width: 100%" >
|
||||||
|
<el-option key="GCJ02" label="GCJ02" value="GCJ02"></el-option>
|
||||||
|
<el-option key="WGS84" label="WGS84" value="WGS84"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="目录订阅" title="0为取消订阅" prop="subscribeCycleForCatalog" >
|
<el-form-item label="目录订阅" title="0为取消订阅" prop="subscribeCycleForCatalog" >
|
||||||
<el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input>
|
<el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
@ -49,7 +49,7 @@ import devicePlayer from './dialog/devicePlayer.vue'
|
||||||
import queryTrace from './dialog/queryTrace.vue'
|
import queryTrace from './dialog/queryTrace.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "devicePosition",
|
name: "map",
|
||||||
components: {
|
components: {
|
||||||
MapComponent,
|
MapComponent,
|
||||||
DeviceTree,
|
DeviceTree,
|
||||||
|
@ -183,12 +183,27 @@ export default {
|
||||||
this.clean()
|
this.clean()
|
||||||
this.closeInfoBox()
|
this.closeInfoBox()
|
||||||
let params = [];
|
let params = [];
|
||||||
|
let longitudeStr;
|
||||||
|
let latitudeStr;
|
||||||
|
if (window.mapParam.coordinateSystem == "GCJ-02") {
|
||||||
|
longitudeStr = "longitudeGcj02";
|
||||||
|
latitudeStr = "latitudeGcj02";
|
||||||
|
}else if (window.mapParam.coordinateSystem == "WGS84") {
|
||||||
|
longitudeStr = "longitudeWgs84";
|
||||||
|
latitudeStr = "latitudeWgs84";
|
||||||
|
}else {
|
||||||
|
longitudeStr = "longitude";
|
||||||
|
latitudeStr = "latitude";
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < channels.length; i++) {
|
for (let i = 0; i < channels.length; i++) {
|
||||||
if (channels[i].longitude * channels[i].latitude === 0) {
|
let longitude = channels[i][longitudeStr];
|
||||||
|
let latitude = channels[i][latitudeStr];
|
||||||
|
if (longitude * latitude === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let item = {
|
let item = {
|
||||||
position: [channels[i].longitude, channels[i].latitude],
|
position: [longitude, latitude],
|
||||||
image: {
|
image: {
|
||||||
src: this.getImageByChannel(channels[i]),
|
src: this.getImageByChannel(channels[i]),
|
||||||
anchor: [0.5, 1]
|
anchor: [0.5, 1]
|
||||||
|
@ -202,7 +217,7 @@ export default {
|
||||||
this.layer = this.$refs.map.addLayer(params, this.featureClickEvent)
|
this.layer = this.$refs.map.addLayer(params, this.featureClickEvent)
|
||||||
console.log(4)
|
console.log(4)
|
||||||
if (params.length === 1) {
|
if (params.length === 1) {
|
||||||
this.$refs.map.panTo([channels[0].longitude, channels[0].latitude], mapParam.maxZoom)
|
this.$refs.map.panTo([channels[0][longitudeStr], channels[0][latitudeStr]], mapParam.maxZoom)
|
||||||
} else if (params.length > 1) {
|
} else if (params.length > 1) {
|
||||||
this.$refs.map.fit(this.layer)
|
this.$refs.map.fit(this.layer)
|
||||||
} else {
|
} else {
|
|
@ -7,7 +7,7 @@ import deviceList from '../components/DeviceList.vue'
|
||||||
import channelList from '../components/channelList.vue'
|
import channelList from '../components/channelList.vue'
|
||||||
import pushVideoList from '../components/PushVideoList.vue'
|
import pushVideoList from '../components/PushVideoList.vue'
|
||||||
import streamProxyList from '../components/StreamProxyList.vue'
|
import streamProxyList from '../components/StreamProxyList.vue'
|
||||||
import devicePosition from '../components/devicePosition.vue'
|
import map from '../components/map.vue'
|
||||||
import login from '../components/Login.vue'
|
import login from '../components/Login.vue'
|
||||||
import parentPlatformList from '../components/ParentPlatformList.vue'
|
import parentPlatformList from '../components/ParentPlatformList.vue'
|
||||||
import cloudRecord from '../components/CloudRecord.vue'
|
import cloudRecord from '../components/CloudRecord.vue'
|
||||||
|
@ -69,9 +69,9 @@ export default new VueRouter({
|
||||||
component: parentPlatformList,
|
component: parentPlatformList,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/devicePosition/:deviceId/:parentChannelId/:count/:page',
|
path: '/map/:deviceId/:parentChannelId/:count/:page',
|
||||||
name: 'devicePosition',
|
name: 'map',
|
||||||
component: devicePosition,
|
component: map,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/cloudRecord',
|
path: '/cloudRecord',
|
||||||
|
@ -100,8 +100,8 @@ export default new VueRouter({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/map',
|
path: '/map',
|
||||||
name: 'devicePosition',
|
name: 'map',
|
||||||
component: devicePosition,
|
component: map,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue