1、修改倾角推送的bug
This commit is contained in:
parent
319cac5311
commit
8aa982b81b
@ -54,43 +54,13 @@ public class D350SurfaceInclineMessageExecutor implements Executor<D350SurfaceIn
|
|||||||
logger.debug("{} not existed", deviceId);
|
logger.debug("{} not existed", deviceId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 补齐tenantId
|
|
||||||
SurfaceInclineData data = message.getInclineData();
|
SurfaceInclineData data = message.getInclineData();
|
||||||
data.setTenantid(device.device.getTenantid());
|
data.setTenantid(device.device.getTenantid());
|
||||||
SurfaceInclineData data1 = device.data1;
|
forwardData(device, data);
|
||||||
|
|
||||||
// 推送数据
|
|
||||||
if(data1 == null){
|
|
||||||
device.data1 = data;
|
|
||||||
device.sensorNum = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//只有1个传感器的设备立刻发数据
|
|
||||||
if(device.sensorNum == 1){
|
|
||||||
if (!data.getSensorid().equals(data1.getSensorid())){
|
|
||||||
device.sensorNum = 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dataForwarder.send(device.device, data);
|
|
||||||
device.data1 = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//有两个的等收到第2个才发
|
|
||||||
if (device.sensorNum == 2) {
|
|
||||||
if (data.getSensorid()==1) device.data1 = data;
|
|
||||||
else {
|
|
||||||
data.setAnglex(data1.getAnglex());
|
|
||||||
data.setAccx(data1.getAccx());
|
|
||||||
dataForwarder.send(device.device, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
device.updateTime = LocalDateTime.now();
|
|
||||||
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
//保存状态信息,判断是否有低电压等告警,清除离线告警
|
dataMapper.insert(data);
|
||||||
dataMapper.insert(message.getInclineData());
|
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -130,4 +100,35 @@ public class D350SurfaceInclineMessageExecutor implements Executor<D350SurfaceIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void forwardData(DeviceInfo device, SurfaceInclineData data){
|
||||||
|
SurfaceInclineData data1 = device.data1;
|
||||||
|
if(data1 == null){
|
||||||
|
device.data1 = data;
|
||||||
|
device.sensorNum = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//只有1个传感器的设备立刻发数据
|
||||||
|
if(device.sensorNum == 1){
|
||||||
|
if (!data.getSensorid().equals(data1.getSensorid())){
|
||||||
|
device.sensorNum = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dataForwarder.send(device.device, data);
|
||||||
|
device.data1 = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//有两个的等收到第2个才发
|
||||||
|
if (device.sensorNum == 2) {
|
||||||
|
if (data.getSensorid()==1) device.data1 = data;
|
||||||
|
else {
|
||||||
|
data1.setAngley(data.getAnglex());
|
||||||
|
data1.setAccy(data.getAccx());
|
||||||
|
dataForwarder.send(device.device, data1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
device.updateTime = LocalDateTime.now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,8 +117,8 @@ public class InclineDataForwarder{
|
|||||||
float z = surfaceInclineData.getAnglez();
|
float z = surfaceInclineData.getAnglez();
|
||||||
// 振幅
|
// 振幅
|
||||||
float Zx = surfaceInclineData.getMaxaccx()-surfaceInclineData.getMinaccx();
|
float Zx = surfaceInclineData.getMaxaccx()-surfaceInclineData.getMinaccx();
|
||||||
float Zy = surfaceInclineData.getMaxaccx()-surfaceInclineData.getMinaccy();
|
float Zy = surfaceInclineData.getMaxaccy()-surfaceInclineData.getMinaccy();
|
||||||
float Zz = surfaceInclineData.getMaxaccx()-surfaceInclineData.getMinaccz();
|
float Zz = surfaceInclineData.getMaxaccz()-surfaceInclineData.getMinaccz();
|
||||||
|
|
||||||
data.setX(NumberUtils.scale((double) x, 3));
|
data.setX(NumberUtils.scale((double) x, 3));
|
||||||
data.setY(NumberUtils.scale((double) y, 3));
|
data.setY(NumberUtils.scale((double) y, 3));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user