Commit 94625a6d by 111-PC\111

[+]pulsar消费服务

1 parent def3b734
......@@ -115,8 +115,19 @@ public class InfoService {
List<SmartDevideStatus> list = new ArrayList<>();
List<DeviceStatusDetail> status = deviceStatus.getStatus();
if (CollectionUtils.isNotEmpty(status)) {
list = status.stream().map(index -> {
status.forEach(index -> {
SmartDevideStatus smartDevideStatus = smartDevideStatusMapper.findDevStatusByIdAndCode(deviceStatus.getDevId(), index.getCode());
// 温度特殊处理
if(smartDevideStatus!=null){
String code = index.getCode();
String deviceOrderValue = smartDevideStatus.getDeviceOrderValue();
if(code.equals("va_temperature") || code.equals("va_humidity")){
if(deviceOrderValue.substring(0,deviceOrderValue.length()-1).equals(index.getValue().substring(0,deviceOrderValue.length()-1))){
log.info("温湿度误差在0.1之内,不用触发场景");
return;
}
}
}
if (smartDevideStatus == null) {
smartDevideStatus = new SmartDevideStatus();
smartDevideStatus.setDeviceId(deviceStatus.getDevId());
......@@ -127,8 +138,8 @@ public class InfoService {
}
smartDevideStatus.setUpdatetime(new Date(index.getT()));
smartDevideStatus.setDeviceOrderValue(index.getValue());
return smartDevideStatus;
}).collect(Collectors.toList());
list.add(smartDevideStatus);
});
}
return list;
}
......@@ -181,6 +192,7 @@ public class InfoService {
log.info("温湿度值为{}",paramValue.getValue());
Value = Integer.parseInt(paramValue.getValue()) * 10 + "";
}
// 处理特殊温度时候情况
} else {
Value = paramValue.getValue();
}
......@@ -192,6 +204,8 @@ public class InfoService {
}
}
//根据logic逻辑码,判断触发条件与数据库中实际的值,判断是否满足
return ELogic.getValueByCode(logic, Value, smartDevideStatus.getDeviceOrderValue() == null ? "" : smartDevideStatus.getDeviceOrderValue());
boolean valueByCode = ELogic.getValueByCode(logic, Value, smartDevideStatus.getDeviceOrderValue() == null ? "" : smartDevideStatus.getDeviceOrderValue());
log.info("deviceOrderCode为{}的判断是{}",deviceOrderCode,valueByCode);
return valueByCode;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!