yangys
2024-04-24 11b76c76bcd4f235fb75959b53b64c6d9a2dd71e
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;