Commit 2d2752a5 by 翁国栋

8小时运营后台--导入替换

parent d57bd6e5
...@@ -1713,19 +1713,22 @@ public class InsureContorll { ...@@ -1713,19 +1713,22 @@ public class InsureContorll {
xw = new XSSFWorkbook(file.getInputStream()); xw = new XSSFWorkbook(file.getInputStream());
XSSFSheet sheetAt = xw.getSheetAt(0); XSSFSheet sheetAt = xw.getSheetAt(0);
//默认第一行为标题行,i = 13 //默认第一行为标题行,i = 13
XSSFRow titleRow = sheetAt.getRow(13); XSSFRow titleRow = sheetAt.getRow(12);
InsureUser originalUser; InsureUser originalUser;
InsureUser replaceUser; InsureUser replaceUser;
/*原被保人集合*/ /*原被保人集合*/
List<InsureUser> originalList=Lists.newArrayList(); List<InsureUser> originalList=Lists.newArrayList();
// 循环获取每一行数据 // 循环获取每一行数据
for (int i = 14; i < sheetAt.getPhysicalNumberOfRows(); i++) { for (int i = 13; i < sheetAt.getPhysicalNumberOfRows(); i++) {
XSSFRow row = sheetAt.getRow(i); XSSFRow row = sheetAt.getRow(i);
originalUser=InsureUser.builder().build(); originalUser=InsureUser.builder().build();
replaceUser=InsureUser.builder().build(); replaceUser=InsureUser.builder().build();
// 读取每一格内容 // 读取每一格内容
for (int index = 0; index < row.getPhysicalNumberOfCells(); index++) { for (int index = 0; index < row.getPhysicalNumberOfCells(); index++) {
XSSFCell titleCell = titleRow.getCell(index); XSSFCell titleCell = titleRow.getCell(index);
if(titleCell==null){
continue;
}
XSSFCell cell = row.getCell(index); XSSFCell cell = row.getCell(index);
if (cell == null) { if (cell == null) {
continue; continue;
...@@ -1735,6 +1738,9 @@ public class InsureContorll { ...@@ -1735,6 +1738,9 @@ public class InsureContorll {
if (cell.getStringCellValue().equals("")) { if (cell.getStringCellValue().equals("")) {
continue; continue;
} }
if(StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))){
continue;
}
switch (ExcelUtils.getString(titleCell)) { switch (ExcelUtils.getString(titleCell)) {
// case "ID":/*不重要*/ // case "ID":/*不重要*/
// break; // break;
......
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