|
@@ -390,21 +390,23 @@ public class AdmEquipmentController {
|
|
|
tempMap.put(define.getCode(), cell.getStringCellValue().trim());
|
|
|
} else if ("INTEGER".equalsIgnoreCase(define.getDataType())) {
|
|
|
try {
|
|
|
- if (!CellType.NUMERIC.equals(cell.getCellTypeEnum())) {
|
|
|
+ if (!CellType.NUMERIC.equals(cell.getCellTypeEnum()) || StrUtil.isBlank(cell.getRawValue())) {
|
|
|
failurNum++;
|
|
|
this.setColor(workbook, 155, 227, 255, cell);
|
|
|
continue;
|
|
|
}
|
|
|
- tempMap.put(define.getCode(), cell.getRawValue().toString().trim());
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ tempMap.put(define.getCode(), cell.getStringCellValue().trim());
|
|
|
} catch (Exception e) {
|
|
|
failurNum++;
|
|
|
this.setColor(workbook, 155, 227, 255, cell);
|
|
|
continue;
|
|
|
}
|
|
|
} else if ("ENUM".equalsIgnoreCase(define.getDataType())) {
|
|
|
- if (CellType.NUMERIC.equals(cell.getCellTypeEnum())) {
|
|
|
- tempMap.put(define.getCode(), cell.getRawValue().toString().trim());
|
|
|
- } else if (CellType.STRING.equals(cell.getCellTypeEnum())) {
|
|
|
+ if (CellType.NUMERIC.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ tempMap.put(define.getCode(), cell.getStringCellValue().trim());
|
|
|
+ } else if (CellType.STRING.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
|
|
|
tempMap.put(define.getCode(), cell.getStringCellValue().trim());
|
|
|
} else {
|
|
|
failurNum++;
|
|
@@ -413,7 +415,8 @@ public class AdmEquipmentController {
|
|
|
}
|
|
|
} else if ("DATETIME".equalsIgnoreCase(define.getDataType())) {
|
|
|
try {
|
|
|
- String trim = cell.getRawValue().trim();
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ String trim = cell.getStringCellValue().trim();
|
|
|
tempMap.put(define.getCode(), DateUtil.parseByPatterns(trim, "yyyyMMdd"));
|
|
|
} catch (Exception e) {
|
|
|
failurNum++;
|
|
@@ -422,7 +425,8 @@ public class AdmEquipmentController {
|
|
|
}
|
|
|
} else if ("DOUBLE".equalsIgnoreCase(define.getDataType())) {
|
|
|
try {
|
|
|
- String trim = cell.getRawValue().trim();
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ String trim = cell.getStringCellValue().trim();
|
|
|
tempMap.put(define.getCode(), Double.parseDouble(trim));
|
|
|
} catch (Exception e) {
|
|
|
failurNum++;
|
|
@@ -430,7 +434,8 @@ public class AdmEquipmentController {
|
|
|
continue;
|
|
|
}
|
|
|
} else if ("BOOLEAN".equalsIgnoreCase(define.getDataType())) {
|
|
|
- String trim = cell.getRawValue() == null ? null : cell.getRawValue().toString().trim();
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
|
+ String trim = cell.getStringCellValue() == null ? null : cell.getStringCellValue().trim();
|
|
|
if ("1".equals(trim) || "0".equals(trim)) {
|
|
|
tempMap.put(define.getCode(), Double.parseDouble(trim));
|
|
|
} else {
|