1、倾角的设备ID加_qj
This commit is contained in:
parent
209c992734
commit
00fa3171ab
@ -2,7 +2,11 @@ package com.imdroid.beidou_fwd.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.imdroid.beidou_fwd.entity.XFZData;
|
||||
import com.imdroid.beidou_fwd.service.TCPClient;
|
||||
import com.imdroid.common.util.GsonUtil;
|
||||
import com.imdroid.common.util.NumberUtils;
|
||||
import com.imdroid.secapi.dto.GnssCalcData;
|
||||
import com.imdroid.secapi.dto.ResendRecord;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -12,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@ -46,6 +51,87 @@ public class GXJSForwarder extends GXXfzForwarder{
|
||||
forwardCurrentGnss();
|
||||
}
|
||||
|
||||
@Override
|
||||
int send(String projectId, List<GnssCalcData> records, LocalDateTime sentTime){
|
||||
int batchNum = 0;
|
||||
int sendNum = 0;
|
||||
if(records.size() == 0) return 0;
|
||||
|
||||
XFZData xfzTcpMessage = new XFZData();
|
||||
xfzTcpMessage.setProjectID(projectId);
|
||||
xfzTcpMessage.setWorkPointID(projectId);
|
||||
|
||||
List<XFZData.Data> dataList = new ArrayList<>(records.size());
|
||||
xfzTcpMessage.setData(dataList);
|
||||
|
||||
for(GnssCalcData locationRecord: records) {
|
||||
XFZData.Data data = new XFZData.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));
|
||||
// 经纬度
|
||||
data.setDevLng(locationRecord.getR9250e());
|
||||
data.setDevLat(locationRecord.getR9250n());
|
||||
|
||||
if(projectId!=null && projectId.equals("20257071")) {
|
||||
//倾角
|
||||
XFZData.Data data2 = new XFZData.Data();
|
||||
dataList.add(data2);
|
||||
data2.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data2.setDevNum(locationRecord.getDeviceid() + "_qj");
|
||||
data2.setDevtype("InclinoMeter");
|
||||
// 角度
|
||||
data2.setX(NumberUtils.scale(locationRecord.getAuxe(), 3));
|
||||
data2.setY(NumberUtils.scale(locationRecord.getAuxn(), 3));
|
||||
data2.setZ(NumberUtils.scale(locationRecord.getAuxd(), 3));
|
||||
// 经纬度
|
||||
data2.setDevLng(locationRecord.getR9250e());
|
||||
data2.setDevLat(locationRecord.getR9250n());
|
||||
}
|
||||
// 发送
|
||||
batchNum++;
|
||||
|
||||
if(batchNum==20){
|
||||
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
|
||||
//logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId);
|
||||
//logger.debug(json);
|
||||
try {
|
||||
listener.clear();
|
||||
xfzTcpClient.writeAndFlush(json);
|
||||
//等待应答
|
||||
if(checkResult()) sendNum += batchNum;
|
||||
} catch (Exception e1) {
|
||||
logger.error(e1.toString());
|
||||
}
|
||||
batchNum = 0;
|
||||
dataList.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(batchNum>0){
|
||||
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
|
||||
logger.debug("project {}: forwad {} gnss records to {}",projectId, dataList.size(),fwdGroupId);
|
||||
logger.debug(json);
|
||||
try {
|
||||
listener.clear();
|
||||
xfzTcpClient.writeAndFlush(json);
|
||||
//等待应答
|
||||
if(checkResult()) sendNum += batchNum;
|
||||
} catch (Exception e1) {
|
||||
logger.error(e1.toString());
|
||||
}
|
||||
dataList.clear();
|
||||
}
|
||||
return sendNum;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void forwardHistoryGnss(){
|
||||
// 1.从转发记录表里检索待补传记录时间表,含设备Id,时间段
|
||||
|
||||
@ -69,20 +69,6 @@ public class GXXfzForwarder extends Forwarder{
|
||||
data.setDevLng(locationRecord.getR9250e());
|
||||
data.setDevLat(locationRecord.getR9250n());
|
||||
|
||||
//倾角
|
||||
XFZData.Data data2 = new XFZData.Data();
|
||||
dataList.add(data2);
|
||||
data2.setDataTime(locationRecord.getCreatetime().format(formatter));
|
||||
data2.setDevNum(locationRecord.getDeviceid()+"_qj");
|
||||
data2.setDevtype("InclinoMeter");
|
||||
// 角度
|
||||
data2.setX(NumberUtils.scale(locationRecord.getAuxe(), 3));
|
||||
data2.setY(NumberUtils.scale(locationRecord.getAuxn(), 3));
|
||||
data2.setZ(NumberUtils.scale(locationRecord.getAuxd(), 3));
|
||||
// 经纬度
|
||||
data2.setDevLng(locationRecord.getR9250e());
|
||||
data2.setDevLat(locationRecord.getR9250n());
|
||||
|
||||
// 发送
|
||||
batchNum++;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user