Browse Source

Merge branch 'hostfix_v0.4.0' into develop

lijie 2 years ago
parent
commit
bf6757cb03

+ 21 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -60,6 +60,7 @@ import java.awt.Color;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.*;
@@ -492,7 +493,7 @@ public class AdmEquipmentController {
 						equipment.put(define.getCode(), tempCell.getStringCellValue().trim());
 					} else if ("INTEGER".equalsIgnoreCase(define.getDataType())) {
 						try {
-							if (!CellType.NUMERIC.equals(tempCell.getCellTypeEnum())
+							if (!CellType.NUMERIC.equals(tempCell.getCellType())
 									|| StrUtil.isBlank(StrUtil.toString(CellUtil.getCellValue(tempCell,true)))) {
 								failurNum++;
 								this.setColor(workbook, 155, 227, 255, tempCell);
@@ -500,19 +501,19 @@ public class AdmEquipmentController {
 								continue;
 							}
 							tempCell.setCellType(CellType.STRING);
-							equipment.put(define.getCode(), tempCell.getStringCellValue().trim());
+							equipment.putPOJO(define.getCode(), CellUtil.getCellValue(tempCell,CellType.STRING,true));
 						} catch (Exception e) {
 							failurNum++;
 							this.setColor(workbook, 155, 227, 255, tempCell);
 							changeFlag=false;
 							continue;
 						}
-					} else if ("ENUM".equalsIgnoreCase(define.getDataType()) || "MENUM".equalsIgnoreCase(define.getDataType())) {
-						if (CellType.NUMERIC.equals(tempCell.getCellTypeEnum())
+					} else if ("ENUM".equalsIgnoreCase(define.getDataType())) {
+						if (CellType.NUMERIC.equals(tempCell.getCellType())
 								&& StrUtil.isNotBlank(StrUtil.toString(CellUtil.getCellValue(tempCell,true)))) {
 							tempCell.setCellType(CellType.STRING);
-							equipment.put(define.getCode(), tempCell.getStringCellValue().trim());
-						} else if (CellType.STRING.equals(tempCell.getCellTypeEnum())
+							equipment.putPOJO(define.getCode(), CellUtil.getCellValue(tempCell,CellType.STRING,true));
+						} else if (CellType.STRING.equals(tempCell.getCellType())
 								&& StrUtil.isNotBlank(StrUtil.toString(CellUtil.getCellValue(tempCell,true)))) {
 							equipment.put(define.getCode(), tempCell.getStringCellValue().trim());
 						} else {
@@ -521,6 +522,20 @@ public class AdmEquipmentController {
 							changeFlag=false;
 							continue;
 						}
+					} else if ("MENUM".equalsIgnoreCase(define.getDataType())) {
+						if (CellType.NUMERIC.equals(tempCell.getCellType())
+								&& StrUtil.isNotBlank(StrUtil.toString(CellUtil.getCellValue(tempCell,true)))) {
+							tempCell.setCellType(CellType.STRING);
+							equipment.putPOJO(define.getCode(), CollUtil.newArrayList(CellUtil.getCellValue(tempCell,CellType.STRING,true)));
+						} else if (CellType.STRING.equals(tempCell.getCellType())
+								&& StrUtil.isNotBlank(StrUtil.toString(CellUtil.getCellValue(tempCell,true)))) {
+							equipment.putPOJO(define.getCode(), CollUtil.newArrayList(CellUtil.getCellValue(tempCell,CellType.STRING,true)));
+						} else {
+							failurNum++;
+							this.setColor(workbook, 155, 227, 255, tempCell);
+							changeFlag=false;
+							continue;
+						}
 					} else if ("DATETIME".equalsIgnoreCase(define.getDataType())) {
 						try {
 							tempCell.setCellType(CellType.STRING);