|
@@ -1,5 +1,6 @@
|
|
|
package org.jetlinks.community.device.web;
|
|
package org.jetlinks.community.device.web;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -53,7 +54,20 @@ public class GeoController implements ReactiveServiceCrudController<GeoProperty
|
|
|
@PostMapping("/_search/geo.json")
|
|
@PostMapping("/_search/geo.json")
|
|
|
public Mono<?> search(@RequestBody GeoRequestParam param){
|
|
public Mono<?> search(@RequestBody GeoRequestParam param){
|
|
|
return geoService.queryPager(param.getFilter())
|
|
return geoService.queryPager(param.getFilter())
|
|
|
- .map(PagerResult::getData);
|
|
|
|
|
|
|
+ .map(PagerResult::getData)
|
|
|
|
|
+ .zipWith(Mono.just(new GeoPayload()))
|
|
|
|
|
+ .doOnNext(tp2->{
|
|
|
|
|
+ List<GeoProperty> properties = tp2.getT1();
|
|
|
|
|
+ if(CollectionUtil.isNotEmpty(properties)){
|
|
|
|
|
+ tp2.getT2().setFeatures(properties.stream().map(geoProperty -> {
|
|
|
|
|
+ GeoEntity geoEntity = new GeoEntity();
|
|
|
|
|
+ geoEntity.setGeometry(geoProperty.getGeometry());
|
|
|
|
|
+ geoEntity.setProperties(geoProperty);
|
|
|
|
|
+ return geoEntity;
|
|
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .map(Tuple2::getT2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|