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

This commit is contained in:
lin
2022-01-07 19:37:05 +08:00
parent cea7d51139
commit 458e7d18b7
8 changed files with 268 additions and 14343 deletions

View File

@@ -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;
}
}

View File

@@ -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);
}
}