文件删除如果先删除文件后关闭文件流,就会出现文件删除不了的情况,
我原先的代码
assert file != null; file.delete();try {if(outStream!=null){outStream.close();}} catch (IOException e) {log.error("excel导入失败", e);}
修改之后
assert file != null; try {if(outStream!=null){outStream.close();}} catch (IOException e) {log.error("excel导入失败", e);}file.delete();