增加d331和b562字节数统计;修改状态查询bug

This commit is contained in:
weidong 2023-12-30 08:19:47 +08:00
parent 4c2ec4d0a2
commit 211cea3a17
11 changed files with 41 additions and 35 deletions

View File

@ -22,15 +22,13 @@ public class GnssTrxMsg {
LocalDateTime createtime;
LocalTime devicetime;
String deviceid;
Long uart1txbytes;
Long uart1rxbytes;
Long uart1unknown;
Long uart2txbytes;
Long uart2rxbytes;
Long uart2unknown;
Integer uart1txbytes;
Integer uart1rxbytes;
Integer uart1unknown;
Integer uart2txbytes;
Integer uart2rxbytes;
Integer uart2unknown;
// 这里的收发都是服务端统计的终端收发详细统计在msg_trx表里
Long servertxbytes;
Long serverrxbytes;
Long b562bytes;
Long d3xxbytes;
Integer b562bytes;
Integer d3xxbytes;
}

View File

@ -34,6 +34,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
Device device1 = deviceService.findByDeviceId(message.getId());
if(device1 == null) return null;
message.setTenantId(device1.getTenantId());
device1.updateD331Bytes(message.getLen());
String id = message.getId();
byte[] forwardBytes = message.getSrcData();

View File

@ -38,6 +38,7 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
Device device = deviceService.findByDeviceId(message.getId());
if(device == null) return null;
message.setTenantId(device.getTenantId());
device.updateD341Bytes(message.getLen());
ThreadManager.getFixedThreadPool().submit(() -> {
gnssCalcService.calcSingle(message,true);

View File

@ -1,6 +1,7 @@
package com.imdroid.sideslope.executor;
import com.imdroid.secapi.client.BeidouClient;
import com.imdroid.secapi.dto.GnssTrxMsg;
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
import com.imdroid.sideslope.message.D3F2StopIndicationMessage;
import com.imdroid.sideslope.sal.Device;
@ -38,6 +39,10 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
Device device = deviceService.findByDeviceId(deviceId);
if(device == null) return null;
message.setTenantId(device.getTenantId());
GnssTrxMsg gnssTrxMsg = message.getTrxMsg();
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
gnssTrxMsg.setB562bytes(device.getB562bytes());
device.clearStat();
LocalDateTime uploadTime = multiLineGNSSCalcService.getUploadTime(device.getDeviceId());

View File

@ -28,17 +28,17 @@ public class D3F2StopIndicationMessage extends BaseMessage {
int key = src.readUnsignedByte();
long value = src.readUnsignedInt();
if (key == 0) {
trxMsg.setUart1txbytes(value);
trxMsg.setUart1txbytes((int) value);
} else if (key == 1) {
trxMsg.setUart1rxbytes(value);
trxMsg.setUart1rxbytes((int) value);
} else if (key == 2) {
trxMsg.setUart1unknown(value);
trxMsg.setUart1unknown((int) value);
} else if (key == 3) {
trxMsg.setUart2txbytes(value);
trxMsg.setUart2txbytes((int) value);
} else if (key == 4) {
trxMsg.setUart2rxbytes(value);
trxMsg.setUart2rxbytes((int) value);
} else if (key == 5) {
trxMsg.setUart2unknown(value);
trxMsg.setUart2unknown((int) value);
}
}
}

View File

@ -33,4 +33,20 @@ public class Device {
private Integer calcGroupId;
int d3xxbytes = 0;
int b562bytes = 0;
public void updateD331Bytes(int bytes){
d3xxbytes += bytes;
}
public void updateD341Bytes(int bytes){
b562bytes += bytes;
}
public void clearStat(){
d3xxbytes = 0;
b562bytes = 0;
}
}

View File

@ -23,10 +23,6 @@ public class DeviceChannel {
private long lastTime;
private boolean tcp;
int txbytes = 0;
int rxbytes = 0;
int d3xxbytes = 0;
int b562bytes = 0;
public DeviceChannel(String deviceId, Channel channel, InetSocketAddress address) {
this.deviceId = deviceId;
@ -45,17 +41,10 @@ public class DeviceChannel {
}
public void writeAndFlush(ByteBuf buf) {
txbytes += buf.readableBytes();
if (tcp) {
channel.writeAndFlush(buf);
} else {
channel.writeAndFlush(new DatagramPacket(buf, address));
}
}
public void updateRxBytes(int bytes, int header){
rxbytes += bytes;
if(header == 0xd331) d3xxbytes += bytes;
else if(header == 0xd341) b562bytes += bytes;
}
}

View File

@ -97,9 +97,9 @@ public class DataPersistServiceImpl implements DataPersistService {
if(null != deviceState) {
// 记录服务端收发统计
/*deviceState.setTxbytes(txbytes);
deviceState.setRxbytes(rxbytes);
deviceState.setD3xxbytes(d3xxbytes);
deviceState.setB562bytes(b562bytes);*/
deviceState.setRxbytes(rxbytes);*/
deviceState.setD3xxbytes(trxMsg.getD3xxbytes());
deviceState.setB562bytes(trxMsg.getB562bytes());
deviceState.setState(isUploading?GnssStatus.STATE_UPLOADING:GnssStatus.STATE_IDLE);
deviceStateRepository.updateById(deviceState);
}

View File

@ -49,7 +49,7 @@ public class GnssStatusController extends BasicController{
//设备号
String deviceid = search.getString("deviceid");
if (!StringUtils.isEmpty(deviceid)) {
queryWrapper.like("deviceid", deviceid);
queryWrapper.like("d.deviceid", deviceid);
}
//状态
Integer state = search.getInteger("state");

View File

@ -205,8 +205,6 @@ CREATE TABLE IF NOT EXISTS `gnsstrxmsg` (
`uart2txbytes` int DEFAULT NULL,
`uart2rxbytes` int DEFAULT NULL,
`uart2unknown` int DEFAULT NULL,
`servertxbytes` int DEFAULT NULL,
`serverrxbytes` int DEFAULT NULL,
`b562bytes` int DEFAULT NULL,
`d3xxbytes` int DEFAULT NULL,
PRIMARY KEY (`id`)

View File

@ -61,8 +61,6 @@
{field: 'devicetime', title: '设备时间'},
{field: 'd3xxbytes', title: 'D3XX'},
{field: 'b562bytes', title: 'B562'},
{field: 'servertxbytes', title: '服务端发'},
{field: 'serverrxbytes', title: '服务端收'},
{field: 'uart1txbytes', title: '串口1发'},
{field: 'uart1rxbytes', title: '串口1收'},
{field: 'uart1unknown', title: '串口1未知'},