wangliang 3 жил өмнө
parent
commit
c976b40c9a

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/util/ExcelUtil.java

@@ -85,7 +85,7 @@ public class ExcelUtil {
                                             fields[j].set(o, obj);
                                             Annotation annotation = fields[j].getAnnotation(NotNull.class);
                                             ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
-                                            if (Objects.isNull(obj) && Objects.nonNull(annotation)) {
+                                            if ((Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
                                                 excelErrorList.add(y, new ExcelError(j + 1, "excel第" + (y + 1) + "个sheet第" + (j + 1) + "行[" + note.value() + "]为空"));
                                             }
                                         } else {
@@ -108,7 +108,7 @@ public class ExcelUtil {
                                         fields[j].set(o, obj);
                                         Annotation annotation = fields[j].getAnnotation(NotNull.class);
                                         ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
-                                        if (Objects.isNull(obj) && Objects.nonNull(annotation)) {
+                                        if ((Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
                                             excelErrorList.add(y, new ExcelError(i + 1, "excel第" + (y + 1) + "个sheet第" + (i + 1) + "行[" + note.value() + "]为空"));
                                         }
                                     }
@@ -210,7 +210,7 @@ public class ExcelUtil {
             field.setAccessible(true);
             Annotation annotation = field.getAnnotation(NotNull.class);
             ExcelNote note = field.getAnnotation(ExcelNote.class);
-            if (Objects.isNull(field.get(obj)) && Objects.nonNull(annotation)) {
+            if ((Objects.isNull(field.get(obj)) || Objects.equals("", field.get(obj))) && Objects.nonNull(annotation)) {
                 excelErrorList.add(new ExcelError(index + 1, "excel第" + (sheetIndex + 1) + "个sheet第" + (index + 1) + "行[" + note.value() + "]为空"));
             }
         }