cos下载流关闭处理

This commit is contained in:
liyawei
2022-06-16 14:25:49 +08:00
parent dd6168c739
commit e0ff4ee573
7 changed files with 191 additions and 169 deletions
@@ -615,13 +615,17 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
return sheetsList;
}
private void downLoadFileList(List<OSSFile> fileTemplateList,String fileNowPath) throws IOException {
private void downLoadFileList(List<OSSFile> fileTemplateList,String fileNowPath) {
for(OSSFile fileExportDto : fileTemplateList){
String oldPath = fileExportDto.getUrl();
String newPath = fileNowPath + File.separator + fileExportDto.getFileName();
if (CosBootUtil.doesObjectExist(oldPath)){
InputStream in = CosBootUtil.download(oldPath);
copyFile(in, newPath);
try (InputStream in = CosBootUtil.download(oldPath);) {
copyFile(in, newPath);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
}