Commit 7f637f80 authored by lcl's avatar lcl

u

parent 16242821
...@@ -14,6 +14,7 @@ import com.dsk.common.utils.file.ImageUtils; ...@@ -14,6 +14,7 @@ import com.dsk.common.utils.file.ImageUtils;
import com.dsk.common.utils.poi.ExcelHandlerAdapter; import com.dsk.common.utils.poi.ExcelHandlerAdapter;
import com.dsk.common.utils.poi.ExcelUtil; import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.common.utils.reflect.ReflectUtils; import com.dsk.common.utils.reflect.ReflectUtils;
import org.apache.commons.collections4.list.CursorableLinkedList;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.commons.lang3.reflect.FieldUtils;
...@@ -1397,7 +1398,7 @@ public class ExcelUtils<T> { ...@@ -1397,7 +1398,7 @@ public class ExcelUtils<T> {
} }
/** /**
* 对excel表单指定表格索引名转换成list * 对excel表单所有表格转换成list
* *
* @param titleNum 标题占用行数 * @param titleNum 标题占用行数
* @param is 输入流 * @param is 输入流
...@@ -1406,7 +1407,7 @@ public class ExcelUtils<T> { ...@@ -1406,7 +1407,7 @@ public class ExcelUtils<T> {
public List<T> importExcelAllSheet(InputStream is, int titleNum) throws Exception { public List<T> importExcelAllSheet(InputStream is, int titleNum) throws Exception {
this.type = Excel.Type.IMPORT; this.type = Excel.Type.IMPORT;
this.wb = WorkbookFactory.create(is); this.wb = WorkbookFactory.create(is);
List<T> resList = new ArrayList<T>(); List<T> resList = new ArrayList<>();
int sheetCount = wb.getNumberOfSheets(); int sheetCount = wb.getNumberOfSheets();
System.out.println("工作表个数为:" + sheetCount); System.out.println("工作表个数为:" + sheetCount);
IntStream.rangeClosed(0, sheetCount - 1).parallel().forEach(sheetNum -> { IntStream.rangeClosed(0, sheetCount - 1).parallel().forEach(sheetNum -> {
...@@ -1523,7 +1524,9 @@ public class ExcelUtils<T> { ...@@ -1523,7 +1524,9 @@ public class ExcelUtils<T> {
ReflectUtils.invokeSetter(entity, propertyName, val); ReflectUtils.invokeSetter(entity, propertyName, val);
} }
} }
resList.add(entity); synchronized (resList){
resList.add(entity);
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
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