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