Commit 08bb27ae by fudahua

feat: 新版本的下载

parent d827216c
...@@ -912,6 +912,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService { ...@@ -912,6 +912,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}catch (Exception e) { }catch (Exception e) {
logger.info("异常:{}",e); logger.info("异常:{}",e);
}finally {
//删除文件
delFileOrDirByTaskId(task.getId());
} }
} }
...@@ -921,6 +924,35 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService { ...@@ -921,6 +924,35 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
} }
private void delFileOrDirByTaskId(String taskId){
File file = new File(SAVE_FOLDER);
File[] files = file.listFiles();
for (File midFile : files) {
if (midFile.getName().equals(taskId)) {
if (midFile.isDirectory()) {
delDir(midFile);
}else{
midFile.delete();
}
}
}
}
private void delDir(File dirFile) {
if (dirFile.getPath().startsWith(SAVE_FOLDER)) {
File[] files = dirFile.listFiles();
for (File file : files) {
if (file.isDirectory()) {
delDir(file);
}else{
file.delete();
}
}
dirFile.delete();
}
}
/** /**
* 读物文件 * 读物文件
* @param dirName * @param dirName
......
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