fix: 合并冲突解决

This commit is contained in:
fit2cloud-chenyw 2021-07-23 12:20:15 +08:00
parent f1e3621fac
commit bc06646e32

View File

@ -24,8 +24,8 @@ import io.dataease.provider.QueryProvider;
import io.dataease.service.message.DeMsgutil; import io.dataease.service.message.DeMsgutil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
@ -302,7 +302,7 @@ public class ExtractDataService {
replaceTable(DorisTableUtils.dorisName(datasetTableId)); replaceTable(DorisTableUtils.dorisName(datasetTableId));
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, taskId,true); sendWebMsg(datasetTable, datasetTableTask, true);
deleteFile("all_scope", datasetTableId); deleteFile("all_scope", datasetTableId);
@ -315,7 +315,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
sendWebMsg(datasetTable, taskId,false); sendWebMsg(datasetTable, datasetTableTask, false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null); updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId))); dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
deleteFile("all_scope", datasetTableId); deleteFile("all_scope", datasetTableId);
@ -360,7 +360,7 @@ public class ExtractDataService {
} }
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, taskId,true); sendWebMsg(datasetTable, datasetTableTask, true);
deleteFile("incremental_add", datasetTableId); deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId); deleteFile("incremental_delete", datasetTableId);
@ -370,7 +370,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
} catch (Exception e) { } catch (Exception e) {
saveErrorLog(datasetTableId, taskId, e); saveErrorLog(datasetTableId, taskId, e);
sendWebMsg(datasetTable, taskId,false); sendWebMsg(datasetTable, datasetTableTask, false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null); updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
@ -395,7 +395,8 @@ public class ExtractDataService {
} }
private void sendWebMsg(DatasetTable datasetTable, String taskId, Boolean status) { private void sendWebMsg(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Boolean status) {
String taskId = datasetTableTask.getId();
String msg = status ? "成功" : "失败"; String msg = status ? "成功" : "失败";
Long typeId = status ? 5L : 6L; Long typeId = status ? 5L : 6L;
String id = datasetTable.getId(); String id = datasetTable.getId();
@ -408,7 +409,11 @@ public class ExtractDataService {
if (StringUtils.isNotEmpty(taskId)) { if (StringUtils.isNotEmpty(taskId)) {
param.put("taskId", taskId); param.put("taskId", taskId);
} }
DeMsgutil.sendMsg(userId, typeId, 1L, "数据集【"+datasetTable.getName()+"】同步"+msg, gson.toJson(param)); String content = "数据集【" + datasetTable.getName() + "】同步" + msg;
if (ObjectUtils.isNotEmpty(datasetTableTask) && ObjectUtils.isNotEmpty(datasetTableTask.getName())) {
content += " 任务名称【" + datasetTableTask.getName() + "";
}
DeMsgutil.sendMsg(userId, typeId, 1L, content, gson.toJson(param));
}); });
} }
@ -499,7 +504,8 @@ public class ExtractDataService {
datasourceRequest.setDatasource(dorisDatasource); datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery(dropTableSql.replace("TABLE_NAME", dorisTableName)); datasourceRequest.setQuery(dropTableSql.replace("TABLE_NAME", dorisTableName));
jdbcProvider.exec(datasourceRequest); jdbcProvider.exec(datasourceRequest);
}catch (Exception ignore){} } catch (Exception ignore) {
}
} }
private void replaceTable(String dorisTableName) throws Exception { private void replaceTable(String dorisTableName) throws Exception {
@ -518,7 +524,8 @@ public class ExtractDataService {
if (datasetTable == null) { if (datasetTable == null) {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
}catch (Exception ignore){} } catch (Exception ignore) {
}
} else { } else {
return datasetTable; return datasetTable;
} }
@ -552,7 +559,8 @@ public class ExtractDataService {
} }
try { try {
Thread.sleep(1000); Thread.sleep(1000);
}catch (Exception ignore){} } catch (Exception ignore) {
}
} }
datasetTableTaskLog.setStartTime(System.currentTimeMillis()); datasetTableTaskLog.setStartTime(System.currentTimeMillis());
dataSetTableTaskLogService.save(datasetTableTaskLog); dataSetTableTaskLogService.save(datasetTableTaskLog);
@ -850,7 +858,9 @@ public class ExtractDataService {
HSSFWorkbook workbook = new HSSFWorkbook(inputStream); HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
HSSFSheet sheet0 = workbook.getSheetAt(0); HSSFSheet sheet0 = workbook.getSheetAt(0);
excelInputMeta.setSheetName(new String[]{sheet0.getSheetName()}); excelInputMeta.setSheetName(new String[]{sheet0.getSheetName()});
}catch (Exception e){e.printStackTrace();} } catch (Exception e) {
e.printStackTrace();
}
} }
excelInputMeta.setPassword("Encrypted"); excelInputMeta.setPassword("Encrypted");
excelInputMeta.setFileName(new String[]{filePath}); excelInputMeta.setFileName(new String[]{filePath});
@ -953,15 +963,18 @@ public class ExtractDataService {
try { try {
File file = new File(root_path + fileName + "." + extention); File file = new File(root_path + fileName + "." + extention);
FileUtils.forceDelete(file); FileUtils.forceDelete(file);
}catch (Exception e){} } catch (Exception e) {
}
try { try {
File file = new File(root_path + jobName + ".kjb"); File file = new File(root_path + jobName + ".kjb");
FileUtils.forceDelete(file); FileUtils.forceDelete(file);
}catch (Exception e){} } catch (Exception e) {
}
try { try {
File file = new File(root_path + transName + ".ktr"); File file = new File(root_path + transName + ".ktr");
FileUtils.forceDelete(file); FileUtils.forceDelete(file);
}catch (Exception e){} } catch (Exception e) {
}
} }
public boolean isKettleRunning() { public boolean isKettleRunning() {