Browse Source

处理空表格的bug

yujia 7 years ago
parent
commit
9bdc0fcad9

+ 3 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -193,6 +193,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		ModelMap modelMap = new ModelMap();
 		// 获取第一个工作表
 		Sheet sheet = workbook.getSheetAt(0);
+		if (sheet.getRow(0) == null) {
+			throw new IllegalOperatorException("表格模板不正确!请重新下载最新模板");
+		}
 		int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
 		if (isAPerson) {
 			if (colNum != UploadConstant.TOTAL_COLUMN_PERSON && colNum != UploadConstant.MAX_TOTAL_COLUMN_PERSON) {