mirror of
https://gitee.com/beecue/fastbee.git
synced 2026-09-20 20:02:06 +08:00
refactor(规则引擎): topic转换失败修复
This commit is contained in:
@@ -149,7 +149,11 @@ public class TopicsUtils {
|
||||
@SneakyThrows
|
||||
public String parseSerialNumber(String topic) {
|
||||
String[] values = topic.split("/");
|
||||
return values[2];
|
||||
// 从topic分段中按长度识别设备编号,设备编号通常长度>9
|
||||
return Arrays.stream(values)
|
||||
.filter(s -> s.length() > 9)
|
||||
.findFirst()
|
||||
.orElseGet(() -> values.length > 2 ? values[2] : values[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user