liu 1 anno fa
parent
commit
efd50f7df0

+ 6 - 0
src/main/java/com/template/controller/WelcomeBedController.java

@@ -371,6 +371,9 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
                     } else {
                         WelcomeBed bedData = new WelcomeBed();
                         String school = dataFormatter.formatCellValue(row.getCell(0));//校区
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋
                         String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
                         String number = dataFormatter.formatCellValue(row.getCell(3));//床位号
@@ -560,6 +563,9 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
                     } else {
                         WelcomeBed bedData = new WelcomeBed();
                         String school = dataFormatter.formatCellValue(row.getCell(0));//校区
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋
                         String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
                         String number = dataFormatter.formatCellValue(row.getCell(3));//床位号

+ 7 - 0
src/main/java/com/template/controller/WelcomeBuildController.java

@@ -222,6 +222,9 @@ public class WelcomeBuildController implements WelcomeBuildControllerAPI {
                         WelcomeBuild buildData = new WelcomeBuild();
 
                         String school = dataFormatter.formatCellValue(row.getCell(1));//校区名称
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         Optional<WelcomeSchool> wos = ws.stream().filter(e -> e.getSchool().equals(school)).findFirst();
                         if (wos != null && wos.isPresent()) {
                             buildData.setSchoolId(wos.get().getId()+"");
@@ -283,6 +286,7 @@ public class WelcomeBuildController implements WelcomeBuildControllerAPI {
 
                 XSSFRow row = sheetAt.getRow(rowNum);
 
+
                 if (row != null) {
                     //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
                     //所以先使用setCellType()方法先将该单元格的类型设置为STRING
@@ -321,6 +325,9 @@ public class WelcomeBuildController implements WelcomeBuildControllerAPI {
                         WelcomeBuild buildData = new WelcomeBuild();
 
                         String school = dataFormatter.formatCellValue(row.getCell(1));//校区名称
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         Optional<WelcomeSchool> wos = ws.stream().filter(e -> e.getSchool().equals(school)).findFirst();
                         if (wos != null && wos.isPresent()) {
                             buildData.setSchoolId(wos.get().getId()+"");

+ 6 - 0
src/main/java/com/template/controller/WelcomeDormitoryController.java

@@ -447,6 +447,9 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
 
                     } else {
                         String school = dataFormatter.formatCellValue(row.getCell(0));//校区名称
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋名称
                         String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
                         WelcomeDormitory wd = new WelcomeDormitory();
@@ -579,6 +582,9 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
 
                     } else {
                         String school = dataFormatter.formatCellValue(row.getCell(0));//校区名称
+                        if (ObjectUtils.isEmpty(school)) {
+                            continue;
+                        }
                         String build = dataFormatter.formatCellValue(row.getCell(1));//楼栋名称
                         String dormitory = dataFormatter.formatCellValue(row.getCell(2));//寝室号
                         WelcomeDormitory wd = new WelcomeDormitory();