Parcourir la source

添加接收redis订阅的GPS消息,为GPS订阅发送到级联平台做准备

lin il y a 3 ans
Parent
commit
458e7d18b7

+ 2 - 0
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java

@@ -60,7 +60,9 @@ public class VideoManagerConstants {
 
 	//************************** redis 消息*********************************
 	public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_";
+	public static final String WVP_MSG_GPS_PREFIX = "WVP_MSG_GPS_";
 
 	//**************************    第三方  ****************************************
 	public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";
+	public static final String WVP_STREAM_GPS_MSG_PREFIX = "WVP_STREAM_GPS_MSG_";
 }

+ 8 - 0
src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java

@@ -1,12 +1,16 @@
 package com.genersoft.iot.vmp.conf;
 
+import com.genersoft.iot.vmp.common.VideoManagerConstants;
+import com.genersoft.iot.vmp.service.impl.RedisGPSMsgListener;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.CachingConfigurerSupport;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.listener.PatternTopic;
 import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
@@ -41,6 +45,9 @@ public class RedisConfig extends CachingConfigurerSupport {
 	@Value("${spring.redis.poolMaxWait:5}")
 	private int poolMaxWait;
 
+	@Autowired
+	private RedisGPSMsgListener redisGPSMsgListener;
+
 	@Bean
 	public JedisPool jedisPool() {
 		if (StringUtils.isBlank(password)) {
@@ -85,6 +92,7 @@ public class RedisConfig extends CachingConfigurerSupport {
 
         RedisMessageListenerContainer container = new RedisMessageListenerContainer();
         container.setConnectionFactory(connectionFactory);
+		container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_GPS_PREFIX));
         return container;
     }
 

+ 96 - 0
src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java

@@ -0,0 +1,96 @@
+package com.genersoft.iot.vmp.service.bean;
+
+public class GPSMsgInfo {
+
+    /**
+     *
+     */
+    private String id;
+
+    /**
+     * 经度 (必选)
+     */
+    private double lng;
+
+    /**
+     * 纬度 (必选)
+     */
+    private double lat;
+
+    /**
+     * 速度,单位:km/h (可选)
+     */
+    private double speed;
+
+    /**
+     * 产生通知时间,
+     */
+    private String time;
+
+    /**
+     * 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
+     */
+    private String direction;
+
+    /**
+     * 海拔高度,单位:m(可选)
+     */
+    private String altitude;
+
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public double getLng() {
+        return lng;
+    }
+
+    public void setLng(double lng) {
+        this.lng = lng;
+    }
+
+    public double getLat() {
+        return lat;
+    }
+
+    public void setLat(double lat) {
+        this.lat = lat;
+    }
+
+    public double getSpeed() {
+        return speed;
+    }
+
+    public void setSpeed(double speed) {
+        this.speed = speed;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public String getDirection() {
+        return direction;
+    }
+
+    public void setDirection(String direction) {
+        this.direction = direction;
+    }
+
+    public String getAltitude() {
+        return altitude;
+    }
+
+    public void setAltitude(String altitude) {
+        this.altitude = altitude;
+    }
+}

+ 22 - 0
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGPSMsgListener.java

@@ -0,0 +1,22 @@
+package com.genersoft.iot.vmp.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
+import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.connection.MessageListener;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RedisGPSMsgListener implements MessageListener {
+
+    @Autowired
+    private IRedisCatchStorage redisCatchStorage;
+
+    @Override
+    public void onMessage(Message message, byte[] bytes) {
+        GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
+        redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
+    }
+}

+ 3 - 0
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java

@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
 import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
+import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
 
 import java.util.List;
@@ -193,4 +194,6 @@ public interface IRedisCatchStorage {
     Device getDevice(String deviceId);
 
     void resetAllCSEQ();
+
+    void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo);
 }

+ 7 - 0
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
 import com.genersoft.iot.vmp.conf.UserSetup;
 import com.genersoft.iot.vmp.gb28181.bean.*;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
+import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
@@ -426,4 +427,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
         String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId;
         return (Device)redis.get(key);
     }
+
+    @Override
+    public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
+        String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId();
+        redis.set(key, gpsMsgInfo);
+    }
 }

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 14223
web_src/package-lock.json


+ 1 - 1
web_src/package.json

@@ -10,7 +10,7 @@
     "build": "node build/build.js"
   },
   "dependencies": {
-    "axios": "^0.19.2",
+    "axios": "^0.24.0",
     "core-js": "^2.6.5",
     "echarts": "^4.9.0",
     "element-ui": "^2.15.1",

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff