From d8f51c40544ae278095e991ed00ec297842d4332 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期日, 29 九月 2024 11:01:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/poi/util/ExcelUtil.java |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/poi/util/ExcelUtil.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/poi/util/ExcelUtil.java
index 7272b62..3321606 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/poi/util/ExcelUtil.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/poi/util/ExcelUtil.java
@@ -19,7 +19,6 @@
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddressList;
@@ -524,6 +523,7 @@
 				if (ed.isMerged() && (ed.getRowTo() > ed.getRow() || ed.getColTo() > ed.getCol())) {
 					mergedDataList.add(ed);
 				}
+				// TODO: 淇敼缂栧彿鍒椾负鏂囨湰
 				if("id".equalsIgnoreCase(ed.getObjCode())){
 					//CellStyle textStyle = workbook.createCellStyle();
 					HSSFDataFormat format = (HSSFDataFormat)sheet.getWorkbook().createDataFormat();
@@ -942,7 +942,7 @@
 
 									Map<Integer, String> rowDataMap = new HashMap();
 
-									for(int columnIndex = 0; columnIndex < rowDataSet.getLastCellNum(); ++columnIndex) {
+									for(int columnIndex = 0; columnIndex < sheetDataSet.getColName().size(); ++columnIndex) {
 										Cell cell = rowDataSet.getCell(columnIndex);
 										Object value = getCellValue(cell, evaluator);
 										String title = colsNameIndexMap.containsKey(columnIndex) ? (String)colsNameIndexMap.get(columnIndex) : "";
@@ -1024,14 +1024,17 @@
 											} else {
 												rowDataMap.put(columnIndex, VciBaseUtil.getStringValueFromObject(value));
 											}
-										} else if (!isDataSet && thisField != null && excelColumn != null) {
-											if (!excelColumn.nullable()) {
-												throw new VciBaseException("cellValueCanNotNull", new String[]{title, rowIndex + 1 + ""});
-											}
+										} else {
+											if (!isDataSet && thisField != null && excelColumn != null) {
+												if (!excelColumn.nullable()) {
+													throw new VciBaseException("cellValueCanNotNull", new String[]{title, rowIndex + 1 + ""});
+												}
 
-											if (StringUtil.isNotBlank(excelColumn.regExg())) {
-												throw new VciBaseException("cellValueCanNotNullForReg", new String[]{title, rowIndex + 1 + ""});
+												if (StringUtil.isNotBlank(excelColumn.regExg())) {
+													throw new VciBaseException("cellValueCanNotNullForReg", new String[]{title, rowIndex + 1 + ""});
+												}
 											}
+											rowDataMap.put(columnIndex, VciBaseUtil.getStringValueFromObject(value));
 										}
 									}
 

--
Gitblit v1.9.3