|
@@ -199,7 +199,7 @@ public class ExcelUtil {
|
|
} else {
|
|
} else {
|
|
if (Objects.nonNull(cell)) {
|
|
if (Objects.nonNull(cell)) {
|
|
Object obj = convert(cell);
|
|
Object obj = convert(cell);
|
|
- if (StringUtils.isBlank(obj.toString().trim())) {
|
|
|
|
|
|
+ if (obj == null || StringUtils.isBlank(obj.toString().trim())) {
|
|
emptyRowSum++;
|
|
emptyRowSum++;
|
|
}
|
|
}
|
|
if (extend) {
|
|
if (extend) {
|
|
@@ -208,7 +208,7 @@ public class ExcelUtil {
|
|
fields[j].set(o, obj);
|
|
fields[j].set(o, obj);
|
|
Annotation annotation = fields[j].getAnnotation(NotNull.class);
|
|
Annotation annotation = fields[j].getAnnotation(NotNull.class);
|
|
ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
|
|
ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
|
|
- if (note.require() && (Objects.isNull(obj) || Objects.equals("", 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() + "]为空"));
|
|
excelErrorList.add(y, new ExcelError(j + 1, "excel第" + (y + 1) + "个sheet第" + (j + 1) + "行[" + note.value() + "]为空"));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -232,7 +232,7 @@ public class ExcelUtil {
|
|
fields[j].set(o, obj);
|
|
fields[j].set(o, obj);
|
|
Annotation annotation = fields[j].getAnnotation(NotNull.class);
|
|
Annotation annotation = fields[j].getAnnotation(NotNull.class);
|
|
ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
|
|
ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
|
|
- if (note.require() && (Objects.isNull(obj) || Objects.equals("", 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() + "]为空"));
|
|
excelErrorList.add(y, new ExcelError(i + 1, "excel第" + (y + 1) + "个sheet第" + (i + 1) + "行[" + note.value() + "]为空"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -341,7 +341,7 @@ public class ExcelUtil {
|
|
field.setAccessible(true);
|
|
field.setAccessible(true);
|
|
Annotation annotation = field.getAnnotation(NotNull.class);
|
|
Annotation annotation = field.getAnnotation(NotNull.class);
|
|
ExcelNote note = field.getAnnotation(ExcelNote.class);
|
|
ExcelNote note = field.getAnnotation(ExcelNote.class);
|
|
- if (note.require() && (Objects.isNull(field.get(obj)) || Objects.equals("", 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() + "]为空"));
|
|
excelErrorList.add(new ExcelError(index + 1, "excel第" + (sheetIndex + 1) + "个sheet第" + (index + 1) + "行[" + note.value() + "]为空"));
|
|
}
|
|
}
|
|
}
|
|
}
|