Commit b88e024cac952c33b2b3c253d81363c6985224ab

Authored by gaoming
1 parent 33a3ecf6
Exists in master

.

@@ -54,7 +54,7 @@ uploadArchives { @@ -54,7 +54,7 @@ uploadArchives {
54 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) 54 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD)
55 } 55 }
56 pom.project { 56 pom.project {
57 - version '1.1.20' 57 + version '1.1.21'
58 artifactId ARTIFACT_Id 58 artifactId ARTIFACT_Id
59 groupId GROUP_ID 59 groupId GROUP_ID
60 packaging TYPE 60 packaging TYPE
src/main/java/com/taover/util/UtilExcel.java
@@ -23,6 +23,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -23,6 +23,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
23 public class UtilExcel { 23 public class UtilExcel {
24 private final static String excel2003L =".xls"; //2003- 版本的excel 24 private final static String excel2003L =".xls"; //2003- 版本的excel
25 private final static String excel2007U =".xlsx"; //2007+ 版本的excel 25 private final static String excel2007U =".xlsx"; //2007+ 版本的excel
  26 + private final static String CSV =".csv"; //csv
26 27
27 private final static int maxExcelRowNum = 5000; 28 private final static int maxExcelRowNum = 5000;
28 private final static int maxExcelColumnNum = 50; 29 private final static int maxExcelColumnNum = 50;
@@ -54,7 +55,13 @@ public class UtilExcel { @@ -54,7 +55,13 @@ public class UtilExcel {
54 }else{ 55 }else{
55 wb = new XSSFWorkbook(); //2007+ 56 wb = new XSSFWorkbook(); //2007+
56 } 57 }
57 - }else{ 58 + }else if(CSV.equals(fileType.trim().toLowerCase())){
  59 + if(isRead){
  60 + wb = new HSSFWorkbook(new FileInputStream(filePath)); //2003-
  61 + }else{
  62 + wb = new HSSFWorkbook(); //2003-
  63 + }
  64 + } else{
58 throw new Exception("解析的文件格式有误!"); 65 throw new Exception("解析的文件格式有误!");
59 } 66 }
60 return wb; 67 return wb;
@@ -387,7 +394,7 @@ public class UtilExcel { @@ -387,7 +394,7 @@ public class UtilExcel {
387 394
388 public static void main(String args[]){ 395 public static void main(String args[]){
389 //String filepath = "C:\\Users\\root\\Desktop\\千丁-6.27.xlsx"; 396 //String filepath = "C:\\Users\\root\\Desktop\\千丁-6.27.xlsx";
390 - String filepath = "C:\\Users\\EDZ\\Desktop\\gaoming测试甩单.xls"; 397 + String filepath = "C:\\Users\\EDZ\\Desktop\\gaoming测试甩单.csv";
391 List<List<Object>> data = null; 398 List<List<Object>> data = null;
392 try { 399 try {
393 data = UtilExcel.readExcel(filepath); 400 data = UtilExcel.readExcel(filepath);