fei
2025-12-15 5be5c89210dbb626dbb87a81265ff8eef92979df
修改了对应代码
8个文件已修改
172 ■■■■ 已修改文件
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.util.Date;
@@ -10,30 +11,30 @@
public class DocumentMaterialsVo {
    @Excel(name="序号", height = 10,width=10)
    @Excel(name="序号", height = 10,width=8,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private Long num;
    @Excel(name = "文件编号", height = 10, width=15)
    @Excel(name = "文件编号", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String documentNumber;
    @Excel(name = "责任者", height = 10, width=10)
    @Excel(name = "责任者", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String creator;
    @Excel(name = "文件题名", height = 20)
    @Excel(name = "文件题名", height = 8,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String title;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "日期", width = 10, dateFormat = "yyyy-MM-dd", height = 10)
    @Excel(name = "日期", width = 10, dateFormat = "yyyy-MM-dd", height = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private Date date;
    @Excel(name = "页号", height = 10,width = 10)
    @Excel(name = "页号", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private Long pageNumber;
    @Excel(name = "备注", height = 20)
    @Excel(name = "备注", height = 20,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String remarks;
    @Excel(name = "档号", height = 10)
    @Excel(name = "档号", height = 10,width=10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE, headerFontName = "Arial", headerFontBold = true)
    private String recordId;
    @Excel(name = "公开属性", height = 10)
    @Excel(name = "公开属性", height = 10,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String publicity;
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.util.Date;
@@ -10,25 +11,25 @@
public class DocumentMaterialsVoSmall {
    @Excel(name="序号")
    @Excel(name="序号",width = 5, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private Long num;
    @Excel(name = "文件编号")
    @Excel(name = "文件编号",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String documentNumber;
    @Excel(name = "编任者")
    @Excel(name = "责任者",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String creator;
    @Excel(name = "文件题名")
    @Excel(name = "文件题名",width = 36, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String title;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    @Excel(name = "日期", width = 12, dateFormat = "yyyy-MM-dd", headerColor = IndexedColors.BLACK, headerFontBold = true)
    private Date date;
    @Excel(name = "页号")
    @Excel(name = "页号",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private Long pageNumber;
    @Excel(name = "备注")
    @Excel(name = "备注",width = 10, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String remarks;
    public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, Long pageNumber, String remarks) {
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
@@ -134,6 +134,16 @@
    public IndexedColors headerColor() default IndexedColors.WHITE;
    /**
     * 导出列头字体名称
     */
    public String headerFontName() default "Arial";
    /**
     * 导出列头字体是否加粗
     */
    public boolean headerFontBold() default false;
    /**
     * 导出单元格背景颜色
     */
    public IndexedColors backgroundColor() default IndexedColors.WHITE;
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -910,8 +910,9 @@
                style.cloneStyleFrom(styles.get("data"));
                style.setAlignment(HorizontalAlignment.CENTER);
                style.setVerticalAlignment(VerticalAlignment.CENTER);
                style.setFillForegroundColor(excel.headerBackgroundColor().index);
                style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                // 已注释,表头不显示背景色
                // style.setFillForegroundColor(excel.headerBackgroundColor().index);
                // style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                // 设置表头自动换行
                style.setWrapText(true);
                Font headerFont = wb.createFont();
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -295,7 +295,7 @@
                    // 创建行并设置高度
                     row = sheet.createRow(0);
                    row.setHeight((short)(40 * 40));
                    row.setHeight((short)(30 *30));
                    // 创建单元格并添加图片
                    Cell cell = row.createCell(0);
@@ -307,8 +307,8 @@
                            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 5),
                                    cell.getRow().getRowNum() + 1);
                                    // 计算居中位置
                    int col1 = 1; // 中间列
                    int col2 = col1 + 5;
                    int col1 = 3; // 中间列
                    int col2 = col1 + 2;
                    anchor.setCol1(col1);
                    anchor.setCol2(col2);
                    anchor.setRow1(0);
@@ -336,11 +336,12 @@
                    sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
                    Cell titleCell = row.createCell(0);
                    titleCell.setCellValue("卷内目录");
                    // 设置加粗和居中样式
                    // 设置加粗、宋体、18号字体和居中样式
                    CellStyle style = wb.createCellStyle();
                    Font font = wb.createFont();
                    font.setBold(true);
                    font.setFontName("宋体");
                    font.setFontHeightInPoints((short) 18);
                    style.setFont(font);
                    style.setAlignment(HorizontalAlignment.CENTER);
                    titleCell.setCellStyle(style);
@@ -508,21 +509,35 @@
        style.setFont(dataFont);
        styles.put("data", style);
        // 创建表头样式映射,根据Excel注解动态生成
        Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>();
        for (Object[] os : fields)
        {
            Excel excel = (Excel) os[1];
            String key = StringUtils.format("header_{}_{}_{}_{}", excel.headerColor(), excel.headerBackgroundColor(), excel.headerFontName(), excel.headerFontBold());
            if (!headerStyles.containsKey(key))
            {
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
                // 根据注解设置表头背景色 - 已注释,表头不显示背景色
                /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
                    style.setFillForegroundColor(excel.headerBackgroundColor().index);
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
        style.setFont(headerFont);
        // 表头也设置自动换行
                }*/
                // 设置表头自动换行
        style.setWrapText(true);
        styles.put("header", style);
                Font headerFont = wb.createFont();
                headerFont.setFontName(excel.headerFontName());
                headerFont.setFontHeightInPoints((short) 10);
                headerFont.setBold(excel.headerFontBold());
                headerFont.setColor(excel.headerColor().index);
                style.setFont(headerFont);
                headerStyles.put(key, style);
            }
        }
        styles.putAll(headerStyles);
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
@@ -568,7 +583,9 @@
        // 写入列信息
        cell.setCellValue(attr.name());
        setDataValidation(attr, row, column);
        cell.setCellStyle(styles.get("header"));
        // 根据Excel注解动态选择表头样式
        String key = StringUtils.format("header_{}_{}_{}_{}", attr.headerColor(), attr.headerBackgroundColor(), attr.headerFontName(), attr.headerFontBold());
        cell.setCellStyle(styles.get(key));
        return cell;
    }
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -554,21 +554,35 @@
        style.setFont(dataFont);
        styles.put("data", style);
        // 创建表头样式映射,根据Excel注解动态生成
        Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>();
        for (Object[] os : fields)
        {
            Excel excel = (Excel) os[1];
            String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor());
            if (!headerStyles.containsKey(key))
            {
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
                // 根据注解设置表头背景色 - 已注释,表头不显示背景色
                /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
                    style.setFillForegroundColor(excel.headerBackgroundColor().index);
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                }*/
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
                headerFont.setBold(false);
                headerFont.setColor(excel.headerColor().index);
        style.setFont(headerFont);
        styles.put("header", style);
                headerStyles.put(key, style);
            }
        }
        styles.putAll(headerStyles);
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
@@ -614,7 +628,9 @@
        // 写入列信息
        cell.setCellValue(attr.name());
        setDataValidation(attr, row, column);
        cell.setCellStyle(styles.get("header"));
        // 根据Excel注解动态选择表头样式
        String key = StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor());
        cell.setCellStyle(styles.get(key));
        return cell;
    }
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -604,21 +604,35 @@
        style.setFont(dataFont);
        styles.put("data", style);
        // 创建表头样式映射,根据Excel注解动态生成
        Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>();
        for (Object[] os : fields)
        {
            Excel excel = (Excel) os[1];
            String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor());
            if (!headerStyles.containsKey(key))
            {
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
                // 根据注解设置表头背景色 - 已注释,表头不显示背景色
                /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
                    style.setFillForegroundColor(excel.headerBackgroundColor().index);
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                }*/
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
                headerFont.setBold(excel.headerFontBold());
                headerFont.setColor(excel.headerColor().index);
        style.setFont(headerFont);
        styles.put("header", style);
                headerStyles.put(key, style);
            }
        }
        styles.putAll(headerStyles);
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
@@ -664,7 +678,9 @@
        // 写入列信息
        cell.setCellValue(attr.name());
        setDataValidation(attr, row, column);
        cell.setCellStyle(styles.get("header"));
        // 根据Excel注解动态选择表头样式
        String key = StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor());
        cell.setCellStyle(styles.get(key));
        return cell;
    }
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
@@ -469,21 +469,35 @@
        style.setFont(dataFont);
        styles.put("data", style);
        // 创建表头样式映射,根据Excel注解动态生成
        Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>();
        for (Object[] os : fields)
        {
            Excel excel = (Excel) os[1];
            String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor());
            if (!headerStyles.containsKey(key))
            {
        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(HorizontalAlignment.CENTER);
        style.setVerticalAlignment(VerticalAlignment.CENTER);
        // 设置单元格内容自动换行
        style.setWrapText(true);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
                // 根据注解设置表头背景色 - 已注释,表头不显示背景色
                /*if (excel.headerBackgroundColor() != IndexedColors.WHITE) {
                    style.setFillForegroundColor(excel.headerBackgroundColor().index);
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
                }*/
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
                headerFont.setBold(false);
                headerFont.setColor(excel.headerColor().index);
        style.setFont(headerFont);
        styles.put("header", style);
                headerStyles.put(key, style);
            }
        }
        styles.putAll(headerStyles);
        style = wb.createCellStyle();
        style.setAlignment(HorizontalAlignment.CENTER);
@@ -529,7 +543,9 @@
        // 写入列信息
        cell.setCellValue(attr.name());
        setDataValidation(attr, row, column);
        cell.setCellStyle(styles.get("header"));
        // 根据Excel注解动态选择表头样式
        String key = StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor());
        cell.setCellStyle(styles.get(key));
        return cell;
    }