1、增加广西交科推送
2、规范推送设备ID、设备别名、设备名的编码
This commit is contained in:
parent
a685481817
commit
8fc19d9e71
@ -0,0 +1,54 @@
|
||||
package com.imdroid.beidou_fwd.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Layton
|
||||
* @date 2023/2/19 9:16
|
||||
*/
|
||||
@Data
|
||||
public class GXJKData {
|
||||
private String WorkPointLng = "0";//基准站设备经度
|
||||
|
||||
private String WorkPointLat = "0";
|
||||
|
||||
private List<Data> data;
|
||||
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
private String DevNum;
|
||||
|
||||
private String Devtype;
|
||||
|
||||
private String DevLng = "0";//设备经度
|
||||
|
||||
private String DevLat = "0";
|
||||
|
||||
private double x;
|
||||
|
||||
private double y;
|
||||
|
||||
private double z;
|
||||
|
||||
private String DataTime;
|
||||
|
||||
public Data() {
|
||||
|
||||
}
|
||||
|
||||
public Data(String devNum, String devtype, String devLng, String devLat, double x, double y, double z, String dataTime) {
|
||||
DevNum = devNum;
|
||||
Devtype = devtype;
|
||||
DevLng = devLng;
|
||||
DevLat = devLat;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
DataTime = dataTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,14 @@
|
||||
package com.imdroid.beidou_fwd.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Layton
|
||||
* @date 2023/2/19 9:16
|
||||
*/
|
||||
@Data
|
||||
public class XFZData {
|
||||
|
||||
private String ProjectID;
|
||||
@ -18,7 +21,7 @@ public class XFZData {
|
||||
|
||||
private List<Data> data;
|
||||
|
||||
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
private String DevNum;
|
||||
|
||||
@ -51,108 +54,6 @@ public class XFZData {
|
||||
DataTime = dataTime;
|
||||
}
|
||||
|
||||
public String getDevNum() {
|
||||
return DevNum;
|
||||
}
|
||||
|
||||
public void setDevNum(String devNum) {
|
||||
DevNum = devNum;
|
||||
}
|
||||
|
||||
public String getDevtype() {
|
||||
return Devtype;
|
||||
}
|
||||
|
||||
public void setDevtype(String devtype) {
|
||||
Devtype = devtype;
|
||||
}
|
||||
|
||||
public String getDevLng() {
|
||||
return DevLng;
|
||||
}
|
||||
|
||||
public void setDevLng(String devLng) {
|
||||
DevLng = devLng;
|
||||
}
|
||||
|
||||
public String getDevLat() {
|
||||
return DevLat;
|
||||
}
|
||||
|
||||
public void setDevLat(String devLat) {
|
||||
DevLat = devLat;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public String getDataTime() {
|
||||
return DataTime;
|
||||
}
|
||||
|
||||
public void setDataTime(String dataTime) {
|
||||
DataTime = dataTime;
|
||||
}
|
||||
}
|
||||
|
||||
public String getProjectID() {
|
||||
return ProjectID;
|
||||
}
|
||||
|
||||
public void setProjectID(String projectID) {
|
||||
ProjectID = projectID;
|
||||
}
|
||||
|
||||
public String getWorkPointID() {
|
||||
return WorkPointID;
|
||||
}
|
||||
|
||||
public void setWorkPointID(String workPointID) {
|
||||
WorkPointID = workPointID;
|
||||
}
|
||||
|
||||
public String getWorkPointLng() {
|
||||
return WorkPointLng;
|
||||
}
|
||||
|
||||
public void setWorkPointLng(String workPointLng) {
|
||||
WorkPointLng = workPointLng;
|
||||
}
|
||||
|
||||
public String getWorkPointLat() {
|
||||
return WorkPointLat;
|
||||
}
|
||||
|
||||
public void setWorkPointLat(String workPointLat) {
|
||||
WorkPointLat = workPointLat;
|
||||
}
|
||||
|
||||
public List<Data> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<Data> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,16 +15,13 @@ public class MQTTClient {
|
||||
private String username;
|
||||
private String password;
|
||||
private String clientid;
|
||||
private String topic;
|
||||
int qos = 1;//0、1、2
|
||||
|
||||
public MQTTClient(String brokerUrl, String username, String password,
|
||||
String clientid, String topic){
|
||||
public MQTTClient(String brokerUrl, String username, String password,String clientid){
|
||||
this.brokerUrl = brokerUrl;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.clientid = clientid;
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public void connect() throws MqttException {
|
||||
@ -42,7 +39,7 @@ public class MQTTClient {
|
||||
client.connect(options);
|
||||
}
|
||||
|
||||
public boolean publish(String message) throws MqttException {
|
||||
public boolean publish(String topic, String message) {
|
||||
if(!client.isConnected()){
|
||||
logger.info("mqtt disconnected");
|
||||
return false;
|
||||
|
||||
@ -6,6 +6,7 @@ import com.imdroid.secapi.dto.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -17,11 +18,14 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Forwarder {
|
||||
final Logger logger = LoggerFactory.getLogger(Forwarder.class);
|
||||
static final byte FWD_DEVICE_ID = 0;
|
||||
static final byte FWD_DEVICE_NAME = 1;
|
||||
static final byte FWD_DEVICE_ALIAS_NAME = 2;
|
||||
|
||||
String fwdGroupId;
|
||||
String description;
|
||||
Integer tenantId;
|
||||
boolean useFwdId;
|
||||
byte fwdNameType = FWD_DEVICE_ID;
|
||||
int totalSendNum = 0;
|
||||
|
||||
int fwdCycleMinutes = 30;
|
||||
@ -50,14 +54,14 @@ public class Forwarder {
|
||||
* @param fwdGroupId,推送组名
|
||||
* @param desc,推送组描述
|
||||
* @param tenantId,租户Id
|
||||
* @param useFwdId,是否使用转发名,如果不使用,则用deviceId
|
||||
* @param fwdNameType,推送设备名:deviceid或fwdid或projectid-sector-name
|
||||
* @param cycle,发送周期
|
||||
*/
|
||||
void init(String fwdGroupId, String desc, Integer tenantId, boolean useFwdId, int cycle){
|
||||
void init(String fwdGroupId, String desc, Integer tenantId, byte fwdNameType, int cycle){
|
||||
this.fwdGroupId = fwdGroupId;
|
||||
this.description = desc;
|
||||
this.tenantId = tenantId;
|
||||
this.useFwdId = useFwdId;
|
||||
this.fwdNameType = fwdNameType;
|
||||
this.fwdCycleMinutes = cycle;
|
||||
|
||||
if(!isFwdTableInit){
|
||||
@ -141,11 +145,20 @@ public class Forwarder {
|
||||
record.setRposn(record.getRposn() - device.getIposn());
|
||||
record.setRposd(record.getRposd() - device.getIposd());
|
||||
}
|
||||
if (useFwdId || (device.getName()!=null&&device.getName().contains("替换"))) {
|
||||
if (device.getFwddeviceid() != null && !device.getFwddeviceid().isBlank()) {
|
||||
if (fwdNameType == FWD_DEVICE_ALIAS_NAME || (device.getName()!=null&&device.getName().contains("替换"))) {
|
||||
if (StringUtils.hasText(device.getFwddeviceid())) {
|
||||
record.setDeviceid(device.getFwddeviceid());
|
||||
}
|
||||
}
|
||||
else if(fwdNameType == FWD_DEVICE_NAME){
|
||||
String devName = "";
|
||||
if(StringUtils.hasText(device.getProject_id())) devName = devName+device.getProject_id()+"-";
|
||||
if(StringUtils.hasText(device.getSector())) devName = devName+device.getSector()+"-";
|
||||
if(StringUtils.hasText(device.getName())) devName = devName+device.getName();
|
||||
if(StringUtils.hasText(devName)) {
|
||||
record.setDeviceid(devName);
|
||||
}
|
||||
}
|
||||
recordsToSend.add(record);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package com.imdroid.beidou_fwd.task;
|
||||
|
||||
|
||||
import com.imdroid.beidou_fwd.entity.GXJKData;
|
||||
import com.imdroid.beidou_fwd.service.MQTTClient;
|
||||
import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class GXJKForwarder extends Forwarder {
|
||||
static final String FORWARDER_NAME = "广西交科";
|
||||
@Value("${gxjk.mqtt.server.brokerUrl}")
|
||||
private String brokerUrl;
|
||||
@Value("${gxjk.mqtt.server.username}")
|
||||
private String username;
|
||||
@Value("${gxjk.mqtt.server.password}")
|
||||
private String password;
|
||||
@Value("${gxjk.mqtt.server.clientid}")
|
||||
private String clientid;
|
||||
|
||||
MQTTClient mqttClient;
|
||||
|
||||
@PostConstruct
|
||||
void registerMe() throws MqttException {
|
||||
init(FORWARDER_NAME, "MQTT "+brokerUrl,7,FWD_DEVICE_NAME,60);
|
||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
||||
mqttClient.connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
*/
|
||||
@Scheduled(cron = "0 0/60 * * * ?") // 每30分钟执行一次
|
||||
private void forwardGnss() {
|
||||
logger.info("gxjk forwardGnss");
|
||||
forwardCurrentGnss();
|
||||
}
|
||||
|
||||
@Override
|
||||
int send(String projectId, List<GnssCalcData> records, LocalDateTime sentTime) {
|
||||
int sendNum = 0;
|
||||
if(records.size() == 0) return 0;
|
||||
|
||||
GXJKData sendData = new GXJKData();
|
||||
|
||||
List<GXJKData.Data> dataList = new ArrayList<>(records.size());
|
||||
sendData.setData(dataList);
|
||||
|
||||
for(GnssCalcData locationRecord: records) {
|
||||
GXJKData.Data data = new GXJKData.Data();
|
||||
dataList.add(data);
|
||||
data.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data.setDevNum(locationRecord.getDeviceid());
|
||||
data.setDevtype("GNSS");
|
||||
// 单位由mm转化为m
|
||||
data.setX(NumberUtils.scale(locationRecord.getRpose() * 0.001, 5));
|
||||
data.setY(NumberUtils.scale(locationRecord.getRposn() * 0.001, 5));
|
||||
data.setZ(NumberUtils.scale(locationRecord.getRposd() * 0.001, 5));
|
||||
sendNum++;
|
||||
}
|
||||
String json = "#" + GsonUtil.toJson(sendData) + "!";
|
||||
logger.info("project " + projectId + ": push calculation result to GXJK");
|
||||
logger.info(json);
|
||||
// /slope/项目号-all/gnss/all/publish
|
||||
String topic = "/slope/"+projectId+"-all/gnss/all/publish";
|
||||
try {
|
||||
if(!mqttClient.publish(topic, json)) {
|
||||
sendNum = 0;
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
return sendNum;
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -31,8 +30,6 @@ public class GXXfz2Forwarder extends Forwarder{
|
||||
|
||||
private TCPClient xfzTcpClient;
|
||||
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
static class XFZTCPListener implements TCPListener{
|
||||
public static final int STATE_NO_ACK = 0;
|
||||
public static final int STATE_OK = 1;
|
||||
@ -61,7 +58,7 @@ public class GXXfz2Forwarder extends Forwarder{
|
||||
XFZTCPListener listener = new XFZTCPListener();
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,6,false,30);
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,6,FWD_DEVICE_ID,30);
|
||||
xfzTcpClient = new TCPClient();
|
||||
xfzTcpClient.init(host, port,listener);
|
||||
xfzTcpClient.start();
|
||||
@ -90,7 +87,7 @@ public class GXXfz2Forwarder extends Forwarder{
|
||||
for(GnssCalcData locationRecord: records) {
|
||||
XFZData.Data data = new XFZData.Data();
|
||||
dataList.add(data);
|
||||
data.setDataTime(locationRecord.getCreatetime().format(dateFormatter));
|
||||
data.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data.setDevNum(locationRecord.getDeviceid());
|
||||
data.setDevtype("GNSS");
|
||||
// 单位由mm转化为m
|
||||
|
||||
@ -6,8 +6,6 @@ import com.imdroid.beidou_fwd.service.TCPListener;
|
||||
import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@ -16,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,8 +30,6 @@ public class GXXfzForwarder extends Forwarder{
|
||||
|
||||
private TCPClient xfzTcpClient;
|
||||
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
static class XFZTCPListener implements TCPListener{
|
||||
public static final int STATE_NO_ACK = 0;
|
||||
public static final int STATE_OK = 1;
|
||||
@ -63,7 +58,7 @@ public class GXXfzForwarder extends Forwarder{
|
||||
XFZTCPListener listener = new XFZTCPListener();
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,1,false,30);
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,1,FWD_DEVICE_ID,30);
|
||||
xfzTcpClient = new TCPClient();
|
||||
xfzTcpClient.init(host, port,listener);
|
||||
xfzTcpClient.start();
|
||||
@ -99,7 +94,7 @@ public class GXXfzForwarder extends Forwarder{
|
||||
for(GnssCalcData locationRecord: records) {
|
||||
XFZData.Data data = new XFZData.Data();
|
||||
dataList.add(data);
|
||||
data.setDataTime(locationRecord.getCreatetime().format(dateFormatter));
|
||||
data.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data.setDevNum(locationRecord.getDeviceid());
|
||||
data.setDevtype("GNSS");
|
||||
// 单位由mm转化为m
|
||||
|
||||
@ -5,8 +5,6 @@ import com.imdroid.beidou_fwd.service.UDPClient;
|
||||
import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@ -32,7 +30,7 @@ public class GZYForwarder extends Forwarder{
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, "UDP "+host+":"+port,2,true,30);
|
||||
init(FORWARDER_NAME, "UDP "+host+":"+port,2,FWD_DEVICE_ALIAS_NAME,30);
|
||||
udpClient = new UDPClient();
|
||||
udpClient.init(host, port);
|
||||
}
|
||||
|
||||
@ -7,8 +7,6 @@ import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@ -40,8 +38,8 @@ public class GZYMQTTForwarder extends Forwarder {
|
||||
|
||||
@PostConstruct
|
||||
void registerMe() throws MqttException {
|
||||
init(FORWARDER_NAME, "MQTT "+brokerUrl,2,true,30);
|
||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid,topic);
|
||||
init(FORWARDER_NAME, "MQTT "+brokerUrl,2,FWD_DEVICE_ALIAS_NAME,30);
|
||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
||||
mqttClient.connect();
|
||||
}
|
||||
|
||||
@ -73,7 +71,7 @@ public class GZYMQTTForwarder extends Forwarder {
|
||||
logger.info("forward to GZY mqtt");
|
||||
logger.info(json);
|
||||
try {
|
||||
if(!mqttClient.publish(json)) break;
|
||||
if(!mqttClient.publish(topic, json)) break;
|
||||
Thread.sleep(200);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
|
||||
@ -45,7 +45,7 @@ public class KingMaForwarder extends Forwarder{
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, data_host,3,true,60);
|
||||
init(FORWARDER_NAME, data_host,3,FWD_DEVICE_ALIAS_NAME,60);
|
||||
}
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
|
||||
@ -6,8 +6,6 @@ import com.imdroid.beidou_fwd.service.TCPListener;
|
||||
import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@ -16,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +30,6 @@ public class SaasForwarder extends Forwarder{
|
||||
|
||||
private TCPClient tcpClient;
|
||||
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
static class MyTCPListener implements TCPListener {
|
||||
public static final int STATE_NO_ACK = 0;
|
||||
public static final int STATE_OK = 1;
|
||||
@ -62,7 +58,7 @@ public class SaasForwarder extends Forwarder{
|
||||
MyTCPListener listener = new MyTCPListener();
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,0,false,30);
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,0,FWD_DEVICE_ID,30);
|
||||
tcpClient = new TCPClient();
|
||||
tcpClient.init(host, port,listener);
|
||||
tcpClient.start();
|
||||
@ -92,7 +88,7 @@ public class SaasForwarder extends Forwarder{
|
||||
for(GnssCalcData locationRecord: records) {
|
||||
XFZData.Data data = new XFZData.Data();
|
||||
dataList.add(data);
|
||||
data.setDataTime(locationRecord.getCreatetime().format(dateFormatter));
|
||||
data.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data.setDevNum(locationRecord.getDeviceid());
|
||||
data.setDevtype("GNSS");
|
||||
// 单位由mm转化为m
|
||||
|
||||
@ -14,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@ -25,11 +24,10 @@ public class ZNYForwarder extends Forwarder{
|
||||
|
||||
@Value("${zny.server.host}")
|
||||
private String data_host;
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, data_host,4,true,30);
|
||||
init(FORWARDER_NAME, data_host,4,FWD_DEVICE_ALIAS_NAME,30);
|
||||
}
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
@ -51,7 +49,7 @@ public class ZNYForwarder extends Forwarder{
|
||||
int send(String projectId, List<GnssCalcData> records, LocalDateTime sentTime){
|
||||
int sendNum = 0;
|
||||
// 单位:米
|
||||
DefoData defoData = new DefoData(projectId, sentTime.format(dateFormatter), records.size());
|
||||
DefoData defoData = new DefoData(projectId, sentTime.format(formatter), records.size());
|
||||
for(GnssCalcData locationRecord:records) {
|
||||
double n = NumberUtils.scale(locationRecord.getRposn() * 0.001, 5);
|
||||
double e = NumberUtils.scale(locationRecord.getRpose() * 0.001, 5);
|
||||
|
||||
@ -14,7 +14,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@ -25,11 +24,10 @@ public class ZNYForwarder2 extends Forwarder{
|
||||
|
||||
@Value("${zny.server.host2}")
|
||||
private String data_host;
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, data_host,4,true,30);
|
||||
init(FORWARDER_NAME, data_host,4,FWD_DEVICE_ALIAS_NAME,30);
|
||||
}
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
@ -50,7 +48,7 @@ public class ZNYForwarder2 extends Forwarder{
|
||||
int send(String projectId, List<GnssCalcData> records, LocalDateTime sentTime){
|
||||
int sendNum = 0;
|
||||
// 单位:米
|
||||
DefoData defoData = new DefoData(projectId, sentTime.format(dateFormatter), records.size());
|
||||
DefoData defoData = new DefoData(projectId, sentTime.format(formatter), records.size());
|
||||
for(GnssCalcData locationRecord:records) {
|
||||
double n = NumberUtils.scale(locationRecord.getRposn() * 0.001, 5);
|
||||
double e = NumberUtils.scale(locationRecord.getRpose() * 0.001, 5);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user