|
@@ -53,39 +53,7 @@ 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)
|
|
|
|
|
- .zipWith(Mono.just(new GeoPayload()))
|
|
|
|
|
- .doOnNext(tuple2->{
|
|
|
|
|
- GeoPayload payload = tuple2.getT2();
|
|
|
|
|
- List<GeoProperty> properties = tuple2.getT1();
|
|
|
|
|
- properties.forEach(property -> {
|
|
|
|
|
- Mono.zip(Mono.just(property),Mono.just(new GeoEntity()))
|
|
|
|
|
- .filter(tp2->tp2.getT1().getGeometry()==null)
|
|
|
|
|
- .doOnNext(tp2->
|
|
|
|
|
- tagsService.createQuery()
|
|
|
|
|
- .where(DeviceTagEntity::getDeviceId, property.getObjectId())
|
|
|
|
|
- .where(DeviceTagEntity::getKey, "coordinate")
|
|
|
|
|
- .where(DeviceTagEntity::getType, GeoType.ID)
|
|
|
|
|
- .fetchOne()
|
|
|
|
|
- .switchIfEmpty(Mono.just(new DeviceTagEntity()))
|
|
|
|
|
- .subscribe(tag -> {
|
|
|
|
|
- if (!StrUtil.isEmpty(tag.getId())) {
|
|
|
|
|
- Geometry geometry = new Geometry();
|
|
|
|
|
- String[] split = tag.getValue().split(",");
|
|
|
|
|
- geometry.getCoordinates().add(split[0]);
|
|
|
|
|
- geometry.getCoordinates().add(split[1]);
|
|
|
|
|
- geometry.setType(GeoType.ID);
|
|
|
|
|
- tp2.getT1().setGeometry(geometry);
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- )
|
|
|
|
|
- .subscribe(tp2->{
|
|
|
|
|
- tp2.getT2().with(tp2.getT1());
|
|
|
|
|
- payload.getFeatures().add(tp2.getT2());
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- .map(Tuple2::getT2);
|
|
|
|
|
|
|
+ .map(PagerResult::getData);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|