Merge branch 'dev' into pr@dev_one_dot_x
This commit is contained in:
commit
0aefe3a4f3
@ -8,10 +8,6 @@
|
||||
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2F1dataease%2Fdataease?ref=badge_shield"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdataease%2Fdataease.svg?type=shield" alt="FOSSA Status"></a>
|
||||
</p>
|
||||
|
||||
|说明|
|
||||
|------------------|
|
||||
|此分支为 DataEase v1.18 版本的开发分支。[DataEase v2.0.0](https://github.com/dataease/dataease/releases/tag/v2.0.0) 也已经正式发布,v2 版本的开发分支为 [dev-v2](https://github.com/dataease/dataease/tree/dev-v2)。v2 版本正在快速迭代中,如是在生产环境部署 DataEase,建议继续使用 v1.18.* 的最新稳定版本。|
|
||||
|
||||
<hr/>
|
||||
|
||||
## 什么是 DataEase?
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.engine.doris;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1418,6 +1420,21 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1435,10 +1452,22 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getDataeaseName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.engine.mysql;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1366,6 +1368,21 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1383,10 +1400,22 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MysqlConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getDataeaseName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package io.dataease.provider.query.ck;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1416,6 +1418,21 @@ public class CKQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1433,10 +1450,22 @@ public class CKQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(CKConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -2,7 +2,9 @@ package io.dataease.provider.query.db2;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.dto.datasource.Db2Configuration;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1404,6 +1406,21 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1421,10 +1438,22 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(Db2Constants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.query.es;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1322,6 +1324,21 @@ public class EsQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1339,10 +1356,22 @@ public class EsQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.query.hive;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1334,6 +1336,21 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1351,10 +1368,22 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(HiveConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.query.impala;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -18,7 +20,6 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
|
||||
import io.dataease.plugins.datasource.entity.Dateformat;
|
||||
import io.dataease.plugins.datasource.entity.PageInfo;
|
||||
import io.dataease.plugins.datasource.query.QueryProvider;
|
||||
import io.dataease.plugins.datasource.query.Utils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -1306,6 +1307,21 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1323,10 +1339,22 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(ImpalaConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.query.mongodb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1159,6 +1161,21 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1176,10 +1193,22 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MongoConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.provider.query.mysql;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1426,6 +1428,21 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1443,10 +1460,22 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -2,7 +2,9 @@ package io.dataease.provider.query.oracle;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.dto.datasource.OracleConfiguration;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1516,6 +1518,21 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1533,10 +1550,22 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -2,6 +2,8 @@ package io.dataease.provider.query.pg;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1332,6 +1334,21 @@ public class PgQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1349,10 +1366,22 @@ public class PgQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -2,6 +2,8 @@ package io.dataease.provider.query.redshift;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -1313,6 +1315,21 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1330,10 +1347,22 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sqlLimit(String sql, ChartViewWithBLOBs view) {
|
||||
|
||||
@ -2,6 +2,8 @@ package io.dataease.provider.query.sqlserver;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
@ -110,94 +112,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
return createQuerySQL("(" + sqlFix(sql) + ")", fields, isGroup, null, fieldCustomFilter, rowPermissionsTree, sortFields, limit, keyword);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public String createQuerySQLWithLimit(String table, List<DatasetTableField> fields, boolean isGroup, Datasource ds, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<DeSortField> sortFields, Long limit, String keyword) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
setSchema(tableObj, ds);
|
||||
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(fields)) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
DatasetTableField f = fields.get(i);
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(f.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
String fieldName;
|
||||
// 处理横轴字段
|
||||
if (f.getDeExtractType() == DeTypeConstants.DE_TIME) { // 时间 转为 数值
|
||||
if (f.getDeType() == DeTypeConstants.DE_INT || f.getDeType() == DeTypeConstants.DE_FLOAT) {
|
||||
fieldName = String.format(SqlServerSQLConstants.UNIX_TIMESTAMP, originField);
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
} else if (f.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
if (f.getDeType() == DeTypeConstants.DE_INT) {
|
||||
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_INT_FORMAT, originField);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_FLOAT) {
|
||||
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_FLOAT_FORMAT, originField);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_TIME) { //字符串转时间
|
||||
fieldName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : SqlServerSQLConstants.DEFAULT_DATE_FORMAT);
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
} else {
|
||||
if (f.getDeType() == DeTypeConstants.DE_TIME) { // 数值转时间
|
||||
String cast = String.format(SqlServerSQLConstants.LONG_TO_DATE, originField + "/1000");
|
||||
fieldName = String.format(SqlServerSQLConstants.FROM_UNIXTIME, cast);
|
||||
} else if (f.getDeType() == DeTypeConstants.DE_INT) {
|
||||
fieldName = String.format(SqlServerSQLConstants.CONVERT, SqlServerSQLConstants.DEFAULT_INT_FORMAT, originField);
|
||||
} else {
|
||||
fieldName = originField;
|
||||
}
|
||||
}
|
||||
xFields.add(SQLObj.builder()
|
||||
.fieldName(fieldName)
|
||||
.fieldAlias(fieldAlias)
|
||||
.build());
|
||||
}
|
||||
private boolean anyFieldExceed(List<DatasetTableField> fields) {
|
||||
if (CollectionUtils.isEmpty(fields)) return false;
|
||||
return fields.stream().anyMatch(field -> field.getDeExtractType().equals(DeTypeConstants.DE_STRING) && field.getSize() > 8000);
|
||||
}
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", isGroup);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
String customWheres = transCustomFilterList(tableObj, fieldCustomFilter);
|
||||
// row permissions tree
|
||||
String whereTrees = transFilterTrees(tableObj, rowPermissionsTree);
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
List<SQLObj> xOrders = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
int step = fields.size();
|
||||
for (int i = step; i < (step + sortFields.size()); i++) {
|
||||
DeSortField deSortField = sortFields.get(i - step);
|
||||
SQLObj order = buildSortField(deSortField, tableObj, i);
|
||||
xOrders.add(order);
|
||||
private boolean anySortFieldExceed(List<DeSortField> fields) {
|
||||
if (CollectionUtils.isEmpty(fields)) return false;
|
||||
return fields.stream().anyMatch(field -> field.getDeExtractType().equals(DeTypeConstants.DE_STRING) && field.getSize() > 8000);
|
||||
}
|
||||
}
|
||||
if(limit != null){
|
||||
SQLObj limitFiled = SQLObj.builder().limitFiled(" top " + limit + " ").build();
|
||||
st_sql.add("limitFiled", limitFiled);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(xOrders)) {
|
||||
st_sql.add("orders", xOrders);
|
||||
}
|
||||
return st_sql.render();
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup, Datasource ds, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<DeSortField> sortFields, Long limit, String keyword) {
|
||||
@ -206,11 +129,46 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
.build();
|
||||
setSchema(tableObj, ds);
|
||||
List<String> exceedList = null;
|
||||
if (anyFieldExceed(fields) || anySortFieldExceed(sortFields)) {
|
||||
exceedList = new ArrayList<>();
|
||||
List<DatasetTableField> calcFieldList = new ArrayList<>(fields);
|
||||
if (CollectionUtils.isNotEmpty(sortFields)) {
|
||||
calcFieldList.addAll(sortFields);
|
||||
}
|
||||
List<SQLObj> sqlObjList = new ArrayList<>();
|
||||
sqlObjList.add(SQLObj.builder().fieldName("*").build());
|
||||
for (DatasetTableField f : calcFieldList) {
|
||||
boolean exceed = f.getDeExtractType().equals(DeTypeConstants.DE_STRING) && f.getSize() > 8000;
|
||||
if (!exceedList.contains(f.getOriginName()) && exceed) {
|
||||
exceedList.add(f.getOriginName());
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
String newOriginName = f.getOriginName() + "_exceed";
|
||||
String format = String.format(SqlServerSQLConstants.TO_STRING, originField, newOriginName);
|
||||
sqlObjList.add(SQLObj.builder().fieldName(format).build());
|
||||
}
|
||||
}
|
||||
STGroup tabStg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = tabStg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", false);
|
||||
st_sql.add("notUseAs", true);
|
||||
st_sql.add("table", tableObj);
|
||||
st_sql.add("groups", sqlObjList);
|
||||
String render = st_sql.render();
|
||||
tableObj = SQLObj.builder()
|
||||
.tableName(" (" + render + ") ")
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, "_exceed"))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
List<SQLObj> xFields = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(fields)) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
DatasetTableField f = fields.get(i);
|
||||
if (CollectionUtils.isNotEmpty(exceedList) && exceedList.contains(f.getOriginName())) {
|
||||
f.setOriginName(f.getOriginName() + "_exceed");
|
||||
}
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
@ -278,6 +236,9 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
int step = fields.size();
|
||||
for (int i = step; i < (step + sortFields.size()); i++) {
|
||||
DeSortField deSortField = sortFields.get(i - step);
|
||||
if (CollectionUtils.isNotEmpty(exceedList) && exceedList.contains(deSortField.getOriginName())) {
|
||||
deSortField.setOriginName(deSortField.getOriginName() + "_exceed");
|
||||
}
|
||||
SQLObj order = buildSortField(deSortField, tableObj, i);
|
||||
xOrders.add(order);
|
||||
}
|
||||
@ -1488,6 +1449,21 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildCalcField(String originField, SQLObj tableObj, int i) throws Exception {
|
||||
try {
|
||||
i++;
|
||||
if (i > 100) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
@ -1505,10 +1481,22 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
if (StringUtils.containsIgnoreCase(originField, ele.getId() + "")) {
|
||||
// 计算字段允许二次引用,这里递归查询完整引用链
|
||||
if (Objects.equals(ele.getExtField(), 0)) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
} else {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]", ele.getOriginName());
|
||||
originField = buildCalcField(originField, tableObj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return originField;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -18,6 +18,8 @@ import java.util.*;
|
||||
@Service
|
||||
public class ReptileService {
|
||||
String blogUrl = "https://blog.fit2cloud.com/categories/dataease";
|
||||
|
||||
String blogBaseUrl = "https://blog.fit2cloud.com";
|
||||
//获取最新的前几条数据
|
||||
private static int infoCount=5;
|
||||
|
||||
@ -33,7 +35,7 @@ public class ReptileService {
|
||||
Element info = elementsContent.get(i).children().get(0);
|
||||
Map<String, String> infoMap = new HashMap();
|
||||
infoMap.put("title",info.attr("title"));
|
||||
infoMap.put("href",info.attr("href"));
|
||||
infoMap.put("href",blogBaseUrl + info.attr("href"));
|
||||
result.add(infoMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -278,3 +278,5 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=Default template only screenshot
|
||||
I18n_name_cant_empty=Name can not be empty!
|
||||
I18n_del_admin_tips=Forbidden to delete the admin account
|
||||
I18N_NO_DRIVER_PERMISSION=Do not have permissions!
|
||||
i18n_field_circular_error=Field error
|
||||
i18n_field_circular_ref=Field has Circular Reference
|
||||
|
||||
@ -268,4 +268,5 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8BA4\u6A21\u677F(\u53EA\u622A\u56FE)
|
||||
I18n_name_cant_empty=\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF01
|
||||
I18n_del_admin_tips=\u7981\u6B62\u5220\u9664admin\u8D26\u53F7
|
||||
I18N_NO_DRIVER_PERMISSION=\u6ca1\u6709\u6743\u9650\uff01
|
||||
|
||||
i18n_field_circular_error=\u5B57\u6BB5\u89E3\u6790\u9519\u8BEF\uFF0C\u53EF\u80FD\u539F\u56E0\uFF1A\u5B57\u6BB5\u5DF2\u5220\u9664\u3001\u8BA1\u7B97\u5B57\u6BB5\u5F15\u7528\u5C42\u7EA7\u8FC7\u6DF1\u3001\u5B58\u5728\u5FAA\u73AF\u5F15\u7528\u7B49\uFF0C\u8BF7\u68C0\u67E5\u8868\u8282\u70B9\u548C\u5B57\u6BB5\u5E76\u91CD\u65B0\u7F16\u8F91\u3002
|
||||
i18n_field_circular_ref=\u5B57\u6BB5\u5B58\u5728\u5FAA\u73AF\u5F15\u7528
|
||||
|
||||
@ -274,3 +274,5 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8A8D\u6A21\u677F(\u53EA\u622A\u5716)
|
||||
I18n_name_cant_empty=\u540D\u7A31\u4E0D\u80FD\u70BA\u7A7A\uFF01
|
||||
I18n_del_admin_tips=\u7981\u6B62\u522A\u9664admin\u8CEC\u865F
|
||||
I18N_NO_DRIVER_PERMISSION=\u6c92\u6709\u8a31\u53ef\u6b0a\uff01
|
||||
i18n_field_circular_error=\u5B57\u6BB5\u89E3\u6790\u932F\u8AA4\uFF0C\u53EF\u80FD\u539F\u56E0\uFF1A\u5B57\u6BB5\u5DF2\u522A\u9664\u3001\u8A08\u7B97\u5B57\u6BB5\u5F15\u7528\u5C64\u7D1A\u904E\u6DF1\u3001\u5B58\u5728\u5FAA\u74B0\u5F15\u7528\u7B49\uFF0C\u8ACB\u6AA2\u67E5\u8868\u7BC0\u9EDE\u548C\u5B57\u6BB5\u4E26\u91CD\u65B0\u7DE8\u8F2F\u3002
|
||||
i18n_field_circular_ref=\u5B57\u6BB5\u5B58\u5728\u5FAA\u74B0\u5F15\u7528
|
||||
|
||||
@ -524,8 +524,8 @@ const data = {
|
||||
element.options.manualModify = false
|
||||
}
|
||||
// 去掉首选项
|
||||
if (element.options?.attr?.selectFirst) {
|
||||
element.options.attr.selectFirst = false
|
||||
if (element.options?.attrs?.selectFirst) {
|
||||
element.options.attrs.selectFirst = false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -415,16 +415,16 @@ export default {
|
||||
deep: true
|
||||
},
|
||||
'tableFields': function() {
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList))
|
||||
},
|
||||
'searchField': function(val) {
|
||||
if (val && val !== '') {
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) && ele.extField === 0)))
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) && ele.extField === 0)))
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()))))
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()))))
|
||||
} else {
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList))
|
||||
}
|
||||
},
|
||||
'searchFunction': function(val) {
|
||||
@ -572,8 +572,8 @@ export default {
|
||||
this.tableFields.dimensionListData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
|
||||
this.tableFields.quotaListData = JSON.parse(JSON.stringify(this.tableFields.quotaList))
|
||||
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
|
||||
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
|
||||
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList))
|
||||
|
||||
this.initField()
|
||||
})
|
||||
|
||||
@ -392,10 +392,10 @@ export default {
|
||||
tableFields: function() {
|
||||
this.dimensionData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.dimensionList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
this.quotaData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.quotaList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
},
|
||||
searchField: function(val) {
|
||||
if (val && val !== '') {
|
||||
@ -405,7 +405,7 @@ export default {
|
||||
(ele) =>
|
||||
ele.name
|
||||
.toLocaleLowerCase()
|
||||
.includes(val.toLocaleLowerCase()) && ele.extField === 0
|
||||
.includes(val.toLocaleLowerCase())
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -415,17 +415,17 @@ export default {
|
||||
(ele) =>
|
||||
ele.name
|
||||
.toLocaleLowerCase()
|
||||
.includes(val.toLocaleLowerCase()) && ele.extField === 0
|
||||
.includes(val.toLocaleLowerCase())
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
this.dimensionData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.dimensionList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
this.quotaData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.quotaList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
}
|
||||
},
|
||||
searchFunction: function(val) {
|
||||
@ -452,10 +452,10 @@ export default {
|
||||
this.initFunctions()
|
||||
this.dimensionData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.dimensionList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
this.quotaData = JSON.parse(
|
||||
JSON.stringify(this.tableFields.quotaList)
|
||||
).filter((ele) => ele.extField === 0)
|
||||
)
|
||||
this.initField()
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
@editItemCompare="showQuotaEditCompare"
|
||||
@editItemFilter="showQuotaEditFilter"
|
||||
@onNameEdit="showRename"
|
||||
@onQuotaItemChange="quotaItemChange"
|
||||
@onQuotaItemChange="quotaExtItemChange"
|
||||
@onQuotaItemRemove="quotaItemRemove"
|
||||
@valueFormatter="valueFormatter"
|
||||
/>
|
||||
@ -152,6 +152,7 @@ import QuotaItem from '../../../components/views/QuotaItem'
|
||||
import QuotaExtItem from '../../../components/views/QuotaExtItem'
|
||||
import FilterItem from '../../../components/views/FilterItem'
|
||||
import messages from '@/de-base/lang/messages'
|
||||
import {defaultTo} from "lodash-es"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -174,6 +175,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
yChartType: undefined,
|
||||
yExtChartType: undefined,
|
||||
widgets: [],
|
||||
places: [],
|
||||
moveId: -1,
|
||||
@ -229,8 +232,19 @@ export default {
|
||||
created() {
|
||||
this.$emit('on-add-languages', messages)
|
||||
},
|
||||
mounted() {
|
||||
if (this.view.yaxis && this.view.yaxis[0]) {
|
||||
this.yChartType = this.view.yaxis[0].chartType
|
||||
}
|
||||
if (this.view.yaxisExt && this.view.yaxisExt[0]) {
|
||||
this.yExtChartType = this.view.yaxisExt[0].chartType
|
||||
}
|
||||
this.yChartType = defaultTo(this.yChartType, 'bar');
|
||||
this.yExtChartType = defaultTo(this.yExtChartType, 'line');
|
||||
|
||||
},
|
||||
watch: {
|
||||
listenLists: function(val) {
|
||||
/*listenLists: function(val) {
|
||||
if (this.listenLists[0] <= 1 && this.listenLists[1] <= 1) {
|
||||
return
|
||||
}
|
||||
@ -243,7 +257,7 @@ export default {
|
||||
this.view.yaxisExt = [this.view.yaxisExt[0]]
|
||||
}
|
||||
this.calcData(true)
|
||||
}
|
||||
}*/
|
||||
},
|
||||
methods: {
|
||||
executeAxios(url, type, data, callBack) {
|
||||
@ -284,20 +298,29 @@ export default {
|
||||
this.multiAdd(e, this.view.yaxis)
|
||||
this.dragMoveDuplicate(this.view.yaxis, e)
|
||||
this.dragCheckType(this.view.yaxis, 'q')
|
||||
if (this.view.yaxis.length <= 1) {
|
||||
this.calcData(true)
|
||||
|
||||
for (let i = 0; i < this.view.yaxis.length; i++) {
|
||||
this.view.yaxis[i].chartType = this.yChartType
|
||||
}
|
||||
|
||||
//if (this.view.yaxis.length <= 1) {
|
||||
this.calcData(true)
|
||||
//}
|
||||
},
|
||||
addYaxisExt(e) {
|
||||
this.multiAdd(e, this.view.yaxisExt)
|
||||
this.dragMoveDuplicate(this.view.yaxisExt, e)
|
||||
this.dragCheckType(this.view.yaxisExt, 'q')
|
||||
if (this.view.yaxisExt.length <= 1) {
|
||||
this.calcData(true)
|
||||
|
||||
for (let i = 0; i < this.view.yaxisExt.length; i++) {
|
||||
this.view.yaxisExt[i].chartType = this.yExtChartType;
|
||||
}
|
||||
|
||||
//if (this.view.yaxisExt.length <= 1) {
|
||||
this.calcData(true)
|
||||
//}
|
||||
},
|
||||
calcData(cache) {
|
||||
console.log(cache)
|
||||
//this.view.xaxis = [...this.source, ...this.target]
|
||||
|
||||
this.$emit('plugin-call-back', {
|
||||
@ -339,6 +362,17 @@ export default {
|
||||
},
|
||||
|
||||
quotaItemChange(item) {
|
||||
this.yChartType = item.chartType;
|
||||
for (let i = 0; i < this.view.yaxis.length; i++) {
|
||||
this.view.yaxis[i].chartType = this.yChartType
|
||||
}
|
||||
this.calcData(true)
|
||||
},
|
||||
quotaExtItemChange(item) {
|
||||
this.yExtChartType = item.chartType;
|
||||
for (let i = 0; i < this.view.yaxisExt.length; i++) {
|
||||
this.view.yaxisExt[i].chartType = this.yExtChartType
|
||||
}
|
||||
this.calcData(true)
|
||||
},
|
||||
quotaItemRemove(item) {
|
||||
|
||||
@ -43,7 +43,7 @@ import {
|
||||
getLineDash, DEFAULT_COLOR_CASE, formatterItem, DEFAULT_YAXIS_EXT_STYLE
|
||||
} from '../../../utils/map';
|
||||
import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate';
|
||||
import _ from 'lodash';
|
||||
import {map, filter, join, flatten, cloneDeep} from 'lodash-es';
|
||||
import {clear} from 'size-sensor'
|
||||
import {valueFormatter} from '../../../utils/formatter'
|
||||
|
||||
@ -310,135 +310,54 @@ export default {
|
||||
|
||||
const names = [];
|
||||
|
||||
let _data = this.chart.data && this.chart.data.data && this.chart.data.data.length > 0 ? _.map(_.filter(this.chart.data.data, (c, _index) => {
|
||||
const yChartData = this.chart.data && this.chart.data.data && this.chart.data.data.length > 0 ? map(filter(this.chart.data.data, (c, _index) => {
|
||||
return _index < yaxisCount;
|
||||
}), (t, _index) => {
|
||||
|
||||
const _labelSetting = _.cloneDeep(labelSetting);
|
||||
if (_labelSetting && yaxisList[_index].formatterCfg) {
|
||||
_labelSetting.formatter = function (x) {
|
||||
return valueFormatter(x.value, yaxisList[_index].formatterCfg);
|
||||
}
|
||||
}
|
||||
|
||||
names.push(t.name);
|
||||
|
||||
const _chartType = this.getChartType(yaxisList[_index].chartType);
|
||||
|
||||
if (_labelSetting) {
|
||||
if (_chartType === "column") {
|
||||
_labelSetting.position = labelPosition;
|
||||
} else {
|
||||
_labelSetting.position = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
let color = colors && _index < colors.length ? hexColorToRGBA(colors[_index], alpha) : undefined;
|
||||
if (color && gradient) {
|
||||
color = setGradientColor(color, true, 270)
|
||||
}
|
||||
|
||||
const setting = {
|
||||
type: _chartType,
|
||||
name: t.name,
|
||||
options: {
|
||||
data: _.map(t.data, (v) => {
|
||||
return map(t.data, (v) => {
|
||||
return {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: _.join(_.map(v.dimensionList, (d) => d.value), "\n"),
|
||||
key: join(map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
name: t.name,
|
||||
i: _index,
|
||||
t: 'yaxis'
|
||||
}
|
||||
}),
|
||||
xField: 'key',
|
||||
yField: 'value',
|
||||
meta: {
|
||||
key: {
|
||||
sync: true,
|
||||
},
|
||||
value: {
|
||||
alias: t.name,
|
||||
},
|
||||
},
|
||||
color: color,
|
||||
label: _labelSetting,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
});
|
||||
}
|
||||
}
|
||||
return this.setSizeSetting(setting);
|
||||
}) : [];
|
||||
) : [];
|
||||
|
||||
let _dataExt = this.chart.data && this.chart.data.data && this.chart.data.data.length > 0 ? _.map(_.filter(this.chart.data.data, (c, _index) => {
|
||||
const yData = [this.getYData(flatten(yChartData), labelSetting, labelPosition, yaxisList, colors, gradient, alpha, xAxis, yAxis, yaxisExtList.length)];
|
||||
|
||||
const yExtChartData = this.chart.data && this.chart.data.data && this.chart.data.data.length > 0 ? map(filter(this.chart.data.data, (c, _index) => {
|
||||
return _index >= yaxisCount;
|
||||
}), (t, _index) => {
|
||||
|
||||
const _labelSetting = _.cloneDeep(labelSetting);
|
||||
if (_labelSetting && yaxisExtList[_index].formatterCfg) {
|
||||
_labelSetting.formatter = function (x) {
|
||||
return valueFormatter(x.value, yaxisExtList[_index].formatterCfg);
|
||||
}
|
||||
}
|
||||
|
||||
names.push(t.name);
|
||||
|
||||
const _chartType = this.getChartType(yaxisExtList[_index].chartType);
|
||||
|
||||
if (_labelSetting) {
|
||||
if (_chartType === "column") {
|
||||
_labelSetting.position = labelPosition;
|
||||
} else {
|
||||
_labelSetting.position = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
let color = colors && (yaxisCount + _index) < colors.length ? hexColorToRGBA(colors[yaxisCount + _index], alpha) : undefined;
|
||||
if (color && gradient) {
|
||||
color = setGradientColor(color, true, 270)
|
||||
}
|
||||
|
||||
const setting = {
|
||||
type: _chartType,
|
||||
name: t.name,
|
||||
options: {
|
||||
data: _.map(t.data, (v) => {
|
||||
return map(t.data, (v) => {
|
||||
return {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: _.join(_.map(v.dimensionList, (d) => d.value), "\n"),
|
||||
key: join(map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
name: t.name,
|
||||
i: _index,
|
||||
t: 'yaxisExt'
|
||||
}
|
||||
}),
|
||||
xField: 'key',
|
||||
yField: 'value',
|
||||
meta: {
|
||||
key: {
|
||||
sync: true,
|
||||
},
|
||||
value: {
|
||||
alias: t.name,
|
||||
},
|
||||
},
|
||||
color: color,
|
||||
label: _labelSetting,
|
||||
xAxis: false,
|
||||
yAxis: yAxisExt,
|
||||
})
|
||||
}
|
||||
}
|
||||
return this.setSizeSetting(setting);
|
||||
}) : [];
|
||||
) : [];
|
||||
|
||||
const yExtData = [this.getYExtData(flatten(yExtChartData), labelSetting, labelPosition, yaxisExtList, colors, gradient, alpha, xAxis, yAxisExt, yaxisCount)];
|
||||
|
||||
const params = {
|
||||
tooltip: false,
|
||||
syncViewPadding: true,
|
||||
plots: [
|
||||
..._data,
|
||||
..._dataExt
|
||||
...yData,
|
||||
...yExtData
|
||||
]
|
||||
};
|
||||
|
||||
@ -471,7 +390,7 @@ export default {
|
||||
item.value = valueFormatter(item.data.value, yaxisExtList[item.data.i].formatterCfg)
|
||||
}
|
||||
})
|
||||
return _.filter(originalItems, (item) => {
|
||||
return filter(originalItems, (item) => {
|
||||
const v = item.data.key;
|
||||
if (item.title === v && item.title === item.value && item.name === "key" || !names.includes(item.name)) {
|
||||
return false;
|
||||
@ -489,7 +408,8 @@ export default {
|
||||
|
||||
params.annotations = this.getAnalyse(this.chart);
|
||||
|
||||
params.legend = this.getLegend(this.chart);
|
||||
//两个轴只能展示一个轴的图例,所以隐藏
|
||||
//params.legend = this.getLegend(this.chart);
|
||||
|
||||
return params;
|
||||
},
|
||||
@ -755,6 +675,116 @@ export default {
|
||||
return axis
|
||||
},
|
||||
|
||||
getYData(data, labelSetting, labelPosition, yaxisList, colors, gradient, alpha, xAxis, yAxis, yaxisExtCount) {
|
||||
|
||||
const _labelSetting = cloneDeep(labelSetting);
|
||||
if (_labelSetting) {
|
||||
_labelSetting.formatter = function (x) {
|
||||
for (let i = 0; i < yaxisList.length; i++) {
|
||||
if (i === x.i && yaxisList[i].formatterCfg) {
|
||||
return valueFormatter(x.value, yaxisList[i].formatterCfg);
|
||||
}
|
||||
}
|
||||
return x.value;
|
||||
}
|
||||
}
|
||||
|
||||
const _chartType = this.getChartType(yaxisList && yaxisList.length > 0 ? yaxisList[0].chartType : undefined);
|
||||
|
||||
if (_labelSetting) {
|
||||
if (_chartType === "column") {
|
||||
_labelSetting.position = labelPosition;
|
||||
} else {
|
||||
_labelSetting.position = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const color = [];
|
||||
for (let i = 0; i < yaxisList.length; i++) {
|
||||
if (gradient) {
|
||||
color.push(setGradientColor(hexColorToRGBA(colors[i % colors.length], alpha), true, 270))
|
||||
} else {
|
||||
color.push(hexColorToRGBA(colors[i % colors.length], alpha))
|
||||
}
|
||||
}
|
||||
|
||||
const setting = {
|
||||
type: _chartType,
|
||||
options: {
|
||||
data: data,
|
||||
xField: 'key',
|
||||
yField: 'value',
|
||||
seriesField: 'name',
|
||||
colorField: 'name',
|
||||
isGroup: true,
|
||||
meta: {
|
||||
key: {
|
||||
sync: true,
|
||||
},
|
||||
},
|
||||
color: color,
|
||||
label: _labelSetting,
|
||||
xAxis: yaxisList.length > 0 || yaxisExtCount === 0 ? xAxis : false,
|
||||
yAxis: yAxis,
|
||||
}
|
||||
}
|
||||
return this.setSizeSetting(setting);
|
||||
},
|
||||
|
||||
getYExtData(data, labelSetting, labelPosition, yaxisExtList, colors, gradient, alpha, xAxis, yAxisExt, yaxisCount) {
|
||||
const _labelSetting = cloneDeep(labelSetting);
|
||||
if (_labelSetting) {
|
||||
_labelSetting.formatter = function (x) {
|
||||
for (let i = 0; i < yaxisExtList.length; i++) {
|
||||
if (i === x.i && yaxisExtList[i].formatterCfg) {
|
||||
return valueFormatter(x.value, yaxisExtList[i].formatterCfg);
|
||||
}
|
||||
}
|
||||
return x.value;
|
||||
}
|
||||
}
|
||||
|
||||
const _chartType = this.getChartType(yaxisExtList && yaxisExtList.length > 0 ? yaxisExtList[0].chartType : undefined);
|
||||
|
||||
if (_labelSetting) {
|
||||
if (_chartType === "column") {
|
||||
_labelSetting.position = labelPosition;
|
||||
} else {
|
||||
_labelSetting.position = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const color = [];
|
||||
for (let i = yaxisCount; i < yaxisExtList.length + yaxisCount; i++) {
|
||||
if (gradient) {
|
||||
color.push(setGradientColor(hexColorToRGBA(colors[i % colors.length], alpha), true, 270))
|
||||
} else {
|
||||
color.push(hexColorToRGBA(colors[i % colors.length], alpha))
|
||||
}
|
||||
}
|
||||
|
||||
const setting = {
|
||||
type: _chartType,
|
||||
options: {
|
||||
data: data,
|
||||
xField: 'key',
|
||||
yField: 'value',
|
||||
seriesField: 'name',
|
||||
isGroup: true,
|
||||
meta: {
|
||||
key: {
|
||||
sync: true,
|
||||
},
|
||||
},
|
||||
color: color,
|
||||
label: _labelSetting,
|
||||
xAxis: yaxisCount > 0 || yaxisExtList.length === 0 ? false : xAxis,
|
||||
yAxis: yAxisExt,
|
||||
}
|
||||
}
|
||||
return this.setSizeSetting(setting);
|
||||
},
|
||||
|
||||
setSizeSetting(setting) {
|
||||
let customAttr = undefined;
|
||||
if (this.chart.customAttr) {
|
||||
|
||||
@ -11,10 +11,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@ -124,7 +122,7 @@ public class SymbolMapRSHandler implements PluginViewRSHandler<Map> {
|
||||
ChartQuotaDTO chartQuotaDTO = new ChartQuotaDTO();
|
||||
chartQuotaDTO.setId(curY.getId());
|
||||
axisChartDataDTO.getQuotaList().add(chartQuotaDTO);
|
||||
axisChartDataDTO.getProperties().put(curY.getName(), row[i + step]);
|
||||
axisChartDataDTO.getProperties().put(curY.getName(), formatLabel(curY, row[i + step]));
|
||||
axisChartDataDTO.setLongitude(dimensionList.get(0).getValue());
|
||||
axisChartDataDTO.setLatitude(dimensionList.get(1).getValue());
|
||||
if (StringUtils.equals(curY.getTypeField(), "yAxis") && !valueFilled) {
|
||||
@ -139,4 +137,13 @@ public class SymbolMapRSHandler implements PluginViewRSHandler<Map> {
|
||||
map.put("data", datalist);
|
||||
return map;
|
||||
}
|
||||
|
||||
private String formatLabel(PluginViewField field, String val) {
|
||||
if (StringUtils.isBlank(val)) return val;
|
||||
String typeField = field.getTypeField();
|
||||
if (StringUtils.isNotBlank(typeField) && trans2Ykeys.contains(typeField)) {
|
||||
return Arrays.stream(val.split(",")).distinct().collect(Collectors.joining(","));
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,4 +47,6 @@ public class SqlServerSQLConstants extends SQLConstants {
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "120";
|
||||
|
||||
public static final String TO_STRING = "cast(%s as varchar(max)) as %s";
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user