作者 xudada

舱单excel邮单导入

@@ -102,7 +102,7 @@ public class UpfileJsonController { @@ -102,7 +102,7 @@ public class UpfileJsonController {
102 or.setConsigneeaddress(arr.get(47));//收货人地址 102 or.setConsigneeaddress(arr.get(47));//收货人地址
103 or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss 103 or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss
104 or.setFlightDate(format.parse(arr.get(66)));//航班日期yyyy-MM-dd 104 or.setFlightDate(format.parse(arr.get(66)));//航班日期yyyy-MM-dd
105 - or.setStatus("17");//操作状态 105 + or.setStatus("01");//操作状态
106 or.setIsbatch("T");//分批标识 106 or.setIsbatch("T");//分批标识
107 or.setShipperCountrycode(arr.get(86));//发货人国家代码 107 or.setShipperCountrycode(arr.get(86));//发货人国家代码
108 or.setShipperPhone(arr.get(106));//发货人联系电话 108 or.setShipperPhone(arr.get(106));//发货人联系电话
@@ -22,8 +22,7 @@ import java.util.ArrayList; @@ -22,8 +22,7 @@ import java.util.ArrayList;
22 import java.util.Date; 22 import java.util.Date;
23 import java.util.List; 23 import java.util.List;
24 24
25 -import static org.apache.poi.ss.usermodel.CellType.BLANK;  
26 -import static org.apache.poi.ss.usermodel.CellType.STRING; 25 +import static org.apache.poi.ss.usermodel.CellType.*;
27 26
28 /** 27 /**
29 * shenhailong 28 * shenhailong
@@ -59,7 +58,7 @@ public class ExcelUtils { @@ -59,7 +58,7 @@ public class ExcelUtils {
59 } 58 }
60 totoalRows = xssfSheet.getLastRowNum(); 59 totoalRows = xssfSheet.getLastRowNum();
61 //读取row 60 //读取row
62 - for (int rowIndex = 2; rowIndex <= totoalRows; rowIndex++) { 61 + for (int rowIndex = 1; rowIndex <= totoalRows; rowIndex++) {
63 XSSFRow xssfRow = xssfSheet.getRow(rowIndex); 62 XSSFRow xssfRow = xssfSheet.getRow(rowIndex);
64 63
65 if (xssfRow == null) { 64 if (xssfRow == null) {
@@ -145,12 +144,12 @@ public class ExcelUtils { @@ -145,12 +144,12 @@ public class ExcelUtils {
145 //读取列 144 //读取列
146 for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) { 145 for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) {
147 HSSFCell hssfCell = hssfRow.getCell(cellIndex); 146 HSSFCell hssfCell = hssfRow.getCell(cellIndex);
148 - if (hssfCell == null) { 147 + if (hssfCell == null || String.valueOf(hssfCell)=="") {
149 rowList.add(""); 148 rowList.add("");
150 } else { 149 } else {
151 // System.out.println(hssfCell.getCellType()); 150 // System.out.println(hssfCell.getCellType());
152 151
153 - if(BLANK==hssfCell.getCellType()){ 152 + if(NUMERIC==hssfCell.getCellType()){
154 if(DateUtil.isCellDateFormatted(hssfCell)){ 153 if(DateUtil.isCellDateFormatted(hssfCell)){
155 //用于转化为日期格式 154 //用于转化为日期格式
156 Date d = hssfCell.getDateCellValue(); 155 Date d = hssfCell.getDateCellValue();