Explorar o código

修复通道位置的展示

648540858 hai 1 ano
pai
achega
313243195e

+ 28 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java

@@ -186,6 +186,18 @@ public class DeviceChannel {
 	@Schema(description = "纬度")
 	private double latitude;
 
+	/**
+	 * 经度
+	 */
+	@Schema(description = "自定义经度")
+	private double customLongitude;
+
+	/**
+	 * 纬度
+	 */
+	@Schema(description = "自定义纬度")
+	private double customLatitude;
+
 	/**
 	 * 经度 GCJ02
 	 */
@@ -586,4 +598,20 @@ public class DeviceChannel {
 	public void setStreamIdentification(String streamIdentification) {
 		this.streamIdentification = streamIdentification;
 	}
+
+	public double getCustomLongitude() {
+		return customLongitude;
+	}
+
+	public void setCustomLongitude(double customLongitude) {
+		this.customLongitude = customLongitude;
+	}
+
+	public double getCustomLatitude() {
+		return customLatitude;
+	}
+
+	public void setCustomLatitude(double customLatitude) {
+		this.customLatitude = customLatitude;
+	}
 }

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java

@@ -117,7 +117,6 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
 		if (parentPlatform != null) {
 			Map<String, Object> param = getSendRtpParam(sendRtpItem);
 			if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
-//				redisCatchStorage.sendStartSendRtp(sendRtpItem);
 				WVPResult wvpResult = redisRpcService.startSendRtp(sendRtpItem);
 				if (wvpResult.getCode() == 0) {
 					MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java

@@ -138,10 +138,10 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
 					redisCatchStorage.sendPlatformStopPlayMsg(sendRtpItem, platform);
 					if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
 						redisRpcService.stopSendRtp(sendRtpItem);
+						redisCatchStorage.deleteSendRTPServer(null, null, sendRtpItem.getCallId(), null);
 					}else {
 						MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
-						redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),
-								callIdHeader.getCallId(), null);
+						redisCatchStorage.deleteSendRTPServer(null, null, callIdHeader.getCallId(), null);
 						zlmServerFactory.stopSendRtpStream(mediaInfo, param);
 						if (userSetting.getUseCustomSsrcForParentInvite()) {
 							mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc());

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java

@@ -775,7 +775,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
         redisRpcService.waitePushStreamOnline(sendRtpItem, (sendRtpItemFromRedis) -> {
             dynamicTask.stop(sendRtpItem.getCallId());
             if (sendRtpItemFromRedis.getServerId().equals(userSetting.getServerId())) {
-
+                logger.info("[级联点播] 等待的推流在本平台上线 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream());
                 int localPort = sendRtpPortManager.getNextPort(mediaServerItem);
                 if (localPort == 0) {
                     logger.warn("上级点时创建sendRTPItem失败,可能是服务器端口资源不足");
@@ -827,7 +827,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
      * 来自其他wvp的推流
      */
     private void otherWvpPushStream(SendRtpItem sendRtpItem, SIPRequest request, ParentPlatform platform) {
-        logger.info("[级联点播]直播流来自其他平台,发送redis消息");
+        logger.info("[级联点播] 来自其他wvp的推流 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream());
         sendRtpItem = redisRpcService.getSendRtpItem(sendRtpItem);
         // 写入redis, 超时时回复
         sendRtpItem.setStatus(1);

+ 7 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java

@@ -180,6 +180,13 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
 				logger.warn("[mobilePosition移动位置Notify] 未找到通道{}所属的设备", channelId);
 				return;
 			}
+			// 兼容设备部分设备上报是通道编号与设备编号一致的情况
+			if(deviceId.equals(channelId)) {
+				List<DeviceChannel> deviceChannels = deviceChannelService.queryChaneListByDeviceId(deviceId);
+				if (deviceChannels.size() == 1) {
+					channelId = deviceChannels.get(0).getChannelId();
+				}
+			}
 			if (!ObjectUtils.isEmpty(device.getName())) {
 				mobilePosition.setDeviceName(device.getName());
 			}

+ 13 - 9
src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcController.java

@@ -79,7 +79,7 @@ public class RedisRpcController {
      */
     public RedisRpcResponse getSendRtpItem(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
-        logger.info("[redis-rpc] 获取发流的信息: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+        logger.info("[redis-rpc] 获取发流的信息: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort());
         // 查询本级是否有这个流
         MediaServerItem mediaServerItem = mediaServerService.getMediaServerByAppAndStream(sendRtpItem.getApp(), sendRtpItem.getStream());
         if (mediaServerItem == null) {
@@ -114,11 +114,11 @@ public class RedisRpcController {
      */
     public RedisRpcResponse waitePushStreamOnline(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
-        logger.info("[redis-rpc] 监听流上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+        logger.info("[redis-rpc] 监听流上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort());
         // 查询本级是否有这个流
         MediaServerItem mediaServerItem = mediaServerService.getMediaServerByAppAndStream(sendRtpItem.getApp(), sendRtpItem.getStream());
         if (mediaServerItem != null) {
-            logger.info("[redis-rpc] 监听流上线时发现流已存在直接返回: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+            logger.info("[redis-rpc] 监听流上线时发现流已存在直接返回: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
             RedisRpcResponse response = request.getResponse();
             response.setBody(sendRtpItem);
             response.setStatusCode(200);
@@ -128,7 +128,7 @@ public class RedisRpcController {
                 sendRtpItem.getApp(), sendRtpItem.getStream(), true, "rtsp", null);
 
         hookSubscribe.addSubscribe(hook, (MediaServerItem mediaServerItemInUse, HookParam hookParam) -> {
-            logger.info("[redis-rpc] 监听流上线,流已上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+            logger.info("[redis-rpc] 监听流上线,流已上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort());
             // 读取redis中的上级点播信息,生成sendRtpItm发送出去
             if (sendRtpItem.getSsrc() == null) {
                 // 上级平台点播时不使用上级平台指定的ssrc,使用自定义的ssrc,参考国标文档-点播外域设备媒体流SSRC处理方式
@@ -138,6 +138,7 @@ public class RedisRpcController {
             sendRtpItem.setMediaServerId(mediaServerItemInUse.getId());
             sendRtpItem.setLocalIp(mediaServerItemInUse.getSdpIp());
             sendRtpItem.setServerId(userSetting.getServerId());
+
             RedisRpcResponse response = request.getResponse();
             response.setBody(sendRtpItem);
             response.setStatusCode(200);
@@ -153,7 +154,7 @@ public class RedisRpcController {
      */
     public RedisRpcResponse stopWaitePushStreamOnline(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
-        logger.info("[redis-rpc] 停止监听流上线: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+        logger.info("[redis-rpc] 停止监听流上线: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
 
         // 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者
         HookSubscribeForStreamChange hook = HookSubscribeFactory.on_stream_changed(
@@ -168,6 +169,7 @@ public class RedisRpcController {
      */
     public RedisRpcResponse startSendRtp(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
+        logger.info("[redis-rpc] 开始发流: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort());
         MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId());
         if (mediaServerItem == null) {
             logger.info("[redis-rpc] startSendRtp->未找到MediaServer: {}", sendRtpItem.getMediaServerId() );
@@ -185,9 +187,11 @@ public class RedisRpcController {
         RedisRpcResponse response = request.getResponse();
         response.setStatusCode(200);
         if (jsonObject.getInteger("code") == 0) {
+            logger.info("[redis-rpc] 发流成功: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort());
             WVPResult wvpResult = WVPResult.success();
             response.setBody(wvpResult);
         }else {
+            logger.info("[redis-rpc] 发流失败: {}/{}, 目标地址: {}:{}, {}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), jsonObject);
             WVPResult wvpResult = WVPResult.fail(jsonObject.getInteger("code"), jsonObject.getString("msg"));
             response.setBody(wvpResult);
         }
@@ -199,7 +203,7 @@ public class RedisRpcController {
      */
     public RedisRpcResponse stopSendRtp(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
-        logger.info("[redis-rpc] 停止推流: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+        logger.info("[redis-rpc] 停止推流: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
         MediaServerItem mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId());
         if (mediaServerItem == null) {
             logger.info("[redis-rpc] stopSendRtp->未找到MediaServer: {}", sendRtpItem.getMediaServerId() );
@@ -210,13 +214,13 @@ public class RedisRpcController {
         RedisRpcResponse response = request.getResponse();
         response.setStatusCode(200);
         if (jsonObject.getInteger("code") == 0) {
-            logger.info("[redis-rpc] 停止推流成功: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+            logger.info("[redis-rpc] 停止推流成功: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
             WVPResult wvpResult = WVPResult.success();
             response.setBody(wvpResult);
         }else {
             int code = jsonObject.getInteger("code");
             String msg = jsonObject.getString("msg");
-            logger.info("[redis-rpc] 停止推流失败: {}/{}, code: {}, msg: {}", sendRtpItem.getApp(), sendRtpItem.getStream(),code, msg );
+            logger.info("[redis-rpc] 停止推流失败: {}/{}, 目标地址: {}:{}, code: {}, msg: {}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), code, msg );
             WVPResult wvpResult = WVPResult.fail(code, msg);
             response.setBody(wvpResult);
         }
@@ -228,7 +232,7 @@ public class RedisRpcController {
      */
     public RedisRpcResponse rtpSendStopped(RedisRpcRequest request) {
         SendRtpItem sendRtpItem = JSON.parseObject(request.getParam().toString(), SendRtpItem.class);
-        logger.info("[redis-rpc] 推流已经停止: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream() );
+        logger.info("[redis-rpc] 推流已经停止: {}/{}, 目标地址: {}:{}", sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort() );
         SendRtpItem sendRtpItemInCatch = redisCatchStorage.querySendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getStream(), sendRtpItem.getCallId());
         RedisRpcResponse response = request.getResponse();
         response.setStatusCode(200);

+ 6 - 0
src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java

@@ -15,12 +15,15 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
 import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class RedisRpcServiceImpl implements IRedisRpcService {
 
+    private final static Logger logger = LoggerFactory.getLogger(RedisRpcServiceImpl.class);
 
     @Autowired
     private RedisRpcConfig redisRpcConfig;
@@ -52,6 +55,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
 
     @Override
     public WVPResult startSendRtp(SendRtpItem sendRtpItem) {
+        logger.info("[请求其他WVP] 开始推流,wvp:{}, {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream());
         RedisRpcRequest request = buildRequest("startSendRtp", sendRtpItem);
         request.setToId(sendRtpItem.getServerId());
         RedisRpcResponse response = redisRpcConfig.request(request, 10);
@@ -68,6 +72,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
 
     @Override
     public void waitePushStreamOnline(SendRtpItem sendRtpItem, CommonCallback<SendRtpItem> callback) {
+        logger.info("[请求所有WVP监听流上线] {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream());
         // 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者
         HookSubscribeForStreamChange hook = HookSubscribeFactory.on_stream_changed(
                 sendRtpItem.getApp(), sendRtpItem.getStream(), true, "rtsp", null);
@@ -91,6 +96,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
         request.setToId(sendRtpItem.getServerId());
         redisRpcConfig.request(request, response -> {
             SendRtpItem sendRtpItemFromOther = JSON.parseObject(response.getBody().toString(), SendRtpItem.class);
+            logger.info("[请求所有WVP监听流上线] 流上线 {}/{}->{}", sendRtpItemFromOther.getApp(), sendRtpItemFromOther.getStream(), sendRtpItemFromOther);
             if (callback != null) {
                 callback.run(sendRtpItemFromOther);
             }

+ 8 - 4
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@@ -52,8 +52,8 @@ public interface DeviceChannelMapper {
             "<if test='status != null'>, status=#{status}</if>" +
             "<if test='streamId != null'>, stream_id=#{streamId}</if>" +
             "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
-            ", custom_longitude=#{longitude}" +
-            ", custom_latitude=#{latitude}" +
+            "<if test='customLongitude != null'>, custom_longitude=#{customLongitude}</if>" +
+            "<if test='customLatitude != null'>, custom_latitude=#{customLatitude}</if>" +
             "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
             "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
             "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
@@ -89,8 +89,10 @@ public interface DeviceChannelMapper {
             "dc.password, " +
             "COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " +
             "dc.status, " +
-            "COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " +
-            "COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " +
+            "dc.longitude, " +
+            "dc.latitude, " +
+            "dc.custom_longitude, " +
+            "dc.custom_latitude, " +
             "dc.stream_id, " +
             "dc.device_id, " +
             "dc.parental, " +
@@ -345,6 +347,8 @@ public interface DeviceChannelMapper {
             "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" +
             "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
             "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
+            "<if test='customLongitude != null'>, custom_longitude=#{item.customLongitude}</if>" +
+            "<if test='custom_latitude != null'>, custom_latitude=#{item.customLatitude}</if>" +
             "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
             "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
             "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +

+ 1 - 1
src/main/resources/application.yml

@@ -2,4 +2,4 @@ spring:
   application:
     name: wvp
   profiles:
-    active: local2
+    active: local

+ 8 - 4
web_src/src/components/channelList.vue

@@ -315,7 +315,9 @@ export default {
             e.ptzType = e.ptzType + "";
             that.$set(e, "edit", false);
             that.$set(e, "location", "");
-            if (e.longitude && e.latitude) {
+            if (e.customLongitude && e.customLatitude) {
+              that.$set(e, "location", e.customLongitude + "," + e.customLatitude);
+            }else if (e.longitude && e.latitude) {
               that.$set(e, "location", e.longitude + "," + e.latitude);
             }
           });
@@ -463,7 +465,9 @@ export default {
               e.ptzType = e.ptzType + "";
               this.$set(e, "edit", false);
               this.$set(e, "location", "");
-              if (e.longitude && e.latitude) {
+              if (e.customLongitude && e.customLatitude) {
+                this.$set(e, "location", e.customLongitude + "," + e.customLatitude);
+              }else if (e.longitude && e.latitude) {
                 this.$set(e, "location", e.longitude + "," + e.latitude);
               }
             });
@@ -585,8 +589,8 @@ export default {
           this.$message.warning("位置信息格式有误,例:117.234,36.378");
           return;
         } else {
-          row.longitude = parseFloat(segements[0]);
-          row.latitude = parseFloat(segements[1]);
+          row.customLongitude = parseFloat(segements[0]);
+          row.custom_latitude = parseFloat(segements[1]);
           if (!(row.longitude && row.latitude)) {
             this.$message.warning("位置信息格式有误,例:117.234,36.378");
             return;