优化产品ID处理
This commit is contained in:
parent
66a09c951c
commit
67c5e2c884
|
@ -85,9 +85,12 @@ public class JetLinksMqttDeviceMessageCodec implements DeviceMessageCodec {
|
||||||
if (convertResult == null) {
|
if (convertResult == null) {
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
}
|
}
|
||||||
return context
|
return Mono
|
||||||
.getDevice()
|
.justOrEmpty(deviceMessage.getHeader("productId").map(String::valueOf))
|
||||||
.getConfig(DeviceConfigKey.productId)
|
.switchIfEmpty(context.getDevice(deviceMessage.getDeviceId())
|
||||||
|
.flatMap(device -> device
|
||||||
|
.getConfig(DeviceConfigKey.productId))
|
||||||
|
)
|
||||||
.defaultIfEmpty("null")
|
.defaultIfEmpty("null")
|
||||||
.map(productId -> SimpleMqttMessage
|
.map(productId -> SimpleMqttMessage
|
||||||
.builder()
|
.builder()
|
||||||
|
|
Loading…
Reference in New Issue