fei
9 天以前 a5edca4c62ea99418dcaa5d792947b1bab7fe8b2
修改了对应代码
6个文件已修改
371 ■■■■■ 已修改文件
archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java 208 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.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;
@@ -11,40 +12,40 @@
    /** 档案号 */
    @Excel(name = "档案号")
    @Excel(name = "档案号",width = 8, headerColor = IndexedColors.BLACK)
    private String recordId;
    /** 档案管(室)号 */
    @Excel(name = "档案管(室)号")
    @Excel(name = "档案管(室)号",width = 6, headerColor = IndexedColors.BLACK)
    private String archiveRoomNumber;
    /** 缩微号 */
    @Excel(name = "缩微号")
    @Excel(name = "缩微号",width = 8, headerColor = IndexedColors.BLACK)
    private String microfilmNumber;
    /** 发问号 */
    @Excel(name = "发文号")
    @Excel(name = "发文号",width = 8, headerColor = IndexedColors.RED)
    private String inquiryNumber;
    /** 案卷题名 */
    @Excel(name = "案卷题名")
    @Excel(name = "案卷题名",width = 20, headerColor = IndexedColors.RED)
    private String caseTitle;
    /** 编制日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "编制日期", width = 30, dateFormat = "yyyy-MM-dd")
    @Excel(name = "编制日期", width = 12, dateFormat = "yyyy-MM-dd", headerColor = IndexedColors.RED)
    private Date preparationDate;
    /** 编制单位 */
    @Excel(name = "编制单位")
    @Excel(name = "编制单位",width = 8, headerColor = IndexedColors.RED)
    private String preparationUnit;
    /** 保管期限 */
    @Excel(name = "保管期限")
    @Excel(name = "保管期限", width = 8,headerColor = IndexedColors.RED)
    private String retentionPeriod;
    /** 密级 */
    @Excel(name = "密级")
    @Excel(name = "密级", width = 8,headerColor = IndexedColors.RED)
    private String securityClassification;
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java
@@ -16,6 +16,7 @@
            Code128Bean barcodeGenerator = new Code128Bean();
            final int dpi = 160;
            barcodeGenerator.setModuleWidth(0.21);
            barcodeGenerator.setBarHeight(4.0); // 设置条形码高度为64
            barcodeGenerator.doQuietZone(false);
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java
@@ -7,10 +7,7 @@
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.*;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
@@ -18,6 +15,7 @@
import com.ruoyi.domain.vo.DocumentMaterialsVoSmall;
import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IDocumentMaterialsService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +30,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -268,10 +267,79 @@
    }
    // 自定义页面事件类,用于在每个新页面添加卷内封面内容
    private class DirectoryHeaderPageEvent extends PdfPageEventHelper {
        private String volumeNumber;
        private byte[] barcodeImageBytes;
        public DirectoryHeaderPageEvent(String volumeNumber, byte[] barcodeImageBytes) {
            this.volumeNumber = volumeNumber;
            this.barcodeImageBytes = barcodeImageBytes;
        }
        @Override
        public void onStartPage(PdfWriter writer, Document document) {
            try {
                // 设置中文字体
                BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
                Font chineseFont = new Font(bfChinese, 12);
                Font chineseFont1 = new Font(bfChinese, 16, Font.BOLD);
                // 添加条形码
                Image img = Image.getInstance(barcodeImageBytes);
                PdfPCell pdfPCell = new PdfPCell(img);
                pdfPCell.setBorder(Rectangle.NO_BORDER);
                pdfPCell.setMinimumHeight(40);
                pdfPCell.setUseAscender(true);
                pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
                pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
                pdfPCell.setColspan(2);
                pdfPCell.setPaddingBottom(30);
                float[] columnWidths1 = {35f, 65f};
                PdfPTable table1 = new PdfPTable(columnWidths1);
                table1.setWidthPercentage(80);
                table1.setHorizontalAlignment(Element.ALIGN_LEFT);
                table1.setSpacingBefore(30f);
                table1.addCell(pdfPCell);
                PdfContentByte canvas = writer.getDirectContent();
                ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, new Phrase(" ", chineseFont),
                        document.left(), document.top() - 50, 0);
                document.add(table1);
                // 添加标题
                Paragraph title = new Paragraph("卷    内    目    录", chineseFont1);
                title.setAlignment(Element.ALIGN_CENTER);
                document.add(title);
                Paragraph withNewLine = new Paragraph("\n");
                document.add(withNewLine);
                document.add(withNewLine);
                // 添加卷号
                Paragraph recordInfo = new Paragraph("卷号:" + volumeNumber, chineseFont);
                recordInfo.setAlignment(Element.ALIGN_RIGHT);
                document.add(recordInfo);
                document.add(withNewLine);
                document.add(withNewLine);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    //导出卷内目录的pdf
    public void generateFileDirectoryPdf(String pdfPath,List<DocumentMaterialsVo> dvss) throws DocumentException, IOException {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
        // 添加页面事件,在每个新页面自动添加卷内封面内容
        String volumeNumber = dvss.get(0).getRecordId();
        byte[] barcodeImageBytes = barcodeService.generateBarcodeImage(volumeNumber);
        writer.setPageEvent(new DirectoryHeaderPageEvent(volumeNumber, barcodeImageBytes));
        document.open();
        // 创建表格(5列)
@@ -279,56 +347,19 @@
        // 设置表格宽度(占页面宽度的100%)
        table.setWidthPercentage(100);
        //添加条形码
        String volumeNumber = dvss.get(0).getRecordId();
        Image img = Image.getInstance(barcodeService.generateBarcodeImage(volumeNumber));
        // 设置图片在PDF中的位置(可选)
//        img.setAbsolutePosition(100, 100);
        // 将图片添加到PDF文档中
        PdfPCell pdfPCell = new PdfPCell(img);
        pdfPCell.setBorder(Rectangle.NO_BORDER); // 移除单元格边框
        pdfPCell.setMinimumHeight(40);
        pdfPCell.setUseAscender(true); // 设置可以居中
        pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 设置水平居中
        pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 设置垂直居中
        pdfPCell.setColspan(2);
        pdfPCell.setPaddingBottom(30);
// 创建表格并设置列宽比例
        float[] columnWidths = {35f, 65f}; // 第一列30%,第二列70%
        PdfPTable table1 = new PdfPTable(columnWidths);
//        PdfPTable table = new PdfPTable(2);
        table1.setWidthPercentage(80); // 增大表格宽度百分比
        table1.setHorizontalAlignment(Element.ALIGN_LEFT); // 设置表格整体居中
        table1.setSpacingBefore(30f); // 设置表格前间距
        table1.addCell(pdfPCell);
        document.add(table1);
        // 添加表头
        // 设置列宽比例,第4列(文件题名)设置得更宽
        float[] columnWidths = {8f, 14f, 12f, 30f, 10f, 10f, 10f}; // 调整列宽比例,第4列文件题名占40%
        table.setWidths(columnWidths);
        // 设置中文字体
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        Font chineseFont = new Font(bfChinese, 12);
        Font chineseFont1 = new Font(bfChinese, 16, Font.BOLD);
        // 添加标题
        Paragraph title = new Paragraph("卷    内    目    录", chineseFont1);
        title.setAlignment(Element.ALIGN_CENTER);
        document.add(title);
        Paragraph withNewLine = new Paragraph("\n");
        document.add(withNewLine);
        document.add(withNewLine);
        //添加卷号
        Paragraph recordInfo = new Paragraph("卷号:" + volumeNumber, chineseFont);
        recordInfo.setAlignment(Element.ALIGN_RIGHT);
        document.add(recordInfo);
        document.add(withNewLine);
        document.add(withNewLine);
        // 设置表头行数,这样分页时每页都会自动重复表头
        table.setHeaderRows(1);
        // 添加表头
        String[] headers = {"序号", "文件编号", "责任者", "文件题名", "日期", "页号", "备注"};
        for (String header : headers) {
            PdfPCell cell = new PdfPCell(new Paragraph(header,
@@ -496,8 +527,8 @@
        PdfWriter.getInstance(document, new FileOutputStream(pdfPath));
        document.open();
        String [] tits = {"档        号:","档案馆(室)号:","缩  微  号: ","发  文  号:",
                "案  卷  题  名:","编  制  日  期:","编  制  单  位:","保  管  期  限:","密     级:"};
        String [] tits = {"档号:","档案馆(室)号:","缩微号:","发文号:",
                "案卷题名:","编制日期:","编制单位:","保管期限:","密级:"};
        ArchiveRecords ard = iArchiveRecordsService.selectArchiveRecordsById(id);
@@ -509,7 +540,7 @@
            ;
            System.out.println("当前日期: " + date);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
      formattedDate = date.format(formatter);
        }
@@ -535,7 +566,7 @@
        float[] columnWidths = {35f, 65f}; // 第一列30%,第二列70%
        PdfPTable table = new PdfPTable(columnWidths);
//        PdfPTable table = new PdfPTable(2);
        table.setWidthPercentage(80); // 增大表格宽度百分比
        table.setWidthPercentage(78); // 减小表格宽度百分比使两列更紧凑
        table.setHorizontalAlignment(Element.ALIGN_LEFT); // 设置表格整体居中
        table.setSpacingBefore(30f); // 设置表格前间距
        table.setSpacingAfter(90f); // 设置表格后间距
@@ -559,12 +590,64 @@
        // 先计算所有标题的最长长度
        int maxTitleLength = 0;
        for (String tit : tits) {
            maxTitleLength = Math.max(maxTitleLength, tit.length()-1);
        }
        for(int i = 0; i < tits.length; i++) {
            // 使用PdfPTable实现精确对齐
            // 第一行:档号
            PdfPCell labelCell1 = new PdfPCell(new Phrase(tits[i], chineseFont));
            labelCell1.setHorizontalAlignment(Element.ALIGN_RIGHT); // 设置右对齐
            // 实现对齐:在文字之间填充空格,使所有标题总长度相同
            String originalText = tits[i];
            // 计算需要添加的空格数
            int spacesToAdd = maxTitleLength - originalText.length();
            String formattedText = originalText;
            if (spacesToAdd > 0) {
                // 在冒号前的文字之间均匀分配填充空格
                if (originalText.contains(":")) {
                    int colonIndex = originalText.indexOf(":");
                    String textBeforeColon = originalText.substring(0, colonIndex);
                    String textAfterColon = originalText.substring(colonIndex);
                    // 如果冒号前只有一个字符,直接在后面加空格
                    if (textBeforeColon.length() == 1) {
                        String fullWidthSpaces = StringUtils.repeat(" ", spacesToAdd);
                        formattedText = textBeforeColon + fullWidthSpaces + textAfterColon;
                    } else if (textBeforeColon.length() > 1) {
                        // 在文字之间均匀分配空格
                        StringBuilder sb = new StringBuilder();
                        int chars = textBeforeColon.length();
                        int spacesPerGap = spacesToAdd / (chars - 1);
                        int extraSpaces = spacesToAdd % (chars - 1);
                        for (int j = 0; j < chars; j++) {
                            sb.append(textBeforeColon.charAt(j));
                            if (j < chars - 1) {
                                // 添加基本空格
                                sb.append(StringUtils.repeat(" ", spacesPerGap));
                                // 分配剩余空格
                                if (j < extraSpaces) {
                                    sb.append(" ");
                                }
                            }
                        }
                        sb.append(textAfterColon);
                        formattedText = sb.toString();
                    }
                } else {
                    // 如果没有冒号,直接在末尾加空格(应该不会出现这种情况)
                    String fullWidthSpaces = StringUtils.repeat(" ", spacesToAdd);
                    formattedText = originalText + fullWidthSpaces;
                }
            }
            PdfPCell labelCell1 = new PdfPCell(new Phrase(formattedText, chineseFont));
            labelCell1.setHorizontalAlignment(Element.ALIGN_RIGHT); // 单元格右对齐
            labelCell1.setBorder(Rectangle.NO_BORDER);
//            PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont));
@@ -573,17 +656,18 @@
            labelCell1.setPaddingTop(10f);    // 上内边距10单位
            labelCell1.setPaddingBottom(10f); // 下内边距10单位
            labelCell1.setPaddingLeft(15f);   // 左内边距15单位
            labelCell1.setPaddingRight(15f);  // 右内边距15单位
            labelCell1.setPaddingRight(0f);  // 右内边距15单位
            PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont));
            valueCell1.setBorder(Rectangle.NO_BORDER);
            valueCell1.setUseBorderPadding(true);
            valueCell1.setUseBorderPadding(false); // 禁用边框内边距计算
            valueCell1.setBorderWidthBottom(0.5f); // 设置底部边框作为下划线
            valueCell1.setMinimumHeight(30);
            valueCell1.setPaddingTop(10f);    // 上内边距10单位
            valueCell1.setPaddingBottom(10f); // 下内边距10单位
            valueCell1.setPaddingLeft(15f);   // 左内边距15单位
            valueCell1.setPaddingLeft(0f);   // 左内边距0单位
            valueCell1.setExtraParagraphSpace(0f); // 移除段落额外空间
            valueCell1.setPaddingRight(15f);  // 右内边距15单位
            table.addCell(labelCell1);
            table.addCell(valueCell1);
@@ -598,7 +682,7 @@
                PdfPCell pdfPCell1 = new PdfPCell(img1);
                pdfPCell1.setBorder(Rectangle.NO_BORDER); // 移除单元格边框
                pdfPCell1.setMinimumHeight(40);
                pdfPCell1.setMinimumHeight(20);
                pdfPCell1.setUseAscender(true); // 设置可以居中
                pdfPCell1.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 设置水平居中
                pdfPCell1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 设置垂直居中
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -599,7 +599,7 @@
            //pdf目录封面
            String pdfPathF = "07-案卷封面.pdf";
            pdfGenerateService.generatePdf(pdfPathF, 55L);
            pdfGenerateService.generatePdf(pdfPathF, id);
            // 2. 压缩PDF到ZIP文件
                // 添加PDF文件到ZIP
                ZipEntry zipEntry = new ZipEntry(pdfPathF);
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -689,7 +689,7 @@
            sheet.setColumnWidth(column, 6000);
        } else {
            // 设置列宽
            sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 200));
            sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
        }
        // 如果设置了提示信息则鼠标放上去提示.
        if (StringUtils.isNotEmpty(attr.prompt())) {
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -302,42 +302,31 @@
//sheet.setColumnWidth(1, 15 * 256); // 第二列宽度15字符
//sheet.setColumnWidth(2, 25 * 256); // 第三列宽度25字符 // 设置第一列宽度为20个字符
                    ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                            cell.getRow().getRowNum() + 1);
                    // 计算居中位置
//                    int col1 = 0; // 中间列
//                    int col2 = col1 + 2;
//                    anchor.setCol1(col1);
//                    anchor.setCol2(col2);
//                    anchor.setDx1(100);
//                    anchor.setDy1(0);
//                    anchor.setDx2(255); // 宽度
//                    anchor.setDy2(255); // 高度
                    anchor.setRow1(2);
                    anchor.setRow2(3);
                    // 设置二维码
                    byte[] data = list.get(index).getSedcode();
// 设置图片大小和位置
                    anchor.setDx1(2400000);
                    anchor.setDy1(100);
                    anchor.setDy2(-600000);
                    // 获取图片原始尺寸
                    BufferedImage image = ImageIO.read(new ByteArrayInputStream(data));
                    double widthInEMU = image.getWidth() * 9525 * 0.2;
                    double heightInEMU = image.getHeight() * 9525;
                    // 设置图片原始尺寸
                    anchor.setDx2(-100000); // 原始宽度
                 //   anchor.setDy2((int)heightInEMU); // 原始高度
//anchor.setCol1(5); // 从第6列开始显示
//anchor.setCol2(10); // 到第11列结束
                    //Files.readAllBytes(Paths.get(RuoYiConfig.getProfile() + "/upload/2025/08/14/30_20250814212128A031.jpg"));
//
//
//                    System.out.println(data.length);
                    getDrawingPatriarch(cell.getSheet()).createPicture(anchor,
                            cell.getSheet().getWorkbook().addPicture(data, getImageType(data)));
                    if (data != null && data.length > 0) {
                        // 创建单元格
                        Cell qrCell = sheet.createRow(2).createCell(1);
                        // 设置行高足够高以显示二维码
                        sheet.getRow(2).setHeightInPoints(120);
                        // 二维码需要较大的列宽来显示,设置之前先保存当前列宽
                        int currentColumnWidth = sheet.getColumnWidth(1);
                        // 设置足够宽的列宽以显示二维码
                        sheet.setColumnWidth(1, 60 * 256);
                        // 创建图片锚点,设置在第2行第2列
                        // 二维码显示在右上角且不填满整个格子
                        // 缩小图片范围:只占用部分单元格空间
                        ClientAnchor anchor = new HSSFClientAnchor(600, 20, 1000, 200, (short) 1, 2, (short) 1, 2);
                        // 设置图片位置和大小
                        anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE);
                        // 添加图片到工作表
                        getDrawingPatriarch(sheet).createPicture(anchor,
                                wb.addPicture(data, getImageType(data)));
                        // 二维码添加完成后,恢复原来的列宽设置
                        sheet.setColumnWidth(1, currentColumnWidth);
                    }
@@ -370,9 +359,12 @@
                        row.setHeightInPoints(40); // 设置行高为20磅
                       // row.createCell(0)
                        cell = row.createCell(0);
                        //设置cell的宽度
                        sheet.setColumnWidth(0, 20 * 256);
                        sheet.setColumnWidth(1, 60 * 256); // 第二列宽度15字符
                        // 根据用户需求设置第二子表格的列宽
                        // 第一列宽度设置为27
                        // 第二列宽度设置为51
                        // 使用与addCell方法相同的计算公式设置列宽
                        sheet.setColumnWidth(0, (int) ((27 + 0.72) * 256)); // 第一列:宽度27
                        sheet.setColumnWidth(1, (int) ((51 + 0.72) * 256)); // 第二列:宽度51
                        CellStyle style = wb.createCellStyle();
                        style.setAlignment(HorizontalAlignment.RIGHT);
@@ -391,7 +383,15 @@
                        style1.setWrapText(true); // 设置自动换行
                        style1.setVerticalAlignment(VerticalAlignment.CENTER);
                        cel.setCellStyle(style1);
                        cel.setCellValue(fieldValue.toString());
                        // 处理日期格式化,特别是"编  制  日  期:"这一行
                        if (i == 5 && fieldValue instanceof Date) {
                            // 设置日期格式为yyyy-MM-dd
                            String dateStr = DateUtils.parseDateToStr("yyyy-MM-dd", (Date) fieldValue);
                            cel.setCellValue(dateStr);
                        } else {
                            cel.setCellValue(fieldValue.toString());
                        }
                      //  sheet.setColumnWidth(0, 60 * 256);
                        i++;
                        if(i==3)
@@ -403,30 +403,32 @@
                            row.setHeightInPoints(40); // 设置行高为20磅
                            row = sheet.createRow(9);
                            //设置条形码
                            Cell cell1 = row.createCell(0);
//sheet.setColumnWidth(0, 20 * 256); // 第一列宽度20字符
//sheet.setColumnWidth(1, 15 * 256); // 第二列宽度15字符
//sheet.setColumnWidth(2, 25 * 256); // 第三列宽度25字符 // 设置第一列宽度为20个字符
                            ClientAnchor anchor1 = new HSSFClientAnchor(0, 0, 0, 0, (short) (cell1.getColumnIndex()), cell1.getRow().getRowNum(), (short) (cell1.getColumnIndex() +2),
                                    cell1.getRow().getRowNum() + 1);
                            // 计算居中位置
//// 设置图片大小和位置
anchor1.setDx1(600000);
anchor1.setDy1(0);
anchor1.setDx2(-600000); // 宽度
anchor1.setDy2(255); // 高度
//anchor1.setCol1(0.5); // 从第6列开始显示
//anchor1.setCol2(10); // 到第11列结束
                            anchor1.setRow1(9);
                            anchor1.setRow2(10);
                            // 设置条形码
                            byte[] dat = list.get(index).getImgr();
                            //Files.readAllBytes(Paths.get(RuoYiConfig.getProfile() + "/upload/2025/08/14/30_20250814212128A031.jpg"));
//
//
//                    System.out.println(data.length);
                            getDrawingPatriarch(cell1.getSheet()).createPicture(anchor1,
                                    cell.getSheet().getWorkbook().addPicture(dat, getImageType(dat)));
                            if (dat != null && dat.length > 0) {
                                // 创建单元格
                                Cell barcodeCell = sheet.createRow(9).createCell(0);
                                // 设置行高足够高以显示条形码
                                sheet.getRow(9).setHeightInPoints(70);
                                // 设置列宽足够宽以显示条形码,先保存当前列宽
                                int currentColumnWidth0 = sheet.getColumnWidth(0);
                                sheet.setColumnWidth(0, 40 * 256);
                                // 创建图片锚点,设置在第10行第1列
                                // 条形码居中且不超出第二个格子
                                // 调整结束列索引和位置参数
                                // 增加dx1值,使条形码整体向右移动
                                ClientAnchor anchor1 = new HSSFClientAnchor(300, 50, 900, 200, (short) 0, 9, (short) 1, 10);
                                // 设置图片位置和大小
                                anchor1.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE);
                                // 添加图片到工作表
                                getDrawingPatriarch(sheet).createPicture(anchor1,
                                        wb.addPicture(dat, getImageType(dat)));
                                // 条形码添加完成后,恢复原来的列宽设置
                                sheet.setColumnWidth(0, currentColumnWidth0);
                            }
@@ -765,9 +767,14 @@
            if (attr.isExport()) {
                // 创建cell
                cell = row.createCell(column);
                //设置cell的宽度
                sheet.setColumnWidth(0, 20 * 256);
                sheet.setColumnWidth(1, 60 * 256); // 第二列宽度15字符
                // 设置列宽,使用@Excel注解中配置的宽度
                if (column == 0) {
                    // 第一列使用固定宽度
                    sheet.setColumnWidth(0, 20 * 256);
                } else if (column == 1) {
                    // 第二列使用@Excel注解中配置的宽度
                    sheet.setColumnWidth(1, (int) ((attr.width() + 0.72) * 256));
                }
                CellStyle style = wb.createCellStyle();
//                style.setAlignment(HorizontalAlignment.RIGHT);
@@ -775,7 +782,7 @@
                style.setVerticalAlignment(VerticalAlignment.CENTER); // 设置垂直居中
                //  style.setAlignment(VerticalAlignment.CENTER);
                Font font = wb.createFont();
                font.setBold(true);
              //  font.setBold(true);
                style.setFont(font);
                style.setWrapText(true); // 设置自动换行