fei
2 天以前 5d91a329768a2a86e01e4b9b6bc6a2b939b87adb
修改了对应代码
11个文件已修改
585 ■■■■ 已修改文件
archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java
@@ -47,7 +47,7 @@
    }
  //  @Excel(name = "项目名称", headerColor = IndexedColors.BLACK)
  @Excel(name = "项目名称", type = Excel.Type.IMPORT)
    private String everyProjectName;
    /** 案卷题名 */
    @Excel(name = "案卷题名", headerColor = IndexedColors.RED, width = 10)
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -96,11 +96,12 @@
        if (StringUtils.isEmpty(categoryNumberStart) || StringUtils.isEmpty(categoryNumberEnd)) {
            lqw.like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId());
        }
        else {
     //  else {
                lqw.
            like(!StringUtils.isEmpty(archiveRecords.getInquiryNumber()), ArchiveRecords::getInquiryNumber, archiveRecords.getInquiryNumber())
                    .like(!StringUtils.isEmpty(archiveRecords.getCaseTitle()), ArchiveRecords::getCaseTitle, archiveRecords.getCaseTitle())
                    .like(!StringUtils.isEmpty(archiveRecords.getPublicAttribute()), ArchiveRecords::getPublicAttribute, archiveRecords.getPublicAttribute())
                        .like(!StringUtils.isEmpty(archiveRecords.getPublicAttribute()), ArchiveRecords::getPublicAttribute, archiveRecords.getPublicAttribute())
                    .like(!StringUtils.isEmpty(archiveRecords.getPreparationUnit()), ArchiveRecords::getPreparationUnit, archiveRecords.getPreparationUnit())
                    .like(!StringUtils.isEmpty(archiveRecords.getRetentionPeriod()), ArchiveRecords::getRetentionPeriod, archiveRecords.getRetentionPeriod())
                    .like(!StringUtils.isEmpty(archiveRecords.getSecurityClassification()), ArchiveRecords::getSecurityClassification, archiveRecords.getSecurityClassification())
@@ -117,7 +118,7 @@
                    .like(!StringUtils.isEmpty(archiveRecords.getEveryProjectName()), ArchiveRecords::getEveryProjectName, archiveRecords.getEveryProjectName())
                    .like(!StringUtils.isEmpty(archiveRecords.getRemarks()), ArchiveRecords::getRemarks, archiveRecords.getRemarks());
        }
      //  }
        if(archiveRecords.getIds()!=null)
                lqw.in(ArchiveRecords::getId,new ArrayList<>(Arrays.asList(archiveRecords.getIds())));
@@ -387,8 +388,16 @@
        for (ArchiveRecords archiveRecords : dataList) {
           // physcialService.mySave(physcial);
            archiveRecords.setRecordStatus("未录入");
            System.out.println(archiveRecords.getProjectName());
            LocalDateTime time = LocalDateTime.now();
            String title = "";
            if(archiveRecords.getConstructionUnit()!=null)
                title = title +archiveRecords.getConstructionUnit();
            if(archiveRecords.getConstructionAddress()!=null)
                title = title + archiveRecords.getConstructionAddress();
            if(archiveRecords.getProjectName()!=null)
                title = title + archiveRecords.getProjectName();
            archiveRecords.setCaseTitle(title);
            Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
            archiveRecords.setCreateTime(date);
            this.mySave(archiveRecords);
@@ -410,7 +419,7 @@
        // 获取当前用户ID
        Long userId = SecurityUtils.getUserId();
        // 可以在这里使用userId进行授权操作
        if(operator.equals("退回管理员"))
        if(operator.equals("退回管理员")||status.equals("录入完成"))
            archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
        this.baseMapper.updateStatusById(status, id, date);
        return 0;
archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java
@@ -26,10 +26,10 @@
    public byte[] generateBarcodeImage(String barcodeText) {
        try {
           // 使用 BitMatrix 生成纯条码,不包含任何文字
            BarcodeFormat format = BarcodeFormat.CODE_39; // 根据您的条码类型
            BarcodeFormat format = BarcodeFormat.CODE_128; // 根据您的条码类型
            // 创建编码器
            Code39Writer writer = new Code39Writer();
            Code128Writer writer = new Code128Writer();
            // 编码参数
            Map<EncodeHintType, Object> hints = new HashMap<>();
@@ -68,10 +68,12 @@
            }
            // 添加自定义文字
            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                    RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
            Font font = new Font("Tahoma", Font.BOLD, 18);
            Font font = new Font("Tahoma", Font.PLAIN, 20);
            g2d.setFont(font);
            FontMetrics fm = g2d.getFontMetrics();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -31,6 +31,7 @@
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelExp;
@@ -509,7 +510,29 @@
        System.out.println(compName+"--+"+sh_person);
        //  pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id);
        //拿到相关数据
        List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
     //   List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
        List<DocumentMaterials> docAllInfo = documentMaterialsService.SelectAllRecordsByPageNumbersToList(id, archiveRecords.getPageCount());
        if (docAllInfo==null||docAllInfo.isEmpty())
        {
            throw new RuntimeException("请补充完整信息,然后导出ISO包!");
        }
        //把DocumentMaterils转到docs
    //    List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
        int texPages = 0;
        int patPages = 0;
        int picPages = 0;
        for (DocumentMaterials mater : docAllInfo) {
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("文字材料"))
                texPages++;
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("图样材料"))
                patPages++;
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("照片材料"))
                picPages++;
        }
        LocalDate currentDate = LocalDate.now();
@@ -518,21 +541,8 @@
        HashMap<String, Object> hs = new HashMap<String, Object>();
        int allPages = 0;
        int texPages = 0;
        int picPages = 0;
        int patPages = 0;
        if(!dmfs.isEmpty())
        {
            for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
            {
                if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料"))
                    texPages = documentMaterialFileStyle.getCnt();
                if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料"))
                    patPages = documentMaterialFileStyle.getCnt();
                if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料"))
                    picPages = documentMaterialFileStyle.getCnt();
            }
        }
        allPages = texPages + picPages + patPages;
        hs.put("pages", allPages);
        hs.put("patPages", patPages);
@@ -597,16 +607,24 @@
    @PostMapping("/exportJuan/{id}")
    public void exportJuanInfo(HttpServletResponse response, @PathVariable Long id) throws IOException {
        System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
        System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
        if(archiveRecords.getPageCount()==null)
            return;
        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString(), archiveRecords.getPageCount());
        System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
        //拿到卷内目录的excel
        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());
        System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
        if(!dsvs.isEmpty()) {
            System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
            String recordId = dsvs.get(0).getRecordId();
            byte[] imgr = barcodeService.generateBarcodeImage(recordId);
            ExcelExp e1 = new ExcelExp("卷内目录数据", dsvs, DocumentMaterialsVo.class);
@@ -620,7 +638,7 @@
         //   System.out.println(dsvs);
         //  zos.putNextEntry(entr);
            ByteOutputStream bos8 = new ByteOutputStream();
            System.out.println("+++++++++++++aaaaaaaaaaaaaaaaaa");
            util2.exportExcelManySheet(bos8, mysheet);
            bos8.writeTo( response.getOutputStream());
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -527,6 +527,11 @@
                //把DocumentMaterils转到docs
                List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
                int nstar = 1;
                //统计3中材料的个数
                int texPages = 0;
                int picPages = 0;
                int patPages = 0;
                for (DocumentMaterials mater : docAllInfo) {
                    // physcialService.mySave(physcial);
                    DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge();
@@ -534,6 +539,12 @@
                    docum.setRecordId(archiveRecords1.getRecordId());
                    docum.setNum(nstar++);
                    docs.add(docum);
                    if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("文字材料"))
                        texPages++;
                    if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("图样材料"))
                        patPages++;
                    if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("照片材料"))
                        picPages++;
                }
@@ -623,7 +634,7 @@
                        dc.setHorizontalResolution((long) wdpi);
                        dc.setVerticalResolution((long) hdpi);
                        dc.setSizeType(sizeType);
                        fileMap.put(dc.getPageNumber()+"", fp);
                        fileMap.put(dc.getPageNumber()+"", fileName1);
                        //   dc.set
                        // 更新数据库
                        //   documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
@@ -641,6 +652,11 @@
                        System.out.println(dc.getPageNumber());
                        String fip = fileMap.get(dc.getPageNumber().toString());
// 创建 File 对象
                        if (fip == null) {
                            // 补零到4位(根据你的需求调整位数)
                            String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue());
                            fip = fileMap.get(paddedKey);
                        }
                        File fils = new File(fip);
// 使用 ImageIO 读取图片
@@ -761,21 +777,21 @@
                HashMap<String, Object> hs = new HashMap<String, Object>();
                int allPages = 0;
                int texPages = 0;
                int picPages = 0;
                int patPages = 0;
                if(!dmfs.isEmpty())
                {
                    for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
                    {
                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料"))
                            texPages = documentMaterialFileStyle.getCnt();
                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料"))
                            patPages = documentMaterialFileStyle.getCnt();
                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料"))
                            picPages = documentMaterialFileStyle.getCnt();
                    }
                }
//                int texPages = 0;
//                int picPages = 0;
//                int patPages = 0;
//                if(!dmfs.isEmpty())
//                {
//                    for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
//                    {
//                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料"))
//                            texPages = documentMaterialFileStyle.getCnt();
//                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料"))
//                            patPages = documentMaterialFileStyle.getCnt();
//                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料"))
//                            picPages = documentMaterialFileStyle.getCnt();
//                    }
//                }
                String compName = "广州盈家档案管理有限公司";
@@ -938,6 +954,9 @@
                    // 创建PDF保存选项
                    com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
                    pdfSaveOptions.setCompliance(com.aspose.cells.PdfCompliance.PDF_A_1_B);
                    // 确保字体嵌入到PDF中
                    // 创建临时字节输出流
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -1090,11 +1109,21 @@
                byte[] buf = new byte[1024];
                for (DocumentMaterialsVoLarge dc : docs) {
                    String filePath = fileMap.get(dc.getPageNumber().toString());
                    if(filePath==null)
                        continue;
                //    filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
                    System.out.println(filePath);
                    if (filePath == null) {
                        // 补零到4位(根据你的需求调整位数)
                        String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue());
                        filePath = fileMap.get(paddedKey);
                    }
                    if(filePath==null)
                        continue;
                    if(filePath.contains("profile"))
                        filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
                    File tempFile = new File(filePath);
                    //在压缩包中添加文件夹
@@ -1195,6 +1224,9 @@
        //把DocumentMaterils转到docs
        List<DocumentMaterialsVoLarge> docs = new ArrayList<>();
        int nstar = 1;
        int texPages = 0;
        int patPages = 0;
        int picPages = 0;
        for (DocumentMaterials mater : docAllInfo) {
            // physcialService.mySave(physcial);
            DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge();
@@ -1202,6 +1234,12 @@
            docum.setRecordId(aIV.getRecordId());
            docum.setNum(nstar++);
            docs.add(docum);
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("文字材料"))
                texPages++;
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("图样材料"))
                patPages++;
            if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("照片材料"))
                picPages++;
        }
        System.out.println(docs.size()+"----009");
@@ -1293,7 +1331,9 @@
                dc.setHorizontalResolution((long) wdpi);
                dc.setVerticalResolution((long) hdpi);
                dc.setSizeType(sizeType);
                fileMap.put(dc.getPageNumber()+"", fp);
                System.out.println(fileName1);
                System.out.println("gggggggggggggggg999999999999");
                fileMap.put(dc.getPageNumber()+"", fileName1);
             //   dc.set
                // 更新数据库
                //   documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
@@ -1310,6 +1350,12 @@
                //拿到图像属性
                System.out.println(dc.getPageNumber());
                String fip = fileMap.get(dc.getPageNumber().toString());
                // 如果直接匹配失败,尝试补零匹配
                if (fip == null) {
                    // 补零到4位(根据你的需求调整位数)
                    String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue());
                    fip = fileMap.get(paddedKey);
                }
// 创建 File 对象
                if(fip==null||fip.equals(""))
                {
@@ -1317,6 +1363,7 @@
                }
                File file = new File(fip);
// 使用 ImageIO 读取图片
@@ -1375,7 +1422,7 @@
            //压缩文件
            List<String> filePathList = paths;
            //把docmentMaterial转为
            File file = compressedFileToZip(docs, dsvs, aIV, id, fileMap);
            File file = compressedFileToZip(docs, dsvs, aIV, id, fileMap, texPages, patPages, picPages);
            System.out.println(file.getName());
            String fileName =aIV.getRecordId()+".zip";
@@ -1469,7 +1516,10 @@
    // 压缩文件
    private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs,   ArchiveInfoVo aIV, Long id,   Map<String, String> fileMap) throws Exception {
    private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs,   ArchiveInfoVo aIV, Long id,   Map<String, String> fileMap,
     int texPages,
    int patPages,
    int picPages) throws Exception {
        //压缩包具体名称(拼接时间戳防止重名)
        String datumName = "";
        String zipFileName =dsvs.get(0).getDocumentNumber()+aIV.getRecordId()+ ".zip";
@@ -1493,7 +1543,7 @@
            String pdf09Path = "09-备考表.pdf";
          //  pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id);
            //拿到相关数据
            List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
          //  List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
            LocalDate currentDate = LocalDate.now();
@@ -1502,21 +1552,21 @@
            HashMap<String, Object> hs = new HashMap<String, Object>();
            int allPages = 0;
            int texPages = 0;
            int picPages = 0;
            int patPages = 0;
            if(!dmfs.isEmpty())
            {
                for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
                {
                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料"))
                        texPages = documentMaterialFileStyle.getCnt();
                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料"))
                        patPages = documentMaterialFileStyle.getCnt();
                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料"))
                        picPages = documentMaterialFileStyle.getCnt();
                }
            }
//            int texPages = 0;
//            int picPages = 0;
//            int patPages = 0;
//            if(!docs.isEmpty())
//            {
//                for(DocumentMaterialsVoLarge documentMaterialFileStyle:docs)
//                {
//                    if(documentMaterialFileStyle!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料"))
//                        texPages = documentMaterialFileStyle.getCnt();
//                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料"))
//                        patPages = documentMaterialFileStyle.getCnt();
//                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料"))
//                        picPages = documentMaterialFileStyle.getCnt();
//                }
//            }
            String compName = "广州盈家档案管理有限公司";
            String li_person = "仇翀";
@@ -1850,8 +1900,7 @@
            byte[] buf = new byte[1024];
            for (DocumentMaterialsVoLarge dc : docs) {
                String filePath = fileMap.get(dc.getPageNumber().toString());
                if(filePath==null)
                    continue;
//                    else {
//                        // 文件名称
@@ -1883,7 +1932,20 @@
//
                if (filePath == null) {
                    // 补零到4位(根据你的需求调整位数)
                    String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue());
                    filePath = fileMap.get(paddedKey);
                    System.out.println(paddedKey);
                }
                System.out.println(filePath);
                if(filePath==null)
                    continue;
                if(filePath.contains("profile"))
                    filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/");
                File tempFile = new File(filePath);
                System.out.println(filePath);
ruoyi-admin/src/main/resources/application.yml
@@ -25,6 +25,9 @@
    uri-encoding: UTF-8
    # 连接数满后的排队数,默认为100
    accept-count: 1000
    connection-timeout: 150000  # 20秒
    keep-alive-timeout: 150000  # 长连接超时
    max-keep-alive-requests: 100
    threads:
      # tomcat最大线程数,默认为200
      max: 800
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -1149,7 +1149,7 @@
        try
        {
            // 设置行高为自动调整
            row.setHeight((short) -1);
           // row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport())
            {
@@ -1162,8 +1162,14 @@
                        sheet.addMergedRegion(new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column));
                    }
                }
                cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText())));
             //   cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText())));
                // 获取并修改样式
                CellStyle style = styles.get(StringUtils.format("data_{}_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType(), attr.wrapText()));
                Workbook workbook = row.getSheet().getWorkbook();
                CellStyle newStyle = workbook.createCellStyle();
                newStyle.cloneStyleFrom(style);
                newStyle.setWrapText(true); // 关键:启用自动换行
                cell.setCellStyle(newStyle);
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
                String dateFormat = attr.dateFormat();
@@ -1201,6 +1207,8 @@
                    // 设置列类型
                    setCellVo(value, attr, cell);
                }
                adjustRowHeightAfterSetValue(row, cell, value);
                addStatisticsData(column, Convert.toStr(value), attr);
            }
        }
@@ -1210,7 +1218,65 @@
        }
        return cell;
    }
    /**
     * 设置值后调整行高
     */
    private void adjustRowHeightAfterSetValue(Row row, Cell cell, Object value) {
        if (value == null) return;
        String text = value.toString();
        Sheet sheet = row.getSheet();
        // 1. 计算自动高度(基于内容)
        short autoHeight = calculateSimpleAutoHeight(text, cell);
        // 2. 获取当前行高
        short currentHeight = row.getHeight();
        if (currentHeight == -1) {
            currentHeight = sheet.getDefaultRowHeight();
        }
        // 3. 使用较大的高度(自动计算的高度或当前高度)
        short baseHeight = (short) Math.max(currentHeight, autoHeight);
        System.out.println(baseHeight+"aaaaaaaaatttttttt");
        // 4. 在基础上增加额外高度(100单位 = 5点)
        short extraHeight = 80;
        short newHeight = (short) (baseHeight + extraHeight);
        // 5. 限制最大高度
        short maxHeight = (short) 4000; // 100点
        row.setHeight((short) Math.min(maxHeight,newHeight));
    }
    /**
     * 简化的自动高度计算
     */
    private short calculateSimpleAutoHeight(String text, Cell cell) {
        if (text == null || text.isEmpty()) return 0;
        Sheet sheet = cell.getSheet();
        int colIndex = cell.getColumnIndex();
        // 获取列宽(字符数)
        int colWidthChars = sheet.getColumnWidth(colIndex) / 256;
        if (colWidthChars <= 0) colWidthChars = 10;
        // 计算文本行数
        int lines = 1;
        if (text.contains("\n")) {
            // 有显式换行
            String[] parts = text.split("\n");
            for (String part : parts) {
                lines += Math.max(1, (int) Math.ceil(part.length() * 1.5 / colWidthChars));
            }
        } else {
            // 自动换行
            lines = (int) Math.ceil(text.length() * 1.5 / colWidthChars);
        }
        // 每行高度:假设18点(360 POI单位)
        return (short) (lines * 360);
    }
    /**
     * 设置 POI XSSFSheet 单元格提示或选择框
     * 
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -325,7 +325,7 @@
                    // 如果是index为1的sheet,设置顶端标题行
                        // 将第1行(索引为0)设置为每页重复的标题行
                        sheet.setRepeatingRows(CellRangeAddress.valueOf("$1:$4"));
                        sheet.setRepeatingRows(CellRangeAddress.valueOf("$1:$5"));
                     row = sheet.createRow(0);
                    row.setHeight((short) (37*20));
@@ -532,6 +532,10 @@
                row = sheet.createRow(i + 5 );
            else
                row = sheet.createRow(i + 1 );
            // 第一步:让POI自动计算适配内容的行高
         //   sheet.autoSizeRow(0);
            // 第二步:获取自动计算后的行高
            // 得到导出对象.
            T vo = (T) list.get(i);
@@ -542,7 +546,9 @@
                // 设置实体类私有属性可访问
                field.setAccessible(true);
                this.addCell(excel, row, vo, field, column++);
            }
        }
    }
@@ -730,7 +736,7 @@
        Cell cell = null;
        try {
            // 设置行高为自动调整
            row.setHeight((short) -1);
          //  row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
@@ -745,7 +751,13 @@
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 获取并修改样式
                CellStyle style = styles.get(styleKey);
                Workbook workbook = row.getSheet().getWorkbook();
                CellStyle newStyle = workbook.createCellStyle();
                newStyle.cloneStyleFrom(style);
                newStyle.setWrapText(true); // 关键:启用自动换行
                cell.setCellStyle(newStyle);
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -762,6 +774,9 @@
                    // 设置列类型
                    setCellVo(value, attr, cell);
                }
                adjustRowHeightAfterSetValue(row, cell, value);
                addStatisticsData(column, Convert.toStr(value), attr);
            }
        } catch (Exception e) {
@@ -769,7 +784,65 @@
        }
        return cell;
    }
    /**
     * 设置值后调整行高
     */
    private void adjustRowHeightAfterSetValue(Row row, Cell cell, Object value) {
        if (value == null) return;
        String text = value.toString();
        Sheet sheet = row.getSheet();
        // 1. 计算自动高度(基于内容)
        short autoHeight = calculateSimpleAutoHeight(text, cell);
        // 2. 获取当前行高
        short currentHeight = row.getHeight();
        if (currentHeight == -1) {
            currentHeight = sheet.getDefaultRowHeight();
        }
        // 3. 使用较大的高度(自动计算的高度或当前高度)
        short baseHeight = (short) Math.max(currentHeight, autoHeight);
        System.out.println(baseHeight+"aaaaaaaaatttttttt");
        // 4. 在基础上增加额外高度(100单位 = 5点)
        short extraHeight = 80;
        short newHeight = (short) (baseHeight + extraHeight);
        // 5. 限制最大高度
        short maxHeight = (short) 4000; // 100点
        row.setHeight((short) Math.min(maxHeight,newHeight));
    }
    /**
     * 简化的自动高度计算
     */
    private short calculateSimpleAutoHeight(String text, Cell cell) {
        if (text == null || text.isEmpty()) return 0;
        Sheet sheet = cell.getSheet();
        int colIndex = cell.getColumnIndex();
        // 获取列宽(字符数)
        int colWidthChars = sheet.getColumnWidth(colIndex) / 256;
        if (colWidthChars <= 0) colWidthChars = 10;
        // 计算文本行数
        int lines = 1;
        if (text.contains("\n")) {
            // 有显式换行
            String[] parts = text.split("\n");
            for (String part : parts) {
                lines += Math.max(1, (int) Math.ceil(part.length() * 1.5 / colWidthChars));
            }
        } else {
            // 自动换行
            lines = (int) Math.ceil(text.length() * 1.5 / colWidthChars);
        }
        // 每行高度:假设18点(360 POI单位)
        return (short) (lines * 360);
    }
    /**
     * 设置 POI HSSFSheet 单元格提示
     *
@@ -1101,7 +1174,7 @@
           // header.setFontName("宋体");4
           // header.setFontSize((short) 10);
            // 设置页眉内容
            hssfSheet.setMargin(Sheet.HeaderMargin, 1.34);
            hssfSheet.setMargin(Sheet.HeaderMargin, 1.43);
            header.setRight("&\"宋体,Bold\"共 &N 页   第 &P 页");
        }
        // 如果是index为1的sheet,设置顶端标题行
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetFour.java
@@ -872,7 +872,7 @@
        Cell cell = null;
        try {
            // 设置行高为自动调整
            row.setHeight((short) -1);
           // row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
@@ -887,7 +887,13 @@
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 获取并修改样式
                CellStyle style = styles.get(styleKey);
                Workbook workbook = row.getSheet().getWorkbook();
                CellStyle newStyle = workbook.createCellStyle();
                newStyle.cloneStyleFrom(style);
                newStyle.setWrapText(true); // 关键:启用自动换行
                cell.setCellStyle(newStyle);
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -904,6 +910,7 @@
                    // 设置列类型
                    setCellVo(value, attr, cell);
                }
                adjustRowHeightAfterSetValue(row, cell, value);
                addStatisticsData(column, Convert.toStr(value), attr);
            }
        } catch (Exception e) {
@@ -911,7 +918,65 @@
        }
        return cell;
    }
    /**
     * 设置值后调整行高
     */
    private void adjustRowHeightAfterSetValue(Row row, Cell cell, Object value) {
        if (value == null) return;
        String text = value.toString();
        Sheet sheet = row.getSheet();
        // 1. 计算自动高度(基于内容)
        short autoHeight = calculateSimpleAutoHeight(text, cell);
        // 2. 获取当前行高
        short currentHeight = row.getHeight();
        if (currentHeight == -1) {
            currentHeight = sheet.getDefaultRowHeight();
        }
        // 3. 使用较大的高度(自动计算的高度或当前高度)
        short baseHeight = (short) Math.max(currentHeight, autoHeight);
        System.out.println(baseHeight+"aaaaaaaaatttttttt");
        // 4. 在基础上增加额外高度(100单位 = 5点)
        short extraHeight = 80;
        short newHeight = (short) (baseHeight + extraHeight);
        // 5. 限制最大高度
        short maxHeight = (short) 4000; // 100点
        row.setHeight((short) Math.min(maxHeight,newHeight));
    }
    /**
     * 简化的自动高度计算
     */
    private short calculateSimpleAutoHeight(String text, Cell cell) {
        if (text == null || text.isEmpty()) return 0;
        Sheet sheet = cell.getSheet();
        int colIndex = cell.getColumnIndex();
        // 获取列宽(字符数)
        int colWidthChars = sheet.getColumnWidth(colIndex) / 256;
        if (colWidthChars <= 0) colWidthChars = 10;
        // 计算文本行数
        int lines = 1;
        if (text.contains("\n")) {
            // 有显式换行
            String[] parts = text.split("\n");
            for (String part : parts) {
                lines += Math.max(1, (int) Math.ceil(part.length() * 1.5 / colWidthChars));
            }
        } else {
            // 自动换行
            lines = (int) Math.ceil(text.length() * 1.5 / colWidthChars);
        }
        // 每行高度:假设18点(360 POI单位)
        return (short) (lines * 360);
    }
    /**
     * 设置单元格提示
     *
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetSecond.java
@@ -419,7 +419,7 @@
                    System.out.println(declaredFields.length);
                    int i = 0;
                    for (Field field : declaredFields) {
                        if(i==8)
                        if(i==9)
                            break;
                        // 设置字段的访问权限,以便于访问私有字段
                        field.setAccessible(true);
@@ -902,7 +902,7 @@
        Cell cell = null;
        try {
            // 设置行高为自动调整
            row.setHeight((short) -1);
          //  row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
@@ -946,6 +946,9 @@
                    // 设置列类型
                    setCellVo(value, attr, cell);
                }
                adjustRowHeightAfterSetValue(row, cell, value);
                addStatisticsData(column, Convert.toStr(value), attr);
            }
        } catch (Exception e) {
@@ -953,7 +956,65 @@
        }
        return cell;
    }
    /**
     * 设置值后调整行高
     */
    private void adjustRowHeightAfterSetValue(Row row, Cell cell, Object value) {
        if (value == null) return;
        String text = value.toString();
        Sheet sheet = row.getSheet();
        // 1. 计算自动高度(基于内容)
        short autoHeight = calculateSimpleAutoHeight(text, cell);
        // 2. 获取当前行高
        short currentHeight = row.getHeight();
        if (currentHeight == -1) {
            currentHeight = sheet.getDefaultRowHeight();
        }
        // 3. 使用较大的高度(自动计算的高度或当前高度)
        short baseHeight = (short) Math.max(currentHeight, autoHeight);
        System.out.println(baseHeight+"aaaaaaaaatttttttt");
        // 4. 在基础上增加额外高度(100单位 = 5点)
        short extraHeight = 80;
        short newHeight = (short) (baseHeight + extraHeight);
        // 5. 限制最大高度
        short maxHeight = (short) 4000; // 100点
        row.setHeight((short) Math.min(maxHeight,newHeight));
    }
    /**
     * 简化的自动高度计算
     */
    private short calculateSimpleAutoHeight(String text, Cell cell) {
        if (text == null || text.isEmpty()) return 0;
        Sheet sheet = cell.getSheet();
        int colIndex = cell.getColumnIndex();
        // 获取列宽(字符数)
        int colWidthChars = sheet.getColumnWidth(colIndex) / 256;
        if (colWidthChars <= 0) colWidthChars = 10;
        // 计算文本行数
        int lines = 1;
        if (text.contains("\n")) {
            // 有显式换行
            String[] parts = text.split("\n");
            for (String part : parts) {
                lines += Math.max(1, (int) Math.ceil(part.length() * 1.5 / colWidthChars));
            }
        } else {
            // 自动换行
            lines = (int) Math.ceil(text.length() * 1.5 / colWidthChars);
        }
        // 每行高度:假设18点(360 POI单位)
        return (short) (lines * 360);
    }
    /**
     * 设置 POI HSSFSheet 单元格提示
     *
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheetThird.java
@@ -628,7 +628,7 @@
        Cell cell = null;
        try {
            // 设置行高为自动调整
            row.setHeight((short) -1);
           // row.setHeight((short) -1);
            // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
            if (attr.isExport()) {
                // 创建cell
@@ -643,7 +643,13 @@
                } else if (align == HorizontalAlignment.RIGHT) {
                    styleKey = "data3";
                }
                cell.setCellStyle(styles.get(styleKey));
                // 获取并修改样式
                CellStyle style = styles.get(styleKey);
                Workbook workbook = row.getSheet().getWorkbook();
                CellStyle newStyle = workbook.createCellStyle();
                newStyle.cloneStyleFrom(style);
                newStyle.setWrapText(true); // 关键:启用自动换行
                cell.setCellStyle(newStyle);
                // 用于读取对象中的属性
                Object value = getTargetValue(vo, field, attr);
@@ -660,6 +666,8 @@
                    // 设置列类型
                    setCellVo(value, attr, cell);
                }
                adjustRowHeightAfterSetValue(row, cell, value);
                addStatisticsData(column, Convert.toStr(value), attr);
            }
        } catch (Exception e) {
@@ -667,7 +675,65 @@
        }
        return cell;
    }
    /**
     * 设置值后调整行高
     */
    private void adjustRowHeightAfterSetValue(Row row, Cell cell, Object value) {
        if (value == null) return;
        String text = value.toString();
        Sheet sheet = row.getSheet();
        // 1. 计算自动高度(基于内容)
        short autoHeight = calculateSimpleAutoHeight(text, cell);
        // 2. 获取当前行高
        short currentHeight = row.getHeight();
        if (currentHeight == -1) {
            currentHeight = sheet.getDefaultRowHeight();
        }
        // 3. 使用较大的高度(自动计算的高度或当前高度)
        short baseHeight = (short) Math.max(currentHeight, autoHeight);
        System.out.println(baseHeight+"aaaaaaaaatttttttt");
        // 4. 在基础上增加额外高度(100单位 = 5点)
        short extraHeight = 80;
        short newHeight = (short) (baseHeight + extraHeight);
        // 5. 限制最大高度
        short maxHeight = (short) 4000; // 100点
        row.setHeight((short) Math.min(maxHeight,newHeight));
    }
    /**
     * 简化的自动高度计算
     */
    private short calculateSimpleAutoHeight(String text, Cell cell) {
        if (text == null || text.isEmpty()) return 0;
        Sheet sheet = cell.getSheet();
        int colIndex = cell.getColumnIndex();
        // 获取列宽(字符数)
        int colWidthChars = sheet.getColumnWidth(colIndex) / 256;
        if (colWidthChars <= 0) colWidthChars = 10;
        // 计算文本行数
        int lines = 1;
        if (text.contains("\n")) {
            // 有显式换行
            String[] parts = text.split("\n");
            for (String part : parts) {
                lines += Math.max(1, (int) Math.ceil(part.length() * 1.5 / colWidthChars));
            }
        } else {
            // 自动换行
            lines = (int) Math.ceil(text.length() * 1.5 / colWidthChars);
        }
        // 每行高度:假设18点(360 POI单位)
        return (short) (lines * 360);
    }
    /**
     * 设置 POI HSSFSheet 单元格提示
     *