|
|
|
@ -15,6 +15,7 @@ import com.gaotao.modules.pms.service.QcBaseInfoService; |
|
|
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.ss.usermodel.CellType; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
|
@ -1540,16 +1541,25 @@ public class QcBaseInfoServiceImpl implements QcBaseInfoService { |
|
|
|
// 读取是否默认 |
|
|
|
String defaultFlag = "N"; |
|
|
|
if (row.getCell(4) != null) { |
|
|
|
String defaultStr = row.getCell(4).getStringCellValue().trim(); |
|
|
|
if ("是".equals(defaultStr) || "Y".equalsIgnoreCase(defaultStr)) { |
|
|
|
defaultFlag = "Y"; |
|
|
|
if (hasDefault) { |
|
|
|
errInfo.append("第").append(j + 1).append("行设置为默认,但已存在默认配置(").append(defaultOperationDesc).append(");"); |
|
|
|
errorCount++; |
|
|
|
continue; |
|
|
|
try { |
|
|
|
// 先检查单元格类型,避免空白单元格调用getStringCellValue报错 |
|
|
|
CellType cellType = row.getCell(4).getCellType(); |
|
|
|
if (cellType != CellType.BLANK) { |
|
|
|
String defaultStr = row.getCell(4).getStringCellValue().trim(); |
|
|
|
if ("是".equals(defaultStr) || "Y".equalsIgnoreCase(defaultStr)) { |
|
|
|
defaultFlag = "Y"; |
|
|
|
if (hasDefault) { |
|
|
|
errInfo.append("第").append(j + 1).append("行设置为默认,但已存在默认配置(").append(defaultOperationDesc).append(");"); |
|
|
|
errorCount++; |
|
|
|
continue; |
|
|
|
} |
|
|
|
hasDefault = true; |
|
|
|
defaultOperationDesc = operationDesc; |
|
|
|
} |
|
|
|
} |
|
|
|
hasDefault = true; |
|
|
|
defaultOperationDesc = operationDesc; |
|
|
|
} catch (Exception e) { |
|
|
|
// 是否默认列读取失败不影响导入,使用默认值N |
|
|
|
log.warn("第{}行是否默认列读取失败,使用默认值N: {}", j + 1, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|