forked from github/dataease
Merge branch 'dev' into pr@dev@refactor_log
This commit is contained in:
commit
fdb4f8bf49
@ -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?
|
||||
|
@ -112,6 +112,7 @@ public interface ParamConstants {
|
||||
MSG_TIME_OUT("basic.msgTimeOut"),
|
||||
|
||||
LOG_TIME_OUT("basic.logTimeOut"),
|
||||
DS_SYNC_LOG_TIME_OUT("basic.dsSyncLogTimeOut"),
|
||||
DS_CHECK_INTERVAL("basic.dsCheckInterval"),
|
||||
DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"),
|
||||
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
||||
|
@ -34,7 +34,6 @@ public class DriverMgmController {
|
||||
@ApiOperation("驱动列表")
|
||||
@PostMapping("/list")
|
||||
public List<DriverDTO> listDeDriver() throws Exception{
|
||||
checkPermission();
|
||||
return driverService.list();
|
||||
}
|
||||
|
||||
@ -57,7 +56,6 @@ public class DriverMgmController {
|
||||
@ApiOperation("驱动列表")
|
||||
@GetMapping("/list/{type}")
|
||||
public List<DriverDTO> listDeDriver(@PathVariable String type) throws Exception{
|
||||
checkPermission();
|
||||
return listDeDriver().stream().filter(driverDTO -> driverDTO.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ public class BasicInfo extends LoginLimitInfo implements Serializable {
|
||||
private String msgTimeOut;
|
||||
@ApiModelProperty("日志保留时间")
|
||||
private String logTimeOut;
|
||||
@ApiModelProperty("数据同步日志保留时间")
|
||||
private String dsSyncLogTimeOut;
|
||||
@ApiModelProperty("显示首页")
|
||||
private String openHomePage;
|
||||
@ApiModelProperty("默认登录方式")
|
||||
|
@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@ -239,7 +241,12 @@ public class ApiProvider extends Provider {
|
||||
String rootPath;
|
||||
if (response.startsWith("[")) {
|
||||
rootPath = "$[*]";
|
||||
JSONArray jsonArray = JSONObject.parseArray(response);
|
||||
JsonNode jsonArray = null;
|
||||
try {
|
||||
jsonArray = new ObjectMapper().readTree(response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (Object o : jsonArray) {
|
||||
handleStr(apiDefinition, o.toString(), fields, rootPath);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class EsProvider extends Provider {
|
||||
}
|
||||
|
||||
for (String[] row : esResponse.getRows()) {
|
||||
if(!row[1].equalsIgnoreCase("STRUCT")){
|
||||
if(!row[1].equalsIgnoreCase("STRUCT") && !row[2].equalsIgnoreCase("unsupported")){
|
||||
TableField field = new TableField();
|
||||
field.setFieldName(row[0]);
|
||||
field.setRemarks(row[0]);
|
||||
|
@ -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;
|
||||
@ -197,7 +199,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1418,27 +1420,54 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getDataeaseName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -167,7 +169,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1366,27 +1368,54 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MysqlConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getDataeaseName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -196,7 +198,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1416,27 +1418,54 @@ public class CKQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(CKConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -172,7 +174,7 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1404,27 +1406,54 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(Db2Constants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -344,8 +346,10 @@ public class EsQueryProvider extends QueryProvider {
|
||||
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == DeTypeConstants.DE_TIME) {
|
||||
originField = String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
} else {
|
||||
if (y.getDeType() == 2 || y.getDeType() == 3) {
|
||||
if (y.getDeType() == 2) {
|
||||
originField = String.format(EsSqlLConstants.CAST, String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()), "bigint");
|
||||
} else if (y.getDeType() == 3) {
|
||||
originField = String.format(EsSqlLConstants.CAST, String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName()), "float");
|
||||
} else {
|
||||
originField = String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
}
|
||||
@ -1320,27 +1324,54 @@ public class EsQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(EsSqlLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -153,7 +155,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1334,27 +1336,54 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(HiveConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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,27 +1307,54 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(ImpalaConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -139,7 +141,7 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
@ -1159,27 +1161,54 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MongoConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -251,7 +253,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1426,27 +1428,54 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -127,7 +129,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -1516,27 +1518,54 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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;
|
||||
@ -180,7 +182,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
List<String> wheres = new ArrayList<>();
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
@ -1332,27 +1334,54 @@ public class PgQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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,27 +1315,54 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(PgConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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();
|
||||
}*/
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@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表达式
|
||||
@ -269,7 +227,7 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (customWheres != null) wheres.add(customWheres);
|
||||
if (whereTrees != null) wheres.add(whereTrees);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
String keyWhere = "("+transKeywordFilterList(tableObj, xFields, keyword)+")";
|
||||
String keyWhere = "(" + transKeywordFilterList(tableObj, xFields, keyword) + ")";
|
||||
wheres.add(keyWhere);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
@ -278,11 +236,14 @@ 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);
|
||||
}
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(limit)){
|
||||
if (ObjectUtils.isNotEmpty(limit)) {
|
||||
SQLObj limitFiled = SQLObj.builder().limitFiled(" top " + limit + " ").build();
|
||||
st_sql.add("limitFiled", limitFiled);
|
||||
}
|
||||
@ -1488,27 +1449,54 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
private String calcFieldRegex(String originField, SQLObj tableObj) {
|
||||
originField = originField.replaceAll("[\\t\\n\\r]]", "");
|
||||
// 正则提取[xxx]
|
||||
String regex = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
try {
|
||||
int i = 0;
|
||||
return buildCalcField(originField, tableObj, i);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(Translator.get("i18n_field_circular_ref"));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
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 = "\\[(.*?)]";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(originField);
|
||||
Set<String> ids = new HashSet<>();
|
||||
while (matcher.find()) {
|
||||
String id = matcher.group(1);
|
||||
ids.add(id);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return originField;
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
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"));
|
||||
}
|
||||
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
|
||||
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
|
||||
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
|
||||
for (DatasetTableField ele : calcFields) {
|
||||
originField = originField.replaceAll("\\[" + ele.getId() + "]",
|
||||
String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
|
||||
}
|
||||
return originField;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.ext.CleaningRebotMapper;
|
||||
import io.dataease.service.dataset.DataSetTableTaskLogService;
|
||||
import io.dataease.service.message.SysMsgService;
|
||||
import io.dataease.service.sys.log.LogService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -23,6 +24,8 @@ public class CleaningRebotService {
|
||||
|
||||
@Resource
|
||||
private SysMsgService sysMsgService;
|
||||
@Resource
|
||||
private DataSetTableTaskLogService dataSetTableTaskLogService;
|
||||
|
||||
public void execute() {
|
||||
int floatDept = 0;
|
||||
@ -43,5 +46,6 @@ public class CleaningRebotService {
|
||||
}
|
||||
logService.cleanDisusedLog();
|
||||
sysMsgService.cleanDisusedMsg();
|
||||
dataSetTableTaskLogService.cleanLog();
|
||||
}
|
||||
}
|
||||
|
@ -1379,6 +1379,9 @@ public class ChartViewService {
|
||||
if (StringUtils.isEmpty(cValue)) {
|
||||
continue;
|
||||
}
|
||||
if (sum.equals(new BigDecimal(0))) {
|
||||
continue;
|
||||
}
|
||||
item[dataIndex] = new BigDecimal(cValue)
|
||||
.divide(sum, 8, RoundingMode.HALF_UP)
|
||||
.toString();
|
||||
|
@ -1115,20 +1115,25 @@ public class DataSetTableService {
|
||||
}
|
||||
}
|
||||
|
||||
private String handlePlainSelect(PlainSelect plainSelect, Select statementSelect, String dsType) throws Exception {
|
||||
|
||||
private void handleSelectItems(PlainSelect plainSelect, String dsType) throws Exception {
|
||||
List<SelectItem> selectItems = new ArrayList<>();
|
||||
plainSelect.getSelectItems().forEach(selectItem -> {
|
||||
System.out.println(selectItem);
|
||||
System.out.println(selectItem instanceof PlainSelect);
|
||||
System.out.println(selectItem instanceof SubSelect);
|
||||
|
||||
for (SelectItem selectItem : plainSelect.getSelectItems()) {
|
||||
try {
|
||||
SelectExpressionItem selectExpressionItem = (SelectExpressionItem) selectItem;
|
||||
if (selectExpressionItem.getExpression() instanceof SubSelect) {
|
||||
SubSelect subSelect = (SubSelect) selectExpressionItem.getExpression();
|
||||
Select select = (Select) CCJSqlParserUtil.parse(removeVariables(subSelect.getSelectBody().toString(), dsType));
|
||||
subSelect.setSelectBody(select.getSelectBody());
|
||||
((SelectExpressionItem) selectItem).setExpression(subSelect);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
selectItems.add(selectItem);
|
||||
});
|
||||
|
||||
plainSelect.addSelectItems(selectItems);
|
||||
|
||||
}
|
||||
plainSelect.setSelectItems(selectItems);
|
||||
}
|
||||
|
||||
private void handleFromItems(PlainSelect plainSelect, String dsType) throws Exception {
|
||||
FromItem fromItem = plainSelect.getFromItem();
|
||||
if (fromItem instanceof SubSelect) {
|
||||
SelectBody selectBody = ((SubSelect) fromItem).getSelectBody();
|
||||
@ -1136,7 +1141,9 @@ public class DataSetTableService {
|
||||
Select subSelectTmp = (Select) CCJSqlParserUtil.parse(removeVariables(selectBody.toString(), dsType));
|
||||
subSelect.setSelectBody(subSelectTmp.getSelectBody());
|
||||
if (dsType.equals(DatasourceTypes.oracle.getType())) {
|
||||
subSelect.setAlias(new Alias(fromItem.getAlias().toString(), false));
|
||||
if (fromItem.getAlias() != null) {
|
||||
subSelect.setAlias(new Alias(fromItem.getAlias().toString(), false));
|
||||
}
|
||||
} else {
|
||||
if (fromItem.getAlias() == null) {
|
||||
throw new Exception("Failed to parse sql, Every derived table must have its own alias!");
|
||||
@ -1145,6 +1152,9 @@ public class DataSetTableService {
|
||||
}
|
||||
plainSelect.setFromItem(subSelect);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleJoins(PlainSelect plainSelect, String dsType) throws Exception {
|
||||
List<Join> joins = plainSelect.getJoins();
|
||||
if (joins != null) {
|
||||
List<Join> joinsList = new ArrayList<>();
|
||||
@ -1170,6 +1180,9 @@ public class DataSetTableService {
|
||||
}
|
||||
plainSelect.setJoins(joinsList);
|
||||
}
|
||||
}
|
||||
|
||||
private String handleWhere(PlainSelect plainSelect, Select statementSelect, String dsType) throws Exception {
|
||||
Expression expr = plainSelect.getWhere();
|
||||
if (expr == null) {
|
||||
return handleWith(plainSelect, statementSelect, dsType);
|
||||
@ -1211,6 +1224,14 @@ public class DataSetTableService {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private String handlePlainSelect(PlainSelect plainSelect, Select statementSelect, String dsType) throws Exception {
|
||||
handleSelectItems(plainSelect, dsType);
|
||||
handleFromItems(plainSelect, dsType);
|
||||
handleJoins(plainSelect, dsType);
|
||||
return handleWhere(plainSelect, statementSelect, dsType);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> getDBPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||
if (ds == null) {
|
||||
@ -1639,8 +1660,17 @@ public class DataSetTableService {
|
||||
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
|
||||
|
||||
String[] array = fields.stream()
|
||||
.map(f -> table + "." + f.getDataeaseName() + " AS "
|
||||
+ TableUtils.fieldName(tableId + "_" + f.getDataeaseName()))
|
||||
.map(f -> {
|
||||
String s = "";
|
||||
if (f == null) {
|
||||
DEException.throwException(
|
||||
Translator.get("i18n_ds_error"));
|
||||
} else {
|
||||
s = table + "." + f.getDataeaseName() + " AS "
|
||||
+ TableUtils.fieldName(tableId + "_" + f.getDataeaseName());
|
||||
}
|
||||
return s;
|
||||
})
|
||||
.toArray(String[]::new);
|
||||
checkedInfo.put(table, array);
|
||||
checkedFields.addAll(fields);
|
||||
@ -2766,13 +2796,13 @@ public class DataSetTableService {
|
||||
if (StringUtils.isEmpty(s)) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_empty_column"));
|
||||
}
|
||||
if(hashSet.contains(s)){
|
||||
if (hashSet.contains(s)) {
|
||||
repeat.add(s);
|
||||
}else {
|
||||
} else {
|
||||
hashSet.add(s);
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(repeat)){
|
||||
if (CollectionUtils.isNotEmpty(repeat)) {
|
||||
DataEaseException.throwException(Translator.get("i18n_excel_field_repeat") + "" + String.valueOf(repeat));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.dataease.commons.constants.ParamConstants;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest;
|
||||
@ -13,6 +14,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableTaskLog;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableTaskLogExample;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableTaskLogMapper;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
@ -29,6 +31,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -46,6 +49,8 @@ public class DataSetTableTaskLogService {
|
||||
private ExtDataSetTaskMapper extDataSetTaskMapper;
|
||||
@Resource
|
||||
private DatasetTableTaskMapper datasetTableTaskMapper;
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
public DatasetTableTaskLog save(DatasetTableTaskLog datasetTableTaskLog, Boolean hasTask) {
|
||||
if (hasTask && datasetTableTaskMapper.selectByPrimaryKey(datasetTableTaskLog.getTaskId()) == null) {
|
||||
@ -210,5 +215,23 @@ public class DataSetTableTaskLogService {
|
||||
return example;
|
||||
}
|
||||
|
||||
private static final String LOG_RETENTION = "30";
|
||||
|
||||
public void cleanLog() {
|
||||
String value = systemParameterService.getValue(ParamConstants.BASIC.DS_SYNC_LOG_TIME_OUT.getValue());
|
||||
value = StringUtils.isBlank(value) ? LOG_RETENTION : value;
|
||||
int logRetention = Integer.parseInt(value);
|
||||
Calendar instance = Calendar.getInstance();
|
||||
Calendar startInstance = (Calendar) instance.clone();
|
||||
startInstance.add(Calendar.DATE, -logRetention);
|
||||
startInstance.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startInstance.set(Calendar.MINUTE, 0);
|
||||
startInstance.set(Calendar.SECOND, 0);
|
||||
startInstance.set(Calendar.MILLISECOND, -1);
|
||||
long timeInMillis = startInstance.getTimeInMillis();
|
||||
DatasetTableTaskLogExample example = new DatasetTableTaskLogExample();
|
||||
example.createCriteria().andCreateTimeLessThan(timeInMillis);
|
||||
datasetTableTaskLogMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -362,13 +362,14 @@ public class ExtractDataService {
|
||||
|
||||
case add_scope: // 增量更新
|
||||
try {
|
||||
if (datasetTable.getLastUpdateTime() == null || datasetTable.getLastUpdateTime() == 0) {
|
||||
throw new Exception("未进行全量同步");
|
||||
}
|
||||
if (datasource.getType().equalsIgnoreCase(DatasourceTypes.api.name())) {
|
||||
extractData(datasetTable, datasource, datasetTableFields, "incremental_add", null);
|
||||
} else {
|
||||
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
|
||||
if (datasetTable.getLastUpdateTime() == null || datasetTable.getLastUpdateTime() == 0) {
|
||||
throw new Exception("未进行全量同步");
|
||||
}
|
||||
|
||||
|
||||
execTime = System.currentTimeMillis();
|
||||
if (datasetTableIncrementalConfig != null && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
|
||||
|
@ -371,9 +371,11 @@ public class DatasourceService {
|
||||
String datasourceStatus = null;
|
||||
try {
|
||||
Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
||||
System.out.println(datasourceProvider.getClass());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(datasource);
|
||||
datasourceStatus = datasourceProvider.checkStatus(datasourceRequest);
|
||||
System.out.println(datasourceStatus);
|
||||
if (datasource.getType().equalsIgnoreCase("api")) {
|
||||
List<ApiDefinition> apiDefinitionList = new Gson().fromJson(datasource.getConfiguration(), new TypeToken<List<ApiDefinition>>() {
|
||||
}.getType());
|
||||
@ -398,6 +400,7 @@ public class DatasourceService {
|
||||
|
||||
return ResultHolder.success("Success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
datasourceStatus = "Error";
|
||||
return ResultHolder.error(Translator.get("I18N_DS_INVALID") + ": " + e.getMessage());
|
||||
} finally {
|
||||
@ -405,6 +408,7 @@ public class DatasourceService {
|
||||
record.setStatus(datasourceStatus);
|
||||
DatasourceExample example = new DatasourceExample();
|
||||
example.createCriteria().andIdEqualTo(datasource.getId());
|
||||
System.out.println(new Gson().toJson(record));
|
||||
datasourceMapper.updateByExampleSelective(record, example);
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,9 @@ public class SystemParameterService {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.LOG_TIME_OUT.getValue())) {
|
||||
result.setLogTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DS_SYNC_LOG_TIME_OUT.getValue())) {
|
||||
result.setDsSyncLogTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DEFAULT_LOGIN_TYPE.getValue())) {
|
||||
String paramValue = param.getParamValue();
|
||||
result.setLoginType(StringUtils.isNotBlank(paramValue) ? Integer.parseInt(paramValue) : 0);
|
||||
|
@ -277,4 +277,6 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=Default template only screenshot
|
||||
\u8FB9\u684610=Border 10
|
||||
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_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
|
||||
|
@ -273,4 +273,6 @@ I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8A8D\u6A21\u677F(\u53EA\u622A\u5716)
|
||||
\u8FB9\u684610=\u908A\u6846 10
|
||||
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_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
|
||||
|
@ -509,7 +509,7 @@ export default {
|
||||
this.$store.commit('setComponentWithId', this.currentFilterCom)
|
||||
this.$store.commit('recordSnapshot', 'sureFilter')
|
||||
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex })
|
||||
bus.$emit('reset-default-value', this.currentFilterCom.id)
|
||||
bus.$emit('reset-default-value', this.currentFilterCom)
|
||||
this.closeFilter()
|
||||
},
|
||||
reFreshComponent(component) {
|
||||
|
@ -399,13 +399,6 @@ export default {
|
||||
.component-active {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.fullscreen {
|
||||
transform: translate(0);
|
||||
.main_view {
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
.user-view {
|
||||
transform: translate(0);
|
||||
}
|
||||
|
@ -445,6 +445,7 @@ export default {
|
||||
this.canvasId === 'canvas-main' && bus.$on('pcChartDetailsDialog', this.openChartDetailsDialog)
|
||||
bus.$on('trigger-search-button', this.triggerSearchButton)
|
||||
bus.$on('trigger-reset-button', this.triggerResetButton)
|
||||
bus.$on('trigger-filter-loaded', this.triggerFilterLoaded)
|
||||
this.initPdfTemplate()
|
||||
},
|
||||
beforeDestroy() {
|
||||
@ -460,10 +461,17 @@ export default {
|
||||
this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog)
|
||||
bus.$off('trigger-search-button', this.triggerSearchButton)
|
||||
bus.$off('trigger-reset-button', this.triggerResetButton)
|
||||
bus.$off('trigger-filter-loaded', this.triggerFilterLoaded)
|
||||
},
|
||||
methods: {
|
||||
filterLoaded(p) {
|
||||
triggerFilterLoaded({ canvasIdStr, panelId, p }) {
|
||||
if (this.panelInfo.id === panelId && !canvasIdStr.includes(this.canvasId)) {
|
||||
this.filterLoaded(p, canvasIdStr)
|
||||
}
|
||||
},
|
||||
filterLoaded(p, canvasIdStr = '') {
|
||||
buildAfterFilterLoaded(this.filterMap, p)
|
||||
bus.$emit('trigger-filter-loaded', { canvasIdStr: (canvasIdStr + this.canvasId), panelId: this.panelInfo.id, p })
|
||||
},
|
||||
getWrapperChildRefs() {
|
||||
return this.$refs['viewWrapperChild']
|
||||
|
@ -76,6 +76,9 @@ export default {
|
||||
|
||||
.track-menu {
|
||||
border: #3a8ee6 1px solid;
|
||||
position: absolute !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -136,6 +136,7 @@ export function panelDataPrepare(componentData, componentStyle, callback) {
|
||||
}
|
||||
if (item.type === 'custom') {
|
||||
item.options.manualModify = false
|
||||
item.options.loaded = false
|
||||
}
|
||||
if (item.filters && item.filters.length > 0) {
|
||||
item.filters = []
|
||||
|
@ -418,8 +418,10 @@ export default {
|
||||
this.$refs.dateRef.hidePicker()
|
||||
}
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.values.toString() !== eleVal && this.defaultValueStr === eleVal) {
|
||||
if (!this.element.options.attrs.default.isDynamic) {
|
||||
this.values = this.fillValueDerfault()
|
||||
this.dateChange(this.values)
|
||||
|
@ -99,8 +99,10 @@ export default {
|
||||
clearHandler() {
|
||||
this.value = null
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) {
|
||||
this.value = this.fillValueDerfault()
|
||||
this.search()
|
||||
}
|
||||
|
@ -160,8 +160,10 @@ export default {
|
||||
this.form.min = null
|
||||
this.form.max = null
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.defaultValueStr === eleVal) {
|
||||
if (!this.element.options.value) {
|
||||
this.form.min = null
|
||||
this.form.max = null
|
||||
|
@ -345,8 +345,10 @@ export default {
|
||||
this.$refs.deSelect.$refs.visualSelect.blur()
|
||||
}
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) {
|
||||
if (this.selectFirst) {
|
||||
this.fillFirstValue()
|
||||
this.firstChange(this.value)
|
||||
@ -380,6 +382,8 @@ export default {
|
||||
componentId: this.element.id,
|
||||
val: (this.value && Array.isArray(this.value)) ? this.value.join(',') : this.value
|
||||
})
|
||||
this.element.options.loaded = true
|
||||
this.$store.commit('setComponentWithId', this.element)
|
||||
}
|
||||
},
|
||||
refreshLoad() {
|
||||
|
@ -12,6 +12,8 @@
|
||||
:size="size"
|
||||
prefix-icon="el-icon-search"
|
||||
clearable
|
||||
@input="filterMethod"
|
||||
@clear="filterMethod"
|
||||
/>
|
||||
</div>
|
||||
<div class="list">
|
||||
@ -31,7 +33,7 @@
|
||||
v-model="value"
|
||||
@change="handleCheckedChange"
|
||||
>
|
||||
<template v-for="item in data.filter(node => !keyWord || (node.id && node.id.toLocaleUpperCase().includes(keyWord.toLocaleUpperCase())))">
|
||||
<template v-for="item in data">
|
||||
<el-checkbox
|
||||
:key="item.id"
|
||||
:label="item.id"
|
||||
@ -51,7 +53,7 @@
|
||||
@change="changeRadioBox"
|
||||
>
|
||||
<el-radio
|
||||
v-for="(item, index) in data.filter(node => !keyWord || (node.id && node.id.toLocaleUpperCase().includes(keyWord.toLocaleUpperCase())))"
|
||||
v-for="(item, index) in data"
|
||||
:key="index"
|
||||
:label="item.id"
|
||||
@click.native.prevent="testChange(item)"
|
||||
@ -118,7 +120,9 @@ export default {
|
||||
show: true,
|
||||
data: [],
|
||||
isIndeterminate: false,
|
||||
checkAll: false
|
||||
checkAll: false,
|
||||
timeMachine: null,
|
||||
changeIndex: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -220,7 +224,7 @@ export default {
|
||||
if (!token && linkToken) {
|
||||
method = linkMultFieldValues
|
||||
}
|
||||
const param = { fieldIds: this.element.options.attrs.fieldId.split(','), sort: this.element.options.attrs.sort }
|
||||
const param = { fieldIds: this.element.options.attrs.fieldId.split(','), sort: this.element.options.attrs.sort, keyword: this.keyWord }
|
||||
if (this.panelInfo.proxy) {
|
||||
param.userId = this.panelInfo.proxy
|
||||
}
|
||||
@ -238,8 +242,7 @@ export default {
|
||||
cssArr: {
|
||||
handler: 'changeInputStyle',
|
||||
deep: true
|
||||
},
|
||||
keyWord: 'changeInputStyle'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.element.options.attrs.sort) {
|
||||
@ -256,6 +259,23 @@ export default {
|
||||
bus.$off('reset-default-value', this.resetDefaultValue)
|
||||
},
|
||||
methods: {
|
||||
searchWithKey(index) {
|
||||
this.timeMachine = setTimeout(() => {
|
||||
if (index === this.changeIndex) {
|
||||
this.initOptions()
|
||||
}
|
||||
this.destroyTimeMachine()
|
||||
}, 1500)
|
||||
},
|
||||
destroyTimeMachine() {
|
||||
this.timeMachine && clearTimeout(this.timeMachine)
|
||||
this.timeMachine = null
|
||||
},
|
||||
filterMethod() {
|
||||
this.destroyTimeMachine()
|
||||
this.changeIndex++
|
||||
this.searchWithKey(this.changeIndex)
|
||||
},
|
||||
clearDefault(optionList) {
|
||||
const emptyOption = !optionList?.length
|
||||
|
||||
@ -282,8 +302,10 @@ export default {
|
||||
this.checkAll = false
|
||||
this.isIndeterminate = false
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) {
|
||||
this.value = this.fillValueDerfault()
|
||||
this.changeValue(this.value)
|
||||
|
||||
@ -332,7 +354,7 @@ export default {
|
||||
}
|
||||
method({
|
||||
fieldIds: this.element.options.attrs.fieldId.split(','),
|
||||
sort: this.element.options.attrs.sort
|
||||
sort: this.element.options.attrs.sort, keyword: this.keyWord
|
||||
}).then(res => {
|
||||
this.data = this.optionData(res.data)
|
||||
this.changeInputStyle()
|
||||
|
@ -234,8 +234,10 @@ export default {
|
||||
this.value = this.element.options.attrs.multiple ? [] : null
|
||||
this.$refs.deSelectTree && this.$refs.deSelectTree.resetSelectAll && this.$refs.deSelectTree.resetSelectAll()
|
||||
},
|
||||
resetDefaultValue(id) {
|
||||
if (this.inDraw && this.manualModify && this.element.id === id) {
|
||||
resetDefaultValue(ele) {
|
||||
const id = ele.id
|
||||
const eleVal = ele.options.value.toString()
|
||||
if (this.inDraw && this.manualModify && this.element.id === id && this.value.toString() !== eleVal && this.defaultValueStr === eleVal) {
|
||||
this.value = this.fillValueDerfault()
|
||||
this.changeValue(this.value)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
class="de-tabs-div"
|
||||
:class="[headClass, headClassScroll]"
|
||||
:class="headClass"
|
||||
>
|
||||
<div
|
||||
v-if="maskShow"
|
||||
@ -296,7 +296,7 @@ export default {
|
||||
'de-stream-media',
|
||||
'de-frame'
|
||||
],
|
||||
headClassScroll: 'head-class-scroll',
|
||||
headClassScroll: '',
|
||||
activeTabName: null,
|
||||
tabIndex: 1,
|
||||
dialogVisible: false,
|
||||
@ -317,9 +317,9 @@ export default {
|
||||
},
|
||||
headClass() {
|
||||
if (this.tabsAreaScroll) {
|
||||
return 'tab-head-left'
|
||||
return `tab-head-left ${this.headClassScroll}`
|
||||
} else {
|
||||
return 'tab-head-' + this.element.style.headPosition
|
||||
return `tab-head-${this.element.style.headPosition} ${this.headClassScroll}`
|
||||
}
|
||||
},
|
||||
curCanvasScaleSelf() {
|
||||
@ -495,8 +495,8 @@ export default {
|
||||
bus.$off('add-new-tab', this.addNewTab)
|
||||
},
|
||||
methods: {
|
||||
setTabLayout: _.debounce(function() {
|
||||
this.headClassScroll = !!this.$refs.deTabsConstom.$refs.tabsConstom.$refs.nav.scrollable && 'head-class-scroll'
|
||||
setTabLayout: _.debounce(function () {
|
||||
this.headClassScroll = !!this.$refs?.deTabsConstom?.$refs?.tabsConstom?.$refs?.nav?.scrollable ? 'head-class-scroll' : ''
|
||||
}, 100),
|
||||
calcTabLength() {
|
||||
this.$nextTick(() => {
|
||||
|
@ -890,6 +890,7 @@ export default {
|
||||
request_timeout: 'Request timeout',
|
||||
message_retention_time: 'Message retention time',
|
||||
log_retention_time: 'Log retention time',
|
||||
ds_sync_log_retention_time: 'Data sync log retention time',
|
||||
ds_check_time: 'Data source detection interval',
|
||||
test_mail_recipient: 'Used only as a test mail recipient',
|
||||
to_enable_tsl: 'If the SMTP port is 587, you usually need to enable TSL',
|
||||
@ -1585,7 +1586,7 @@ export default {
|
||||
gauge_axis_label: 'Axis Label',
|
||||
word_size_range: 'Word Size Range',
|
||||
word_spacing: 'Word Spacing',
|
||||
axis_multi_select_tip: 'Hold down the Ctrl or Shift key and click to select more than one'
|
||||
axis_multi_select_tip: 'Hold down the Ctrl/Cmd or Shift key and click to select more than one'
|
||||
},
|
||||
dataset: {
|
||||
scope_edit: 'Effective only when editing',
|
||||
@ -1944,7 +1945,7 @@ export default {
|
||||
please_input_max_pool_size: 'Please enter the maximum number of connections',
|
||||
please_input_max_idle_time: 'Please enter the maximum idle (seconds)',
|
||||
please_input_acquire_increment: 'Please enter the growth number',
|
||||
please_input_query_timeout: 'Please enter query timeout',
|
||||
please_input_query_timeout: 'Please enter query timeout,Valid range [1 - 300]',
|
||||
please_input_connect_timeout: 'Please enter the connection timeout (seconds)',
|
||||
no_less_then_0: 'Parameters in advanced settings cannot be less than zero',
|
||||
port_no_less_then_0: 'Port cannot be less than zero',
|
||||
|
@ -889,6 +889,7 @@ export default {
|
||||
request_timeout: '請求超時時間',
|
||||
message_retention_time: '消息保留時間',
|
||||
log_retention_time: '日誌保留時間',
|
||||
ds_sync_log_retention_time: '数据同步日誌保留時間',
|
||||
ds_check_time: '數據源檢測時間間隔',
|
||||
test_mail_recipient: '僅用來作為測試郵件收件人',
|
||||
to_enable_tsl: '如果SMTP埠是587,通常需要啟用TSL',
|
||||
@ -1577,7 +1578,7 @@ export default {
|
||||
gauge_axis_label: '刻度標籤',
|
||||
word_size_range: '字號區間',
|
||||
word_spacing: '文字間隔',
|
||||
axis_multi_select_tip: '按住 Ctrl 鍵或者 Shift 鍵再點擊可多選'
|
||||
axis_multi_select_tip: '按住 Ctrl/Cmd 鍵或者 Shift 鍵再點擊可多選'
|
||||
},
|
||||
dataset: {
|
||||
scope_edit: '僅編輯時生效',
|
||||
@ -1936,7 +1937,7 @@ export default {
|
||||
please_input_max_pool_size: '請輸入最大連接數',
|
||||
please_input_max_idle_time: '請輸入最大空閑(秒)',
|
||||
please_input_acquire_increment: '請輸入增長數',
|
||||
please_input_query_timeout: '請輸入查詢超時',
|
||||
please_input_query_timeout: '請輸入查詢超時,請填寫1-300正整數',
|
||||
please_input_connect_timeout: '請輸輸入連接超時(秒)',
|
||||
no_less_then_0: '高級設置中的參數不能小於零',
|
||||
port_no_less_then_0: '端口不能小於零',
|
||||
|
@ -888,6 +888,7 @@ export default {
|
||||
request_timeout: '请求超时时间',
|
||||
message_retention_time: '消息保留时间',
|
||||
log_retention_time: '日志保留时间',
|
||||
ds_sync_log_retention_time: '数据同步日志保留时间',
|
||||
ds_check_time: '数据源检测时间间隔',
|
||||
test_mail_recipient: '仅用来作为测试邮件收件人',
|
||||
to_enable_tsl: '如果SMTP端口是587,通常需要启用TSL',
|
||||
@ -1577,7 +1578,7 @@ export default {
|
||||
gauge_axis_label: '刻度标签',
|
||||
word_size_range: '字号区间',
|
||||
word_spacing: '文字间隔',
|
||||
axis_multi_select_tip: '按住 Ctrl 键或者 Shift 键再点击可多选'
|
||||
axis_multi_select_tip: '按住 Ctrl/Cmd 键或者 Shift 键再点击可多选'
|
||||
},
|
||||
dataset: {
|
||||
scope_edit: '仅编辑时生效',
|
||||
@ -1936,7 +1937,7 @@ export default {
|
||||
please_input_max_pool_size: '请输入最大连接数',
|
||||
please_input_max_idle_time: '请输入最大空闲(秒)',
|
||||
please_input_acquire_increment: '请输入增长数',
|
||||
please_input_query_timeout: '请输入查询超时',
|
||||
please_input_query_timeout: '请输入查询超时,填写1-300正整数',
|
||||
please_input_connect_timeout: '请输入连接超时(秒)',
|
||||
no_less_then_0: '高级设置中的参数不能小于零',
|
||||
port_no_less_then_0: '端口不能小于零',
|
||||
|
@ -90,7 +90,8 @@ export const buildCanvasIdMap = panelItems => {
|
||||
const cacheCondition = (cb, obj) => {
|
||||
obj.cb = cb
|
||||
}
|
||||
export const buildViewKeyFilters = (panelItems, result) => {
|
||||
|
||||
export const buildViewKeyFilters = (panelItems, result, isEdit = false) => {
|
||||
if (!(panelItems && panelItems.length > 0)) {
|
||||
return result
|
||||
}
|
||||
@ -112,7 +113,7 @@ export const buildViewKeyFilters = (panelItems, result) => {
|
||||
// 进行过滤时 如果过滤组件在主画布 则条件适用于所有画布视图 否则需要过滤组件和视图在相同画布
|
||||
if (element.canvasId === 'canvas-main' || element.canvasId === canvasIdMap[viewId]) {
|
||||
const vidMatch = viewIdMatch(condition.viewIds, viewId)
|
||||
if (vidMatch && selectFirst) {
|
||||
if (vidMatch && selectFirst && !element.options.loaded) {
|
||||
const obj = {}
|
||||
const promise = new Promise(resolve => {
|
||||
cacheCondition(cbParam => {
|
||||
@ -139,10 +140,9 @@ export const buildViewKeyFilters = (panelItems, result) => {
|
||||
})
|
||||
return result
|
||||
}
|
||||
export const buildFilterMap = panelItems => {
|
||||
export const buildFilterMap = (panelItems, isEdit = false) => {
|
||||
let result = buildViewKeyMap(panelItems)
|
||||
|
||||
result = buildViewKeyFilters(panelItems, result)
|
||||
result = buildViewKeyFilters(panelItems, result, isEdit)
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,16 @@
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item
|
||||
v-if="chart.type ==='scatter' && chart.render === 'antv'"
|
||||
icon="el-icon-edit-outline"
|
||||
divided
|
||||
:command="beforeClickItem('rename')"
|
||||
>
|
||||
<span>{{ $t('chart.show_name_set') }}</span>
|
||||
</el-dropdown-item>
|
||||
|
||||
<el-dropdown-item
|
||||
icon="el-icon-delete"
|
||||
divided
|
||||
@ -215,7 +225,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getItemType } from '@/views/chart/components/dragItem/utils'
|
||||
import { getItemType, getOriginFieldName } from '@/views/chart/components/dragItem/utils'
|
||||
import FieldErrorTips from '@/views/chart/components/dragItem/components/FieldErrorTips'
|
||||
import bus from '@/utils/bus'
|
||||
|
||||
@ -288,6 +298,9 @@ export default {
|
||||
return
|
||||
}
|
||||
switch (param.type) {
|
||||
case 'rename':
|
||||
this.showRename()
|
||||
break
|
||||
case 'remove':
|
||||
this.removeItem()
|
||||
break
|
||||
@ -353,6 +366,12 @@ export default {
|
||||
},
|
||||
getItemTagType() {
|
||||
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
|
||||
},
|
||||
showRename() {
|
||||
this.item.index = this.index
|
||||
this.item.renameType = 'extStack'
|
||||
this.item.dsFieldName = getOriginFieldName(this.dimensionData, this.quotaData, this.item)
|
||||
this.$emit('onNameEdit', this.item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
})
|
||||
|
@ -183,6 +183,7 @@
|
||||
class="item-dimension father group-dimension"
|
||||
@click.exact="singleSelect(index, dimensionData, selectedDimension, 'lastDimensionIndex')"
|
||||
@click.ctrl="multiSelect(index, dimensionData, selectedDimension, 'lastDimensionIndex')"
|
||||
@click.meta="multiSelect(index, dimensionData, selectedDimension, 'lastDimensionIndex')"
|
||||
@click.shift="rangeSelect(index, dimensionData, selectedDimension, 'lastDimensionIndex')"
|
||||
>
|
||||
<svg-icon
|
||||
@ -265,6 +266,7 @@
|
||||
class="item-quota father group-quota"
|
||||
@click.exact="singleSelect(index, quotaData, selectedQuota, 'lastQuotaIndex')"
|
||||
@click.ctrl="multiSelect(index, quotaData, selectedQuota, 'lastQuotaIndex')"
|
||||
@click.meta="multiSelect(index, quotaData, selectedQuota, 'lastQuotaIndex')"
|
||||
@click.shift="rangeSelect(index, quotaData, selectedQuota, 'lastQuotaIndex')"
|
||||
>
|
||||
<svg-icon
|
||||
@ -939,6 +941,7 @@
|
||||
@onItemChange="stackItemChange"
|
||||
@onItemRemove="stackItemRemove"
|
||||
@onItemCustomSort="stackItemCustomSort"
|
||||
@onNameEdit="showRename"
|
||||
/>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
@ -2545,7 +2548,7 @@ export default {
|
||||
if (equalsAny(view.type, 'chart-mix', 'bidirectional-bar')) {
|
||||
view.yaxisExt.forEach(function(ele) {
|
||||
if (!ele.chartType) {
|
||||
ele.chartType = 'bar'
|
||||
ele.chartType = view.type === 'chart-mix' ? 'line' : 'bar'
|
||||
}
|
||||
if (ele.chartId) {
|
||||
ele.summary = ''
|
||||
@ -3108,6 +3111,8 @@ export default {
|
||||
this.view.yaxisExt[this.itemForm.index].name = this.itemForm.name
|
||||
} else if (this.itemForm.renameType === 'dimensionExt') {
|
||||
this.view.xaxisExt[this.itemForm.index].name = this.itemForm.name
|
||||
} else if (this.itemForm.renameType === 'extStack') {
|
||||
this.view.extStack[this.itemForm.index].name = this.itemForm.name
|
||||
}
|
||||
this.calcData(true)
|
||||
this.closeRename()
|
||||
@ -3237,7 +3242,7 @@ export default {
|
||||
// drag
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
<template>
|
||||
<span
|
||||
style="display: inline-block;position: relative;
|
||||
z-index: 10;"
|
||||
style="display: inline-block;"
|
||||
>
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="hover"
|
||||
width="300"
|
||||
:append-to-body="!previewVisible"
|
||||
popper-class="remark-pop"
|
||||
:popper-class="previewVisible && 'remark-pop'"
|
||||
:visible-arrow="false"
|
||||
>
|
||||
<div
|
||||
@ -19,7 +18,8 @@
|
||||
<i
|
||||
slot="reference"
|
||||
class="el-icon-info"
|
||||
style="cursor: pointer;color: gray;font-size: 12px;"
|
||||
style="cursor: pointer;color: gray;font-size: 12px;position: relative;
|
||||
z-index: 10;"
|
||||
/>
|
||||
</el-popover>
|
||||
</span>
|
||||
@ -43,6 +43,8 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
.remark-style{
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
min-height: 100px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
@ -77,3 +79,16 @@ export default {
|
||||
text-align: -webkit-match-parent!important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.remark-pop {
|
||||
position: absolute !important;
|
||||
left: 10% !important;
|
||||
}
|
||||
.title-is-right {
|
||||
.remark-pop {
|
||||
left: auto !important;
|
||||
right: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -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: {
|
||||
@ -535,7 +535,7 @@ export default {
|
||||
},
|
||||
setNameIdTrans(from, to, originName, name2Auto) {
|
||||
let name2Id = originName
|
||||
const nameIdMap = [...this.dimensionData, ...this.quotaData].reduce(
|
||||
const nameIdMap = [...this.tableFields.dimensionList, ...this.tableFields.quotaList].reduce(
|
||||
(pre, next) => {
|
||||
pre[next[from]] = next[to]
|
||||
return pre
|
||||
|
@ -1269,7 +1269,7 @@ export default {
|
||||
this.$store.commit('recordSnapshot', 'sureFilter')
|
||||
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex })
|
||||
this.$store.commit('setComponentFromList', this.currentFilterCom)
|
||||
bus.$emit('reset-default-value', this.currentFilterCom.id)
|
||||
bus.$emit('reset-default-value', this.currentFilterCom)
|
||||
this.closeFilter()
|
||||
},
|
||||
reFreshComponent(component) {
|
||||
|
@ -499,6 +499,7 @@ export default {
|
||||
},
|
||||
fullscreen(newVal, oldVla) {
|
||||
// 刷新 进行重新渲染
|
||||
this.$store.commit('setPreviewVisible', newVal)
|
||||
this.showMain = false
|
||||
this.$nextTick(() => {
|
||||
this.showMain = true
|
||||
@ -936,6 +937,13 @@ export default {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.fullscreen {
|
||||
transform: translate(0) !important;
|
||||
.main_view {
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fullscreen-visual-selects {
|
||||
.VisualSelects {
|
||||
top: inherit !important;
|
||||
|
@ -999,8 +999,7 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
validator: this.isNumber,
|
||||
message: i18n.t('datasource.please_input_query_timeout'),
|
||||
trigger: 'blur'
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
dataPath: [
|
||||
@ -1168,7 +1167,11 @@ export default {
|
||||
var reg = /^\d+$/;
|
||||
isNumber = reg.test(value);
|
||||
if (!isNumber) {
|
||||
callback(new Error(i18n.t('chart.value_error')))
|
||||
callback(new Error(i18n.t('datasource.please_input_query_timeout')))
|
||||
return
|
||||
}
|
||||
if(value <= 0 || value > 300){
|
||||
callback(new Error(i18n.t('datasource.please_input_query_timeout')))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
|
@ -946,7 +946,7 @@ export default {
|
||||
this.tData.forEach((item) => {
|
||||
if (item.id === this.form.type) {
|
||||
item.children.forEach((child) => {
|
||||
if (this.formType === 'modify' && child.id === this.form.id) {
|
||||
if (child.id === this.form.id) {
|
||||
return
|
||||
}
|
||||
const configuration = JSON.parse(child.configuration)
|
||||
|
@ -84,6 +84,18 @@
|
||||
>{{ $t('components.day') }}</template></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:label="$t('system_parameter_setting.ds_sync_log_retention_time')"
|
||||
prop="logTimeOut"
|
||||
>
|
||||
<el-input
|
||||
v-model="formInline.dsSyncLogTimeOut"
|
||||
:placeholder="$t('system_parameter_setting.empty_msg')"
|
||||
><template
|
||||
slot="append"
|
||||
>{{ $t('components.day') }}</template></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('system_parameter_setting.ds_check_time')">
|
||||
<el-form
|
||||
:inline="true"
|
||||
@ -284,6 +296,13 @@ export default {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
dsSyncLogTimeOut: [
|
||||
{
|
||||
pattern: '^([1-9]|[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-5])$',
|
||||
message: this.$t('system_parameter_setting.msg_error'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
limitTimes: [
|
||||
|
||||
{ validator: this.validateNumber, trigger: 'blur' }
|
||||
@ -404,6 +423,12 @@ export default {
|
||||
type: 'text',
|
||||
sort: 2
|
||||
},
|
||||
{
|
||||
paramKey: 'basic.dsSyncLogTimeOut',
|
||||
paramValue: this.formInline.dsSyncLogTimeOut,
|
||||
type: 'text',
|
||||
sort: 2
|
||||
},
|
||||
{
|
||||
paramKey: 'basic.loginType',
|
||||
paramValue: this.formInline.loginType,
|
||||
|
@ -4,6 +4,7 @@ package io.dataease.plugins.datasource.dm.query;
|
||||
|
||||
import io.dataease.plugins.common.constants.datasource.SQLConstants;
|
||||
|
||||
import static io.dataease.plugins.common.constants.DatasourceTypes.mysql;
|
||||
import static io.dataease.plugins.common.constants.DatasourceTypes.oracle;
|
||||
|
||||
public class DmConstants extends SQLConstants {
|
||||
|
@ -9,7 +9,7 @@ public class KylinConstants extends SQLConstants {
|
||||
|
||||
public static final String KEYWORD_FIX = "%s." + "%s";
|
||||
|
||||
|
||||
public static final String ALIAS_FIX = "%s";
|
||||
public static final String CAST = "CAST(%s AS %s)";
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
@ -11,6 +11,7 @@ public class MaxConstants extends SQLConstants {
|
||||
|
||||
public static final String KEYWORD_FIX = "%s." + "%s";
|
||||
|
||||
public static final String ALIAS_FIX = "%s";
|
||||
public static final String UNIX_TIMESTAMP = "TO_MILLIS(%s)";
|
||||
|
||||
public static final String DATE_FORMAT = "to_char(%s, '%s')";
|
||||
|
@ -11,6 +11,7 @@ public class PrestoConstants extends SQLConstants {
|
||||
|
||||
public static final String KEYWORD_FIX = "%s." + "%s";
|
||||
|
||||
public static final String ALIAS_FIX = "%s";
|
||||
public static final String UNIX_TIMESTAMP = "to_unixtime(%s)";
|
||||
|
||||
public static final String FROM_UNIXTIME = "from_unixtime(%s)";
|
||||
|
@ -289,7 +289,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -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,17 +298,27 @@ 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) {
|
||||
this.$emit('plugin-call-back', {
|
||||
@ -336,6 +360,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) {
|
||||
@ -360,7 +395,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
@ -388,8 +423,8 @@ export default {
|
||||
newItems = groupDie ? this.selectedDimension : this.selectedQuota
|
||||
}
|
||||
const preIds = list
|
||||
.filter((_, i) => i < e.newDraggableIndex || i >= e.newDraggableIndex + newItems.length)
|
||||
.map(i => i.id)
|
||||
.filter((_, i) => i < e.newDraggableIndex || i >= e.newDraggableIndex + newItems.length)
|
||||
.map(i => i.id)
|
||||
// 倒序删除
|
||||
for (let i = e.newDraggableIndex + newItems.length - 1; i >= e.newDraggableIndex; i--) {
|
||||
if (preIds.includes(list[i].id)) {
|
||||
|
@ -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) => {
|
||||
return _index < yaxisCount;
|
||||
}), (t, _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) => {
|
||||
names.push(t.name);
|
||||
|
||||
const _labelSetting = _.cloneDeep(labelSetting);
|
||||
if (_labelSetting && yaxisList[_index].formatterCfg) {
|
||||
_labelSetting.formatter = function (x) {
|
||||
return valueFormatter(x.value, yaxisList[_index].formatterCfg);
|
||||
}
|
||||
return map(t.data, (v) => {
|
||||
return {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: join(map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
name: t.name,
|
||||
i: _index,
|
||||
t: 'yaxis'
|
||||
}
|
||||
});
|
||||
}
|
||||
) : [];
|
||||
|
||||
names.push(t.name);
|
||||
const yData = [this.getYData(flatten(yChartData), labelSetting, labelPosition, yaxisList, colors, gradient, alpha, xAxis, yAxis, yaxisExtList.length)];
|
||||
|
||||
const _chartType = this.getChartType(yaxisList[_index].chartType);
|
||||
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) => {
|
||||
names.push(t.name);
|
||||
|
||||
if (_labelSetting) {
|
||||
if (_chartType === "column") {
|
||||
_labelSetting.position = labelPosition;
|
||||
} else {
|
||||
_labelSetting.position = undefined;
|
||||
}
|
||||
return map(t.data, (v) => {
|
||||
return {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: join(map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
name: t.name,
|
||||
i: _index,
|
||||
t: 'yaxisExt'
|
||||
}
|
||||
})
|
||||
}
|
||||
) : [];
|
||||
|
||||
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 {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: _.join(_.map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
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) => {
|
||||
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 {
|
||||
quotaList: v.quotaList,
|
||||
dimensionList: v.dimensionList,
|
||||
key: _.join(_.map(v.dimensionList, (d) => d.value), "\n"),
|
||||
value: v.value,
|
||||
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) {
|
||||
|
@ -387,7 +387,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ export default {
|
||||
},
|
||||
dragCheckType(list, type) {
|
||||
if (list && list.length > 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i].groupType !== type) {
|
||||
list.splice(i, 1)
|
||||
}
|
||||
|
@ -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