From 436b955086030caec4513022c1f5127470ad2b14 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 28 十二月 2025 20:54:21 +0800
Subject: [PATCH] 修改了对应代码

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java |  362 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 279 insertions(+), 83 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
index 59a903c..3c6ef8e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -6,11 +6,14 @@
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.PdfPCell;
 import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.common.utils.poi.*;
+import com.ruoyi.domain.ArchiveProjectName;
 import com.ruoyi.domain.ArchiveRecords;
 import com.ruoyi.domain.DocumentMaterials;
 import com.ruoyi.domain.vo.*;
+import com.ruoyi.service.IArchiveProjectNameService;
 import com.ruoyi.service.IArchiveRecordsService;
 import com.ruoyi.service.IDocumentMaterialsService;
 import com.ruoyi.service.impl.BarcodeService;
@@ -53,7 +56,8 @@
     private BarcodeService barcodeService;
     @Autowired
     private IDocumentMaterialsService documentMaterialsService;
-
+    @Autowired
+    private IArchiveProjectNameService iArchiveProjectNameService;
     @Autowired
     private IArchiveRecordsService iArchiveRecordsService;
 
@@ -330,7 +334,7 @@
 
         String recordId = aIV.getRecordId();
         byte[] imgr = barcodeService.generateBarcodeImage(recordId);
-        byte[] sedcode = pdfGenerateService.createQrCodeN(recordId, 30, 30);
+        byte[] sedcode = pdfGenerateService.createQrCodeN(recordId, 100, 100);
         ExcelExp e1 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
         ExcelExp e2 = new ExcelExp("妗堝嵎灏侀潰",  arsi, recordId, imgr,sedcode, ArchiveInfoVo.class);
         List<ExcelExp> mysheet = new ArrayList<ExcelExp>();
@@ -445,7 +449,7 @@
 
 
 
-            ExcelExp e6 = new ExcelExp("绉讳氦娓呭崟",lrs, ArchiveRecordSmall.class);
+            ExcelExp e6 = new ExcelExp("绉讳氦娓呭崟","GH" + formattedDate + sequence,  lrs, ArchiveRecordSmall.class);
           //  ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰",  arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
             List<ExcelExp> mysheet6 = new ArrayList<ExcelExp>();
             mysheet6.add(e6);
@@ -464,20 +468,26 @@
 
 
 
+            System.out.println(ids.length);
+            System.out.println("------------------");
+
             for(int i = 0; i < ids.length; i++) {
+                System.out.println(ids[i]);
 
                 // 鑾峰彇鏂囦欢鐨勪繚瀛樹綅缃�,璇诲彇鏁版嵁搴�,
                 DocumentMaterials documentMaterials = new DocumentMaterials();
                 documentMaterials.setRecordId(ids[i]);
                 List<DocumentMaterialsVoLarge> docs = documentMaterialsService.selectDocumentMaterialsAllByRecordId(ids[i]);
-                System.out.println(docs.size()+"----009");
+                System.out.println(docs.size()+"----7777");
 
 
                 //.selectDocumentMaterialsList(documentMaterials);
                 List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(ids[i].toString());
                 ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(ids[i]);
-
+                System.out.println(aIV.getInquiryNumber());
+                System.out.println(aIV.getRecordId());
                 String adir = aIV.getInquiryNumber() + " " + aIV.getRecordId();
+                System.out.println(adir);
                 System.out.println(fna+adir);
                 zos.putNextEntry(new ZipEntry(fna + adir + "/"));
 
@@ -494,39 +504,26 @@
                 }
                 //娣诲姞07  鐨刾df
                 //pdf鐩綍灏侀潰
-                String pdfPathF = "07-妗堝嵎灏侀潰.pdf";
-                pdfGenerateService.generatePdf(pdfPathF, ids[i]);
-                // 2. 鍘嬬缉PDF鍒癦IP鏂囦欢
-                // 娣诲姞PDF鏂囦欢鍒癦IP
-                ZipEntry zipEntry2 = new ZipEntry(fna + adir +"/"+pdfPathF);
-                zos.putNextEntry(zipEntry2);
+//                String pdfPathF = "07-妗堝嵎灏侀潰.pdf";
+//                pdfGenerateService.generatePdf(pdfPathF, ids[i]);
+//                // 2. 鍘嬬缉PDF鍒癦IP鏂囦欢
+//                // 娣诲姞PDF鏂囦欢鍒癦IP
+//                ZipEntry zipEntry2 = new ZipEntry(fna + adir +"/"+pdfPathF);
+//                zos.putNextEntry(zipEntry2);
+//
+//                // 璇诲彇PDF鏂囦欢鍐呭骞跺啓鍏IP
+//                try (FileInputStream fis = new FileInputStream(pdfPathF)) {
+//                    byte[] buffer = new byte[1024];
+//                    int len;
+//                    while ((len = fis.read(buffer)) > 0) {
+//                        zos.write(buffer, 0, len);
+//                    }
+//                }
 
-                // 璇诲彇PDF鏂囦欢鍐呭骞跺啓鍏IP
-                try (FileInputStream fis = new FileInputStream(pdfPathF)) {
-                    byte[] buffer = new byte[1024];
-                    int len;
-                    while ((len = fis.read(buffer)) > 0) {
-                        zos.write(buffer, 0, len);
-                    }
-                }
 
-                //08-鍗峰唴鍗峰唴鐩綍鐨刾df
-                String pdf08Path= "08-鍗峰唴鐩綍.pdf";
-                List<DocumentMaterialsVo> list3 = dsvs;
-                if(list3.size()>0) {
-                    pdfGenerateService.generateFileDirectoryPdf(pdf08Path, list3);
-                    ZipEntry zipEntry3 = new ZipEntry(fna + adir +"/"+pdf08Path);
-                    zos.putNextEntry(zipEntry3);
 
-                    // 璇诲彇PDF鏂囦欢鍐呭骞跺啓鍏IP
-                    try (FileInputStream fis = new FileInputStream(pdf08Path)) {
-                        byte[] buffer = new byte[1024];
-                        int len;
-                        while ((len = fis.read(buffer)) > 0) {
-                            zos.write(buffer, 0, len);
-                        }
-                    }
-                }
+
+
                 //09-澶囪�冭〃.pdf
 
 
@@ -568,13 +565,31 @@
                 {
                     for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
                     {
-                        if(documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
+                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
                             texPages = documentMaterialFileStyle.getCnt();
-                        if(documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
+                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
                             patPages = documentMaterialFileStyle.getCnt();
-                        if(documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
+                        if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
                             picPages = documentMaterialFileStyle.getCnt();
                     }
+                }
+
+
+                String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+                String li_person = "浠囩縺";
+                String sh_person = "鏇剧憺鑾�";
+                ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
+                if(!StringUtils.isEmpty(archiveRecords1.getLiPerson()))
+                    li_person = archiveRecords1.getLiPerson();
+                ArchiveProjectName tmp = new ArchiveProjectName();
+                tmp.setName(archiveRecords1.getProjectName());
+                List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
+                if(!projectName.isEmpty())
+                {
+                    if(!StringUtils.isEmpty(projectName.get(0).getCompanyName()))
+                        compName = projectName.get(0).getCompanyName();
+                    if(!StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
+                        sh_person = projectName.get(0).getCreatePerson();
                 }
                 allPages = texPages + picPages + patPages;
                 hs.put("pages", allPages);
@@ -582,6 +597,9 @@
                 hs.put("picPages", picPages);
                 hs.put("texPages", texPages);
                 hs.put("volumeNumber", aIV.getRecordId());
+                hs.put("company", compName);
+                hs.put("liPerson", li_person);
+                hs.put("shPerson", sh_person);
                 hs.put("time", cdt);
 
                 if (!getLicense()) {
@@ -591,10 +609,16 @@
 
                 try {
 
-                    // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
-                    String filepath = "09-澶囪�冭〃.docx";
+                    ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+                    org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
+//                String filepath = resource.getFile().getAbsolutePath();
+//                // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+//                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+//                       );
+
+                    InputStream inputStream = resource.getInputStream();
                     // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
-                    XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+                    XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
                     );
 
                     String renderedDocPath = "rendered_output.docx";
@@ -638,7 +662,7 @@
 
                 String recordId1 = aIV.getRecordId();
                 byte[] imgr1 = barcodeService.generateBarcodeImage(recordId1);
-                byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 30, 30);
+                byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 200, 200);
                 ExcelExp e3 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
                 ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰",  arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
                 List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
@@ -652,6 +676,64 @@
                 //  System.out.println(bos2);
                 zos.putNextEntry(entryiv);
 
+
+                bos2.writeTo(zos);
+
+
+                //pdf鐩綍灏侀潰
+                String pdfPathF = "07-妗堝嵎灏侀潰.pdf";
+                // pdfGenerateService.generatePdf(pdfPathF, id);
+
+                try {
+                    if (!getLicenseExcel()) {
+                        System.out.println("鎺堟潈澶辫触");
+                        // return ;
+                    }
+                    // 璇诲彇Excel鏂囦欢
+                    com.aspose.cells.Workbook wb = poiToAspose(util3.getWb());
+
+                    // 鑾峰彇闇�瑕佸鍑虹殑sheet锛堢储寮曚粠0寮�濮嬶級
+                    int targetSheetIndex = 1;
+                    com.aspose.cells.Worksheet targetSheet = wb.getWorksheets().get(targetSheetIndex);
+                    targetSheet.autoFitRows(true);
+                    System.out.println("褰撳墠sheet鍚嶇О锛�" + targetSheet.getName());
+                    System.out.println("褰撳墠sheet绱㈠紩锛�" + targetSheet.getIndex());
+
+                    // 闅愯棌鎵�鏈夊叾浠栧伐浣滆〃
+                    for (int j = 0; j < wb.getWorksheets().getCount(); j++) {
+                        if (j != targetSheetIndex) {
+                            wb.getWorksheets().get(j).setVisible(false);
+                        }
+                    }
+
+                    // 璁剧疆娲诲姩宸ヤ綔琛ㄤ负鐩爣宸ヤ綔琛�
+                    wb.getWorksheets().setActiveSheetIndex(targetSheetIndex);
+                    // 鍒涘缓PDF淇濆瓨閫夐」
+                    com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
+                    pdfSaveOptions.setCompliance(com.aspose.cells.PdfCompliance.PDF_A_1_B);
+                    // 鍒涘缓涓存椂瀛楄妭杈撳嚭娴�
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+                    // 灏嗘柊鐨刉orkbook淇濆瓨涓篜DF鍒颁复鏃舵祦
+                    //   newWorkbook.save(baos, com.aspose.cells.SaveFormat.PDF);
+                    wb.save(baos, pdfSaveOptions);
+
+                    // 灏哖DF娣诲姞鍒癦IP鏂囦欢
+                    ZipEntry entry07 = new ZipEntry(fna + adir +"/"+pdfPathF);
+                    zos.putNextEntry(entry07);
+                    zos.write(baos.toByteArray());
+                    //  zos.closeEntry();
+                    // 鐩存帴灏嗗師濮嬪伐浣滅翱淇濆瓨涓篜DF锛堝彧鍖呭惈鍙鐨勫伐浣滆〃锛�
+
+                    long now = System.currentTimeMillis();
+                    //   System.out.println("pdf杞崲鎴愬姛锛屽叡鑰楁椂锛�" + ((now - old) / 1000.0) + "绉�");
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    // 鎵撳嵃璇︾粏閿欒淇℃伅
+                    System.err.println("杞崲澶辫触锛�" + e.getMessage());
+                    e.printStackTrace(System.err);
+                }
+
 //            ExcelUtil<ArchiveInfoVo> utilsv = new ExcelUtil<ArchiveInfoVo>(ArchiveInfoVo.class);
 //
 //
@@ -659,7 +741,7 @@
 //            List<ArchiveInfoVo> aivs = new ArrayList<>();
 //            aivs.add(aIV);
 //            utilsv.byteOutputStreamExcel(boss, aivs,"Date List", "");
-                bos2.writeTo(zos);
+
 
 
 
@@ -675,7 +757,7 @@
 
                 //鎷垮埌鍗峰唴鐩綍鐨別xcel
                 List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
-                        res1.getTitle(), res1.getDate(), res1.getPageNumber(), res1.getRemarks())).collect(Collectors.toList());
+                        res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
                 if(!dsvs.isEmpty()) {
                     String recordId = dsvs.get(0).getRecordId();
                     byte[] imgr = barcodeService.generateBarcodeImage(recordId);
@@ -691,12 +773,90 @@
                     zos.putNextEntry(entr);
                     ByteOutputStream bos8 = new ByteOutputStream();
 
-                    util2.exportExcelManySheet(bos6, mysheet);
+                    util2.exportExcelManySheet(bos8, mysheet);
 
                     //   util1.byteOutputStreamExcel(bos1, dsvs,"Date List", "");
                     bos8.writeTo(zos);
+
+
+
+
+                    //08-鍗峰唴鍗峰唴鐩綍鐨刾df
+                    String pdf08Path= "08-鍗峰唴鐩綍.pdf";
+                    try {
+                        if (!getLicenseExcel()) {
+                            System.out.println("鎺堟潈澶辫触");
+                            // return ;
+                        }
+                        // 璇诲彇Excel鏂囦欢
+                        com.aspose.cells.Workbook wb1 = poiToAspose(util2.getWb());
+
+                        // 鑾峰彇闇�瑕佸鍑虹殑sheet锛堢储寮曚粠0寮�濮嬶級
+                        int targetSheetIndex = 1;
+                        com.aspose.cells.Worksheet targetSheet = wb1.getWorksheets().get(targetSheetIndex);
+                        targetSheet.autoFitRows(true);
+                        System.out.println("褰撳墠sheet鍚嶇О锛�" + targetSheet.getName());
+                        System.out.println("褰撳墠sheet绱㈠紩锛�" + targetSheet.getIndex());
+
+                        // 闅愯棌鎵�鏈夊叾浠栧伐浣滆〃
+                        for (int j = 0; j < wb1.getWorksheets().getCount(); j++) {
+                            if (j != targetSheetIndex) {
+                                wb1.getWorksheets().get(j).setVisible(false);
+                            }
+                        }
+
+                        // 璁剧疆娲诲姩宸ヤ綔琛ㄤ负鐩爣宸ヤ綔琛�
+                        wb1.getWorksheets().setActiveSheetIndex(targetSheetIndex);
+                        // 鍒涘缓PDF淇濆瓨閫夐」
+                        com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
+                        pdfSaveOptions.setCompliance(com.aspose.cells.PdfCompliance.PDF_A_1_B);
+                        // 鍒涘缓涓存椂瀛楄妭杈撳嚭娴�
+                        ByteArrayOutputStream baosm = new ByteArrayOutputStream();
+
+                        // 灏嗘柊鐨刉orkbook淇濆瓨涓篜DF鍒颁复鏃舵祦
+                        //   newWorkbook.save(baos, com.aspose.cells.SaveFormat.PDF);
+                        wb1.save(baosm, pdfSaveOptions);
+
+                        // 灏哖DF娣诲姞鍒癦IP鏂囦欢
+                        ZipEntry entry2 = new ZipEntry(fna + adir +"/"+pdf08Path);
+                        zos.putNextEntry(entry2);
+                        zos.write(baosm.toByteArray());
+                        //  zos.closeEntry();
+                        // 鐩存帴灏嗗師濮嬪伐浣滅翱淇濆瓨涓篜DF锛堝彧鍖呭惈鍙鐨勫伐浣滆〃锛�
+
+                        long now = System.currentTimeMillis();
+                        //   System.out.println("pdf杞崲鎴愬姛锛屽叡鑰楁椂锛�" + ((now - old) / 1000.0) + "绉�");
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        // 鎵撳嵃璇︾粏閿欒淇℃伅
+                        System.err.println("杞崲澶辫触锛�" + e.getMessage());
+                        e.printStackTrace(System.err);
+                    }
+
+
                 }
                 //鎶奺xcel杞负pdf
+
+//
+//                //08-鍗峰唴鍗峰唴鐩綍鐨刾df
+//                String pdf08Path= "08-鍗峰唴鐩綍.pdf";
+//                List<DocumentMaterialsVo> list3 = dsvs;
+//                if(list3.size()>0) {
+//                    pdfGenerateService.generateFileDirectoryPdf(pdf08Path, list3);
+//                    ZipEntry zipEntry3 = new ZipEntry(fna + adir +"/"+pdf08Path);
+//                    zos.putNextEntry(zipEntry3);
+//
+//                    // 璇诲彇PDF鏂囦欢鍐呭骞跺啓鍏IP
+//                    try (FileInputStream fis = new FileInputStream(pdf08Path)) {
+//                        byte[] buffer = new byte[1024];
+//                        int len;
+//                        while ((len = fis.read(buffer)) > 0) {
+//                            zos.write(buffer, 0, len);
+//                        }
+//                    }
+//                }
+//
+//
 
 
 
@@ -713,38 +873,40 @@
                     //鍦ㄥ帇缂╁寘涓坊鍔犳枃浠跺す
 
                     //寰楀埌鏂囦欢鍚峟rontCompWithZore(4, dc.get)+
-                    String fname = frontCompWithZore(4, dc.getFileNumber().intValue())+"-"+dc.getTitle()+"-"+frontCompWithZore(4,dc.getPageNumber().intValue())+"."
-                            +dc.getUrl().split("\\.")[1];
-                    if(dc.getStage().equals("01-鐢宠鏉愭枡"))
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/01-鐢宠鏉愭枡/"+fname));
-                    else if(dc.getStage().equals("02-鍔炴杩囩▼鏉愭枡"))
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/02-鍔炴杩囩▼鏉愭枡/"+fname));
-                    else if(dc.getStage().equals("03-缁撹鎬ф枃浠�"))
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/03-缁撹鎬ф枃浠�/"+fname));
-                    else if(dc.getStage().equals("04-鍏朵粬鏉愭枡")) {
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/04-鍏朵粬鏉愭枡/" + fname));
-                    }
-                    else if(dc.getStage().equals("05-妗f鍙樻洿鏉愭枡"))
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/05-妗f鍙樻洿鏉愭枡/"+fname));
-                    else if(dc.getStage().equals("06-涓氬姟鏁版嵁"))
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/06-涓氬姟鏁版嵁/"+fname));
-                    else
-                        zos.putNextEntry(new ZipEntry(fna + adir + "/"+fname));
 
+                    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];
+                        if (dc.getStage().equals("01-鐢宠鏉愭枡"))
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/01-鐢宠鏉愭枡/" + fname));
+                        else if (dc.getStage().equals("02-鍔炴杩囩▼鏉愭枡"))
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/02-鍔炴杩囩▼鏉愭枡/" + fname));
+                        else if (dc.getStage().equals("03-缁撹鎬ф枃浠�"))
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/03-缁撹鎬ф枃浠�/" + fname));
+                        else if (dc.getStage().equals("04-鍏朵粬鏉愭枡")) {
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/04-鍏朵粬鏉愭枡/" + fname));
+                        } else if (dc.getStage().equals("05-妗f鍙樻洿鏉愭枡"))
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/05-妗f鍙樻洿鏉愭枡/" + fname));
+                        else if (dc.getStage().equals("06-涓氬姟鏁版嵁"))
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/06-涓氬姟鏁版嵁/" + fname));
+                        else
+                            zos.putNextEntry(new ZipEntry(fna + adir + "/" + fname));
 
-
-                    int len;
-                    FileInputStream in = new FileInputStream(tempFile);
-                    while ((len = in.read(buf)) != -1){
-                        zos.write(buf, 0, len);
-                    }
-                    //  zos.putNextEntry(new ZipEntry("04-鍏朵粬鏉愭枡"));
-                    zos.closeEntry();
-                    in.close();
                 }
-            }
 
-            //鍒犻櫎鍘嬬缉鍖�
+                int len;
+                FileInputStream in = new FileInputStream(tempFile);
+                while ((len = in.read(buf)) != -1){
+                    zos.write(buf, 0, len);
+                }
+                  //  zos.putNextEntry(new ZipEntry("04-鍏朵粬鏉愭枡"));
+                zos.closeEntry();
+                in.close();
+            }
+        }
+
+        //鍒犻櫎鍘嬬缉鍖�
 //            if(file.exists()){
 //                file.delete();
 //            }
@@ -958,20 +1120,41 @@
             {
                 for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
                 {
-                    if(documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
+                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
                         texPages = documentMaterialFileStyle.getCnt();
-                    if(documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
+                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
                         patPages = documentMaterialFileStyle.getCnt();
-                    if(documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
+                    if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
                         picPages = documentMaterialFileStyle.getCnt();
                 }
             }
+
+            String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+            String li_person = "浠囩縺";
+            String sh_person = "鏇剧憺鑾�";
+            ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+            if(!StringUtils.isEmpty(archiveRecords.getLiPerson()))
+                li_person = archiveRecords.getLiPerson();
+            ArchiveProjectName tmp = new ArchiveProjectName();
+            tmp.setName(archiveRecords.getProjectName());
+            List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
+            if(!projectName.isEmpty())
+            {
+                if(!StringUtils.isEmpty(projectName.get(0).getCompanyName()))
+                    compName = projectName.get(0).getCompanyName();
+                if(!StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
+                    sh_person = projectName.get(0).getCreatePerson();
+            }
+
             allPages = texPages + picPages + patPages;
             hs.put("pages", allPages);
             hs.put("patPages", patPages);
             hs.put("picPages", picPages);
             hs.put("texPages", texPages);
             hs.put("volumeNumber", aIV.getRecordId());
+            hs.put("company", compName);
+            hs.put("liPerson", li_person);
+            hs.put("shPerson", sh_person);
             hs.put("time", cdt);
 
             if (!getLicense()) {
@@ -982,10 +1165,22 @@
             try {
 
                 // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
-                String filepath = "09-澶囪�冭〃.docx";
-                // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
-                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
-                       );
+                ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+                org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
+//                String filepath = resource.getFile().getAbsolutePath();
+//                // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+//                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+//                       );
+
+                InputStream inputStream = resource.getInputStream();
+                    // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+                    XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
+                    );
+
+
+
+
+
 
                 String renderedDocPath = "rendered_output.docx";
                 File renderedFile = new File(renderedDocPath);
@@ -1017,7 +1212,7 @@
 
 
 
-            com.aspose.words.Document doc = new com.aspose.words.Document("09-澶囪�冭〃.docx");
+           // com.aspose.words.Document doc = new com.aspose.words.Document("09.docx");
 
 
 
@@ -1048,7 +1243,7 @@
 
             String recordId1 = aIV.getRecordId();
             byte[] imgr1 = barcodeService.generateBarcodeImage(recordId1);
-            byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 30, 30);
+            byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 200, 200);
             ExcelExp e3 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
             ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰",  arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
             List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
@@ -1140,7 +1335,7 @@
 
             //鎷垮埌鍗峰唴鐩綍鐨別xcel
             List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res -> new DocumentMaterialsVoSmall(res.getNum(), res.getDocumentNumber(),res.getCreator(),
-                    res.getTitle(), res.getDate(), res.getPageNumber(), res.getRemarks())).collect(Collectors.toList());
+                    res.getTitle(), res.getDate(), res.getPageNumberFormatted(), res.getRemarks())).collect(Collectors.toList());
 
             String recordId = dsvs.get(0).getRecordId();
             byte[] imgr = barcodeService.generateBarcodeImage(recordId);
@@ -1248,6 +1443,7 @@
 
                 System.out.println(filePath);
                 File tempFile = new File(filePath);
+
                 //鍦ㄥ帇缂╁寘涓坊鍔犳枃浠跺す
                 if(res) {
                     zos.putNextEntry(new ZipEntry("01-鐢宠鏉愭枡/"));

--
Gitblit v1.9.1