Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangjiahao 2022-06-22 21:38:15 +08:00
commit dcb1dab5ad
14 changed files with 87 additions and 18 deletions

View File

@ -533,7 +533,7 @@ public class DataSetTableService {
.checked(Boolean.TRUE).build(); .checked(Boolean.TRUE).build();
List<DatasetTableField> fields = dataSetTableFieldsService.list(datasetTableField); List<DatasetTableField> fields = dataSetTableFieldsService.list(datasetTableField);
if (CollectionUtils.isNotEmpty(extFields)) { if (CollectionUtils.isNotEmpty(extFields)) {
fields.addAll(extFields); fields = extFields;
} }
if (CollectionUtils.isEmpty(fields)) { if (CollectionUtils.isEmpty(fields)) {
map.put("fields", fields); map.put("fields", fields);
@ -749,7 +749,7 @@ public class DataSetTableService {
conditionEntities.add(entity2); conditionEntities.add(entity2);
request.setConditions(conditionEntities); request.setConditions(conditionEntities);
List<DataSetTaskLogDTO> dataSetTaskLogDTOS = dataSetTableTaskLogService.listTaskLog(request, "excel"); List<DataSetTaskLogDTO> dataSetTaskLogDTOS = dataSetTableTaskLogService.listTaskLog(request, "excel");
if(CollectionUtils.isNotEmpty(dataSetTaskLogDTOS)){ if (CollectionUtils.isNotEmpty(dataSetTaskLogDTOS)) {
dataSetTaskLogDTOS.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name()); dataSetTaskLogDTOS.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name());
sycnStatus = dataSetTaskLogDTOS.get(0).getStatus(); sycnStatus = dataSetTaskLogDTOS.get(0).getStatus();
} }
@ -943,14 +943,15 @@ public class DataSetTableService {
List<SqlVariableDetails> sqlVariableDetails = new ArrayList<>(); List<SqlVariableDetails> sqlVariableDetails = new ArrayList<>();
datasetTables.forEach(datasetTable -> { datasetTables.forEach(datasetTable -> {
if (StringUtils.isNotEmpty(datasetTable.getSqlVariableDetails())) { if (StringUtils.isNotEmpty(datasetTable.getSqlVariableDetails())) {
sqlVariableDetails.addAll(new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {}.getType())); sqlVariableDetails.addAll(new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {
}.getType()));
} }
}); });
return sqlVariableDetails; return sqlVariableDetails;
} }
public String handleVariableDefaultValue(String sql, String sqlVariableDetails){ public String handleVariableDefaultValue(String sql, String sqlVariableDetails) {
if (StringUtils.isEmpty(sql)) { if (StringUtils.isEmpty(sql)) {
DataEaseException.throwException(Translator.get("i18n_sql_not_empty")); DataEaseException.throwException(Translator.get("i18n_sql_not_empty"));
} }
@ -958,7 +959,8 @@ public class DataSetTableService {
Matcher matcher = pattern.matcher(sql); Matcher matcher = pattern.matcher(sql);
while (matcher.find()) { while (matcher.find()) {
SqlVariableDetails defaultsSqlVariableDetail = null; SqlVariableDetails defaultsSqlVariableDetail = null;
List<SqlVariableDetails> defaultsSqlVariableDetails = new Gson().fromJson(sqlVariableDetails, new TypeToken<List<SqlVariableDetails>>() {}.getType()); List<SqlVariableDetails> defaultsSqlVariableDetails = new Gson().fromJson(sqlVariableDetails, new TypeToken<List<SqlVariableDetails>>() {
}.getType());
for (SqlVariableDetails sqlVariableDetail : defaultsSqlVariableDetails) { for (SqlVariableDetails sqlVariableDetail : defaultsSqlVariableDetails) {
if (matcher.group().substring(2, matcher.group().length() - 1).equalsIgnoreCase(sqlVariableDetail.getVariableName())) { if (matcher.group().substring(2, matcher.group().length() - 1).equalsIgnoreCase(sqlVariableDetail.getVariableName())) {
defaultsSqlVariableDetail = sqlVariableDetail; defaultsSqlVariableDetail = sqlVariableDetail;
@ -969,11 +971,11 @@ public class DataSetTableService {
sql = sql.replace(matcher.group(), defaultsSqlVariableDetail.getDefaultValue()); sql = sql.replace(matcher.group(), defaultsSqlVariableDetail.getDefaultValue());
} }
} }
try { try {
sql = removeVariables(sql); sql = removeVariables(sql);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return sql; return sql;
} }
@ -985,7 +987,7 @@ public class DataSetTableService {
hasVariables = true; hasVariables = true;
sql = sql.replace(matcher.group(), SubstitutedParams); sql = sql.replace(matcher.group(), SubstitutedParams);
} }
if(!hasVariables){ if (!hasVariables) {
return sql; return sql;
} }
CCJSqlParserUtil.parse(sql, parser -> parser.withSquareBracketQuotation(true)); CCJSqlParserUtil.parse(sql, parser -> parser.withSquareBracketQuotation(true));
@ -993,15 +995,15 @@ public class DataSetTableService {
Select select = (Select) statement; Select select = (Select) statement;
PlainSelect plainSelect = ((PlainSelect) select.getSelectBody()); PlainSelect plainSelect = ((PlainSelect) select.getSelectBody());
Expression expr = plainSelect.getWhere(); Expression expr = plainSelect.getWhere();
if(expr == null){ if (expr == null) {
return sql; return sql;
} }
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
BinaryExpression binaryExpression = (BinaryExpression)expr; BinaryExpression binaryExpression = (BinaryExpression) expr;
if(!(binaryExpression.getLeftExpression() instanceof BinaryExpression) && !(binaryExpression.getRightExpression() instanceof BinaryExpression) && hasVarible(binaryExpression.toString())){ if (!(binaryExpression.getLeftExpression() instanceof BinaryExpression) && !(binaryExpression.getRightExpression() instanceof BinaryExpression) && hasVarible(binaryExpression.toString())) {
stringBuilder.append(SubstitutedSql); stringBuilder.append(SubstitutedSql);
}else { } else {
expr.accept(getExpressionDeParser(stringBuilder)); expr.accept(getExpressionDeParser(stringBuilder));
} }
plainSelect.setWhere(CCJSqlParserUtil.parseCondExpression(stringBuilder.toString())); plainSelect.setWhere(CCJSqlParserUtil.parseCondExpression(stringBuilder.toString()));
@ -2626,6 +2628,7 @@ public class DataSetTableService {
}; };
return expressionDeParser; return expressionDeParser;
} }
static private boolean hasVarible(String sql) { static private boolean hasVarible(String sql) {
return sql.contains(SubstitutedParams); return sql.contains(SubstitutedParams);
} }

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '../util.js' import { hexColorToRGBA } from '../util.js'
import { componentStyle, seniorCfg } from '../common/common' import { componentStyle, seniorCfg } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseBarOption(chart_option, chart) { export function baseBarOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -15,6 +16,10 @@ export function baseBarOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data
@ -77,6 +82,10 @@ export function horizontalBarOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -102,7 +102,8 @@ export const DEFAULT_TOOLTIP = {
fontSize: '10', fontSize: '10',
color: '#909399' color: '#909399'
}, },
formatter: '' formatter: '',
backgroundColor: '#ffffff'
} }
export const DEFAULT_TOTAL = { export const DEFAULT_TOTAL = {
row: { row: {

View File

@ -11,7 +11,7 @@ export function getPadding(chart) {
// color,label,tooltip,axis,legend,background // color,label,tooltip,axis,legend,background
export function getTheme(chart) { export function getTheme(chart) {
const colors = [] const colors = []
let bgColor, labelFontsize, labelColor, tooltipColor, tooltipFontsize, legendColor, legendFontsize let bgColor, labelFontsize, labelColor, tooltipColor, tooltipFontsize, tooltipBackgroundColor, legendColor, legendFontsize
let customAttr = {} let customAttr = {}
if (chart.customAttr) { if (chart.customAttr) {
customAttr = JSON.parse(chart.customAttr) customAttr = JSON.parse(chart.customAttr)
@ -33,6 +33,7 @@ export function getTheme(chart) {
const t = JSON.parse(JSON.stringify(customAttr.tooltip)) const t = JSON.parse(JSON.stringify(customAttr.tooltip))
tooltipColor = t.textStyle.color tooltipColor = t.textStyle.color
tooltipFontsize = t.textStyle.fontSize tooltipFontsize = t.textStyle.fontSize
tooltipBackgroundColor = t.backgroundColor
} }
} }
@ -84,7 +85,8 @@ export function getTheme(chart) {
domStyles: { domStyles: {
'g2-tooltip': { 'g2-tooltip': {
color: tooltipColor, color: tooltipColor,
fontSize: tooltipFontsize + 'px' fontSize: tooltipFontsize + 'px',
background: tooltipBackgroundColor
} }
} }
}, },

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseFunnelOption(chart_option, chart) { export function baseFunnelOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -15,6 +16,10 @@ export function baseFunnelOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle, seniorCfg } from '../common/common' import { componentStyle, seniorCfg } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseLineOption(chart_option, chart) { export function baseLineOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -15,6 +16,10 @@ export function baseLineOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
// import { hexColorToRGBA } from '@/views/chart/chart/util' // import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseMapOption(chart_option, chart) { export function baseMapOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -21,6 +22,10 @@ export function baseMapOption(chart_option, chart) {
return text.replace(new RegExp('{a}', 'g'), a).replace(new RegExp('{b}', 'g'), b).replace(new RegExp('{c}', 'g'), c) return text.replace(new RegExp('{a}', 'g'), a).replace(new RegExp('{b}', 'g'), b).replace(new RegExp('{c}', 'g'), c)
} }
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle, seniorCfg } from '../common/common' import { componentStyle, seniorCfg } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseMixOption(chart_option, chart) { export function baseMixOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -16,6 +17,10 @@ export function baseMixOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function basePieOption(chart_option, chart) { export function basePieOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -15,6 +16,10 @@ export function basePieOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data
@ -63,6 +68,10 @@ export function rosePieOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseRadarOption(chart_option, chart) { export function baseRadarOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -20,6 +21,10 @@ export function baseRadarOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle, seniorCfg } from '../common/common' import { componentStyle, seniorCfg } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
let bubbleArray = [] let bubbleArray = []
let terminalType = 'pc' let terminalType = 'pc'
@ -19,6 +20,10 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -1,5 +1,6 @@
import { hexColorToRGBA } from '@/views/chart/chart/util' import { hexColorToRGBA } from '@/views/chart/chart/util'
import { componentStyle } from '../common/common' import { componentStyle } from '../common/common'
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
export function baseTreemapOption(chart_option, chart) { export function baseTreemapOption(chart_option, chart) {
// 处理shape attr // 处理shape attr
@ -15,6 +16,10 @@ export function baseTreemapOption(chart_option, chart) {
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
const bgColor = tooltip.backgroundColor ? tooltip.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
chart_option.tooltip.backgroundColor = bgColor
chart_option.tooltip.borderColor = bgColor
} }
} }
// 处理data // 处理data

View File

@ -20,6 +20,9 @@
<el-form-item v-show="showProperty('textStyle')" :label="$t('chart.text_color')" class="form-item"> <el-form-item v-show="showProperty('textStyle')" :label="$t('chart.text_color')" class="form-item">
<el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" /> <el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" />
</el-form-item> </el-form-item>
<el-form-item v-show="showProperty('textStyle')" :label="$t('chart.background')" class="form-item">
<el-color-picker v-model="tooltipForm.backgroundColor" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" />
</el-form-item>
<el-form-item v-show="showProperty('formatter')" class="form-item"> <el-form-item v-show="showProperty('formatter')" class="form-item">
<span slot="label"> <span slot="label">
<span class="span-box"> <span class="span-box">
@ -101,6 +104,8 @@ export default {
} }
if (customAttr.tooltip) { if (customAttr.tooltip) {
this.tooltipForm = customAttr.tooltip this.tooltipForm = customAttr.tooltip
this.tooltipForm.backgroundColor = this.tooltipForm.backgroundColor ? this.tooltipForm.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
} }
} }
}, },

View File

@ -14,6 +14,9 @@
<el-form-item v-show="showProperty('textStyle')" :label="$t('chart.text_color')" class="form-item"> <el-form-item v-show="showProperty('textStyle')" :label="$t('chart.text_color')" class="form-item">
<el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" /> <el-color-picker v-model="tooltipForm.textStyle.color" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" />
</el-form-item> </el-form-item>
<el-form-item v-show="showProperty('textStyle')" :label="$t('chart.background')" class="form-item">
<el-color-picker v-model="tooltipForm.backgroundColor" class="color-picker-style" :predefine="predefineColors" @change="changeTooltipAttr('textStyle')" />
</el-form-item>
</div> </div>
</el-form> </el-form>
</el-col> </el-col>
@ -73,6 +76,8 @@ export default {
} }
if (customAttr.tooltip) { if (customAttr.tooltip) {
this.tooltipForm = customAttr.tooltip this.tooltipForm = customAttr.tooltip
this.tooltipForm.backgroundColor = this.tooltipForm.backgroundColor ? this.tooltipForm.backgroundColor : DEFAULT_TOOLTIP.backgroundColor
} }
} }
}, },