修复更新坐标系时参数坐标系转换失败

This commit is contained in:
lin
2025-10-29 14:31:53 +08:00
parent f3e3d5700e
commit 952d38d69b
6 changed files with 51 additions and 24 deletions

View File

@@ -17,5 +17,18 @@ public class ChannelDataType {
public final static String PTZ_SERVICE = "sourceChannelPTZService";
public static String getDateTypeDesc(Integer dataType) {
if (dataType == null) {
return "未知";
}
return switch (dataType) {
case ChannelDataType.GB28181 -> "国标28181";
case ChannelDataType.STREAM_PUSH -> "推流设备";
case ChannelDataType.STREAM_PROXY -> "拉流代理";
case ChannelDataType.JT_1078 -> "部标设备";
default -> "未知";
};
}
}

View File

@@ -6,9 +6,10 @@ import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.service.*;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
import com.genersoft.iot.vmp.gb28181.service.ISourceDownloadService;
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
import com.genersoft.iot.vmp.gb28181.service.ISourcePlaybackService;
import com.genersoft.iot.vmp.jt1078.service.Ijt1078PlayService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -89,12 +90,12 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
log.info("[通用通道] 播放, 类型: {} 编号:{}", channel.getDataType(), channel.getGbDeviceId());
log.info("[通用通道] 播放, 类型: {} 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
Integer dataType = channel.getDataType();
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
if (sourceChannelPlayService == null) {
// 通道数据异常
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", dataType);
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", ChannelDataType.getDateTypeDesc(channel.getDataType()));
throw new PlayException(Response.BUSY_HERE, "channel not support");
}
sourceChannelPlayService.play(channel, platform, record, (code, msg, data) -> {
@@ -109,7 +110,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
}
@Override
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
log.info("[通用通道] 回放, 类型: {} 编号:{}", channel.getDataType(), channel.getGbDeviceId());
log.info("[通用通道] 回放, 类型: {} 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -123,7 +124,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
ErrorCallback<StreamInfo> callback){
log.info("[通用通道] 录像下载, 类型: {} 编号:{}", channel.getDataType(), channel.getGbDeviceId());
log.info("[通用通道] 录像下载, 类型: {} 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
Integer dataType = channel.getDataType();
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
if (downloadService == null) {
@@ -148,7 +149,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void stopPlayback(CommonGBChannel channel, String stream) {
log.info("[通用通道] 停止回放, 类型: {} 编号:{}", channel.getDataType(), channel.getGbDeviceId());
log.info("[通用通道] 停止回放, 类型: {} 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -161,7 +162,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void stopDownload(CommonGBChannel channel, String stream) {
log.info("[通用通道] 停止录像下载, 类型: {} 编号:{} stream: {}", channel.getDataType(), channel.getGbDeviceId(), stream);
log.info("[通用通道] 停止录像下载, 类型: {} 编号:{} stream: {}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
Integer dataType = channel.getDataType();
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
if (downloadService == null) {
@@ -174,7 +175,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void playbackPause(CommonGBChannel channel, String stream) {
log.info("[通用通道] 回放暂停, 类型: {} 编号:{} stream{}", channel.getDataType(), channel.getGbDeviceId(), stream);
log.info("[通用通道] 回放暂停, 类型: {} 编号:{} stream{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -187,7 +188,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void playbackResume(CommonGBChannel channel, String stream) {
log.info("[通用通道] 回放暂停恢复, 类型: {} 编号:{} stream{}", channel.getDataType(), channel.getGbDeviceId(), stream);
log.info("[通用通道] 回放暂停恢复, 类型: {} 编号:{} stream{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -200,7 +201,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void playbackSeek(CommonGBChannel channel, String stream, long seekTime) {
log.info("[通用通道] 回放拖动播放, 类型: {} 编号:{} stream{}", channel.getDataType(), channel.getGbDeviceId(), stream);
log.info("[通用通道] 回放拖动播放, 类型: {} 编号:{} stream{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -213,7 +214,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void playbackSpeed(CommonGBChannel channel, String stream, Double speed) {
log.info("[通用通道] 回放倍速播放, 类型: {} 编号:{} stream{}", channel.getDataType(), channel.getGbDeviceId(), stream);
log.info("[通用通道] 回放倍速播放, 类型: {} 编号:{} stream{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {
@@ -226,7 +227,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void queryRecord(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<List<CommonRecordInfo>> callback) {
log.info("[通用通道] 录像查询, 类型: {} 编号:{}", channel.getDataType(), channel.getGbDeviceId());
log.info("[通用通道] 录像查询, 类型: {} 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
Integer dataType = channel.getDataType();
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
if (playbackService == null) {

View File

@@ -366,7 +366,7 @@ public class PlayServiceImpl implements IPlayService {
InviteErrorCode.SUCCESS.getCode(),
InviteErrorCode.SUCCESS.getMsg(),
streamInfo);
log.info("[点播已存在] 直接返回, deviceId: {}, channelId: {}", device.getDeviceId(), channel.getDeviceId());
log.info("[点播已存在] 直接返回, 设备编号: {}, 通道编号: {}", device.getDeviceId(), channel.getDeviceId());
return inviteInfoInCatch.getSsrcInfo();
}else {
// 点播发起了但是尚未成功, 仅注册回调等待结果即可
@@ -413,7 +413,7 @@ public class PlayServiceImpl implements IPlayService {
InviteErrorCode.SUCCESS.getMsg(),
streamInfo);
log.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), channel.getDeviceId(),
log.info("[点播成功] 设备编号: {}, 通道编号:{}, 码流类型:{}", device.getDeviceId(), channel.getDeviceId(),
channel.getStreamIdentification());
snapOnPlay(result.getHookData().getMediaServer(), device.getDeviceId(), channel.getDeviceId(), streamId);
}else {
@@ -435,7 +435,7 @@ public class PlayServiceImpl implements IPlayService {
}
});
if (ssrcInfo == null || ssrcInfo.getPort() <= 0) {
log.info("[点播端口/SSRC]获取失败,deviceId={},channelId={},ssrcInfo={}", device.getDeviceId(), channel.getDeviceId(), ssrcInfo);
log.info("[点播端口/SSRC]获取失败,设备编号:{}, 通道编号:{},ssrcInfo{}", device.getDeviceId(), channel.getDeviceId(), ssrcInfo);
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "获取端口或者ssrc失败", null);
inviteStreamService.call(InviteSessionType.PLAY, channel.getId(), null,
InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(),
@@ -443,9 +443,9 @@ public class PlayServiceImpl implements IPlayService {
null);
return null;
}
log.info("[点播开始] deviceId: {}, channelId({}): {},码流类型:{}, 收流端口: {}, 流:{}, 收流模式:{}, SSRC: {}, SSRC校验{}",
device.getDeviceId(), channel.getDeviceId(), channel.getId(), channel.getStreamIdentification(), ssrcInfo.getPort(), ssrcInfo.getStream(),
device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
log.info("[点播开始] 设备编号: {}, 通道编号: {}, 收流端口: {}, 流ID{}, 收流模式:{}, SSRC: {}, SSRC校验{}",
device.getDeviceId(), channel.getDeviceId(), channel.getStreamIdentification(), ssrcInfo.getPort(), ssrcInfo.getStream(),
ssrcInfo.getSsrc(), device.isSsrcCheck());
// 初始化redis中的invite消息状态
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),

View File

@@ -81,8 +81,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
// 查询设备是否存在
Device device = redisCatchStorage.getDevice(deviceId);
// 查询上级平台是否存在
// Platform parentPlatform = platformService.queryPlatformByServerGBId(deviceId);
Platform parentPlatform = null;
Platform parentPlatform = platformService.queryPlatformByServerGBId(deviceId);
try {
if (device != null && parentPlatform != null) {
String hostAddress = request.getRemoteAddress().getHostAddress();

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.web.custom;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
@@ -33,6 +34,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -44,6 +46,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -73,9 +76,14 @@ public class CameraChannelController {
@Autowired
private IStreamPushPlayService streamPushPlayService;
@Autowired
private DynamicTask dynamicTask;
@Autowired
private IStreamProxyService streamProxyService;
@Value("${sy.ptz-control-time-interval}")
private int ptzControlTimeInterval = 300;
@GetMapping(value = "/camera/list")
@ResponseBody
@@ -308,6 +316,12 @@ public class CameraChannelController {
wvpResult.setData(data);
result.setResult(wvpResult);
});
// 设置时间间隔后自动发送停止
if (!command.equalsIgnoreCase("stop")) {
dynamicTask.startDelay(UUID.randomUUID().toString(), () -> {
channelService.ptz(deviceId, deviceCode, "stop", speed, (code, msg, data) -> {});
}, ptzControlTimeInterval);
}
return result;
}

View File

@@ -513,12 +513,12 @@ public class CameraChannelService implements CommandLineRunner {
if (geoCoordSys != null && longitude != null && latitude != null
&& longitude > 0 && latitude > 0) {
if (geoCoordSys.equalsIgnoreCase("GCJ02")) {
Double[] position = Coordtransform.WGS84ToGCJ02(longitude, latitude);
Double[] position = Coordtransform.GCJ02ToWGS84(longitude, latitude);
commonGBChannel.setGbLongitude(position[0]);
commonGBChannel.setGbLatitude(position[1]);
}else if (geoCoordSys.equalsIgnoreCase("BD09")) {
Double[] gcj02Position = Coordtransform.WGS84ToGCJ02(longitude, latitude);
Double[] position = Coordtransform.GCJ02ToBD09(gcj02Position[0], gcj02Position[1]);
Double[] gcj02Position = Coordtransform.BD09ToGCJ02(longitude, latitude);
Double[] position = Coordtransform.GCJ02ToWGS84(gcj02Position[0], gcj02Position[1]);
commonGBChannel.setGbLongitude(position[0]);
commonGBChannel.setGbLatitude(position[1]);
}else {