Commit b8190823 authored by liuxinben's avatar liuxinben

导入excel,批量取消邮寄

parent cf4059ae
...@@ -384,19 +384,22 @@ public class ExportExcel { ...@@ -384,19 +384,22 @@ public class ExportExcel {
String[] s = new String[headerNum]; String[] s = new String[headerNum];
for (int o = 0; o < headerNum; o++){ for (int o = 0; o < headerNum; o++){
Cell headerCell = sheet.getRow(0).getCell(o); Cell headerCell = sheet.getRow(2).getCell(o);
headerCell.setCellType(CellType.STRING); // headerCell.setCellType(CellType.STRING);
s[o] = headerCell.getStringCellValue(); s[o] = headerCell.getStringCellValue();
} }
// sheet.getRows()返回该页的总行数 // sheet.getRows()返回该页的总行数
for (int nowRowNum = 3; nowRowNum < rowNum-2 ; nowRowNum++) { for (int nowRowNum = 3; nowRowNum <= rowNum ; nowRowNum++) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Row row = sheet.getRow(nowRowNum); Row row = sheet.getRow(nowRowNum);
// sheet.getColumns()返回该页的总列数 // sheet.getColumns()返回该页的总列数
int columnNum = row.getLastCellNum(); int columnNum = row.getLastCellNum();
for (int nowColumnNum = 0; nowColumnNum < columnNum; nowColumnNum++) { for (int nowColumnNum = 0; nowColumnNum < columnNum; nowColumnNum++) {
Cell columnCell = sheet.getRow(nowRowNum).getCell(nowColumnNum); Cell columnCell = sheet.getRow(nowRowNum).getCell(nowColumnNum);
columnCell.setCellType(CellType.STRING); // columnCell.setCellType(CellType.STRING);
if (ObjectUtils.isEmpty(columnCell)){
continue;
}else {
String cellinfo = columnCell.getStringCellValue(); String cellinfo = columnCell.getStringCellValue();
if(cellinfo.isEmpty() || cellinfo.equals("")){ if(cellinfo.isEmpty() || cellinfo.equals("")){
continue; continue;
...@@ -404,6 +407,7 @@ public class ExportExcel { ...@@ -404,6 +407,7 @@ public class ExportExcel {
map.put(s[nowColumnNum],cellinfo); map.put(s[nowColumnNum],cellinfo);
} }
} }
}
if (!ObjectUtils.isEmpty(map)){ if (!ObjectUtils.isEmpty(map)){
outerList.add(map); outerList.add(map);
} }
......
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