diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java index bcfbcfe54e..1413664c6d 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/DefaultChartHandler.java @@ -250,6 +250,120 @@ public class DefaultChartHandler extends AbstractChartPlugin { return res; } + protected List getAssistFields(List list, List yAxis, List xAxis) { + List res = new ArrayList<>(); + for (ChartSeniorAssistDTO dto : list) { + DatasetTableFieldDTO curField = dto.getCurField(); + ChartViewFieldDTO field = null; + String alias = ""; + for (int i = 0; i < yAxis.size(); i++) { + ChartViewFieldDTO yField = yAxis.get(i); + if (Objects.equals(yField.getId(), curField.getId())) { + field = yField; + alias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i); + break; + } + } + if (ObjectUtils.isEmpty(field) && CollectionUtils.isNotEmpty(xAxis)) { + for (int i = 0; i < xAxis.size(); i++) { + ChartViewFieldDTO xField = xAxis.get(i); + if (StringUtils.equalsIgnoreCase(String.valueOf(xField.getId()), String.valueOf(curField.getId()))) { + field = xField; + alias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i); + break; + } + } + } + if (ObjectUtils.isEmpty(field)) { + continue; + } + + ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO(); + BeanUtils.copyBean(chartViewFieldDTO, curField); + chartViewFieldDTO.setSummary(dto.getSummary()); + chartViewFieldDTO.setOriginName(alias);// yAxis的字段别名,就是查找的字段名 + res.add(chartViewFieldDTO); + } + return res; + } + + public List getDynamicThresholdFields(ChartViewDTO view) { + List list = new ArrayList<>(); + Map senior = view.getSenior(); + if (ObjectUtils.isEmpty(senior)) { + return list; + } + ChartSeniorThresholdCfgDTO thresholdCfg = JsonUtil.parseObject((String) JsonUtil.toJSONString(senior.get("threshold")), ChartSeniorThresholdCfgDTO.class); + + if (null == thresholdCfg || !thresholdCfg.isEnable()) { + return list; + } + List tableThreshold = thresholdCfg.getTableThreshold(); + + if (ObjectUtils.isEmpty(tableThreshold)) { + return list; + } + + List conditionsList = tableThreshold.stream() + .filter(item -> !ObjectUtils.isEmpty(item)) + .map(TableThresholdDTO::getConditions) + .flatMap(List::stream) + .filter(condition -> StringUtils.equalsAnyIgnoreCase(condition.getType(), "dynamic")) + .toList(); + + List assistDTOs = conditionsList.stream() + .flatMap(condition -> getConditionFields(condition).stream()) + .filter(this::solveThresholdCondition) + .toList(); + + list.addAll(assistDTOs); + + return list; + } + + private boolean solveThresholdCondition(ChartSeniorAssistDTO fieldDTO) { + Long fieldId = fieldDTO.getFieldId(); + String summary = fieldDTO.getValue(); + if (ObjectUtils.isEmpty(fieldId) || StringUtils.isEmpty(summary)) { + return false; + } + + DatasetTableFieldDTO datasetTableFieldDTO = datasetTableFieldManage.selectById(fieldId); + if (ObjectUtils.isEmpty(datasetTableFieldDTO)) { + return false; + } + ChartViewFieldDTO datasetTableField = new ChartViewFieldDTO(); + BeanUtils.copyBean(datasetTableField, datasetTableFieldDTO); + fieldDTO.setCurField(datasetTableField); + fieldDTO.setSummary(summary); + return true; + } + + private List getConditionFields(ChartSeniorThresholdDTO condition) { + List list = new ArrayList<>(); + if ("between".equals(condition.getTerm())) { + if (!StringUtils.equalsIgnoreCase(condition.getDynamicMaxField().getSummary(), "value")) { + list.add(of(condition.getDynamicMaxField())); + } + if (!StringUtils.equalsIgnoreCase(condition.getDynamicMinField().getSummary(), "value")) { + list.add(of(condition.getDynamicMinField())); + } + } else { + if (!StringUtils.equalsIgnoreCase(condition.getDynamicField().getSummary(), "value")) { + list.add(of(condition.getDynamicField())); + } + } + + return list; + } + + private ChartSeniorAssistDTO of(ThresholdDynamicFieldDTO dynamicField){ + ChartSeniorAssistDTO conditionField = new ChartSeniorAssistDTO(); + conditionField.setFieldId(Long.parseLong(dynamicField.getFieldId())); + conditionField.setValue(dynamicField.getSummary()); + return conditionField; + } + protected String assistSQL(String sql, List assistFields) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < assistFields.size(); i++) { diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java index a53999a8a3..519ba6afc8 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java @@ -120,11 +120,11 @@ public class YoyChartHandler extends DefaultChartHandler { expandedResult.setQuerySql(originSql); } // 同环比数据排序 - expandedResult.setOriginData(sortData(view, expandedResult.getOriginData())); + expandedResult.setOriginData(sortData(view, expandedResult.getOriginData(),formatResult)); return expandedResult; } - public static List sortData(ChartViewDTO view, List data) { + public static List sortData(ChartViewDTO view, List data, AxisFormatResult formatResult) { // 维度排序 List xAxisSortList = view.getXAxis().stream().filter(x -> !StringUtils.equalsIgnoreCase("none", x.getSort())).toList(); // 指标排序 @@ -135,11 +135,9 @@ public class YoyChartHandler extends DefaultChartHandler { ChartViewFieldDTO firstYAxis = yAxisSortList.getFirst(); boolean asc = firstYAxis.getSort().equalsIgnoreCase("asc"); // 维度指标 - List allAxisList = Stream.of( - view.getXAxis(), - view.getXAxisExt(), - view.getYAxis() - ).flatMap(List::stream).toList(); + List allAxisList = new ArrayList<>(); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.xAxis)); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.yAxis)); int index = findIndex(allAxisList, firstYAxis.getId()); return sortData(data, asc, index); } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java index 12bd57256f..63805ef11e 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableInfoHandler.java @@ -12,8 +12,9 @@ import io.dataease.extensions.datasource.provider.Provider; import io.dataease.extensions.view.dto.*; import io.dataease.extensions.view.util.ChartDataUtil; import io.dataease.extensions.view.util.FieldUtil; -import io.dataease.utils.JsonUtil; +import io.dataease.utils.BeanUtils; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -21,6 +22,8 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; @Component public class TableInfoHandler extends DefaultChartHandler { @@ -135,6 +138,32 @@ public class TableInfoHandler extends DefaultChartHandler { calcResult.setContext(filterResult.getContext()); calcResult.setQuerySql(querySql); calcResult.setOriginData(data); + try { + var dynamicAssistFields = getDynamicThresholdFields(view); + Set fieldIds = xAxis.stream().map(ChartViewFieldDTO::getId).collect(Collectors.toSet()); + List finalXAxis = xAxis; + dynamicAssistFields.forEach(i -> { + if (!fieldIds.contains(i.getFieldId())) { + ChartViewFieldDTO fieldDTO = new ChartViewFieldDTO(); + BeanUtils.copyBean(fieldDTO, i.getCurField()); + finalXAxis.add(fieldDTO); + } + }); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis, xAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(querySql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + calcResult.setAssistData(assistData); + calcResult.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } return calcResult; } } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java index 36522b8117..bc48648ea3 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TableNormalHandler.java @@ -1,9 +1,18 @@ package io.dataease.chart.charts.impl.table; import io.dataease.chart.charts.impl.YoyChartHandler; +import io.dataease.extensions.datasource.dto.DatasourceRequest; +import io.dataease.extensions.datasource.dto.DatasourceSchemaDTO; +import io.dataease.extensions.datasource.model.SQLMeta; +import io.dataease.extensions.datasource.provider.Provider; +import io.dataease.extensions.view.dto.*; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; + /** * @author jianneng * @date 2024/9/11 11:37 @@ -12,4 +21,29 @@ import org.springframework.stereotype.Component; public class TableNormalHandler extends YoyChartHandler { @Getter private String type = "table-normal"; + + @Override + public T calcChartResult(ChartViewDTO view, AxisFormatResult formatResult, CustomFilterResult filterResult, Map sqlMap, SQLMeta sqlMeta, Provider provider) { + var dsMap = (Map) sqlMap.get("dsMap"); + var result = (T) super.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, provider); + try { + var originSql = result.getQuerySql(); + var dynamicAssistFields = getDynamicThresholdFields(view); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(originSql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + result.setAssistData(assistData); + result.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } } diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java index 3cdbb4159b..38e1ddf391 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java @@ -17,6 +17,7 @@ import io.dataease.utils.BeanUtils; import io.dataease.utils.IDUtils; import io.dataease.utils.JsonUtil; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import reactor.util.function.Tuple2; @@ -35,6 +36,25 @@ public class TablePivotHandler extends GroupChartHandler { T result = super.calcChartResult(view, formatResult, filterResult, sqlMap, sqlMeta, provider); Map customCalc = calcCustomExpr(view, filterResult, sqlMap, sqlMeta, provider); result.getData().put("customCalc", customCalc); + try { + var dsMap = (Map) sqlMap.get("dsMap"); + var originSql = result.getQuerySql(); + var dynamicAssistFields = getDynamicThresholdFields(view); + var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis); + var assistFields = getAssistFields(dynamicAssistFields, yAxis); + if (CollectionUtils.isNotEmpty(assistFields)) { + var req = new DatasourceRequest(); + req.setDsList(dsMap); + var assistSql = assistSQL(originSql, assistFields); + req.setQuery(assistSql); + logger.debug("calcite assistSql sql: " + assistSql); + var assistData = (List) provider.fetchResultField(req).get("data"); + result.setAssistData(assistData); + result.setDynamicAssistFields(dynamicAssistFields); + } + } catch (Exception e) { + e.printStackTrace(); + } return result; } diff --git a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java index eb849fff12..150aa7dc39 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java +++ b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java @@ -110,7 +110,6 @@ public class ChartDataManage { } var dillAxis = new ArrayList(); - DatasetGroupInfoDTO table = datasetGroupManage.getDatasetGroupInfoDTO(view.getTableId(), null); if (table == null) { DEException.throwException(ResultCode.DATA_IS_WRONG.code(), Translator.get("i18n_no_ds")); diff --git a/core/core-backend/src/main/java/io/dataease/dataset/constant/DatasetTableType.java b/core/core-backend/src/main/java/io/dataease/dataset/constant/DatasetTableType.java index 1975fc8d6c..047df2ccb1 100644 --- a/core/core-backend/src/main/java/io/dataease/dataset/constant/DatasetTableType.java +++ b/core/core-backend/src/main/java/io/dataease/dataset/constant/DatasetTableType.java @@ -6,4 +6,5 @@ package io.dataease.dataset.constant; public class DatasetTableType { public static String DB = "db"; public static String SQL = "sql"; + public static String Es = "es"; } diff --git a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetDataManage.java b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetDataManage.java index 8c88efdf99..771ea7f91f 100644 --- a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetDataManage.java +++ b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetDataManage.java @@ -129,6 +129,15 @@ public class DatasetDataManage { datasourceRequest.setTable(tableInfoDTO.getTable()); } + tableFields = provider.fetchTableField(datasourceRequest); + } else if (StringUtils.equalsIgnoreCase(type, DatasetTableType.Es)) { + CoreDatasource coreDatasource = coreDatasourceMapper.selectById(datasetTableDTO.getDatasourceId()); + Provider provider = ProviderFactory.getProvider(type); + DatasourceRequest datasourceRequest = new DatasourceRequest(); + DatasourceSchemaDTO datasourceSchemaDTO = new DatasourceSchemaDTO(); + BeanUtils.copyBean(datasourceSchemaDTO, coreDatasource); + datasourceRequest.setDatasource(datasourceSchemaDTO); + datasourceRequest.setTable(datasetTableDTO.getTableName()); tableFields = provider.fetchTableField(datasourceRequest); } else { // excel,api @@ -185,9 +194,7 @@ public class DatasetDataManage { DEException.throwException(Translator.get("i18n_no_column_permission")); } } - buildFieldName(sqlMap, fields); - Map dsMap = (Map) sqlMap.get("dsMap"); DatasourceUtils.checkDsStatus(dsMap); List dsList = new ArrayList<>(); @@ -202,13 +209,11 @@ public class DatasetDataManage { } sql = Utils.replaceSchemaAlias(sql, dsMap); } - List rowPermissionsTree = new ArrayList<>(); TokenUserBO user = AuthUtils.getUser(); if (user != null && checkPermission) { rowPermissionsTree = permissionManage.getRowPermissionsTree(datasetGroupInfoDTO.getId(), user.getUserId()); } - Provider provider; if (crossDs) { provider = ProviderFactory.getDefaultProvider(); @@ -236,7 +241,6 @@ public class DatasetDataManage { DatasourceRequest datasourceRequest = new DatasourceRequest(); datasourceRequest.setQuery(querySQL); datasourceRequest.setDsList(dsMap); - Map data = provider.fetchResultField(datasourceRequest); Map map = new LinkedHashMap<>(); diff --git a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetSQLManage.java b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetSQLManage.java index 70549c206e..0de143bce4 100644 --- a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetSQLManage.java +++ b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetSQLManage.java @@ -494,7 +494,16 @@ public class DatasetSQLManage { datasourceSchemaDTO.setSchemaAlias(schemaAlias); dsMap.put(coreDatasource.getId(), datasourceSchemaDTO); } - } else { + } else if (StringUtils.equalsIgnoreCase(ds.getType(), DatasetTableType.Es)){ + CoreDatasource coreDatasource = coreDatasourceMapper.selectById(ds.getDatasourceId()); + schemaAlias = String.format(SQLConstants.SCHEMA, coreDatasource.getId()); + if (!dsMap.containsKey(coreDatasource.getId())) { + DatasourceSchemaDTO datasourceSchemaDTO = new DatasourceSchemaDTO(); + BeanUtils.copyBean(datasourceSchemaDTO, coreDatasource); + datasourceSchemaDTO.setSchemaAlias(schemaAlias); + dsMap.put(coreDatasource.getId(), datasourceSchemaDTO); + } + }else { CoreDatasource coreDatasource = engineManage.getDeEngine(); schemaAlias = String.format(SQLConstants.SCHEMA, coreDatasource.getId()); if (!dsMap.containsKey(coreDatasource.getId())) { diff --git a/core/core-backend/src/main/java/io/dataease/datasource/dto/es/EsResponse.java b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/EsResponse.java new file mode 100644 index 0000000000..45e4a42c04 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/EsResponse.java @@ -0,0 +1,29 @@ +package io.dataease.datasource.dto.es; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class EsResponse { + private List columns = new ArrayList<>(); + private List rows = new ArrayList<>(); + private String cursor; + private Integer status; + private Error error; + private String version; + + @Data + public class Error { + private String type; + private String reason; + } + + @Data + public class Column { + private String name; + private String type; + } + +} diff --git a/core/core-backend/src/main/java/io/dataease/datasource/dto/es/Request.java b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/Request.java new file mode 100644 index 0000000000..6a79b1a827 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/Request.java @@ -0,0 +1,10 @@ +package io.dataease.datasource.dto.es; + +import lombok.Data; + +@Data +public class Request { + private String query; + private Integer fetch_size = 10000; + private boolean field_multi_value_leniency = true; +} diff --git a/core/core-backend/src/main/java/io/dataease/datasource/dto/es/RequestWithCursor.java b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/RequestWithCursor.java new file mode 100644 index 0000000000..d67519aa8f --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/datasource/dto/es/RequestWithCursor.java @@ -0,0 +1,8 @@ +package io.dataease.datasource.dto.es; + +import lombok.Data; + +@Data +public class RequestWithCursor extends Request { + private String cursor; +} diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java index 9599cf20e3..ef4d3f9a49 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java @@ -1271,7 +1271,6 @@ public class CalciteProvider extends Provider { try { connection = initConnection(dsMap); } catch (Exception e) { - e.printStackTrace(); } }); diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/EsProvider.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/EsProvider.java new file mode 100644 index 0000000000..dea1744934 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/EsProvider.java @@ -0,0 +1,211 @@ +package io.dataease.datasource.provider; + +import com.google.gson.Gson; +import com.google.gson.JsonParser; + +import io.dataease.dataset.utils.FieldUtils; +import io.dataease.datasource.dto.es.EsResponse; +import io.dataease.datasource.dto.es.Request; +import io.dataease.datasource.type.Es; +import io.dataease.exception.DEException; +import io.dataease.extensions.datasource.dto.*; +import io.dataease.extensions.datasource.provider.Provider; +import io.dataease.i18n.Translator; + +import io.dataease.utils.HttpClientConfig; +import io.dataease.utils.HttpClientUtil; +import io.dataease.utils.JsonUtil; +import org.apache.commons.codec.binary.Base64; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpHeaders; +import org.springframework.stereotype.Service; + +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.stream.Collectors; + +@Service("esProvider") +public class EsProvider extends Provider { + + @Override + public List getSchema(DatasourceRequest datasourceRequest) { + return new ArrayList<>(); + } + + @Override + public List getTables(DatasourceRequest datasourceRequest) { + List tables = new ArrayList<>(); + try { + String response = execQuery(datasourceRequest, "show tables", "?format=json"); + tables = fetchTables(response); + tables = tables.stream().filter(table -> StringUtils.isNotEmpty(table.getTableName()) && !table.getTableName().startsWith(".")).collect(Collectors.toList()); + tables.forEach(table -> { + table.setDatasourceId(datasourceRequest.getDatasource().getId()); + }); + } catch (Exception e) { + e.getMessage(); + DEException.throwException(e); + } + return tables; + } + + @Override + public ConnectionObj getConnection(DatasourceDTO coreDatasource) throws Exception { + return null; + } + + @Override + public String checkStatus(DatasourceRequest datasourceRequest) throws Exception { + Es es = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Es.class); + String response = execGetQuery(datasourceRequest); + if (JsonParser.parseString(response).getAsJsonObject().getAsJsonObject("error") != null) { + throw new Exception(JsonParser.parseString(response).getAsJsonObject().getAsJsonObject("error").get("reason").getAsString()); + } + String version = JsonParser.parseString(response).getAsJsonObject().getAsJsonObject("version").get("number").getAsString(); + String[] versionList = version.split("\\."); + if (Integer.valueOf(versionList[0]) < 7 && Integer.valueOf(versionList[1]) < 3) { + throw new Exception(Translator.get("i18n_es_limit")); + } + if (Integer.valueOf(versionList[0]) == 6) { + es.setUri("_xpack/sql"); + } + if (Integer.valueOf(versionList[0]) > 6) { + es.setUri("_sql"); + } + datasourceRequest.getDatasource().setConfiguration(JsonUtil.toJSONString(es).toString()); + getTables(datasourceRequest); + return "Success"; + } + + @Override + public Map fetchResultField(DatasourceRequest datasourceRequest) { + Map result = new HashMap<>(); + try { + String response = execQuery(datasourceRequest, datasourceRequest.getQuery(), "?format=json"); + result.put("dataList", fetchResultData(response)); + result.put("fieldList", fetchResultField4Sql(response)); + } catch (Exception e) { + e.printStackTrace(); + DEException.throwException(e); + } + return result; + } + + @Override + public List fetchTableField(DatasourceRequest datasourceRequest) { + List tableFields = new ArrayList<>(); + try { + String response = execQuery(datasourceRequest, "select * from " + datasourceRequest.getTable() + " limit 0", "?format=json"); + tableFields = fetchResultField4Sql(response); + } catch (Exception e) { + DEException.throwException(e); + } + return tableFields; + } + + + @Override + public void hidePW(DatasourceDTO datasourceDTO) { + } + + + private List fetchResultData(String response) throws Exception { + EsResponse esResponse = new Gson().fromJson(response, EsResponse.class); + return fetchResultData(esResponse); + } + + private List fetchResultData(EsResponse esResponse) throws Exception { + List list = new LinkedList<>(); + if (esResponse.getError() != null) { + throw new Exception(esResponse.getError().getReason()); + } + list.addAll(esResponse.getRows()); + return list; + } + + private List fetchResultField4Sql(String response) throws Exception { + List fieldList = new ArrayList<>(); + EsResponse esResponse = new Gson().fromJson(response, EsResponse.class); + if (esResponse.getError() != null) { + throw new Exception(esResponse.getError().getReason()); + } + + for (EsResponse.Column column : esResponse.getColumns()) { + TableField field = new TableField(); + field.setOriginName(column.getName()); + field.setOriginName(column.getName()); + field.setFieldType(column.getType()); + field.setType(column.getType().toUpperCase()); + field.setFieldType(field.getType()); + int deType = FieldUtils.transType2DeType(field.getType()); + field.setDeExtractType(deType); + field.setDeType(deType); + fieldList.add(field); + } + return fieldList; + } + + private List fetchTables(String response) throws Exception { + List tables = new ArrayList<>(); + EsResponse esResponse = new Gson().fromJson(response, EsResponse.class); + if (esResponse.getError() != null) { + throw new Exception(esResponse.getError().getReason()); + } + + for (String[] row : esResponse.getRows()) { + + DatasetTableDTO tableDesc = new DatasetTableDTO(); + if (row.length == 3 && row[1].contains("TABLE") && row[2].equalsIgnoreCase("INDEX")) { + tableDesc.setTableName(row[0]); + } + if (row.length == 2 && row[1].contains("TABLE")) { + tableDesc.setTableName(row[0]); + } + if (row.length == 4 && row[2].contains("TABLE") && row[3].equalsIgnoreCase("INDEX")) { + tableDesc.setTableName(row[1]); + } + tableDesc.setType("es"); + tables.add(tableDesc); + } + return tables; + } + + + private String execQuery(DatasourceRequest datasourceRequest, String sql, String uri) { + Es es = null; + if (datasourceRequest.getDatasource() == null) { + Collection datasourceSchemaDTOS = datasourceRequest.getDsList().values(); + es = JsonUtil.parseObject(datasourceSchemaDTOS.stream().findFirst().get().getConfiguration(), Es.class); + } else { + es = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Es.class); + } + + uri = es.getUri() + uri; + HttpClientConfig httpClientConfig = new HttpClientConfig(); + if (StringUtils.isNotEmpty(es.getUsername()) && StringUtils.isNotEmpty(es.getPassword())) { + String auth = es.getUsername() + ":" + es.getPassword(); + byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8)); + httpClientConfig.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + new String(encodedAuth)); + } + Request request = new Request(); + request.setQuery(sql); + request.setFetch_size(datasourceRequest.getFetchSize()); + String url = es.getUrl().endsWith("/") ? es.getUrl() + uri : es.getUrl() + "/" + uri; + return HttpClientUtil.post(url, new Gson().toJson(request), httpClientConfig); + + } + + private String execGetQuery(DatasourceRequest datasourceRequest) { + Es es = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Es.class); + HttpClientConfig httpClientConfig = new HttpClientConfig(); + if (StringUtils.isNotEmpty(es.getUsername()) && StringUtils.isNotEmpty(es.getPassword())) { + String auth = es.getUsername() + ":" + es.getPassword(); + byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8)); + httpClientConfig.addHeader(HttpHeaders.AUTHORIZATION, "Basic " + new String(encodedAuth)); + } + return HttpClientUtil.get(es.getUrl(), httpClientConfig); + } + + +} diff --git a/core/core-backend/src/main/java/io/dataease/datasource/type/Es.java b/core/core-backend/src/main/java/io/dataease/datasource/type/Es.java new file mode 100644 index 0000000000..fdc1bc2990 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/datasource/type/Es.java @@ -0,0 +1,15 @@ +package io.dataease.datasource.type; + + +import lombok.Data; +import org.springframework.stereotype.Component; + +@Data +public class Es { + private String url; + private String username; + private String password; + private String version; + private String uri; + +} diff --git a/core/core-frontend/src/assets/svg/bubble-map-dark.svg b/core/core-frontend/src/assets/svg/bubble-map-dark.svg index 25a9630000..d9d5147e94 100644 --- a/core/core-frontend/src/assets/svg/bubble-map-dark.svg +++ b/core/core-frontend/src/assets/svg/bubble-map-dark.svg @@ -1,75 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/bubble-map-origin.svg b/core/core-frontend/src/assets/svg/bubble-map-origin.svg index 03ffbc078d..3ca5414790 100644 --- a/core/core-frontend/src/assets/svg/bubble-map-origin.svg +++ b/core/core-frontend/src/assets/svg/bubble-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/bubble-map.svg b/core/core-frontend/src/assets/svg/bubble-map.svg index 8259226e64..9137455e4e 100644 --- a/core/core-frontend/src/assets/svg/bubble-map.svg +++ b/core/core-frontend/src/assets/svg/bubble-map.svg @@ -1,80 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_bubble-map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/es-ds.svg b/core/core-frontend/src/assets/svg/es-ds.svg new file mode 100644 index 0000000000..60e557758f --- /dev/null +++ b/core/core-frontend/src/assets/svg/es-ds.svg @@ -0,0 +1 @@ + diff --git a/core/core-frontend/src/assets/svg/flow-map-dark.svg b/core/core-frontend/src/assets/svg/flow-map-dark.svg index f1111c5f87..35d88664ce 100644 --- a/core/core-frontend/src/assets/svg/flow-map-dark.svg +++ b/core/core-frontend/src/assets/svg/flow-map-dark.svg @@ -1,74 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/flow-map-origin.svg b/core/core-frontend/src/assets/svg/flow-map-origin.svg index a263e1907e..1ab1cd253b 100644 --- a/core/core-frontend/src/assets/svg/flow-map-origin.svg +++ b/core/core-frontend/src/assets/svg/flow-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/flow-map.svg b/core/core-frontend/src/assets/svg/flow-map.svg index 7c3fc1a889..7dac663297 100644 --- a/core/core-frontend/src/assets/svg/flow-map.svg +++ b/core/core-frontend/src/assets/svg/flow-map.svg @@ -1,79 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_flow-map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map-dark.svg b/core/core-frontend/src/assets/svg/heat-map-dark.svg index ef33a25f67..e024a30f37 100644 --- a/core/core-frontend/src/assets/svg/heat-map-dark.svg +++ b/core/core-frontend/src/assets/svg/heat-map-dark.svg @@ -1,122 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map-origin.svg b/core/core-frontend/src/assets/svg/heat-map-origin.svg index cc501bcbd9..f2d9ce0558 100644 --- a/core/core-frontend/src/assets/svg/heat-map-origin.svg +++ b/core/core-frontend/src/assets/svg/heat-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/heat-map.svg b/core/core-frontend/src/assets/svg/heat-map.svg index 3970fe95fb..407bff1cd6 100644 --- a/core/core-frontend/src/assets/svg/heat-map.svg +++ b/core/core-frontend/src/assets/svg/heat-map.svg @@ -1,122 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map-lbs-heat_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map-dark.svg b/core/core-frontend/src/assets/svg/map-dark.svg index bdd14c6a41..5e2f2f1c62 100644 --- a/core/core-frontend/src/assets/svg/map-dark.svg +++ b/core/core-frontend/src/assets/svg/map-dark.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_dark-01 \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map-origin.svg b/core/core-frontend/src/assets/svg/map-origin.svg index 54b17b9449..f80a57b984 100644 --- a/core/core-frontend/src/assets/svg/map-origin.svg +++ b/core/core-frontend/src/assets/svg/map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/map.svg b/core/core-frontend/src/assets/svg/map.svg index a14e153f05..ff2b8a3606 100644 --- a/core/core-frontend/src/assets/svg/map.svg +++ b/core/core-frontend/src/assets/svg/map.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_map_light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/symbolic-map-dark.svg b/core/core-frontend/src/assets/svg/symbolic-map-dark.svg index b3364f324d..f8c6e89af7 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map-dark.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map-dark.svg @@ -1,88 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_dark \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/symbolic-map-origin.svg b/core/core-frontend/src/assets/svg/symbolic-map-origin.svg index fcda4d557c..71a0c1b036 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map-origin.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map-origin.svg @@ -1,69 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_gray light \ No newline at end of file diff --git a/core/core-frontend/src/assets/svg/symbolic-map.svg b/core/core-frontend/src/assets/svg/symbolic-map.svg index e7b32071ee..aec98583f6 100644 --- a/core/core-frontend/src/assets/svg/symbolic-map.svg +++ b/core/core-frontend/src/assets/svg/symbolic-map.svg @@ -1,93 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +icon_symbolic-map_light \ No newline at end of file diff --git a/core/core-frontend/src/components/icon-group/datasource-list.ts b/core/core-frontend/src/components/icon-group/datasource-list.ts index 44167b92e7..2c86934665 100644 --- a/core/core-frontend/src/components/icon-group/datasource-list.ts +++ b/core/core-frontend/src/components/icon-group/datasource-list.ts @@ -13,6 +13,7 @@ import redshiftDs from '@/assets/svg/redshift-ds.svg' import APIDs from '@/assets/svg/API-ds.svg' import ExcelDs from '@/assets/svg/Excel-ds.svg' import dorisDs from '@/assets/svg/doris-ds.svg' +import esDs from '@/assets/svg/es-ds.svg' const iconDatasourceMap = { mysql: mysqlDs, oracle: oracleDs, @@ -28,7 +29,8 @@ const iconDatasourceMap = { redshift: redshiftDs, API: APIDs, Excel: ExcelDs, - doris: dorisDs + doris: dorisDs, + es: esDs } export { iconDatasourceMap } diff --git a/core/core-frontend/src/custom-component/v-query/Component.vue b/core/core-frontend/src/custom-component/v-query/Component.vue index dab464a24f..c95240831a 100644 --- a/core/core-frontend/src/custom-component/v-query/Component.vue +++ b/core/core-frontend/src/custom-component/v-query/Component.vue @@ -111,6 +111,27 @@ const btnStyle = computed(() => { return style }) + +const btnPlainStyle = computed(() => { + const style = { + backgroundColor: 'transparent', + borderColor: customStyle.btnColor, + color: customStyle.btnColor + } as CSSProperties + if (customStyle.fontSizeBtn) { + style.fontSize = customStyle.fontSizeBtn + 'px' + } + + if (customStyle.fontWeightBtn) { + style.fontWeight = customStyle.fontWeightBtn + } + + if (customStyle.fontStyleBtn) { + style.fontStyle = customStyle.fontStyleBtn + } + + return style +}) const curComponentView = computed(() => { return (canvasViewInfo.value[element.value.id] || {}).customStyle }) @@ -619,10 +640,20 @@ const autoStyle = computed(() => {
- + {{ t('commons.clear') }} - + {{ t('chart.reset') }} { ElMessage.error(t('chart.exp_can_not_empty')) return } - if (ele.term === 'between') { - if ( - !ele.term.includes('null') && - !ele.term.includes('empty') && - (ele.min === '' || ele.max === '') - ) { - ElMessage.error(t('chart.value_can_not_empty')) - return - } - if ( - (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && - (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN') - ) { - ElMessage.error(t('chart.value_error')) - return - } - if ( - (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && - parseFloat(ele.min) > parseFloat(ele.max) - ) { - ElMessage.error(t('chart.value_min_max_invalid')) - return + if (ele.type !== 'dynamic') { + if (ele.term === 'between') { + if ( + !ele.term.includes('null') && + !ele.term.includes('empty') && + (ele.min === '' || ele.max === '') + ) { + ElMessage.error(t('chart.value_can_not_empty')) + return + } + if ( + (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && + (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN') + ) { + ElMessage.error(t('chart.value_error')) + return + } + if ( + (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && + parseFloat(ele.min) > parseFloat(ele.max) + ) { + ElMessage.error(t('chart.value_min_max_invalid')) + return + } + } else { + if (!ele.term.includes('null') && !ele.term.includes('empty') && ele.value === '') { + ElMessage.error(t('chart.value_can_not_empty')) + return + } + if ( + (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && + parseFloat(ele.value).toString() === 'NaN' + ) { + ElMessage.error(t('chart.value_error')) + return + } } } else { - if (!ele.term.includes('null') && !ele.term.includes('empty') && ele.value === '') { - ElMessage.error(t('chart.value_can_not_empty')) - return - } - if ( - (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && - parseFloat(ele.value).toString() === 'NaN' - ) { - ElMessage.error(t('chart.value_error')) - return + if (ele.term === 'between') { + if ( + !ele.term.includes('null') && + !ele.term.includes('empty') && + (!ele.dynamicMinField?.fieldId || !ele.dynamicMaxField?.fieldId) + ) { + ElMessage.error(t('chart.field_can_not_empty')) + return + } + } else { + if ( + !ele.term.includes('null') && + !ele.term.includes('empty') && + !ele.dynamicField?.fieldId + ) { + ElMessage.error(t('chart.field_can_not_empty')) + return + } } } } @@ -235,7 +257,24 @@ const changeTableThreshold = () => { changeThreshold() closeTableThreshold() } +const getFieldName = field => (field.chartShowName ? field.chartShowName : field.name) +const getDynamicStyleLabel = (item, fieldObj) => { + const handleSummary = field => { + if (!field?.field) { + return '' + } + if (field.summary === 'value') { + return getFieldName(field.field) + '(' + t('chart.field') + ')' + } else { + let suffix = field.summary === 'avg' ? t('chart.drag_block_label_value') : '' + return getFieldName(field.field) + '(' + t('chart.' + field.summary) + suffix + ')' + } + } + if (item.type === 'dynamic') { + return handleSummary(fieldObj) + } +} init() @@ -519,17 +558,15 @@ init() style="flex-direction: column" >
- - - - - + + + {{ fieldItem.field.name }} @@ -577,7 +614,17 @@ init() 默认
-
+
+ + {{ t('chart.fix') }} + +
+
+ + {{ t('chart.dynamic') }} + +
+
{{ item.min }} ≤{{ t('chart.drag_block_label_value') }}≤ {{ item.max }}  
+
+ + {{ getDynamicStyleLabel(item, item.dynamicField) }} + + {{ getDynamicStyleLabel(item, item.dynamicMinField) }}≤{{ + t('chart.drag_block_label_value') + }}≤{{ getDynamicStyleLabel(item, item.dynamicMaxField) }} + +   +
- +
-
仪表板ID
-
{{ dvInfo.id }}
+
图表ID
+
{{ dvInfo.id }}
{{ t('visualization.create_by') }}
{{ dvInfo.creatorName }}
{{ t('visualization.create_time') }}
diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue index d758aef0a0..fc6f8b1566 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue @@ -928,7 +928,7 @@ defineExpose({
list = Arrays.stream(DatasourceConfiguration.DatasourceType.values()).map(DatasourceConfiguration.DatasourceType::getType).toList(); if (list.contains(type)) { return SpringContextUtil.getApplicationContext().getBean("calciteProvider", Provider.class); diff --git a/sdk/extensions/extensions-datasource/src/main/java/io/dataease/extensions/datasource/vo/DatasourceConfiguration.java b/sdk/extensions/extensions-datasource/src/main/java/io/dataease/extensions/datasource/vo/DatasourceConfiguration.java index 20448b46c0..a57b335e82 100644 --- a/sdk/extensions/extensions-datasource/src/main/java/io/dataease/extensions/datasource/vo/DatasourceConfiguration.java +++ b/sdk/extensions/extensions-datasource/src/main/java/io/dataease/extensions/datasource/vo/DatasourceConfiguration.java @@ -18,6 +18,7 @@ public class DatasourceConfiguration extends Configuration { impala("impala", "Apache Impala", "OLAP", "`", "`"), mariadb("mariadb", "Mariadb", "OLTP", "`", "`"), StarRocks("StarRocks", "StarRocks", "OLAP", "`", "`"), + es("es", "Elasticsearch", "OLAP", "\"", "\""), doris("doris", "Apache Doris", "OLAP", "`", "`"), TiDB("TiDB", "TiDB", "OLTP", "`", "`"), oracle("oracle", "ORACLE", "OLTP", "\"", "\""), diff --git a/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdCfgDTO.java b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdCfgDTO.java new file mode 100644 index 0000000000..2f6ea09549 --- /dev/null +++ b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdCfgDTO.java @@ -0,0 +1,19 @@ +package io.dataease.extensions.view.dto; + +import lombok.Data; + +import java.util.List; + + +@Data +public class ChartSeniorThresholdCfgDTO { + /** + * 是否启用 + */ + private boolean enable; + + /** + * 表格阈值 + */ + private List tableThreshold; +} diff --git a/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdDTO.java b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdDTO.java new file mode 100644 index 0000000000..90b169654b --- /dev/null +++ b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ChartSeniorThresholdDTO.java @@ -0,0 +1,31 @@ +package io.dataease.extensions.view.dto; + +import lombok.Data; + +/** + * @author jianneng + * @date 2024/9/19 18:34 + **/ +@Data +public class ChartSeniorThresholdDTO { + /** + * 对比方式 + */ + private String term; + /** + * 类型,固定值、动态值 + */ + private String type; + /** + * 动态值字段 + */ + private ThresholdDynamicFieldDTO dynamicField; + /** + * 动态值最小值字段 仅当term为between时使用 + */ + private ThresholdDynamicFieldDTO dynamicMinField; + /** + * 动态值最大值字段 仅当term为between时使用 + */ + private ThresholdDynamicFieldDTO dynamicMaxField; +} diff --git a/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/TableThresholdDTO.java b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/TableThresholdDTO.java new file mode 100644 index 0000000000..060619c1a5 --- /dev/null +++ b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/TableThresholdDTO.java @@ -0,0 +1,25 @@ +package io.dataease.extensions.view.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author jianneng + * @date 2024/9/19 18:31 + **/ +@Data +public class TableThresholdDTO { + /** + * 字段id + */ + private String fieldId; + /** + * 字段 + */ + private ChartViewFieldDTO field; + /** + * 条件 + */ + private List conditions; +} diff --git a/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ThresholdDynamicFieldDTO.java b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ThresholdDynamicFieldDTO.java new file mode 100644 index 0000000000..4cd2f87da4 --- /dev/null +++ b/sdk/extensions/extensions-view/src/main/java/io/dataease/extensions/view/dto/ThresholdDynamicFieldDTO.java @@ -0,0 +1,23 @@ +package io.dataease.extensions.view.dto; + +import lombok.Data; + +/** + * @author jianneng + * @date 2024/9/19 18:31 + **/ +@Data +public class ThresholdDynamicFieldDTO { + /** + * 字段id + */ + private String fieldId; + /** + * 字段 + */ + private ChartViewFieldDTO field; + /** + * 条件 + */ + private String summary; +}