fix: 识别es 数据类型
This commit is contained in:
parent
fb9ccc05e1
commit
c74e3863e0
@ -49,11 +49,12 @@ public class EsProvider extends DatasourceProvider {
|
||||
List<String[]> list = new LinkedList<>();
|
||||
try {
|
||||
EsConfigDTO esConfigDTO = new Gson().fromJson(dsr.getDatasource().getConfiguration(), EsConfigDTO.class);
|
||||
|
||||
HttpClientConfig httpClientConfig = new HttpClientConfig();
|
||||
String auth = esConfigDTO.getUsername() + ":" + esConfigDTO.getPassword();
|
||||
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
|
||||
httpClientConfig.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + new String(encodedAuth));
|
||||
if(StringUtils.isNotEmpty(esConfigDTO.getUsername())){
|
||||
String auth = esConfigDTO.getUsername() + ":" + esConfigDTO.getPassword();
|
||||
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
|
||||
httpClientConfig.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + new String(encodedAuth));
|
||||
}
|
||||
Requst requst = new Requst();
|
||||
requst.setQuery(dsr.getQuery());
|
||||
requst.setFetch_size(dsr.getFetchSize());
|
||||
|
||||
@ -151,7 +151,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String cast = String.format(EsSqlLConstants.CAST, originField, "timestamp");
|
||||
fieldName = String.format(EsSqlLConstants.DATETIME_FORMAT, cast, EsSqlLConstants.DEFAULT_DATE_FORMAT);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_INT) {
|
||||
fieldName = String.format(EsSqlLConstants.CAST, originField, "timestamp");
|
||||
fieldName = String.format(EsSqlLConstants.CAST, originField, "bigint");
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
|
||||
@ -504,12 +504,8 @@ public class DataSetTableService {
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false, ds));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
System.out.println(datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
for(int i=0;i< data.size(); i++){
|
||||
System.out.println(data.get(i)[2]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DEException.throwException(e.getMessage());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user