From f984f785528bb3c97e41d483dc214e844993df35 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期四, 28 八月 2025 23:22:16 +0800
Subject: [PATCH] 修改了代码

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java |   87 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 2 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 40d7f56..acddd4c 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
@@ -8,10 +8,14 @@
 import com.itextpdf.text.pdf.PdfWriter;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.utils.file.FileUtils;
+import com.ruoyi.common.utils.poi.ExcelExp;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.poi.ExcelUtilManySheet;
+import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
 import com.ruoyi.domain.DocumentMaterials;
 import com.ruoyi.domain.vo.ArchiveInfoVo;
 import com.ruoyi.domain.vo.DocumentMaterialsVo;
+import com.ruoyi.domain.vo.DocumentMaterialsVoSmall;
 import com.ruoyi.framework.web.domain.server.Sys;
 import com.ruoyi.service.IArchiveRecordsService;
 import com.ruoyi.service.IDocumentMaterialsService;
@@ -36,9 +40,11 @@
 import java.net.URLEncoder;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.List;
+import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipInputStream;
@@ -59,6 +65,64 @@
 
     @Autowired
     private IArchiveRecordsService iArchiveRecordsService;
+
+
+
+
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) throws IOException
+    {
+        //瀵煎嚭鍗烽潰灏侀潰浠g爜
+
+        ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(55L);
+        List<ArchiveInfoVo> arsi = new ArrayList<>();
+        arsi.add(aIV);
+        ExcelExp e1 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
+        ExcelExp e2 = new ExcelExp("鎻愬彇鏂规硶鈥�",  arsi, ArchiveInfoVo.class);
+        List<ExcelExp> mysheet = new ArrayList<ExcelExp>();
+        mysheet.add(e1);
+        mysheet.add(e2);
+        ByteOutputStream bos1 = new ByteOutputStream();
+        ExcelUtilManySheetSecond<List<ExcelExp>> util2 = new ExcelUtilManySheetSecond<List<ExcelExp>>(mysheet);
+
+        util2.exportExcelManySheet(response, mysheet);
+
+
+
+        //瀵煎嚭鍗烽潰鐩綍浠g爜
+//        DocumentMaterials documentMaterials = new DocumentMaterials();
+//        documentMaterials.setRecordId(55L);
+//      //  List<DocumentMaterials> docs = documentMaterialsService.selectDocumentMaterialsList(documentMaterials);
+//        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo("55");
+//      //  dsvs.get(0).setUrl("/profile/upload/2025/08/14/30_20250814212128A031.jpg");
+//
+//
+//      //  dsvs.stream().map()
+//        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());
+//
+//        String recordId = dsvs.get(0).getRecordId();
+//        byte[] imgr = barcodeService.generateBarcodeImage(recordId);
+//        ExcelExp e1 = new ExcelExp("鍗峰唴鐩綍鏁版嵁",dsvs, DocumentMaterialsVo.class);
+//        ExcelExp e2 = new ExcelExp("鍗峰唴鏁版嵁", list2, recordId, imgr, DocumentMaterialsVoSmall.class);
+//        List<ExcelExp> mysheet = new ArrayList<ExcelExp>();
+//        mysheet.add(e1);
+//        mysheet.add(e2);
+//        ExcelUtilManySheet<List<ExcelExp>> util2 = new ExcelUtilManySheet<List<ExcelExp>>(mysheet);
+       // util2.exportExcelManySheet(response, mysheet);
+
+    }
+
+
+
+
+
+
+
+
+
+
     /**
      * 鎵撳寘涓嬭浇
      * @param response
@@ -303,16 +367,35 @@
 
             zos.putNextEntry(entry);
             ByteOutputStream bos = new ByteOutputStream();
-            util.byteOutputStreamExcel(bos, docs,"Date List", "");
+            util.byteOutputStreamExcel(bos, docs,"鐢靛瓙鏂囦欢鐩綍", "");
             bos.writeTo(zos);
 
             //鎷垮埌鍗峰唴鐩綍鐨別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());
+
+            String recordId = dsvs.get(0).getRecordId();
+            byte[] imgr = barcodeService.generateBarcodeImage(recordId);
+            ExcelExp e1 = new ExcelExp("鍗峰唴鐩綍鏁版嵁",dsvs, DocumentMaterialsVo.class);
+            ExcelExp e2 = new ExcelExp("鍗峰唴鏁版嵁", list2, recordId, imgr, DocumentMaterialsVoSmall.class);
+            List<ExcelExp> mysheet = new ArrayList<ExcelExp>();
+            mysheet.add(e1);
+            mysheet.add(e2);
+            ExcelUtilManySheet<List<ExcelExp>> util2 = new ExcelUtilManySheet<List<ExcelExp>>(mysheet);
+
+
+
+
+
             ZipEntry entr = new ZipEntry("鍗峰唴鐩綍" + ".xls");
             ExcelUtil<DocumentMaterialsVo> util1 = new ExcelUtil<DocumentMaterialsVo>(DocumentMaterialsVo.class);
             System.out.println(dsvs);
             zos.putNextEntry(entr);
             ByteOutputStream bos1 = new ByteOutputStream();
-            util1.byteOutputStreamExcel(bos1, dsvs,"Date List", "");
+
+            util2.exportExcelManySheet(bos1, mysheet);
+
+         //   util1.byteOutputStreamExcel(bos1, dsvs,"Date List", "");
             bos1.writeTo(zos);
             //鎶奺xcel杞负pdf
 

--
Gitblit v1.9.1