Excel导入数据临时文件无法删除问题(I7KIXX)
This commit is contained in:
parent
5b61aea064
commit
6a742e1d1b
@ -288,9 +288,23 @@ public class ExcelUtil<T>
|
|||||||
* @param is 输入流
|
* @param is 输入流
|
||||||
* @return 转换后集合
|
* @return 转换后集合
|
||||||
*/
|
*/
|
||||||
public List<T> importExcel(InputStream is) throws Exception
|
public List<T> importExcel(InputStream is)
|
||||||
{
|
{
|
||||||
return importExcel(is, 0);
|
List<T> list = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
list = importExcel(is, 0);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("导入Excel异常{}", e.getMessage());
|
||||||
|
throw new UtilException(e.getMessage());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(is);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -336,7 +350,6 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
// 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1
|
// 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1
|
||||||
int rows = sheet.getLastRowNum();
|
int rows = sheet.getLastRowNum();
|
||||||
|
|
||||||
if (rows > 0)
|
if (rows > 0)
|
||||||
{
|
{
|
||||||
// 定义一个map用于存放excel列的序号和field.
|
// 定义一个map用于存放excel列的序号和field.
|
||||||
|
Loading…
Reference in New Issue
Block a user