Commit f22d725e by fudahua

Merge branch 'fix-2023-04' into 'master'

Fix 2023 04

See merge request !97
parents e7679764 84c71daf
......@@ -47,7 +47,9 @@ public class HDFSUtil {
*/
public boolean downloadFile(String srcPath,String toPath) {
try {
fileSystem.copyToLocalFile(true,new Path(srcPath),new Path(toPath));
Config appConfig = ConfigService.getAppConfig();
Integer delFlag = appConfig.getIntProperty("del.hive.flag", 1);
fileSystem.copyToLocalFile(delFlag.intValue()==1?true:false,new Path(srcPath),new Path(toPath));
return true;
} catch (IOException e) {
logger.info("下载失败:{}",e);
......
......@@ -934,6 +934,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
logger.info("下载耗时:{}",stopWatch.getLastTaskTimeMillis());
stopWatch.start();
List<String> xlsxFiles=new ArrayList<>();
AtomicInteger totalCount=new AtomicInteger(0);
AtomicInteger count=new AtomicInteger(0);
AtomicReference<XlsxFileInfo> currentFile=new AtomicReference<>();
readCsvFile(condition,dirName,(cells,titles,firstFlag)->{
......@@ -946,9 +947,12 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
saveXlsSplitNew(currentFile.get().filepath,cells,titles,currentFile.get(),count,false,queryDataType);
});
//结束
Integer limitSize = FileUtil.getLimitSize();
Integer total= (xlsxFiles.size()-1)*limitSize+count.get();
saveXlsSplitNew(currentFile.get().filepath,null,null,currentFile.get(),count,true,queryDataType);
stopWatch.stop();
logger.info("写入本地excel耗时:{}",stopWatch.getLastTaskTimeMillis());
logger.info("写入本地excel耗时:{}, 数量: {}-》{}",stopWatch.getLastTaskTimeMillis(),task.getAmount(),total);
stopWatch.start();
//是否压缩
boolean zipFlag = (xlsxFiles.size() > 1) ? true : false;
......@@ -975,6 +979,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
task.setFilePath(cloudFileUrl);
}catch (Exception e) {
logger.info("异常:{}",e);
task.setStatus(DownloadTaskStatus.ERROR);
......@@ -1060,6 +1065,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
csvReader.close();
} catch (Exception e) {
logger.info("读取异常:{}",e);
throw new RuntimeException(e);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment