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

This commit is contained in:
wangjiahao 2021-07-28 17:47:56 +08:00
commit e10579cb57
12 changed files with 66 additions and 77 deletions

View File

@ -185,7 +185,7 @@ public class DorisQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()
@ -283,7 +283,7 @@ public class DorisQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()

View File

@ -175,7 +175,7 @@ public class MysqlQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()
@ -274,7 +274,7 @@ public class MysqlQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()

View File

@ -210,7 +210,7 @@ public class OracleQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()
@ -308,7 +308,7 @@ public class OracleQueryProvider extends QueryProvider {
// 处理横轴字段 // 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias)); xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤 // 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias)); // xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序 // 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) { if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder() xOrders.add(SQLObj.builder()

View File

@ -267,6 +267,9 @@ public class ExtractDataService {
}); });
String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields); String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields);
boolean msg = false;
JobStatus jobStatus = JobStatus.Completed;
Long execTime = null;
switch (updateType) { switch (updateType) {
case all_scope: // 全量更新 case all_scope: // 全量更新
try { try {
@ -281,29 +284,22 @@ public class ExtractDataService {
} else { } else {
generateJobFile("all_scope", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList()))); generateJobFile("all_scope", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList())));
} }
Long execTime = System.currentTimeMillis(); execTime = System.currentTimeMillis();
extractData(datasetTable, "all_scope"); extractData(datasetTable, "all_scope");
replaceTable(DorisTableUtils.dorisName(datasetTableId)); replaceTable(DorisTableUtils.dorisName(datasetTableId));
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
msg = true;
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, true); jobStatus = JobStatus.Completed;
deleteFile("all_scope", datasetTableId);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
} catch (Exception e) { } catch (Exception e) {
saveErrorLog(datasetTableId, taskId, e); saveErrorLog(datasetTableId, taskId, e);
msg = false;
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error); jobStatus = JobStatus.Error;
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
deleteFile("all_scope", datasetTableId);
} finally { } finally {
try { deleteFile("all_scope", datasetTableId); }catch (Exception ignore){}
try { sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, msg); }catch (Exception ignore){}
try { dataSetTableTaskService.updateTaskStatus(datasetTableTask, jobStatus); }catch (Exception ignore){}
try { updateTableStatus(datasetTableId, datasetTable, jobStatus, execTime); }catch (Exception ignore){}
try { dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId))); }catch (Exception ignore){}
} }
break; break;
@ -323,7 +319,7 @@ public class ExtractDataService {
if (datasetTableTask == null ) { if (datasetTableTask == null ) {
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableId, taskId); datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableId, taskId);
} }
Long execTime = System.currentTimeMillis(); execTime = System.currentTimeMillis();
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加 if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString()) String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()); .replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
@ -341,28 +337,17 @@ public class ExtractDataService {
} }
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,true); msg = true;
jobStatus = JobStatus.Completed;
deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
} catch (Exception e) { } catch (Exception e) {
saveErrorLog(datasetTableId, taskId, e); saveErrorLog(datasetTableId, taskId, e);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false); msg = false;
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null); jobStatus = JobStatus.Error;
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId);
} finally { } finally {
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) { try { deleteFile("incremental_add", datasetTableId); deleteFile("incremental_delete", datasetTableId); }catch (Exception ignore){}
datasetTableTask.setStatus(TaskStatus.Stopped.name()); try { sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, msg); }catch (Exception ignore){}
dataSetTableTaskService.update(datasetTableTask); try { dataSetTableTaskService.updateTaskStatus(datasetTableTask, jobStatus); }catch (Exception ignore){}
} try { updateTableStatus(datasetTableId, datasetTable, jobStatus, execTime); }catch (Exception ignore){}
} }
break; break;
} }

View File

@ -0,0 +1 @@
UPDATE `chart_view` SET `custom_filter` = '[]';

View File

@ -1,4 +1,3 @@
ALTER TABLE `chart_view` ADD COLUMN `ext_stack` LONGTEXT COMMENT '堆叠项' AFTER `y_axis`; ALTER TABLE `chart_view` ADD COLUMN `ext_stack` LONGTEXT COMMENT '堆叠项' AFTER `y_axis`;
UPDATE `chart_view` SET `ext_stack` = '[]'; UPDATE `chart_view` SET `ext_stack` = '[]';
UPDATE `chart_view` SET `custom_filter` = '[]';

View File

@ -507,14 +507,20 @@
<!--编辑视图使用的数据集的字段--> <!--编辑视图使用的数据集的字段-->
<el-dialog <el-dialog
v-dialogDrag
:visible="editDsField" :visible="editDsField"
:show-close="false" :show-close="false"
class="dialog-css" class="dialog-css"
:destroy-on-close="true" :destroy-on-close="true"
:fullscreen="true" :fullscreen="true"
> >
<field-edit :param="table" @switchComponent="closeEditDsField" /> <field-edit :param="table" />
<div slot="title" class="dialog-footer">
<span style="font-size: 14px;">
{{ $t('dataset.field_manage') }}
<span v-if="table">[{{ table.name }}]</span>
</span>
<el-button size="mini" style="float: right;" @click="closeEditDsField">{{ $t('chart.close') }}</el-button>
</div>
</el-dialog> </el-dialog>
</el-row> </el-row>
</template> </template>

View File

@ -270,7 +270,7 @@ export default {
type: 'excel', type: 'excel',
mode: parseInt(this.mode), mode: parseInt(this.mode),
// info: '{"data":"' + this.path + '"}', // info: '{"data":"' + this.path + '"}',
info: JSON.stringify({ data: this.path }), info: JSON.stringify({ data: this.path, sheets: [this.sheets[0]] }),
editType: this.param.editType ? this.param.editType : 0 editType: this.param.editType ? this.param.editType : 0
} }
} }

View File

@ -16,7 +16,7 @@
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="addCalcField">{{ $t('dataset.add_calc_field') }}</el-button> <el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="addCalcField">{{ $t('dataset.add_calc_field') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item class="form-item" style="float: right;"> <el-form-item class="form-item" style="float: right;margin-right: 0;">
<el-input <el-input
v-model="searchField" v-model="searchField"
size="mini" size="mini"
@ -241,6 +241,7 @@
class="dialog-css" class="dialog-css"
:destroy-on-close="true" :destroy-on-close="true"
:title="$t('dataset.add_calc_field')" :title="$t('dataset.add_calc_field')"
append-to-body
> >
<calc-field-edit :param="param" :table-fields="tableFields" /> <calc-field-edit :param="param" :table-fields="tableFields" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -324,10 +325,6 @@ export default {
}) })
}, },
closeEdit() {
this.$emit('switchComponent', { name: 'ViewTable', param: this.param })
},
dqTrans(item, val) { dqTrans(item, val) {
if (val === 'd') { if (val === 'd') {
item.groupType = 'q' item.groupType = 'q'

View File

@ -1,7 +1,7 @@
<template> <template>
<el-col> <el-col>
<el-row> <el-row>
<el-button v-if="hasDataPermission('manage',param.privileges) || table.type !== 'excel'" icon="el-icon-setting" size="mini" @click="showConfig"> <el-button v-if="hasDataPermission('manage',param.privileges) && table.type !== 'excel'" icon="el-icon-setting" size="mini" @click="showConfig">
{{ $t('dataset.update_setting') }} {{ $t('dataset.update_setting') }}
</el-button> </el-button>
<el-button icon="el-icon-refresh" size="mini" @click="refreshLog"> <el-button icon="el-icon-refresh" size="mini" @click="refreshLog">
@ -96,7 +96,7 @@
append-to-body append-to-body
> >
<el-col> <el-col>
<el-form ref="taskForm" :form="taskForm" :model="taskForm" label-width="100px" size="mini" :rules="taskFormRules"> <el-form :form="taskForm" :model="taskForm" label-width="100px" size="mini" ref="taskForm" :rules="taskFormRules">
<el-form-item :label="$t('dataset.task_name')" prop="name"> <el-form-item :label="$t('dataset.task_name')" prop="name">
<el-input <el-input
v-model="taskForm.name" v-model="taskForm.name"
@ -143,15 +143,15 @@
<el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label=""> <el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label="">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item :label="$t('cron.every')"> <el-form-item :label="$t('cron.every')" >
<el-input v-model="taskForm.extraData.simple_cron_value" size="mini" type="number" min="1" @change="onSimpleCronChange()" /> <el-input v-model="taskForm.extraData.simple_cron_value" size="mini" type="number" min="1" @change="onSimpleCronChange()" />
</el-form-item> </el-form-item>
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()"> <el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()" >
<el-option :label="$t('cron.minute')" value="minute" /> <el-option :label="$t('cron.minute_default')" value="minute" />
<el-option :label="$t('cron.hour')" value="hour" /> <el-option :label="$t('cron.hour_default')" value="hour" />
<el-option :label="$t('cron.day')" value="day" /> <el-option :label="$t('cron.day_default')" value="day" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="form-item" :label="$t('cron.every_exec')" /> <el-form-item class="form-item" :label="$t('cron.every_exec')" />
@ -534,7 +534,7 @@ export default {
} }
this.incrementalConfig.tableId = this.table.id this.incrementalConfig.tableId = this.table.id
let startTime = new Date(task.startTime).getTime() let startTime = new Date(task.startTime).getTime()
if (startTime < new Date().getTime()) { if(startTime < new Date().getTime()){
startTime = new Date().getTime() startTime = new Date().getTime()
} }
task.startTime = startTime task.startTime = startTime
@ -558,9 +558,10 @@ export default {
this.listTask() this.listTask()
this.listTaskLog() this.listTaskLog()
}) })
} else { }else {
return false return false
} }
}) })
}, },
deleteTask(task) { deleteTask(task) {
@ -588,27 +589,27 @@ export default {
}, },
onSimpleCronChange() { onSimpleCronChange() {
if (this.taskForm.extraData.simple_cron_type === 'minute') { if (this.taskForm.extraData.simple_cron_type === 'minute') {
if (this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 59) { if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 59){
this.$message({ message: this.$t('cron.minute_limit'), type: 'warning', showClose: true }) this.$message({message: this.$t('cron.minute_limit'), type: 'warning', showClose: true})
this.taskForm.extraData.simple_cron_value = 59 this.taskForm.extraData.simple_cron_value = 59
} }
this.taskForm.cron = '0 0/' + this.taskForm.extraData.simple_cron_value + ' * * * ? *' this.taskForm.cron = '0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * * ? *'
return return
} }
if (this.taskForm.extraData.simple_cron_type === 'hour') { if (this.taskForm.extraData.simple_cron_type === 'hour') {
if (this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 23) { if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 23){
this.$message({ message: this.$t('cron.hour_limit'), type: 'warning', showClose: true }) this.$message({message: this.$t('cron.hour_limit'), type: 'warning', showClose: true})
this.taskForm.extraData.simple_cron_value = 23 this.taskForm.extraData.simple_cron_value = 23
} }
this.taskForm.cron = '0 0 0/' + this.taskForm.extraData.simple_cron_value + ' * * ? *' this.taskForm.cron = '0 0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * ? *'
return return
} }
if (this.taskForm.extraData.simple_cron_type === 'day') { if (this.taskForm.extraData.simple_cron_type === 'day') {
if (this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 31) { if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 31){
this.$message({ message: this.$t('cron.day_limit'), type: 'warning', showClose: true }) this.$message({message: this.$t('cron.day_limit'), type: 'warning', showClose: true})
this.taskForm.extraData.simple_cron_value = 31 this.taskForm.extraData.simple_cron_value = 31
} }
this.taskForm.cron = '0 0 0 1/' + this.taskForm.extraData.simple_cron_value + ' * ? *' this.taskForm.cron = '0 0 0 1/'+ this.taskForm.extraData.simple_cron_value + ' * ? *'
return return
} }
}, },
@ -618,15 +619,15 @@ export default {
this.taskForm.endTime = '' this.taskForm.endTime = ''
this.taskForm.cron = '' this.taskForm.cron = ''
} }
if (this.taskForm.rate === 'SIMPLE_CRON') { if (this.taskForm.rate === 'SIMPLE_CRON'){
this.taskForm.cron = '0 0 0/1 * * ? *' this.taskForm.cron = '0 0 0/1 * * ? *'
} }
if (this.taskForm.rate === 'CRON') { if (this.taskForm.rate === 'CRON'){
this.taskForm.cron = '00 00 * ? * * *' this.taskForm.cron = '00 00 * ? * * *'
} }
}, },
listTaskLog(loading = true) { listTaskLog(loading = true) {
const params = { 'conditions': [{ 'field': 'dataset_table_task_log.table_id', 'operator': 'eq', 'value': this.table.id }], 'orders': [] } const params = {"conditions":[{"field":"dataset_table_task_log.table_id","operator":"eq","value": this.table.id}],"orders":[]}
post('/dataset/taskLog/list/' + this.table.type + '/' + this.page.currentPage + '/' + this.page.pageSize, params, loading).then(response => { post('/dataset/taskLog/list/' + this.table.type + '/' + this.page.currentPage + '/' + this.page.pageSize, params, loading).then(response => {
this.taskLogData = response.data.listObject this.taskLogData = response.data.listObject
this.page.total = response.data.itemCount this.page.total = response.data.itemCount

View File

@ -93,7 +93,7 @@ export default {
rule: { rule: {
username: [ username: [
{ required: true, message: this.$t('user.input_id'), trigger: 'blur' }, { required: true, message: this.$t('user.input_id'), trigger: 'blur' },
{ min: 1, max: 50, message: this.$t('commons.input_limit', [1, 50]), trigger: 'blur' }, { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
{ {
required: true, required: true,
pattern: '^[^\u4e00-\u9fa5]+$', pattern: '^[^\u4e00-\u9fa5]+$',
@ -103,7 +103,7 @@ export default {
], ],
nickName: [ nickName: [
{ required: true, message: this.$t('user.input_name'), trigger: 'blur' }, { required: true, message: this.$t('user.input_name'), trigger: 'blur' },
{ min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur' }, { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
{ {
required: true, required: true,
message: this.$t('user.special_characters_are_not_supported'), message: this.$t('user.special_characters_are_not_supported'),