Unverified 提交 051ce44e authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw 提交者: GitHub

Merge pull request #343 from dataease/pr@v1.1@fix_解决跳转任务执行记录延时

fix: 跳转任务消息延时
......@@ -29,10 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.pentaho.di.cluster.SlaveServer;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.row.ValueMetaInterface;
......@@ -66,8 +62,6 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.InetAddress;
import java.util.*;
import java.util.stream.Collectors;
......@@ -295,7 +289,7 @@ public class ExtractDataService {
replaceTable(DorisTableUtils.dorisName(datasetTableId));
saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, datasetTableTask, true);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, true);
deleteFile("all_scope", datasetTableId);
......@@ -308,7 +302,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
sendWebMsg(datasetTable, datasetTableTask, false);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
deleteFile("all_scope", datasetTableId);
......@@ -350,7 +344,7 @@ public class ExtractDataService {
}
saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, datasetTableTask, true);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,true);
deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId);
......@@ -360,7 +354,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
} catch (Exception e) {
saveErrorLog(datasetTableId, taskId, e);
sendWebMsg(datasetTable, datasetTableTask, false);
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
......@@ -381,13 +375,14 @@ public class ExtractDataService {
}
private void sendWebMsg(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Boolean status) {
private void sendWebMsg(DatasetTable datasetTable, DatasetTableTask datasetTableTask, DatasetTableTaskLog datasetTableTaskLog, Boolean status) {
String taskId = datasetTableTask.getId();
String msg = status ? "成功" : "失败";
Long typeId = status ? 5L : 6L;
String id = datasetTable.getId();
AuthURD authURD = AuthUtils.authURDR(id);
Set<Long> userIds = AuthUtils.userIdsByURD(authURD);
Gson gson = new Gson();
userIds.forEach(userId -> {
Map<String, Object> param = new HashMap<>();
......@@ -395,6 +390,10 @@ public class ExtractDataService {
if (StringUtils.isNotEmpty(taskId)) {
param.put("taskId", taskId);
}
if (ObjectUtils.isNotEmpty(datasetTableTaskLog) && StringUtils.isNotEmpty(datasetTableTaskLog.getId())) {
param.put("logId", datasetTableTaskLog.getId());
}
String content = "数据集【" + datasetTable.getName() + "】同步" + msg;
if (ObjectUtils.isNotEmpty(datasetTableTask) && ObjectUtils.isNotEmpty(datasetTableTask.getName())) {
content += " 任务名称【" + datasetTableTask.getName() + "】";
......
......@@ -181,7 +181,7 @@ public class SysMsgService {
}
public List<SysMsgSetting> defaultSettings() {
Long userId = AuthUtils.getUser().getUserId();
// Long userId = AuthUtils.getUser().getUserId();
SysMsgSetting sysMsgSetting1 = new SysMsgSetting();
sysMsgSetting1.setTypeId(2L);
sysMsgSetting1.setChannelId(1L);
......
......@@ -5,7 +5,7 @@
<el-table-column prop="name" :label="$t('dataset.task_name')">
<template slot-scope="scope">
<span>
<el-link style="font-size: 12px" @click="jumpTask(scope.row)">{{ scope.row.name }}</el-link>
<el-link :type="matchLogId && scope.row.id === matchLogId ? 'danger': ''" style="font-size: 12px" @click="jumpTask(scope.row)">{{ scope.row.name }}</el-link>
</span>
</template>
</el-table-column>
......@@ -51,17 +51,14 @@
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { post } from '@/api/dataset/dataset'
import cron from '@/components/cron/cron'
import TableSelector from '@/views/chart/view/TableSelector'
export default {
name: 'TaskRecord',
components: { ComplexTable, LayoutContent, cron, TableSelector },
components: { ComplexTable },
props: {
param: {
type: Object,
......@@ -112,7 +109,8 @@ export default {
orderConditions: [],
last_condition: null,
show_error_massage: false,
error_massage: ''
error_massage: '',
matchLogId: null
}
},
computed: {
......@@ -121,7 +119,7 @@ export default {
if (this.param == null) {
this.last_condition = {}
this.search()
} else {
} else if (this.param.name) {
this.last_condition = {
'dataset_table_task.name': {
field: 'dataset_table_task.name',
......@@ -130,6 +128,16 @@ export default {
}
}
this.search(this.last_condition)
} else if (this.param.taskId) {
this.matchLogId = this.param.logId || this.matchLogId
this.last_condition = {
'dataset_table_task.id': {
field: 'dataset_table_task.id',
operator: 'eq',
value: this.param.taskId
}
}
this.search(this.last_condition)
}
// this.timer = setInterval(() => {
......@@ -155,25 +163,25 @@ export default {
this.timer = null
}
},
msg2Current(routerParam) {
if (!routerParam || !routerParam.taskId) return
const taskId = routerParam.taskId
// console.log(taskId)
const current_condition = {
'dataset_table_task.id': {
field: 'dataset_table_task.id',
operator: 'eq',
value: taskId
}
}
// 先把定时器干掉 否则会阻塞下面的search
this.destroyTimer()
// msg2Current(routerParam) {
// if (!routerParam || !routerParam.taskId) return
// const taskId = routerParam.taskId
// // console.log(taskId)
// const current_condition = {
// 'dataset_table_task.id': {
// field: 'dataset_table_task.id',
// operator: 'eq',
// value: taskId
// }
// }
// // 先把定时器干掉 否则会阻塞下面的search
// this.destroyTimer()
this.search(current_condition)
// this.search(current_condition)
// 查询完再开启定时器
this.createTimer()
},
// // 查询完再开启定时器
// this.createTimer()
// },
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {
......@@ -209,6 +217,12 @@ export default {
},
jumpTask(item) {
this.$emit('jumpTask', item)
},
rowClassMethod({ row, rowIndex }) {
if (this.matchLogId && this.matchLogId === row.id) {
return 'row-match-class'
}
return ''
}
}
}
......
......@@ -17,17 +17,14 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import UnionView from '@/views/dataset/data/UnionView'
import UpdateInfo from '@/views/dataset/data/UpdateInfo'
import DatasetTaskList from '@/views/system/task/DatasetTaskList'
import TaskRecord from '@/views/system/task/TaskRecord'
import TabDataPreview from '@/views/dataset/data/TabDataPreview'
import DatasetTableData from '@/views/dataset/common/DatasetTableData'
import bus from '@/utils/bus'
import { mapGetters } from 'vuex'
export default {
components: { DatasetTableData, LayoutContent, ComplexTable, UnionView, UpdateInfo, TabDataPreview, DatasetTaskList, TaskRecord },
components: { LayoutContent, DatasetTaskList, TaskRecord },
data() {
return {
task: null,
......@@ -74,9 +71,12 @@ export default {
try {
const msgParam = JSON.parse(routerParam.sourceParam)
// this.param = msgParam.tableId
this.tabActive = 'TaskRecord'
this.$nextTick(() => {
this.$refs.task_record && this.$refs.task_record.msg2Current && this.$refs.task_record.msg2Current(msgParam)
// 目标组件存在定时器 这种方式会被定时器阻塞
// this.$refs.task_record && this.$refs.task_record.msg2Current && this.$refs.task_record.msg2Current(msgParam)
this.task = msgParam
this.tabActive = 'TaskRecord'
})
} catch (error) {
console.error(error)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论