临时提交
This commit is contained in:
@@ -610,4 +610,6 @@ public interface CommonGBChannelMapper {
|
||||
List<CameraChannel> queryListForSy(@Param("query") String query, @Param("sortName") String sortName, @Param("order") String order,
|
||||
@Param("groupDeviceId") String groupDeviceId, @Param("online") Boolean online, @Param("containMobileDevice") Boolean containMobileDevice);
|
||||
|
||||
|
||||
CommonGBChannel queryByDataIdAndDeviceID(Integer deviceDbId, String deviceId);
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ public interface DeviceChannelMapper {
|
||||
", status=#{item.status}" +
|
||||
", longitude=#{item.longitude}" +
|
||||
", latitude=#{item.latitude}" +
|
||||
", gb_longitude=#{gbLongitude}" +
|
||||
", gb_latitude=#{gbLatitude}" +
|
||||
", gb_longitude=#{item.gbLongitude}" +
|
||||
", gb_latitude=#{item.gbLatitude}" +
|
||||
", ptz_type=#{item.ptzType}" +
|
||||
", position_type=#{item.positionType}" +
|
||||
", room_type=#{item.roomType}" +
|
||||
|
||||
@@ -159,7 +159,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
channel.setChannelType(2);
|
||||
groupList.add(group);
|
||||
}
|
||||
if (channel.getLongitude() > 0 && channel.getLatitude() > 0) {
|
||||
if (channel.getLongitude() != null && channel.getLatitude() != null && channel.getLongitude() > 0 && channel.getLatitude() > 0) {
|
||||
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(channel.getLongitude(), channel.getLatitude());
|
||||
channel.setGbLongitude(wgs84Position[0]);
|
||||
channel.setGbLatitude(wgs84Position[1]);
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.service.IMapService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.MapConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方平台适配
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SyServiceImpl implements IMapService, CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
// 启动后请求组织结构同步
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
String key = VideoManagerConstants.VM_MSG_GROUP_LIST_REQUEST;
|
||||
log.info("[redis发送通知] 发送 同步组织结构请求 {}", key);
|
||||
redisTemplate.convertAndSend(key, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapConfig> getConfig() {
|
||||
List<MapConfig> configList = new ArrayList<>();
|
||||
JSONObject configObject = (JSONObject)redisTemplate.opsForValue().get("interfaceConfig1");
|
||||
if (configObject == null) {
|
||||
return configList;
|
||||
}
|
||||
// 浅色地图
|
||||
MapConfig mapConfigForDefault = readConfig("FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForDefault != null) {
|
||||
mapConfigForDefault.setName("浅色地图");
|
||||
configList.add(mapConfigForDefault);
|
||||
}
|
||||
|
||||
// 深色地图
|
||||
MapConfig mapConfigForDark = readConfig("POLARNIGHTBLUE_FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForDark != null) {
|
||||
mapConfigForDark.setName("深色地图");
|
||||
configList.add(mapConfigForDark);
|
||||
}
|
||||
|
||||
// 卫星地图
|
||||
MapConfig mapConfigForSatellited = readConfig("SATELLITE_FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForSatellited != null) {
|
||||
mapConfigForSatellited.setName("卫星地图");
|
||||
configList.add(mapConfigForSatellited);
|
||||
}
|
||||
return configList;
|
||||
}
|
||||
|
||||
private MapConfig readConfig(String key, JSONObject jsonObject) {
|
||||
JSONArray fragmentimgServerArray = jsonObject.getJSONArray(key);
|
||||
if (fragmentimgServerArray == null || fragmentimgServerArray.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONObject fragmentimgServer = fragmentimgServerArray.getJSONObject(0);
|
||||
// 坐标系
|
||||
String geoCoordSys = fragmentimgServer.getString("csysType").toUpperCase();
|
||||
// 获取地址
|
||||
String path = fragmentimgServer.getString("path");
|
||||
String ip = fragmentimgServer.getString("ip");
|
||||
JSONObject portJson = fragmentimgServer.getJSONObject("port");
|
||||
JSONObject httpPortJson = portJson.getJSONObject("httpPort");
|
||||
String protocol = httpPortJson.getString("portType");
|
||||
Integer port = httpPortJson.getInteger("port");
|
||||
String tileUrl = String.format("%s://%s:%s%s", protocol, ip, port, path);
|
||||
MapConfig mapConfig = new MapConfig();
|
||||
mapConfig.setCoordinateSystem(geoCoordSys);
|
||||
mapConfig.setTilesUrl(tileUrl);
|
||||
return mapConfig;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class CameraChannelController {
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) String sortName,
|
||||
@RequestParam(required = false) String order,
|
||||
@RequestParam(required = false) String groupAlias,
|
||||
@RequestParam(required = true) String groupAlias,
|
||||
@RequestParam(required = false) Boolean status,
|
||||
@RequestParam(required = false) Boolean containMobileDevice){
|
||||
if (ObjectUtils.isEmpty(query)) {
|
||||
@@ -106,9 +106,9 @@ public class CameraChannelController {
|
||||
@Parameter(name = "deviceId", description = "通道编号")
|
||||
@Parameter(name = "deviceCode", description = "摄像头设备国标编号, 对于非国标摄像头可以不设置此参数")
|
||||
@Parameter(name = "geoCoordSys", description = "坐标系类型:WGS84,GCJ02、BD09")
|
||||
public CameraChannel getOne(@RequestParam(required = true) String deviceId,
|
||||
public CameraChannel getOne(@RequestParam(required = true) String deviceId, @RequestParam(required = true) String deviceCode,
|
||||
@RequestParam(required = false) String geoCoordSys) {
|
||||
return null;
|
||||
return channelService.queryOne(deviceId, deviceCode, geoCoordSys);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/camera/update")
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.genersoft.iot.vmp.web.custom.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@
|
||||
@Getter
|
||||
@Setter
|
||||
public class CameraStreamContent extends StreamContent {
|
||||
|
||||
public CameraStreamContent(StreamInfo streamInfo) {
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.genersoft.iot.vmp.web.custom.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||
import com.genersoft.iot.vmp.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraChannel;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -22,6 +28,9 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
@Autowired
|
||||
private CommonGBChannelMapper channelMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Autowired
|
||||
private GroupMapper groupMapper;
|
||||
|
||||
@@ -62,4 +71,34 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
private List<CameraChannel> addIconPathForCameraChannelList(List<CameraChannel> channels) {
|
||||
return channels;
|
||||
}
|
||||
|
||||
public CameraChannel queryOne(String deviceId, String deviceCode, String geoCoordSys) {
|
||||
CommonGBChannel channel = null;
|
||||
if (deviceCode != null) {
|
||||
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
||||
Assert.notNull(device, "设备不存在:" + deviceCode);
|
||||
Integer deviceDbId = device.getId();
|
||||
channel = channelMapper.queryByDataIdAndDeviceID(deviceDbId, deviceId);
|
||||
}else {
|
||||
channel = channelMapper.queryByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
if (deviceDbId != null) {
|
||||
channel.setDeviceCode(deviceCode);
|
||||
}
|
||||
if (geoCoordSys != null && channel.getGbLongitude() != null && channel.getGbLatitude() != null
|
||||
&& channel.getGbLongitude() > 0 && channel.getGbLatitude() > 0) {
|
||||
if (geoCoordSys.equalsIgnoreCase("GCJ02")) {
|
||||
Double[] position = Coordtransform.WGS84ToGCJ02(channel.getGbLongitude(), channel.getGbLatitude());
|
||||
channel.setGbLongitude(position[0]);
|
||||
channel.setGbLatitude(position[1]);
|
||||
}else if (geoCoordSys.equalsIgnoreCase("BD09")) {
|
||||
Double[] gcj02Position = Coordtransform.WGS84ToGCJ02(channel.getGbLongitude(), channel.getGbLatitude());
|
||||
Double[] position = Coordtransform.GCJ02ToBD09(gcj02Position[0], gcj02Position[1]);
|
||||
channel.setGbLongitude(position[0]);
|
||||
channel.setGbLatitude(position[1]);
|
||||
}
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user