|
@@ -7,6 +7,7 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelCallback;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelCallback;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelError;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelError;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelWriter;
|
|
import com.qmth.teachcloud.common.util.excel.ExcelWriter;
|
|
|
|
+import jodd.util.StringUtil;
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
@@ -304,4 +305,25 @@ public class ExcelUtil {
|
|
}
|
|
}
|
|
return excelErrorList;
|
|
return excelErrorList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 验证excel中某一行是否全部为空
|
|
|
|
+ * @param row 当前行
|
|
|
|
+ * @param firstRow 第一行标题行
|
|
|
|
+ * @return 是否整整一行为空
|
|
|
|
+ */
|
|
|
|
+ public static boolean isRowAllCellEmpty(Row row,Row firstRow) {
|
|
|
|
+ int count = 0;
|
|
|
|
+ //单元格数量
|
|
|
|
+ int rowCount = firstRow.getLastCellNum() - firstRow.getFirstCellNum();
|
|
|
|
+ //判断多少个单元格为空
|
|
|
|
+ for (int c = 0; c < rowCount; c++) {
|
|
|
|
+ Cell cell = row.getCell(c);
|
|
|
|
+ if (cell == null || cell.getCellTypeEnum() == CellType.BLANK || StringUtil.isEmpty((cell+"").trim())){
|
|
|
|
+ count += 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return count == rowCount;
|
|
|
|
+ }
|
|
}
|
|
}
|