增加d331和b562字节数统计;修改状态查询bug
This commit is contained in:
parent
4c2ec4d0a2
commit
211cea3a17
@ -22,15 +22,13 @@ public class GnssTrxMsg {
|
|||||||
LocalDateTime createtime;
|
LocalDateTime createtime;
|
||||||
LocalTime devicetime;
|
LocalTime devicetime;
|
||||||
String deviceid;
|
String deviceid;
|
||||||
Long uart1txbytes;
|
Integer uart1txbytes;
|
||||||
Long uart1rxbytes;
|
Integer uart1rxbytes;
|
||||||
Long uart1unknown;
|
Integer uart1unknown;
|
||||||
Long uart2txbytes;
|
Integer uart2txbytes;
|
||||||
Long uart2rxbytes;
|
Integer uart2rxbytes;
|
||||||
Long uart2unknown;
|
Integer uart2unknown;
|
||||||
// 这里的收发都是服务端统计的,终端收发详细统计在msg_trx表里
|
// 这里的收发都是服务端统计的,终端收发详细统计在msg_trx表里
|
||||||
Long servertxbytes;
|
Integer b562bytes;
|
||||||
Long serverrxbytes;
|
Integer d3xxbytes;
|
||||||
Long b562bytes;
|
|
||||||
Long d3xxbytes;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
Device device1 = deviceService.findByDeviceId(message.getId());
|
Device device1 = deviceService.findByDeviceId(message.getId());
|
||||||
if(device1 == null) return null;
|
if(device1 == null) return null;
|
||||||
message.setTenantId(device1.getTenantId());
|
message.setTenantId(device1.getTenantId());
|
||||||
|
device1.updateD331Bytes(message.getLen());
|
||||||
|
|
||||||
String id = message.getId();
|
String id = message.getId();
|
||||||
byte[] forwardBytes = message.getSrcData();
|
byte[] forwardBytes = message.getSrcData();
|
||||||
|
|||||||
@ -38,6 +38,7 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
Device device = deviceService.findByDeviceId(message.getId());
|
Device device = deviceService.findByDeviceId(message.getId());
|
||||||
if(device == null) return null;
|
if(device == null) return null;
|
||||||
message.setTenantId(device.getTenantId());
|
message.setTenantId(device.getTenantId());
|
||||||
|
device.updateD341Bytes(message.getLen());
|
||||||
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
gnssCalcService.calcSingle(message,true);
|
gnssCalcService.calcSingle(message,true);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.imdroid.sideslope.executor;
|
package com.imdroid.sideslope.executor;
|
||||||
|
|
||||||
import com.imdroid.secapi.client.BeidouClient;
|
import com.imdroid.secapi.client.BeidouClient;
|
||||||
|
import com.imdroid.secapi.dto.GnssTrxMsg;
|
||||||
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
|
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
|
||||||
import com.imdroid.sideslope.message.D3F2StopIndicationMessage;
|
import com.imdroid.sideslope.message.D3F2StopIndicationMessage;
|
||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
@ -38,6 +39,10 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
Device device = deviceService.findByDeviceId(deviceId);
|
Device device = deviceService.findByDeviceId(deviceId);
|
||||||
if(device == null) return null;
|
if(device == null) return null;
|
||||||
message.setTenantId(device.getTenantId());
|
message.setTenantId(device.getTenantId());
|
||||||
|
GnssTrxMsg gnssTrxMsg = message.getTrxMsg();
|
||||||
|
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
|
||||||
|
gnssTrxMsg.setB562bytes(device.getB562bytes());
|
||||||
|
device.clearStat();
|
||||||
|
|
||||||
LocalDateTime uploadTime = multiLineGNSSCalcService.getUploadTime(device.getDeviceId());
|
LocalDateTime uploadTime = multiLineGNSSCalcService.getUploadTime(device.getDeviceId());
|
||||||
|
|
||||||
|
|||||||
@ -28,17 +28,17 @@ public class D3F2StopIndicationMessage extends BaseMessage {
|
|||||||
int key = src.readUnsignedByte();
|
int key = src.readUnsignedByte();
|
||||||
long value = src.readUnsignedInt();
|
long value = src.readUnsignedInt();
|
||||||
if (key == 0) {
|
if (key == 0) {
|
||||||
trxMsg.setUart1txbytes(value);
|
trxMsg.setUart1txbytes((int) value);
|
||||||
} else if (key == 1) {
|
} else if (key == 1) {
|
||||||
trxMsg.setUart1rxbytes(value);
|
trxMsg.setUart1rxbytes((int) value);
|
||||||
} else if (key == 2) {
|
} else if (key == 2) {
|
||||||
trxMsg.setUart1unknown(value);
|
trxMsg.setUart1unknown((int) value);
|
||||||
} else if (key == 3) {
|
} else if (key == 3) {
|
||||||
trxMsg.setUart2txbytes(value);
|
trxMsg.setUart2txbytes((int) value);
|
||||||
} else if (key == 4) {
|
} else if (key == 4) {
|
||||||
trxMsg.setUart2rxbytes(value);
|
trxMsg.setUart2rxbytes((int) value);
|
||||||
} else if (key == 5) {
|
} else if (key == 5) {
|
||||||
trxMsg.setUart2unknown(value);
|
trxMsg.setUart2unknown((int) value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,4 +33,20 @@ public class Device {
|
|||||||
|
|
||||||
private Integer calcGroupId;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,10 +23,6 @@ public class DeviceChannel {
|
|||||||
private long lastTime;
|
private long lastTime;
|
||||||
|
|
||||||
private boolean tcp;
|
private boolean tcp;
|
||||||
int txbytes = 0;
|
|
||||||
int rxbytes = 0;
|
|
||||||
int d3xxbytes = 0;
|
|
||||||
int b562bytes = 0;
|
|
||||||
|
|
||||||
public DeviceChannel(String deviceId, Channel channel, InetSocketAddress address) {
|
public DeviceChannel(String deviceId, Channel channel, InetSocketAddress address) {
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
@ -45,17 +41,10 @@ public class DeviceChannel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeAndFlush(ByteBuf buf) {
|
public void writeAndFlush(ByteBuf buf) {
|
||||||
txbytes += buf.readableBytes();
|
|
||||||
if (tcp) {
|
if (tcp) {
|
||||||
channel.writeAndFlush(buf);
|
channel.writeAndFlush(buf);
|
||||||
} else {
|
} else {
|
||||||
channel.writeAndFlush(new DatagramPacket(buf, address));
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,9 +97,9 @@ public class DataPersistServiceImpl implements DataPersistService {
|
|||||||
if(null != deviceState) {
|
if(null != deviceState) {
|
||||||
// 记录服务端收发统计
|
// 记录服务端收发统计
|
||||||
/*deviceState.setTxbytes(txbytes);
|
/*deviceState.setTxbytes(txbytes);
|
||||||
deviceState.setRxbytes(rxbytes);
|
deviceState.setRxbytes(rxbytes);*/
|
||||||
deviceState.setD3xxbytes(d3xxbytes);
|
deviceState.setD3xxbytes(trxMsg.getD3xxbytes());
|
||||||
deviceState.setB562bytes(b562bytes);*/
|
deviceState.setB562bytes(trxMsg.getB562bytes());
|
||||||
deviceState.setState(isUploading?GnssStatus.STATE_UPLOADING:GnssStatus.STATE_IDLE);
|
deviceState.setState(isUploading?GnssStatus.STATE_UPLOADING:GnssStatus.STATE_IDLE);
|
||||||
deviceStateRepository.updateById(deviceState);
|
deviceStateRepository.updateById(deviceState);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public class GnssStatusController extends BasicController{
|
|||||||
//设备号
|
//设备号
|
||||||
String deviceid = search.getString("deviceid");
|
String deviceid = search.getString("deviceid");
|
||||||
if (!StringUtils.isEmpty(deviceid)) {
|
if (!StringUtils.isEmpty(deviceid)) {
|
||||||
queryWrapper.like("deviceid", deviceid);
|
queryWrapper.like("d.deviceid", deviceid);
|
||||||
}
|
}
|
||||||
//状态
|
//状态
|
||||||
Integer state = search.getInteger("state");
|
Integer state = search.getInteger("state");
|
||||||
|
|||||||
@ -205,8 +205,6 @@ CREATE TABLE IF NOT EXISTS `gnsstrxmsg` (
|
|||||||
`uart2txbytes` int DEFAULT NULL,
|
`uart2txbytes` int DEFAULT NULL,
|
||||||
`uart2rxbytes` int DEFAULT NULL,
|
`uart2rxbytes` int DEFAULT NULL,
|
||||||
`uart2unknown` int DEFAULT NULL,
|
`uart2unknown` int DEFAULT NULL,
|
||||||
`servertxbytes` int DEFAULT NULL,
|
|
||||||
`serverrxbytes` int DEFAULT NULL,
|
|
||||||
`b562bytes` int DEFAULT NULL,
|
`b562bytes` int DEFAULT NULL,
|
||||||
`d3xxbytes` int DEFAULT NULL,
|
`d3xxbytes` int DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
|
|||||||
@ -61,8 +61,6 @@
|
|||||||
{field: 'devicetime', title: '设备时间'},
|
{field: 'devicetime', title: '设备时间'},
|
||||||
{field: 'd3xxbytes', title: 'D3XX'},
|
{field: 'd3xxbytes', title: 'D3XX'},
|
||||||
{field: 'b562bytes', title: 'B562'},
|
{field: 'b562bytes', title: 'B562'},
|
||||||
{field: 'servertxbytes', title: '服务端发'},
|
|
||||||
{field: 'serverrxbytes', title: '服务端收'},
|
|
||||||
{field: 'uart1txbytes', title: '串口1发'},
|
{field: 'uart1txbytes', title: '串口1发'},
|
||||||
{field: 'uart1rxbytes', title: '串口1收'},
|
{field: 'uart1rxbytes', title: '串口1收'},
|
||||||
{field: 'uart1unknown', title: '串口1未知'},
|
{field: 'uart1unknown', title: '串口1未知'},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user