|
|
@@ -1,5 +1,6 @@
|
|
|
package org.jetlinks.community.device.response;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
import lombok.Getter;
|
|
|
import lombok.Setter;
|
|
|
@@ -168,7 +169,11 @@ public class DeviceDetail {
|
|
|
}
|
|
|
|
|
|
public synchronized DeviceDetail with(List<DeviceTagEntity> tags) {
|
|
|
+ DeviceTagEntity geoTag = new DeviceTagEntity();
|
|
|
+ geoTag.setDeviceId(this.id);
|
|
|
+ geoTag.setKey("coordinate");
|
|
|
if (CollectionUtils.isEmpty(tags)) {
|
|
|
+ tags= Collections.singletonList(geoTag);
|
|
|
return this;
|
|
|
}
|
|
|
Map<String, DeviceTagEntity> map = Stream
|
|
|
@@ -178,9 +183,7 @@ public class DeviceDetail {
|
|
|
DeviceTagEntity::getKey,
|
|
|
Function.identity(),
|
|
|
(_1, _2) -> StringUtils.hasText(_1.getValue()) ? _1 : _2));
|
|
|
- DeviceTagEntity geoTag = new DeviceTagEntity();
|
|
|
- geoTag.setDeviceId(this.id);
|
|
|
- geoTag.setKey("coordinate");
|
|
|
+
|
|
|
|
|
|
//将地理位置放于首位
|
|
|
this.tags = new ArrayList<>(map.values());
|