fc3ccbfc30b83e432c71c508ef2b9c1052816ed2..2d59c3e55978bd93741dae7a8ff21cf63b9ecf25
4 天以前 fei
修改了对应代码
2d59c3 对比 | 目录
4 天以前 fei
修改了对应代码
2f1ae9 对比 | 目录
10个文件已修改
1个文件已添加
587 ■■■■ 已修改文件
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoMid.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java 85 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -44,6 +44,8 @@
    private String publicity;
    private String fileStyle;
    private String retentionPeriod;
//    @Excel(name = "图片", cellType = Excel.ColumnType.IMAGE)
//    private String url;
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoMid.java
New file
@@ -0,0 +1,81 @@
package com.ruoyi.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
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;
@Data
public class DocumentMaterialsVoMid {
    @Excel(name="序号", height = 10,width=8,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private Long num;
    @Excel(name = "文件编号", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String documentNumber;
    @Excel(name = "责任者", height = 10, width=8,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String creator;
    @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,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private Date date;
    // 页号(原始数值,用于计算)
    private Long pageNumber;
    // 格式化后的页号,用于显示范围,如"38-38"或"23-38"
    @TableField(exist = false)
    @Excel(name = "页号", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String pageNumberFormatted;
    @Excel(name = "材料类型", width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String fileStyle;
    /** $column.columnComment */
    @Excel(name = "所处阶段", width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String stage;
    /** $column.columnComment */
    @Excel(name = "公开属性", height = 10,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String publicity;
    /** $column.columnComment */
    @Excel(name = "是否为附件附图", width = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String isAttachment;
    /** $column.columnComment */
//    @Excel(name = "是否为附图")
    private String isDiagram;
    /** $column.columnComment */
    @Excel(name = "保管期限", width = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String retentionPeriod;
    /** $column.columnComment */
    @Excel(name = "密级", width = 10,headerColor = IndexedColors.BLACK,readConverterExp = "该页另存=普通,普通=普通,内部用图=内部用图,内部用途=内部用途,秘密=秘密", headerBackgroundColor = IndexedColors.WHITE)
    private String securityLevel;
    /** $column.columnComment */
    @Excel(name = "是否涉密及敏感信息",headerColor = IndexedColors.BLACK, width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String isSensitive;
    /** $column.columnComment */
    @Excel(name = "是否注销" ,headerColor = IndexedColors.BLACK,width = 10, headerBackgroundColor = IndexedColors.WHITE)
    private String isCanceled;
    @Excel(name = "备注", height = 20,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String remarks;
   // private String retentionPeriod;
}
archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
import com.ruoyi.domain.vo.DocumentMaterialsFileList;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.domain.vo.DocumentMaterialsVoLarge;
import com.ruoyi.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -37,13 +34,20 @@
    //查询卷内目录
    @Select(
            "select ROW_NUMBER() OVER (ORDER BY page_number) AS num, document_number, creator,title, date, page_number,dm.remarks, ar.record_id, publicity from document_materials as dm, archive_records as ar \n" +
            "select ROW_NUMBER() OVER (ORDER BY page_number) AS num, document_number, creator,title, date, page_number,dm.remarks, ar.record_id, publicity, file_style, dm.retention_period from document_materials as dm, archive_records as ar \n" +
            "            WHERE ar.id = dm.record_id and page_number  IN (\n" +
            "            SELECT MIN(page_number)\n" +
            "            FROM document_materials where record_id=#{recordId}\n" +
            "             GROUP BY stage, title) and ar.id =#{recordId} order by page_number ;")
    List<DocumentMaterialsVo> getArchiveMatInfo(@Param("recordId") int recordId);
    //查询卷内目录的详细信息
    @Select(
            "select ROW_NUMBER() OVER (ORDER BY page_number) AS num, document_number, creator,title, date, page_number, publicity, file_style, stage,is_attachment,is_diagram, dm.retention_period,is_sensitive,is_canceled,dm.remarks from document_materials as dm, archive_records as ar \n" +
                    "            WHERE ar.id = dm.record_id and page_number  IN (\n" +
                    "            SELECT MIN(page_number)\n" +
                    "            FROM document_materials where record_id=#{recordId}\n" +
                    "             GROUP BY stage, title) and ar.id =#{recordId} order by page_number ;")
    List<DocumentMaterialsVoMid> getArchiveMatInfoAll(@Param("recordId") int recordId);
    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,ar.record_id, file_number, \n" +
            "            document_number, creator, title, date, page_number, page_order, \n" +
archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java
@@ -4,10 +4,7 @@
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.Archiverecordstouser;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
import com.ruoyi.domain.vo.DocumentMaterialsFileList;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.domain.vo.DocumentMaterialsVoLarge;
import com.ruoyi.domain.vo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;
@@ -78,7 +75,7 @@
    public int updateByPageNumber(Long pageNumber,String sizeType, Long fileNumber, int wid, int hei, int wdpi, int hdpi, double sz,String url,String format, Long recordId);
    public List<DocumentMaterialsVo> findArchMInfo(String recordId, long pageCount);
    public List<DocumentMaterialsVoMid> findArchMInfoAll(String recordId, long pageCount);
    public List<DocumentMaterialFileStyle> findFileStyleInfo(@Param("recordId") int recordId);
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java
@@ -1,34 +1,97 @@
package com.ruoyi.service.impl;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.oned.Code39Writer;
import org.krysalis.barcode4j.impl.code128.Code128Bean;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
import org.springframework.stereotype.Service;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@Service
public class BarcodeService {
    public byte[] generateBarcodeImage(String barcodeText) {
        try {
            Code128Bean barcodeGenerator = new Code128Bean();
            final int dpi = 160;
            barcodeGenerator.setModuleWidth(0.58);
            barcodeGenerator.setBarHeight(14.2); // 设置条形码高度为64
            barcodeGenerator.doQuietZone(false);
           // 使用 BitMatrix 生成纯条码,不包含任何文字
            BarcodeFormat format = BarcodeFormat.CODE_39; // 根据您的条码类型
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            BitmapCanvasProvider canvas = new BitmapCanvasProvider(
                    outputStream, "image/png", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0);
            // 创建编码器
            Code39Writer writer = new Code39Writer();
            barcodeGenerator.generateBarcode(canvas, barcodeText);
            canvas.finish();
            // 编码参数
            Map<EncodeHintType, Object> hints = new HashMap<>();
            hints.put(EncodeHintType.MARGIN, 0); // 无边框
            return outputStream.toByteArray();
            // 生成 BitMatrix(纯条码,无文字)
            BitMatrix matrix = writer.encode(barcodeText, format, 0, 63, hints);
            int width = matrix.getWidth();
            int height = matrix.getHeight();
            // 计算文字区域
            int textAreaHeight = 30 + 10;
            // 创建最终图像
            BufferedImage finalImage = new BufferedImage(
                    width,
                    height + textAreaHeight,
                    BufferedImage.TYPE_BYTE_BINARY
            );
            Graphics2D g2d = finalImage.createGraphics();
            // 白色背景
            g2d.setColor(Color.WHITE);
            g2d.fillRect(0, 0, width, height + textAreaHeight);
            // 绘制条码(从 BitMatrix)
            g2d.setColor(Color.BLACK);
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
                    if (matrix.get(x, y)) {
                        g2d.fillRect(x, y, 1, 1);
                    }
                }
            }
            // 添加自定义文字
            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                    RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            Font font = new Font("Tahoma", Font.BOLD, 18);
            g2d.setFont(font);
            FontMetrics fm = g2d.getFontMetrics();
            int textWidth = fm.stringWidth(barcodeText);
            int x = (width - textWidth) / 2;
            int y = height + 30 - 5; // 调整垂直位置
            g2d.drawString(barcodeText, x, y);
            g2d.dispose();
            // 保存
            ByteArrayOutputStream resultStream = new ByteArrayOutputStream();
            ImageIO.write(finalImage, "png", resultStream);
            return resultStream.toByteArray();
         //   return outputStream.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException("Error generating barcode", e);
        } catch (WriterException e) {
            throw new RuntimeException(e);
        }
    }
}
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -333,6 +333,37 @@
    }
    @Override
    public List<DocumentMaterialsVoMid> findArchMInfoAll(String recordId, long pageCount) {
        // 获取原始数据列表
        List<DocumentMaterialsVoMid> dataList = this.baseMapper.getArchiveMatInfoAll(Integer.parseInt(recordId));
        // 获取该案卷的最大页号(总页数)
        Long totalPages = (long) pageCount;
        //this.baseMapper.getMaxPageNumber(Integer.parseInt(recordId));
        // 如果数据列表不为空
        if (dataList != null && !dataList.isEmpty() && totalPages != null) {
            int size = dataList.size();
            // 遍历所有条目,设置pageNumberFormatted
            for (int i = 0; i < size; i++) {
                DocumentMaterialsVoMid item = dataList.get(i);
                Long pageNumber = item.getPageNumber();
                if (i == size - 1) {
                    // 最后一行:格式化页号为"最后一页页号-总页数"的形式
                    item.setPageNumberFormatted(pageNumber + "-" + totalPages);
                } else {
                    // 其他行:直接使用pageNumber的值
                    item.setPageNumberFormatted(pageNumber != null ? pageNumber.toString() : "");
                }
            }
        }
        return dataList;
    }
    @Override
    public List<DocumentMaterialFileStyle> findFileStyleInfo(int recordId) {
        return this.baseMapper.getFileStyleInfo(recordId);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
@@ -1,10 +1,10 @@
package com.ruoyi.web.controller.archive;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil;
@@ -172,7 +172,64 @@
        System.out.println("090sdfsdf");
        return new AjaxResult(0, archiveRecordsService.updateStatusByIds(ids) + "");
    }
    /**
     *
     */
    @PreAuthorize("@ss.hasPermi('system:records:list')")
    @Log(title = "档案记录", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/getAllFilesCounts")
    public AjaxResult getAllFileCounts(@RequestBody Long[] ids) {
// 1. 初始化Map,用于存储recordId和对应的文件数
        Map<Long, Integer> recordFileCountMap = new HashMap<>();
// 2. 获取基础上传路径
        String filePath = RuoYiConfig.getUploadPath();
// 3. 遍历每个recordId,计算文件数并放入Map
        for (Long recordId : ids) {
            // 拼接当前recordId的目录路径
            File desc = new File(filePath + File.separator + recordId);
            int fileCount = 0;
            try {
                // 判断目录是否存在且是目录
                if (desc.exists() && desc.isDirectory()) {
                    // 过滤出仅文件(排除子目录)
                    File[] files = desc.listFiles(new FileFilter() {
                        @Override
                        public boolean accept(File file) {
                            return file.isFile(); // 只统计文件,不统计目录
                        }
                    });
                    // 避免空指针(空目录时listFiles返回null)
                    if (files != null) {
                        fileCount = files.length;
                    }
                } else {
                    // 目录不存在/不是目录,文件数为0
                    fileCount = 0;
                    // 可选:日志提示
                    // log.warn("目录不存在或非目录:{}", desc.getAbsolutePath());
                }
            } catch (SecurityException e) {
                // 权限不足等异常,文件数置0
                fileCount = 0;
                // 可选:日志记录异常
                // log.error("获取目录[{}]文件数失败:{}", recordId, e.getMessage(), e);
            }
            // 4. 将recordId和对应的文件数放入Map
            recordFileCountMap.put(recordId, fileCount);
        }
        return new AjaxResult(200,"拿到所有对应的数据", recordFileCountMap);
    }
    /**
     * 删除档案记录
     */
@@ -259,11 +316,19 @@
        List<DocumentMaterialsFileList> arsi = new ArrayList<>();
//        DocumentMaterials documentMaterials = new DocumentMaterials();
//        documentMaterials.setRecordId(recordId);
        List<DocumentMaterialsFileList> lst = iDocumentMaterialsService.selectDocumentMaterialsFileList(searSigAnn.getRecordId());
                ArchiveRecords archiveRecords = archiveRecordsService.selectArchiveRecordsById(searSigAnn.getRecordId());
        List<DocumentMaterialsVo> lst = iDocumentMaterialsService.findArchMInfo(searSigAnn.getRecordId().toString(), archiveRecords.getPageCount());
       // List<DocumentMaterialsFileList> lst =
        //拿到卷内目录的excel
//        List<DocumentMaterialsVoSmall> lst = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
//                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
        //iDocumentMaterialsService.selectDocumentMaterialsFileList(searSigAnn.getRecordId());
        // 复制属性到SmallObject列表
        for (DocumentMaterialsFileList bigObject : lst) {
        for (DocumentMaterialsVo bigObject : lst) {
            DocumentMaterialsFileList smallObject = new DocumentMaterialsFileList();
            BeanUtil.copyProperties(bigObject, smallObject); // 复制属性
            System.out.println(bigObject);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -189,10 +189,10 @@
    public void exportDir(HttpServletResponse response, DocumentMaterials documentMaterials, @RequestParam(value = "ids", required = false) Long[] ids)
    {
        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(documentMaterials.getRecordId());
        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(documentMaterials.getRecordId().toString(), archiveRecords.getPageCount());
        List<DocumentMaterialsVoMid> dsvs = documentMaterialsService.findArchMInfoAll(documentMaterials.getRecordId().toString(), archiveRecords.getPageCount());
        List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
//        List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
//                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
//        List<DocumentMaterials> list;
//        System.out.println(ids);
@@ -227,8 +227,8 @@
//            return vo;
//        }).collect(Collectors.toList());
        
        ExcelUtil<DocumentMaterialsVoSmall> util = new ExcelUtil<DocumentMaterialsVoSmall>(DocumentMaterialsVoSmall.class);
        util.exportExcel(response, list2, "卷内目录");
        ExcelUtil<DocumentMaterialsVoMid> util = new ExcelUtil<DocumentMaterialsVoMid>(DocumentMaterialsVoMid.class);
        util.exportExcel(response, dsvs, "卷内目录");
    }
   // List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString());
@@ -599,6 +599,8 @@
    public void exportJuanInfo(HttpServletResponse response, @PathVariable Long id) throws IOException {
        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
        if(archiveRecords.getPageCount()==null)
            return;
        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString(), archiveRecords.getPageCount());
        //拿到卷内目录的excel
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -517,16 +517,176 @@
            for(int i = 0; i < ids.length; i++) {
                System.out.println(ids[i]);
                ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
                ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(ids[i]);
                // 获取文件的保存位置,读取数据库,
                DocumentMaterials documentMaterials = new DocumentMaterials();
                documentMaterials.setRecordId(ids[i]);
                List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(ids[i]);
                System.out.println(docs.size()+"----7777");
                //生成新的记录,不保存再数据库
                List<DocumentMaterials> docAllInfo = documentMaterialsService.SelectAllRecordsByPageNumbersToList(ids[i], archiveRecords1.getPageCount());
                //把DocumentMaterils转到docs
                List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
                int nstar = 1;
                for (DocumentMaterials mater : docAllInfo) {
                    // physcialService.mySave(physcial);
                    DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge();
                    BeanUtils.copyProperties(mater, docum);
                    docum.setRecordId(archiveRecords1.getRecordId());
                    docum.setNum(nstar++);
                    docs.add(docum);
                }
                //把附件和记录一一对应
                String fileSysPath = RuoYiConfig.getUploadPath();
                AjaxResult ajax = AjaxResult.success();
                String path = fileSysPath + File.separator + ids[i];
                File desc = new File(fileSysPath + File.separator + ids[i]);
                System.out.println("44444444444444456666666666666666");
                if (!desc.exists())
                {
                    throw new RuntimeException("电子文件信息没有上传,请补充!");
                }
                Map<String, String> fileMap = new HashMap<>();
                try (Stream<Path> paths = Files.walk(Paths.get(path))) {
                    fileMap = paths
                            .filter(Files::isRegularFile)
                            .collect(Collectors.toMap(
                                    // Key: 文件名前缀(不带扩展名)
                                    Path -> {
                                        String fileNam = Path.getFileName().toString();
                                        int dotIndex = fileNam.lastIndexOf('.');
                                        return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
                                    },
                                    // Value: 文件全路径
                                    Path::toString,
                                    // 处理重复键的情况(如果有相同前缀的文件)
                                    (existing, replacement) -> existing
                            ));
                }
                //重新封装一下docs,和附件绑定再一起
                for (int k = 0; k < docs.size(); k++) {
                    DocumentMaterialsVoLarge dc = docs.get(k);
                    if (dc.getSecurityLevel() != null && (dc.getSecurityLevel().equals("该页另存") ||
                            dc.getSecurityLevel().equals("秘密") || dc.getSecurityLevel().equals("内部用途") ||
                            dc.getSecurityLevel().equals("内部用图"))) {
                        // 替换为了准备好的图像
                        String fp = fileSysPath + "\\glc.jpg";
                        Path path1 = Paths.get(fp);
                        // 拿到图像属性
                        BufferedImage bufferedImage = ImageIO.read(Files.newInputStream(path1));
                        int wid = bufferedImage.getWidth();
                        int hei = bufferedImage.getHeight();
                        double sz = Double.parseDouble(String.format("%.2f", Files.size(path1) * 1.0 / 1024));
                        // 拿到图像的dpi信息
                        ImageInfo info = Imaging.getImageInfo(Files.readAllBytes(path1));
                        int wdpi = info.getPhysicalWidthDpi();
                        int hdpi = info.getPhysicalHeightDpi();
                        // 计算fileNumber
                        //    Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
                        // 计算sizeType
                        String sizeType = getPageSize(wid * hei);
                        Graphics2D g2d = bufferedImage.createGraphics();
                        g2d.setFont(new java.awt.Font("宋体", Font.BOLD, 80)); // 设置字体样式和大小
                        g2d.setColor(Color.black);
                        String pageNumber = dc.getPageNumber() + "";
                        int fontHeight = g2d.getFontMetrics().getHeight();
                        int x = bufferedImage.getWidth() - g2d.getFontMetrics().stringWidth(pageNumber) - 80;
                        int y = bufferedImage.getHeight() - fontHeight / 2 - 100;
                        g2d.drawString(pageNumber, x, y);
                        g2d.dispose();
                        // 将BufferedImage转换为MultipartFile
                        MultipartFile multipartFile = null;
                        ByteArrayOutputStream ost = new ByteArrayOutputStream();
                        ImageIO.write(bufferedImage, "jpg", ost);
                        InputStream input = new ByteArrayInputStream(ost.toByteArray());
                        multipartFile = new MockMultipartFile(pageNumber, pageNumber + ".jpg", "text/plain", input);
                        // 上传并返回新文件名称
                        String fileName1 = FileUploadUtils.upload(fileSysPath, multipartFile);
                        // filePath = fileName1;
                        dc.setWidth((long) wid);
                        dc.setHeight((long) hei);
                        dc.setFileSize(sz);
                        dc.setFormat(".jpg");
                        dc.setHorizontalResolution((long) wdpi);
                        dc.setVerticalResolution((long) hdpi);
                        dc.setSizeType(sizeType);
                        fileMap.put(dc.getPageNumber()+"", fp);
                        //   dc.set
                        // 更新数据库
                        //   documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
//                        urls.add(serverConfig.getUrl() + fileName1);
//                        fileNames.add(fileName1);
//                        newFileNames.add(FileUtils.getName(fileName1));
//                        originalFilenames.add(pageNumber + ".jpg");
                    }
                    else {
                        //文件名称
                        //  String pname = nams[1];
                        //   ajax.put("url", url);
                        //拿到图像属性
                        System.out.println(dc.getPageNumber());
                        String fip = fileMap.get(dc.getPageNumber().toString());
// 创建 File 对象
                        File fils = new File(fip);
// 使用 ImageIO 读取图片
                        BufferedImage image = ImageIO.read(fils);
                        BufferedImage bufferedImage = ImageIO.read(fils);
                        int wid = bufferedImage.getWidth();
                        int hei = bufferedImage.getHeight();
                        double sz =  Double.parseDouble(String.format("%.2f", fils.length()*1.0/1024));
                        System.out.println(wid+":"+hei+":"+sz);
                        //拿到图像的dpi信息
                        byte[] bytesArray = new byte[(int) fils.length()];
                        FileInputStream fis = new FileInputStream(fils);
                        fis.read(bytesArray); //read file into bytes[]
                        ImageInfo info = Imaging.getImageInfo(bytesArray);
                        int wdpi = info.getPhysicalWidthDpi() ;
                        int hdpi = info.getPhysicalHeightDpi();
                        //      System.out.println("DPI: " + info.getPhysicalWidthDpi()+nam+"dds");
                        fis.close();
                        //计算fileNumber
                        //  Long fileNumber = documentMaterialsService.getFiNum(dc.getPageNumber(), id);
                        //计算sizeType
                        String sizeType = getPageSize(wid*hei);
                        dc.setWidth((long) wid);
                        dc.setHeight((long) hei);
                        dc.setFileSize(sz);
                        dc.setFormat(".jpg");
                        dc.setHorizontalResolution((long) wdpi);
                        dc.setVerticalResolution((long) hdpi);
                        dc.setSizeType(sizeType);
                    }
                }
                List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(ids[i].toString(), archiveRecords1.getPageCount());
//                List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(ids[i]);
//                System.out.println(docs.size()+"----7777");
                //.selectDocumentMaterialsList(documentMaterials);
                List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(ids[i].toString(), archiveRecords1.getPageCount());
                ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(ids[i]);
                System.out.println(aIV.getInquiryNumber());
                System.out.println(aIV.getRecordId());
                String adir = aIV.getInquiryNumber() + " " + aIV.getRecordId();
@@ -929,10 +1089,10 @@
                byte[] buf = new byte[1024];
                for (DocumentMaterialsVoLarge dc : docs) {
                    String filePath = dc.getUrl();
                    String filePath = fileMap.get(dc.getPageNumber().toString());
                    if(filePath==null)
                        continue;
                    filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
                //    filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
                    System.out.println(filePath);
                    File tempFile = new File(filePath);
@@ -944,7 +1104,7 @@
                    String fname = "";
                    if(dc.getFileNumber()!=null&&dc.getPageNumber()!=null) {
                        fname = frontCompWithZore(4, dc.getFileNumber().intValue()) + "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
                                + dc.getUrl().split("\\.")[1];
                                + filePath.split("\\.")[1];
                        if (dc.getStage().equals("01-申请材料"))
                            zos.putNextEntry(new ZipEntry(fna + adir + "/01-申请材料/" + fname));
                        else if (dc.getStage().equals("02-办案过程材料"))
@@ -1019,16 +1179,19 @@
    public void packDownload(HttpServletResponse response,  @PathVariable Long id) throws Exception {
        // 获取文件的保存位置,读取数据库,
        DocumentMaterials documentMaterials = new DocumentMaterials();
        documentMaterials.setRecordId(id);
     //   List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(id);
        //   List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(id);
        //根据id拿到pageNumber
        ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(id);
        System.out.println(aIV.getPageCount()+"++++++++++++++++==");
        System.out.println(aIV.getPageCount() + "++++++++++++++++==");
        //生成新的记录,不保存再数据库
        List<DocumentMaterials> docAllInfo = documentMaterialsService.SelectAllRecordsByPageNumbersToList(id, aIV.getPageCount());
        if (docAllInfo==null||docAllInfo.isEmpty())
        {
            throw new RuntimeException("请补充完整信息,然后导出ISO包!");
        }
        //把DocumentMaterils转到docs
        List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
        int nstar = 1;
@@ -1148,6 +1311,12 @@
                System.out.println(dc.getPageNumber());
                String fip = fileMap.get(dc.getPageNumber().toString());
// 创建 File 对象
                if(fip==null||fip.equals(""))
                {
                    throw new RuntimeException("电子文件信息没有上传完整,请补充!");
                }
                File file = new File(fip);
// 使用 ImageIO 读取图片
@@ -1733,10 +1902,10 @@
                String fname = "";
             //   if(dc.getFileNumber()!=null&&dc.getPageNumber()!=null) {
                    if(dc.getPageNumber()!=null) {
                    if(dc.getFileNumber()!=null&&dc.getPageNumber()!=null) {
                    //    fname = frontCompWithZore(4, dc.getFileNumber().intValue()) + "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
                          //      + filePath.split("\\.")[1];
                    fname = "-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
                    fname = frontCompWithZore(4, dc.getFileNumber().intValue()) +"-" + dc.getTitle() + "-" + frontCompWithZore(4, dc.getPageNumber().intValue()) + "."
                            + filePath.split("\\.")[1];
                    System.out.println(fname);
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -336,17 +336,22 @@
                      //  if (Files.exists(Paths.get(imagePath))) {
                          //  byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath));
                            // 将byte数组转换成inputstream,以便插入到Excel中
                            ClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 100, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 5),
                                    cell.getRow().getRowNum() + 1);
                            ClientAnchor anchor = new HSSFClientAnchor(813, 0, 787, 71, (short) 2, 0, (short) 4,
                                    1);
//                    ClientAnchor anchor = new HSSFClientAnchor(813, 0, 787, 71, (short) 2, 0, (short) 4,
//                            2);
                            // 设置锚点类型为MOVE_AND_RESIZE,使图片可以随单元格调整大小
                            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
                                    // 计算居中位置
                    int col1 = 3; // 中间列
                    int col2 = col1 + 2;
                    anchor.setCol1(col1);
                    anchor.setCol2(col2);
                    anchor.setRow1(0);
                    anchor.setRow2(1);
//                    int col1 = 3; // 中间列
//                    int col2 = col1 + 2;
//                    anchor.setCol1(col1);
//                    anchor.setCol2(col2);
//                    anchor.setRow1(0);
//                    anchor.setRow2(1);
//                            anchor.set
//                            anchor.setHorizontallyCenter(true);
@@ -1093,10 +1098,10 @@
            HSSFSheet hssfSheet = hssfWb.getSheetAt(index);
            HSSFHeader header = hssfSheet.getHeader();
            // 设置页眉字体
           // header.setFontName("宋体");
           // header.setFontName("宋体");4
           // header.setFontSize((short) 10);
            // 设置页眉内容
            hssfSheet.setMargin(Sheet.HeaderMargin, 2.1);
            hssfSheet.setMargin(Sheet.HeaderMargin, 1.34);
            header.setRight("&\"宋体,Bold\"共 &N 页   第 &P 页");
        }
        // 如果是index为1的sheet,设置顶端标题行
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -307,7 +307,6 @@
                int column = 0;
                if(index == 0) {
                    // 合并第一行的前5个单元格
                    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
                    // 必须先设置为true
                    // 页面布局设置
@@ -333,33 +332,49 @@
                    {
                        row.setHeight((short)(55.8 * 20));
                        Cell cell = row.createCell(6);
                        Cell cell = row.createCell(0);
//                        for(int cl = 1 ; cl <=8; cl++)
//                            cell = row.createCell(cl);
//
//
//                        for (int col = 4; col <= 7; col++) {
//                            row.getSheet().setColumnWidth(col, 15 * 256); // 每列15字符宽
                //        }
                        int margin = -40* 9525;
                        int mary = -11 * 9525;
                        XSSFClientAnchor anchor = new XSSFClientAnchor(
                                0,          // dx1
                                0,          // dy1
                                margin,     // dx2:右边界左移10像素
                                mary,          // dy2
                                (short)5,   // col1
                                0,          // row1
                                (short)9,   // col2
                                1          // row2
                        );
                        // 设置图片大小和位置
                        ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) (cell.getColumnIndex()+1), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() +2),
                                cell.getRow().getRowNum() + 1);
                     //   ClientAnchor anchor = new XSSFClientAnchor(0, 0, 600, 150, (short)0, 0, (short)6, 1);
                    //   anchor.setDx2(488);
                    //   anchor.setDy2(10);
                   //     anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
                        // 计算居中位置
//                    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.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
                        // 计算居中位置
                        int col1 = 4; // 中间列
                        int col2 = col1 + 3;
                        anchor.setCol1(col1);
                        anchor.setCol2(col2);
                        anchor.setRow1(0);
                        anchor.setRow2(1);
//                        int col1 = 4; // 中间列
//                        int col2 = col1 + 3;
//                        anchor.setCol1(col1);
//                        anchor.setCol2(col2);
//                        anchor.setRow1(0);
//                        anchor.setRow2(1);
                        byte[] data = bt;
                 
                        // 获取图片原始尺寸
                        BufferedImage image = ImageIO.read(new ByteArrayInputStream(data));
                        double widthInEMU = image.getWidth() * 9525 * 0.2;
                        double heightInEMU = image.getHeight() * 9525;
//                        double widthInEMU = image.getWidth() * 9525 * 0.2;
//                        double heightInEMU = image.getHeight() * 9525;
                        // 设置图片原始尺寸
                    //    anchor.setDx2(-100000); // 原始宽度
@@ -378,6 +393,7 @@
                    }
                    else
                        row.setHeight((short)(33 * 20));
                  //  sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
                    //  sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 7));
                    if(firow==1)