forked from github/dataease
fix: 定时同步任务支持在历史数据变动后增量更新到doris中
This commit is contained in:
parent
42c85bdc82
commit
3df5e3e2e9
@ -370,6 +370,9 @@ public class ExcelXlsReader implements HSSFListener {
|
||||
|
||||
|
||||
private String checkType(String str, int thisColumn) {
|
||||
if (str.length() > 19) {
|
||||
return "TEXT";
|
||||
}
|
||||
String type = null;
|
||||
try {
|
||||
double d = Double.valueOf(str);
|
||||
|
@ -2949,6 +2949,9 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
private String cellType(String value) {
|
||||
if (value.length() > 19) {
|
||||
return "TEXT";
|
||||
}
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
sdf.parse(value);
|
||||
|
@ -479,9 +479,10 @@ public class ExtractDataService {
|
||||
}
|
||||
|
||||
private void extractApiData(DatasetTable datasetTable, Datasource datasource, List<DatasetTableField> datasetTableFields, String extractType) throws Exception {
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||
List<ApiDefinition> lists = new Gson().fromJson(datasource.getConfiguration(), new TypeToken<ArrayList<ApiDefinition>>() {
|
||||
}.getType());
|
||||
lists = lists.stream().filter(item -> item.getName().equalsIgnoreCase(new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable())).collect(Collectors.toList());
|
||||
lists = lists.stream().filter(item -> item.getName().equalsIgnoreCase(dataTableInfoDTO.getTable())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(lists)) {
|
||||
throw new Exception("未找到API数据表");
|
||||
}
|
||||
@ -521,15 +522,16 @@ public class ExtractDataService {
|
||||
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), dataFile);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(dataFile));
|
||||
for (String[] strings : dataList) {
|
||||
String content = "";
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
content = content + strings[i] + separator;
|
||||
content = i != strings.length - 1 ? content + strings[i] + separator : content + strings[i];
|
||||
}
|
||||
boolean isSetKey = dataTableInfoDTO.isSetKey() && CollectionUtils.isNotEmpty(dataTableInfoDTO.getKeys());
|
||||
if (!isSetKey) {
|
||||
content = Md5Utils.md5(content) + separator + content;
|
||||
}
|
||||
content = content + Md5Utils.md5(content);
|
||||
bw.write(content);
|
||||
bw.newLine();
|
||||
}
|
||||
@ -565,8 +567,8 @@ public class ExtractDataService {
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
File deleteFile = new File(root_path + datasetTable.getId() + ".sh");
|
||||
FileUtils.forceDelete(deleteFile);
|
||||
// File deleteFile = new File(root_path + datasetTable.getId() + ".sh");
|
||||
// FileUtils.forceDelete(deleteFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user