|
@@ -450,7 +450,7 @@ public class POIUtil {
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> datas = new ArrayList<Map<String, Object>>();
|
|
|
- rowIter = sheet.iterator();
|
|
|
+ rowIter = sheet.rowIterator();
|
|
|
while (rowIter.hasNext()) {
|
|
|
Map<String, Object> obj = null;
|
|
|
boolean hasVal = false;
|
|
@@ -460,7 +460,7 @@ public class POIUtil {
|
|
|
currentRowNum++;
|
|
|
|
|
|
if (currentRowNum == 1) {// 第一列表示英文名称对应表字段
|
|
|
- cellIter = row.iterator();
|
|
|
+ cellIter = row.cellIterator();
|
|
|
// 列号清零
|
|
|
List<String> names = new ArrayList<String>();
|
|
|
while (cellIter.hasNext()) {
|
|
@@ -476,15 +476,13 @@ public class POIUtil {
|
|
|
}
|
|
|
// 实例化对象
|
|
|
obj = new HashMap<>();
|
|
|
- cellIter = row.iterator();
|
|
|
// 列号清零
|
|
|
currentCellNum = 0;
|
|
|
- while (cellIter.hasNext() && currentCellNum < fieldsName.length) {
|
|
|
- cell = cellIter.next();
|
|
|
- int columnIndex = cell.getColumnIndex();
|
|
|
- cell.setCellType(Cell.CELL_TYPE_STRING);
|
|
|
+ while (currentCellNum < fieldsName.length) {
|
|
|
String fieldValue = "";
|
|
|
- if (columnIndex == currentCellNum) {
|
|
|
+ cell = row.getCell(currentCellNum);
|
|
|
+ if (cell != null) {
|
|
|
+ cell.setCellType(Cell.CELL_TYPE_STRING);
|
|
|
fieldValue = cell.getStringCellValue();
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(fieldValue)) {
|