删除上传的临时文件
This commit is contained in:
parent
3d562bdc5a
commit
c3d570a3f3
|
|
@ -82,8 +82,7 @@ public class CommonService {
|
|||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
eleDataPath = osName.startsWith("win") ? environment.getProperty("data.windows.path") : environment.getProperty("data.linux.path");
|
||||
eleDataPath = EleCommonUtil.isWinOs() ? environment.getProperty("data.windows.path") : environment.getProperty("data.linux.path");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ public class ExcelParse extends FileParse {
|
|||
@Override
|
||||
public String parseAllText(InputStream stream, String fileType) {
|
||||
String fileTmpPath = createFileTmpPath(fileType);
|
||||
String res = "";
|
||||
try {
|
||||
FileUtil.writeFromStream(stream, fileTmpPath);
|
||||
if (fileType.endsWith("xlsx")) {
|
||||
|
|
@ -21,7 +20,10 @@ public class ExcelParse extends FileParse {
|
|||
return OfficeFileUtil.parseXlsAllText(fileTmpPath);
|
||||
} catch (Exception e) {
|
||||
log.error("解析{}格式的excel错误,具体为{}",fileType, e.getMessage(), e);
|
||||
} finally {
|
||||
FileUtil.del(fileTmpPath);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public class PptParse extends FileParse {
|
|||
res = fileType.endsWith("pptx") ? OfficeFileUtil.parsePptxAllText(fileTmpPath) : OfficeFileUtil.parsePptAllText(fileTmpPath);
|
||||
} catch (Exception e) {
|
||||
log.error("解析{}格式的ppt错误,具体为{}",fileType, e.getMessage(), e);
|
||||
} finally {
|
||||
FileUtil.del(fileTmpPath);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue