Commit b8190823 authored by liuxinben's avatar liuxinben

导入excel,批量取消邮寄

parent cf4059ae
...@@ -384,24 +384,28 @@ public class ExportExcel { ...@@ -384,24 +384,28 @@ 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);
String cellinfo = columnCell.getStringCellValue(); if (ObjectUtils.isEmpty(columnCell)){
if(cellinfo.isEmpty() || cellinfo.equals("")){
continue; continue;
}else { }else {
map.put(s[nowColumnNum],cellinfo); String cellinfo = columnCell.getStringCellValue();
if(cellinfo.isEmpty() || cellinfo.equals("")){
continue;
}else {
map.put(s[nowColumnNum],cellinfo);
}
} }
} }
if (!ObjectUtils.isEmpty(map)){ if (!ObjectUtils.isEmpty(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