|
@@ -11,6 +11,7 @@ import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
|
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
|
|
import org.hswebframework.ezorm.core.param.Term;
|
|
import org.hswebframework.ezorm.core.param.Term;
|
|
|
|
|
+import org.hswebframework.ezorm.rdb.exception.DuplicateKeyException;
|
|
|
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
|
|
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
|
|
|
import org.hswebframework.ezorm.rdb.mapping.defaults.SaveResult;
|
|
import org.hswebframework.ezorm.rdb.mapping.defaults.SaveResult;
|
|
|
import org.hswebframework.reactor.excel.ReactorExcel;
|
|
import org.hswebframework.reactor.excel.ReactorExcel;
|
|
@@ -56,7 +57,6 @@ import org.jetlinks.core.metadata.*;
|
|
|
import org.jetlinks.core.metadata.types.GeoPoint;
|
|
import org.jetlinks.core.metadata.types.GeoPoint;
|
|
|
import org.springframework.core.io.buffer.DataBufferFactory;
|
|
import org.springframework.core.io.buffer.DataBufferFactory;
|
|
|
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
|
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
|
|
-import org.springframework.dao.DuplicateKeyException;
|
|
|
|
|
import org.springframework.data.util.Lazy;
|
|
import org.springframework.data.util.Lazy;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
@@ -224,8 +224,8 @@ public class DeviceInstanceController implements
|
|
|
return Mono
|
|
return Mono
|
|
|
.zip(payload, Authentication.currentReactive(), this::applyAuthentication)
|
|
.zip(payload, Authentication.currentReactive(), this::applyAuthentication)
|
|
|
.flatMap(entity -> service.insert(Mono.just(entity)).thenReturn(entity))
|
|
.flatMap(entity -> service.insert(Mono.just(entity)).thenReturn(entity))
|
|
|
- .onErrorMap(DuplicateKeyException.class, err -> new BusinessException("设备ID已存在", err))
|
|
|
|
|
- .onErrorMap(e->new BusinessException("服务器繁忙,请稍后重试",e));
|
|
|
|
|
|
|
+ .onErrorResume(DuplicateKeyException.class,err->Mono.error(new BusinessException("设备ID已存在")));
|
|
|
|
|
+// .onErrorResume(Exception.class,e->Mono.error(new BusinessException("服务器繁忙,请稍后重试",e)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -872,9 +872,9 @@ public class DeviceInstanceController implements
|
|
|
public Mono<?> queryPageGeo(@RequestBody GeoRequestParam param, @PathVariable("hasGeo") boolean hasGeo) {
|
|
public Mono<?> queryPageGeo(@RequestBody GeoRequestParam param, @PathVariable("hasGeo") boolean hasGeo) {
|
|
|
Mono<PagerResult<DeviceInstanceEntity>> resultMono = null;
|
|
Mono<PagerResult<DeviceInstanceEntity>> resultMono = null;
|
|
|
if(!hasGeo){
|
|
if(!hasGeo){
|
|
|
- /**
|
|
|
|
|
- * 没有查询区域
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 没有查询区域
|
|
|
|
|
+ */
|
|
|
param.getQuery().setIncludes(CollectionUtil.newHashSet("id","name","location","productId","productName"));
|
|
param.getQuery().setIncludes(CollectionUtil.newHashSet("id","name","location","productId","productName"));
|
|
|
Term term = new Term();
|
|
Term term = new Term();
|
|
|
term.setColumn("location");
|
|
term.setColumn("location");
|