--- tools/v1-decompiled/cfr-from-cw-lib-current/cw-elevator-application-service-1.0-SNAPSHOT/cn/cloudwalk/elevator/export/utils/ExcelUtil.java	2026-04-28 12:58:09.585844892 +0800
+++ cw-elevator-application-service/src/main/java/cn/cloudwalk/elevator/export/utils/ExcelUtil.java	2026-04-25 00:53:00.865643196 +0800
@@ -1,30 +1,3 @@
-/*
- * Decompiled with CFR 0.152.
- * 
- * Could not load the following classes:
- *  cn.cloudwalk.elevator.util.DateUtils
- *  org.apache.commons.lang3.StringUtils
- *  org.apache.poi.hssf.usermodel.DVConstraint
- *  org.apache.poi.hssf.usermodel.HSSFCell
- *  org.apache.poi.hssf.usermodel.HSSFCellStyle
- *  org.apache.poi.hssf.usermodel.HSSFClientAnchor
- *  org.apache.poi.hssf.usermodel.HSSFDataValidation
- *  org.apache.poi.hssf.usermodel.HSSFFont
- *  org.apache.poi.hssf.usermodel.HSSFPatriarch
- *  org.apache.poi.hssf.usermodel.HSSFRow
- *  org.apache.poi.hssf.usermodel.HSSFSheet
- *  org.apache.poi.hssf.usermodel.HSSFWorkbook
- *  org.apache.poi.ss.usermodel.Cell
- *  org.apache.poi.ss.usermodel.DataValidation
- *  org.apache.poi.ss.usermodel.DataValidationConstraint
- *  org.apache.poi.ss.usermodel.Row
- *  org.apache.poi.ss.usermodel.Sheet
- *  org.apache.poi.ss.usermodel.Workbook
- *  org.apache.poi.ss.usermodel.WorkbookFactory
- *  org.apache.poi.ss.util.CellRangeAddressList
- *  org.slf4j.Logger
- *  org.slf4j.LoggerFactory
- */
 package cn.cloudwalk.elevator.export.utils;
 
 import cn.cloudwalk.elevator.export.ExcelAttribute;
@@ -47,6 +20,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.DVConstraint;
 import org.apache.poi.hssf.usermodel.HSSFCell;
@@ -59,6 +33,8 @@
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.IndexedColors;
 import org.apache.poi.ss.usermodel.DataValidation;
 import org.apache.poi.ss.usermodel.DataValidationConstraint;
 import org.apache.poi.ss.usermodel.Row;
@@ -76,11 +52,12 @@
     private static String EXPORT_KEY = "isExport";
     private static String ANNOTATION_FIELD = "memberValues";
 
-    public static <T> List<T> getExcelToList(String sheetName, Integer startNo, InputStream input, Class<T> clazz) throws Exception {
-        ArrayList<T> list = new ArrayList<T>();
-        try (Workbook book = WorkbookFactory.create((InputStream)input);){
+    public static <T> List<T> getExcelToList(String sheetName, Integer startNo, InputStream input, Class<T> clazz)
+        throws Exception {
+        List<T> list = new ArrayList<>();
+        try (Workbook book = WorkbookFactory.create(input)) {
             Sheet sheet = null;
-            if (StringUtils.isNotBlank((CharSequence)sheetName)) {
+            if (StringUtils.isNotBlank(sheetName)) {
                 sheet = book.getSheet(sheetName);
             }
             if (sheet == null) {
@@ -88,279 +65,276 @@
             }
             int rows = sheet.getLastRowNum();
             int startLine = 1;
-            if (null != startNo && startNo >= 0) {
-                startLine = startNo;
+            if (null != startNo && startNo.intValue() >= 0) {
+                startLine = startNo.intValue();
             }
             if (rows > 0) {
                 Field[] allFields = clazz.getDeclaredFields();
-                Map<String, Field> fieldsMap = ExcelUtil.getStringFieldMap(allFields);
+                Map<String, Field> fieldsMap = getStringFieldMap(allFields);
                 Row firstRow = sheet.getRow(sheet.getFirstRowNum() + startLine - 1);
-                for (int i = sheet.getFirstRowNum() + startLine; i <= rows; ++i) {
+                for (int i = sheet.getFirstRowNum() + startLine; i <= rows; i++) {
                     Row row = sheet.getRow(i);
-                    if (row == null) continue;
-                    Iterator cells = row.cellIterator();
-                    T entity = null;
-                    boolean isNull = true;
-                    while (cells.hasNext()) {
-                        Cell cell = (Cell)cells.next();
-                        String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
-                        if (!fieldsMap.containsKey(fieldName)) continue;
-                        cell.setCellType(1);
-                        String c = cell.getStringCellValue();
-                        if (StringUtils.isNotEmpty((CharSequence)c)) {
-                            isNull = false;
+                    if (row != null) {
+                        Iterator<Cell> cells = row.cellIterator();
+                        T entity = null;
+                        boolean isNull = true;
+                        while (cells.hasNext()) {
+                            Cell cell = cells.next();
+                            String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
+                            if (!fieldsMap.containsKey(fieldName)) {
+                                continue;
+                            }
+                            cell.setCellType(CellType.STRING);
+                            String c = cell.getStringCellValue();
+                            if (StringUtils.isNotEmpty(c)) {
+                                isNull = false;
+                            }
+                            entity = (entity == null) ? clazz.newInstance() : entity;
+                            Field field = fieldsMap.get(fieldName);
+                            Class<?> fieldType = field.getType();
+                            if (fieldType == null) {
+                                continue;
+                            }
+                            setValue(entity, c, field, fieldType);
                         }
-                        entity = entity == null ? (T)clazz.newInstance() : entity;
-                        Field field = fieldsMap.get(fieldName);
-                        Class<?> fieldType = field.getType();
-                        if (fieldType == null) continue;
-                        ExcelUtil.setValue(entity, c, field, fieldType);
+                        if (entity != null && !isNull)
+                            list.add(entity);
                     }
-                    if (entity == null || isNull) continue;
-                    list.add(entity);
                 }
             }
-        }
-        catch (Exception e) {
-            throw new Exception("\u5c06excel\u8868\u5355\u6570\u636e\u6e90\u7684\u6570\u636e\u5bfc\u5165\u5230list\u5f02\u5e38!", e);
+        } catch (Exception e) {
+            throw new Exception("将excel表单数据源的数据导入到list异常!", e);
         }
         return list;
     }
 
-    private static <T> void setValue(T entity, String c, Field field, Class<?> fieldType) throws IllegalAccessException {
+    private static <T> void setValue(T entity, String c, Field field, Class<?> fieldType)
+        throws IllegalAccessException {
         if (String.class == fieldType) {
             field.set(entity, String.valueOf(c));
         } else if (BigDecimal.class == fieldType) {
-            field.set(entity, BigDecimal.valueOf(Double.valueOf(c)));
-        } else if (Integer.TYPE == fieldType || Integer.class == fieldType) {
-            field.set(entity, Integer.parseInt(c));
-        } else if (Long.TYPE == fieldType || Long.class == fieldType) {
+            field.set(entity, BigDecimal.valueOf(Double.valueOf(c).doubleValue()));
+        } else if (int.class == fieldType || Integer.class == fieldType) {
+            field.set(entity, Integer.valueOf(Integer.parseInt(c)));
+        } else if (long.class == fieldType || Long.class == fieldType) {
             field.set(entity, Long.valueOf(c));
-        } else if (Float.TYPE == fieldType || Float.class == fieldType) {
+        } else if (float.class == fieldType || Float.class == fieldType) {
             field.set(entity, Float.valueOf(c));
-        } else if (Short.TYPE == fieldType || Short.class == fieldType) {
+        } else if (short.class == fieldType || Short.class == fieldType) {
             field.set(entity, Short.valueOf(c));
-        } else if (Double.TYPE == fieldType || Double.class == fieldType) {
+        } else if (double.class == fieldType || Double.class == fieldType) {
             field.set(entity, Double.valueOf(c));
         }
     }
 
     private static Map<String, Field> getStringFieldMap(Field[] allFields) {
-        HashMap<String, Field> fieldsMap = new HashMap<String, Field>(allFields.length);
+        Map<String, Field> fieldsMap = new HashMap<>(allFields.length);
         for (Field field : allFields) {
-            ExcelAttribute attribute;
-            if (!field.isAnnotationPresent(ExcelAttribute.class) || StringUtils.isBlank((CharSequence)(attribute = field.getAnnotation(ExcelAttribute.class)).name())) continue;
-            field.setAccessible(true);
-            fieldsMap.put(attribute.name(), field);
+            if (field.isAnnotationPresent((Class)ExcelAttribute.class)) {
+                ExcelAttribute attribute = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
+                if (!StringUtils.isBlank(attribute.name())) {
+                    field.setAccessible(true);
+                    fieldsMap.put(attribute.name(), field);
+                }
+            }
         }
         return fieldsMap;
     }
 
     public static <T> boolean matchExcel(String sheetName, InputStream input, Class<T> clazz) throws Exception {
-        block6: {
-            try {
-                int rows;
-                HSSFWorkbook book = new HSSFWorkbook(input);
-                HSSFSheet sheet = null;
-                if (StringUtils.isNotBlank((CharSequence)sheetName)) {
-                    sheet = book.getSheet(sheetName);
-                }
-                if (sheet == null) {
-                    sheet = book.getSheetAt(0);
-                }
-                if ((rows = sheet.getLastRowNum()) > 0) {
-                    Field[] allFields = clazz.getDeclaredFields();
-                    Map<String, Field> fieldsMap = ExcelUtil.getStringFieldMap(allFields);
-                    HSSFRow firstRow = sheet.getRow(sheet.getFirstRowNum());
-                    Iterator cells = firstRow.cellIterator();
-                    while (cells.hasNext()) {
-                        Cell cell = (Cell)cells.next();
-                        String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
-                        if (fieldsMap.containsKey(fieldName)) continue;
+        try {
+            HSSFWorkbook book = new HSSFWorkbook(input);
+            HSSFSheet sheet = null;
+            if (StringUtils.isNotBlank(sheetName)) {
+                sheet = book.getSheet(sheetName);
+            }
+            if (sheet == null) {
+                sheet = book.getSheetAt(0);
+            }
+            int rows = sheet.getLastRowNum();
+            if (rows > 0) {
+                Field[] allFields = clazz.getDeclaredFields();
+                Map<String, Field> fieldsMap = getStringFieldMap(allFields);
+                HSSFRow firstRow = sheet.getRow(sheet.getFirstRowNum());
+                Iterator<Cell> cells = firstRow.cellIterator();
+                while (cells.hasNext()) {
+                    Cell cell = cells.next();
+                    String fieldName = firstRow.getCell(cell.getColumnIndex()).getStringCellValue();
+                    if (!fieldsMap.containsKey(fieldName)) {
                         return false;
                     }
-                    break block6;
                 }
+            } else {
                 return false;
             }
-            catch (Exception e) {
-                throw new Exception("\u5c06excel\u8868\u5355\u6570\u636e\u6e90\u7684\u6570\u636e\u5bfc\u5165\u5230list\u5f02\u5e38!", e);
-            }
+        } catch (Exception e) {
+            throw new Exception("将excel表单数据源的数据导入到list异常!", e);
         }
         return true;
     }
 
-    /*
-     * Enabled aggressive block sorting
-     * Enabled unnecessary exception pruning
-     * Enabled aggressive exception aggregation
-     */
-    public static <T> boolean getListToExcel(List<T> list, List<T> listHead, String sheetName, OutputStream output, Class<T> clazz) throws Exception {
-        try (HSSFWorkbook workbook = new HSSFWorkbook();){
+    public static <T> boolean getListToExcel(List<T> list, List<T> listHead, String sheetName, OutputStream output,
+        Class<T> clazz) throws Exception {
+        try (HSSFWorkbook workbook = new HSSFWorkbook()) {
             Field[] allFields = clazz.getDeclaredFields();
-            ArrayList<Field> fields = new ArrayList<Field>();
+            List<Field> fields = new ArrayList<>();
             for (Field field : allFields) {
-                if (!field.isAnnotationPresent(ExcelAttribute.class)) continue;
-                fields.add(field);
+                if (field.isAnnotationPresent((Class)ExcelAttribute.class)) {
+                    fields.add(field);
+                }
             }
             HSSFSheet sheet = workbook.createSheet();
             workbook.setSheetName(0, sheetName);
-            ExcelUtil.createRowContent(sheet, fields, workbook, listHead, 0, listHead.size(), 0);
-            ExcelUtil.createRowHeard(sheet, fields, workbook, 1);
-            ExcelUtil.createRowContent(sheet, fields, workbook, list, 0, list.size(), 2);
+            createRowContent(sheet, fields, workbook, listHead, 0, listHead.size(), 0);
+            createRowHeard(sheet, fields, workbook, 1);
+            createRowContent(sheet, fields, workbook, list, 0, list.size(), 2);
             output.flush();
             workbook.write(output);
             output.close();
-            int n = Boolean.TRUE.booleanValue() ? 1 : 0;
-            return n != 0;
-        }
-        catch (Exception e) {
-            throw new Exception("\u5c06list\u6570\u636e\u6e90\u7684\u6570\u636e\u5bfc\u5165\u5230excel\u8868\u5355\u5f02\u5e38!", e);
+            return Boolean.TRUE.booleanValue();
+        } catch (Exception e) {
+            throw new Exception("将list数据源的数据导入到excel表单异常!", e);
         }
     }
 
-    /*
-     * Enabled aggressive block sorting
-     * Enabled unnecessary exception pruning
-     * Enabled aggressive exception aggregation
-     */
-    public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz) throws Exception {
-        try (HSSFWorkbook workbook = new HSSFWorkbook();){
+    public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz)
+        throws Exception {
+        try (HSSFWorkbook workbook = new HSSFWorkbook()) {
             int sheetSize = 65536;
             Field[] allFields = clazz.getDeclaredFields();
-            ArrayList<Field> fields = new ArrayList<Field>();
+            List<Field> fields = new ArrayList<>();
             for (Field field : allFields) {
-                ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
-                if (attr == null || !attr.isExport()) continue;
-                fields.add(field);
+                ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
+                if (attr != null && attr.isExport()) {
+                    fields.add(field);
+                }
             }
             int listSize = 0;
             if (list != null && list.size() > 0) {
                 listSize = list.size();
             }
             int sheetNo = listSize / sheetSize;
-            for (int index = 0; index <= sheetNo; ++index) {
+            for (int index = 0; index <= sheetNo; index++) {
                 HSSFSheet sheet = workbook.createSheet();
                 workbook.setSheetName(index, sheetName + index);
-                ExcelUtil.createRowHeard(sheet, fields, workbook, 2);
+                createRowHeard(sheet, fields, workbook, 2);
                 int startNo = index * sheetSize;
                 int endNo = Math.min(startNo + sheetSize, listSize);
-                ExcelUtil.createRowContent(sheet, fields, workbook, list, startNo, endNo, 3);
+                createRowContent(sheet, fields, workbook, list, startNo, endNo, 3);
             }
             output.flush();
             workbook.write(output);
             output.close();
-            int n = Boolean.TRUE.booleanValue() ? 1 : 0;
-            return n != 0;
-        }
-        catch (Exception e) {
-            throw new Exception("\u5c06list\u6570\u636e\u6e90\u7684\u6570\u636e\u5bfc\u5165\u5230excel\u8868\u5355\u5f02\u5e38!", e);
+            return Boolean.TRUE.booleanValue();
+        } catch (Exception e) {
+            throw new Exception("将list数据源的数据导入到excel表单异常!", e);
         }
     }
 
-    /*
-     * Enabled aggressive block sorting
-     * Enabled unnecessary exception pruning
-     * Enabled aggressive exception aggregation
-     */
-    public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz, Integer startRow, ExcelCallback callback) throws Exception {
-        try (HSSFWorkbook workbook = new HSSFWorkbook();){
+    public static <T> boolean getListToExcel(List<T> list, String sheetName, OutputStream output, Class<T> clazz,
+        Integer startRow, ExcelCallback callback) throws Exception {
+        try (HSSFWorkbook workbook = new HSSFWorkbook()) {
             int sheetSize = 65536;
             Field[] allFields = clazz.getDeclaredFields();
-            ArrayList<Field> fields = new ArrayList<Field>();
+            List<Field> fields = new ArrayList<>();
             for (Field field : allFields) {
-                ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
-                if (attr == null || !attr.isExport()) continue;
-                fields.add(field);
+                ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
+                if (attr != null && attr.isExport()) {
+                    fields.add(field);
+                }
             }
             int listSize = 0;
             if (list != null && list.size() > 0) {
                 listSize = list.size();
             }
             int sheetNo = listSize / sheetSize;
-            for (int index = 0; index <= sheetNo; ++index) {
+            for (int index = 0; index <= sheetNo; index++) {
                 HSSFSheet sheet = workbook.createSheet();
                 workbook.setSheetName(index, sheetName + index);
-                ExcelUtil.createRowHeard(sheet, fields, workbook, startRow);
+                createRowHeard(sheet, fields, workbook, startRow.intValue());
                 int startNo = index * sheetSize;
                 int endNo = Math.min(startNo + sheetSize, listSize);
-                ExcelUtil.createRowContent(sheet, fields, workbook, list, startNo, endNo, startRow + 1);
-                if (null == callback) continue;
-                callback.call(workbook, sheet);
+                createRowContent(sheet, fields, workbook, list, startNo, endNo, startRow.intValue() + 1);
+                if (null != callback) {
+                    callback.call(workbook, sheet);
+                }
             }
             output.flush();
             workbook.write(output);
             output.close();
-            int n = Boolean.TRUE.booleanValue() ? 1 : 0;
-            return n != 0;
-        }
-        catch (Exception e) {
-            throw new Exception("\u5c06list\u6570\u636e\u6e90\u7684\u6570\u636e\u5bfc\u5165\u5230excel\u8868\u5355\u5f02\u5e38!", e);
+            return Boolean.TRUE.booleanValue();
+        } catch (Exception e) {
+            throw new Exception("将list数据源的数据导入到excel表单异常!", e);
         }
     }
 
-    private static <T> void createRowContent(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, List<T> list, int startNo, int endNo, int rowIndex) throws Exception {
+    private static <T> void createRowContent(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, List<T> list,
+        int startNo, int endNo, int rowIndex) throws Exception {
         String value = null;
         int hwPicType = 0;
         byte[] picByte = null;
-        for (int i = startNo; i < endNo; ++i) {
+        for (int i = startNo; i < endNo; i++) {
             HSSFRow row = sheet.createRow(i - startNo + rowIndex);
             T vo = list.get(i);
-            for (int j = 0; j < fields.size(); ++j) {
+            for (int j = 0; j < fields.size(); j++) {
                 Field field = fields.get(j);
                 field.setAccessible(true);
-                ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
+                ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
                 int col = j;
-                if (StringUtils.isNotBlank((CharSequence)attr.column())) {
-                    col = ExcelUtil.getExcelCol(attr.column());
+                if (StringUtils.isNotBlank(attr.column())) {
+                    col = getExcelCol(attr.column());
                 }
-                if (!attr.isExport()) continue;
-                HSSFCell cell = row.createCell(col);
-                Class<Comparable<Date>> classType = field.getType();
-                if (field.get(vo) == null) continue;
-                value = null;
-                if (classType.isAssignableFrom(Date.class)) {
-                    value = DateUtils.formatDate((Date)((Date)field.get(vo)), (String)"yyyy-MM-dd HH:mm:ss");
-                }
-                if (classType.isAssignableFrom(Long.class) && attr.isDate()) {
-                    value = DateUtils.formatDate((Date)new Date((Long)field.get(vo)), (String)"yyyy-MM-dd HH:mm:ss");
-                }
-                if (attr.isPic()) {
-                    try {
-                        if (field.getType().equals(String.class)) {
-                            picByte = ExcelUtil.getBytesByUrl((String)field.get(vo));
+                if (attr.isExport()) {
+                    HSSFCell cell = row.createCell(col);
+                    Class<?> classType = field.getType();
+                    if (field.get(vo) != null) {
+                        value = null;
+                        if (classType.isAssignableFrom(Date.class)) {
+                            value = DateUtils.formatDate((Date)field.get(vo), "yyyy-MM-dd HH:mm:ss");
+                        }
+                        if (classType.isAssignableFrom(Long.class) && attr.isDate()) {
+                            value = DateUtils.formatDate(new Date(((Long)field.get(vo)).longValue()),
+                                "yyyy-MM-dd HH:mm:ss");
+                        }
+                        if (attr.isPic()) {
+                            try {
+                                if (field.getType().equals(String.class)) {
+                                    picByte = getBytesByUrl((String)field.get(vo));
+                                }
+                                picByte = (byte[])field.get(vo);
+                            } catch (Exception exception) {
+                            }
+                            hwPicType = 5;
+                            HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+                            HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 1020, 250, (short)col, row.getRowNum(),
+                                (short)col, row.getRowNum());
+                            patriarch.createPicture(anchor, workbook.addPicture(picByte, hwPicType));
+                            row.setHeight((short)1000);
+                        } else {
+                            cell.setCellValue((field.get(vo) == null) ? ""
+                                : ((value == null) ? String.valueOf(field.get(vo)) : value));
                         }
-                        picByte = (byte[])field.get(vo);
-                    }
-                    catch (Exception exception) {
-                        // empty catch block
                     }
-                    hwPicType = 5;
-                    HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
-                    HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 1020, 250, (short)col, row.getRowNum(), (short)col, row.getRowNum());
-                    patriarch.createPicture(anchor, workbook.addPicture(picByte, hwPicType));
-                    row.setHeight((short)1000);
-                    continue;
                 }
-                cell.setCellValue(field.get(vo) == null ? "" : (value == null ? String.valueOf(field.get(vo)) : value));
             }
         }
     }
 
     public static void createRowHeard(HSSFSheet sheet, List<Field> fields, HSSFWorkbook workbook, int index) {
         HSSFRow row = sheet.createRow(index);
-        for (int i = 0; i < fields.size(); ++i) {
+        for (int i = 0; i < fields.size(); i++) {
             int col = i;
             Field field = fields.get(i);
-            ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
-            if (StringUtils.isNotBlank((CharSequence)attr.column())) {
-                col = ExcelUtil.getExcelCol(attr.column());
+            ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
+            if (StringUtils.isNotBlank(attr.column())) {
+                col = getExcelCol(attr.column());
             }
             HSSFCell cell = row.createCell(col);
-            HSSFCellStyle cellStyle = ExcelUtil.createCellStyle(workbook, attr.isMark() ? "2" : FONT_CODE);
+            HSSFCellStyle cellStyle = createCellStyle(workbook, attr.isMark() ? "2" : "1");
             cell.setCellStyle(cellStyle);
-            sheet.setColumnWidth(i, (int)((double)(attr.name().getBytes().length <= 4 ? 6 : attr.name().getBytes().length) * 1.5 * 256.0));
-            cell.setCellType(1);
+            sheet.setColumnWidth(i,
+                (int)((((attr.name().getBytes()).length <= 4) ? 6 : (attr.name().getBytes()).length) * 1.5D * 256.0D));
+            cell.setCellType(CellType.STRING);
             cell.setCellValue(attr.name());
         }
     }
@@ -369,9 +343,9 @@
         HSSFFont font = workbook.createFont();
         HSSFCellStyle cellStyle = workbook.createCellStyle();
         font.setFontName("Arail narrow");
-        font.setBoldweight((short)700);
-        if (FONT_CODE.equals(type)) {
-            font.setColor((short)Short.MAX_VALUE);
+        font.setBold(true);
+        if ("1".equals(type)) {
+            font.setColor(IndexedColors.RED.getIndex());
             cellStyle.setFont(font);
         } else {
             font.setColor((short)10);
@@ -384,14 +358,15 @@
         col = col.toUpperCase();
         int count = -1;
         char[] cs = col.toCharArray();
-        for (int i = 0; i < cs.length; ++i) {
-            count = (int)((double)count + (double)(cs[i] - 64) * Math.pow(26.0, (double)cs.length - 1.0 - (double)i));
+        for (int i = 0; i < cs.length; i++) {
+            count = (int)(count + (cs[i] - 64) * Math.pow(26.0D, cs.length - 1.0D - i));
         }
         return count;
     }
 
-    public static HSSFSheet setHSSFPrompt(HSSFSheet sheet, String promptTitle, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
-        DVConstraint constraint = DVConstraint.createCustomFormulaConstraint((String)"DD1");
+    public static HSSFSheet setHSSFPrompt(HSSFSheet sheet, String promptTitle, String promptContent, int firstRow,
+        int endRow, int firstCol, int endCol) {
+        DVConstraint constraint = DVConstraint.createCustomFormulaConstraint("DD1");
         CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
         HSSFDataValidation dataValidationView = new HSSFDataValidation(regions, (DataValidationConstraint)constraint);
         dataValidationView.createPromptBox(promptTitle, promptContent);
@@ -399,25 +374,22 @@
         return sheet;
     }
 
-    public static HSSFSheet setHSSFValidation(HSSFSheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
-        DVConstraint constraint = DVConstraint.createExplicitListConstraint((String[])textlist);
+    public static HSSFSheet setHSSFValidation(HSSFSheet sheet, String[] textlist, int firstRow, int endRow,
+        int firstCol, int endCol) {
+        DVConstraint constraint = DVConstraint.createExplicitListConstraint(textlist);
         CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
         HSSFDataValidation dataValidationList = new HSSFDataValidation(regions, (DataValidationConstraint)constraint);
         sheet.addValidationData((DataValidation)dataValidationList);
         return sheet;
     }
 
-    /*
-     * WARNING - Removed try catching itself - possible behaviour change.
-     */
     public static byte[] getBytesByUrl(String imgUrl) throws Exception {
-        if (StringUtils.isEmpty((CharSequence)imgUrl)) {
+        if (StringUtils.isEmpty(imgUrl)) {
             return null;
         }
         BufferedInputStream bis = null;
         ByteArrayOutputStream bos = null;
         try {
-            int size;
             URL url = new URL(imgUrl);
             HttpURLConnection http = (HttpURLConnection)url.openConnection();
             http.setConnectTimeout(3000);
@@ -425,28 +397,25 @@
             bis = new BufferedInputStream(http.getInputStream());
             bos = new ByteArrayOutputStream();
             byte[] buf = new byte[8096];
+            int size;
             while ((size = bis.read(buf)) != -1) {
                 bos.write(buf, 0, size);
             }
             http.disconnect();
-            byte[] byArray = bos.toByteArray();
-            return byArray;
-        }
-        finally {
+            return bos.toByteArray();
+        } finally {
             if (bis != null) {
                 try {
                     bis.close();
-                }
-                catch (IOException e) {
-                    logger.error("\u6d41\u5173\u95ed\u5931\u8d25\uff0c\u539f\u56e0\uff1a" + e.getMessage(), (Throwable)e);
+                } catch (IOException e) {
+                    logger.error("流关闭失败，原因：" + e.getMessage(), e);
                 }
             }
             if (bos != null) {
                 try {
                     bos.close();
-                }
-                catch (IOException e) {
-                    logger.error("\u6d41\u5173\u95ed\u5931\u8d25\uff0c\u539f\u56e0\uff1a" + e.getMessage(), (Throwable)e);
+                } catch (IOException e) {
+                    logger.error("流关闭失败，原因：" + e.getMessage(), e);
                 }
             }
         }
@@ -460,20 +429,18 @@
         Field value = null;
         try {
             value = invocationHandler.getClass().getDeclaredField(ANNOTATION_FIELD);
-        }
-        catch (Exception e) {
-            logger.warn("\u53cd\u5c04\u83b7\u53d6ExcelAttribute\u6ce8\u89e3\u7684\u6210\u5458\u5b57\u6bb5\u5f02\u5e38", (Throwable)e);
+        } catch (Exception e) {
+            logger.warn("反射获取ExcelAttribute注解的成员字段异常", e);
         }
         if (value == null) {
             return;
         }
         value.setAccessible(true);
-        Map memberValues = null;
+        Map<String, Object> memberValues = null;
         try {
-            memberValues = (Map)value.get(invocationHandler);
-        }
-        catch (Exception e) {
-            logger.warn("\u53cd\u5c04\u83b7\u53d6ExcelAttribute\u6ce8\u89e3\u7684\u6210\u5458\u503c\u5f02\u5e38", (Throwable)e);
+            memberValues = (Map<String, Object>)value.get(invocationHandler);
+        } catch (Exception e) {
+            logger.warn("反射获取ExcelAttribute注解的成员值异常", e);
         }
         if (memberValues == null) {
             return;
@@ -482,34 +449,30 @@
             memberValues.put(key, obj);
         }
         if (!isExport) {
-            memberValues.put(EXPORT_KEY, isExport);
+            memberValues.put(EXPORT_KEY, Boolean.valueOf(isExport));
         }
     }
 
-    /*
-     * Exception decompiling
-     */
-    public static <T> boolean appendListToExcel(InputStream inputStream, List<T> list, int sheetIndex, OutputStream output, Class<T> clazz, Integer startRow) throws Exception {
-        /*
-         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
-         * 
-         * org.benf.cfr.reader.util.ConfusedCFRException: Started 2 blocks at once
-         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.getStartingBlocks(Op04StructuredStatement.java:412)
-         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.buildNestedBlocks(Op04StructuredStatement.java:487)
-         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op03SimpleStatement.createInitialStructuredBlock(Op03SimpleStatement.java:736)
-         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:850)
-         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
-         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
-         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
-         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
-         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
-         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
-         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
-         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
-         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
-         *     at org.benf.cfr.reader.Main.main(Main.java:54)
-         */
-        throw new IllegalStateException("Decompilation failed");
+    public static <T> boolean appendListToExcel(InputStream inputStream, List<T> list, int sheetIndex,
+        OutputStream output, Class<T> clazz, Integer startRow) throws Exception {
+        try (HSSFWorkbook workbook = new HSSFWorkbook(inputStream)) {
+            Field[] allFields = clazz.getDeclaredFields();
+            List<Field> fields = new ArrayList<>();
+            for (Field field : allFields) {
+                ExcelAttribute attr = field.<ExcelAttribute>getAnnotation(ExcelAttribute.class);
+                if (attr != null && attr.isExport()) {
+                    fields.add(field);
+                }
+            }
+            HSSFSheet sheet = workbook.getSheetAt(sheetIndex);
+            createRowContent(sheet, fields, workbook, list, 0, list.size(), startRow.intValue());
+            output.flush();
+            workbook.write(IOUtils.buffer(output));
+            return Boolean.TRUE.booleanValue();
+        } catch (IOException e) {
+            throw new Exception("将list数据源的数据导入到excel表单异常!", e);
+        } finally {
+            output.close();
+        }
     }
 }
-
