From e19227de97d21c10fd22536f85c8153e63072d0c Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 06 五月 2024 11:30:54 +0800
Subject: [PATCH] 代码整理1

---
 smart-man-boot/src/main/java/com/qianwen/smartman/common/utils/ExcelUtils.java |  104 +++++++--------------------------------------------
 1 files changed, 15 insertions(+), 89 deletions(-)

diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/common/utils/ExcelUtils.java b/smart-man-boot/src/main/java/com/qianwen/smartman/common/utils/ExcelUtils.java
index e66debf..0e42c08 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/common/utils/ExcelUtils.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/common/utils/ExcelUtils.java
@@ -14,6 +14,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellType;
@@ -33,8 +34,9 @@
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import com.qianwen.smartman.common.constant.ExcelConstant;
+
 import com.qianwen.core.tool.utils.Func;
+import com.qianwen.smartman.common.constant.ExcelConstant;
 import com.qianwen.smartman.modules.coproduction.dto.CheckResultDTO;
 
 public class ExcelUtils {
@@ -66,7 +68,9 @@
               String value = getCellValue(cell);
               excelDataDTO.setData(index, head, value);
             } 
-            Integer integer1 = index, integer2 = index = Integer.valueOf(index.intValue() + 1);
+            
+            index = index + 1;
+            //Integer integer1 = index, integer2 = index = Integer.valueOf(index.intValue() + 1);
           } 
         } catch (IOException e) {
           e.printStackTrace();
@@ -86,85 +90,7 @@
         } 
         return excelDataDTO;
         
-    	/*
-        Workbook workBook = null;
-        ExcelDataDTO excelDataDTO = buildDataDTO();
-        try {
-            try {
-                workBook = new XSSFWorkbook(inputStream);
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                workBook.write(bos);
-                excelDataDTO.setBytes(bos.toByteArray());
-                Sheet sheet = workBook.getSheetAt(0);
-                int lastRowNum = sheet.getLastRowNum();
-                Row rowHead = sheet.getRow(1);
-                int lastCellNum = rowHead.getLastCellNum();
-                for (int j = 0; j < lastCellNum; j++) {
-                    String value = rowHead.getCell(j).getStringCellValue();
-                    excelDataDTO.addHead(value);
-                }
-                List<String> heads = excelDataDTO.getHeads();
-                Integer index = 0;
-                for (int i = 2; i <= lastRowNum; i++) {
-                    Row row = sheet.getRow(i);
-                    for (int j2 = 0; j2 < lastCellNum; j2++) {
-                        String head = heads.get(j2);
-                        Cell cell = row.getCell(j2);
-                        String value2 = getCellValue(cell);
-                        excelDataDTO.setData(index, head, value2);
-                    }
-                    index = Integer.valueOf(index.intValue() + 1);
-                }
-                if (workBook != null) {
-                    try {
-                        workBook.close();
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-                if (inputStream != null) {
-                    try {
-                        inputStream.close();
-                    } catch (IOException e2) {
-                        e2.printStackTrace();
-                    }
-                }
-            } catch (IOException e3) {
-                e3.printStackTrace();
-                if (workBook != null) {
-                    try {
-                        workBook.close();
-                    } catch (IOException e4) {
-                        e4.printStackTrace();
-                    }
-                }
-                if (inputStream != null) {
-                    try {
-                        inputStream.close();
-                    } catch (IOException e5) {
-                        e5.printStackTrace();
-                    }
-                }
-            }
-            return excelDataDTO;
-        } catch (Throwable th) {
-            if (workBook != null) {
-                try {
-                    workBook.close();
-                } catch (IOException e6) {
-                    e6.printStackTrace();
-                }
-            }
-            if (inputStream != null) {
-                try {
-                    inputStream.close();
-                } catch (IOException e7) {
-                    e7.printStackTrace();
-                }
-            }
-            throw th;
-        }
-        */
+    	
     }
 
     private static String getCellValue(Cell cell) {
@@ -543,8 +469,8 @@
 
     /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/common/utils/ExcelUtils$ExcelExportDTO.class */
     public static class ExcelExportDTO {
-        private final List<Header> tableHeader = new ArrayList();
-        private List<Map<String, String>> data = new ArrayList();
+        private final List<Header> tableHeader = new ArrayList<>();
+        private List<Map<String, String>> data = new ArrayList<>();
 
         public void setData(final List<Map<String, String>> data) {
             this.data = data;
@@ -609,10 +535,10 @@
         }
     }
 
-    /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/common/utils/ExcelUtils$ExcelTemplateDTO.class */
+    
     public static class ExcelTemplateDTO {
-        private final List<RemindLine> remind = new ArrayList();
-        private final List<Header> tableHeader = new ArrayList();
+        private final List<RemindLine> remind = new ArrayList<>();
+        private final List<Header> tableHeader = new ArrayList<>();
 
         public List<RemindLine> getRemind() {
             return this.remind;
@@ -633,10 +559,10 @@
         }
     }
 
-    /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/common/utils/ExcelUtils$ExcelDataDTO.class */
+    
     public static class ExcelDataDTO {
-        private List<String> heads = new ArrayList();
-        private List<Map<String, String>> data = new ArrayList();
+        private List<String> heads = new ArrayList<>();
+        private List<Map<String, String>> data = new ArrayList<>();
         private List<CheckResultDTO> checkResultDTOS;
         private byte[] bytes;
 

--
Gitblit v1.9.3