From 359f1d48b1d859a23cd35a425d2cffb1e9d1c811 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 26 十二月 2025 19:58:59 +0800
Subject: [PATCH] 修改了对应代码

---
 archiveManager/pom.xml                                                                      |    2 
 ruoyi-admin/pom.xml                                                                         |   11 +
 ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java               |    4 
 archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java                  |    2 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java    |    1 
 archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java              |    6 
 ruoyi-common/pom.xml                                                                        |   32 +++
 archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java                   |   10 +
 archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java                  |  177 +++++++++++----------
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java  |   80 ++++++++-
 archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java          |   16 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java |   41 ++++
 archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java                        |    9 
 archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java       |   59 +++++++
 14 files changed, 330 insertions(+), 120 deletions(-)

diff --git a/archiveManager/pom.xml b/archiveManager/pom.xml
index 641b0f3..6d64248 100644
--- a/archiveManager/pom.xml
+++ b/archiveManager/pom.xml
@@ -116,6 +116,8 @@
             <artifactId>spring-test</artifactId>
         </dependency>
 
+
+
     </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
index d54657d..002ce80 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
@@ -27,11 +27,11 @@
     /** $column.columnComment */
     @TableId(type = IdType.AUTO)
     private Long materialId;
-    @Excel(name = "鏂囦欢鏉愭枡搴忓彿", handler = NumberFormatHandler.class)
+    @Excel(name = "鏂囦欢鏉愭枡搴忓彿", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
     private Long fileNumber;
 
 
-    @Excel(name = "鏂囦欢缂栧彿")
+    @Excel(name = "鏂囦欢缂栧彿", headerColor = IndexedColors.BLACK)
     private String documentNumber;
 
 
@@ -58,9 +58,10 @@
     private Date date;
 
     /** $column.columnComment */
-    @Excel(name = "椤靛彿", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
+   // @Excel(name = "椤靛彿", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
     private Long pageNumber;
-
+    @Excel(name = "椤靛彿", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
+    private String pageNumberFormatted;
     /** $column.columnComment */
     @Excel(name = "椤垫", headerColor = IndexedColors.BLACK)
     private Long pageOrder;
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
index ef46602..7cf33a2 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -26,9 +26,12 @@
     @Excel(name = "鏃ユ湡", width = 10, dateFormat = "yyyy-MM-dd", height = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
 
     private Date date;
-    @Excel(name = "椤靛彿", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
-
+    // 椤靛彿锛堝師濮嬫暟鍊硷紝鐢ㄤ簬璁$畻锛�
     private Long pageNumber;
+    
+    // 鏍煎紡鍖栧悗鐨勯〉鍙凤紝鐢ㄤ簬鏄剧ず鑼冨洿锛屽"38-38"鎴�"23-38"
+    @Excel(name = "椤靛彿", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
+    private String pageNumberFormatted;
     @Excel(name = "澶囨敞", height = 20,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
     private String remarks;
 
@@ -42,3 +45,6 @@
 //    @Excel(name = "鍥剧墖", cellType = Excel.ColumnType.IMAGE)
 //    private String url;
 }
+
+
+
diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
index 936e316..3506c27 100644
--- a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
+++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
@@ -27,18 +27,18 @@
 
     private Date date;
     @Excel(name = "椤靛彿",width = 10, headerFontSize=12, headerColor = IndexedColors.BLACK, headerFontBold = true)
-
+    private String pageNumberFormatted;
     private Long pageNumber;
     @Excel(name = "澶囨敞",width = 8,  headerFontSize=12,headerColor = IndexedColors.BLACK, headerFontBold = true)
     private String remarks;
 
-    public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, Long pageNumber, String remarks) {
+    public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, String pageNumberFormatted, String remarks) {
         this.num = num;
         this.documentNumber = documentNumber;
         this.creator = creator;
         this.title = title;
         this.date = date;
-        this.pageNumber = pageNumber;
+       this.pageNumberFormatted = pageNumberFormatted;
         this.remarks = remarks;
     }
 
diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java
index 1d501f1..ef37016 100644
--- a/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java
+++ b/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java
@@ -1,86 +1,91 @@
-package com.ruoyi.mapper;
-
-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 org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-
-import java.util.List;
-/**
- * 銆愭枃浠舵潗鏂欑患鍚堜俊鎭�慚apper鎺ュ彛
- *
- * @author ruoyi
- * @date 2025-07-26
- */
-@Mapper
-public interface DocumentMaterialsMapper extends BaseMapper<DocumentMaterials> {
-
-    @Select("update document_materials SET url = #{url},size_type=#{sizeType}, file_number=#{fileNumber},page_order=#{pageOrder},width=#{width},height=#{height},horizontal_resolution=#{horizontalResolution},vertical_resolution=#{verticalResolution},file_size=#{fileSize}, format=#{format} where page_number = #{pageNumber} and record_id=#{recordId}")
-    Long updateInfoByPageNumber(@Param("pageNumber") Long pageNumber,@Param("sizeType") String sizeType, @Param("fileNumber") Long fileNumber,@Param("pageOrder") Long pageOrder,@Param("width") int width, @Param("height") int height,  @Param("horizontalResolution") int horizontalResolution, @Param("verticalResolution") int verticalResolution, @Param("fileSize") Double fileSize,@Param("url")  String url,@Param("format")  String format, @Param("recordId") Long recordId);
-
-
-    //鏍规嵁棰樺悕鎷垮埌鏈�澶х殑pageOrder
-    @Select("select count(*) from document_materials where title=#{title} and page_number<#{pageNumber} and stage=#{stage} and record_id=#{recordId}")
-    Long getMaxPageOrder(@Param("title")String title,@Param("pageNumber") Long pageNumber,@Param("stage") String stage, @Param("recordId") Long recordId);
-
-    //璁$畻鏂囦欢鐨勫簭鍙凤紝title鏈夊彲鑳介噸澶�
-    @Select("select count(distinct(concat_ws(',', title, stage)))-1 from document_materials where  page_number<=#{pageNumber} and record_id=#{recordId}")
-    Long getFileNumber(@Param("pageNumber") Long pageNumber, @Param("recordId") Long recordId);
-
-
-
-
-    //鏌ヨ鍗峰唴鐩綍
-    @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" +
-            "            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,ar.record_id, file_number, \n" +
-            "            document_number, creator, title, date, page_number, page_order, \n" +
-            "            stage, publicity, is_attachment, dm.retention_period, security_level, is_sensitive,\n" +
-            "            is_canceled, format, size_type, horizontal_resolution, vertical_resolution, width,\n" +
-            "            height, file_size, attachment_history_numbers,url, dm.remarks\n" +
-            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
-            "and dm.record_id=#{recordId} and file_style!='鍏跺畠鏉愭枡' ")
-    List<DocumentMaterialsVoLarge> getDocumentMaterialsvoLarge(@Param("recordId") int recordId);
-    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,file_style, ar.record_id, ar.inquiry_number, ar.case_title, " +
-            "            document_number, title, page_number, \n" +
-            "            publicity, dm.retention_period, dm.remarks\n" +
-            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
-            "and dm.record_id=#{recordId} and file_style!='鍏跺畠鏉愭枡' ")
-    List<DocumentMaterialsFileList> getDocumentMaterialsFileList(@Param("recordId") int recordId);
-    @Select("select count(*) as cnt, file_style from document_materials " +
-            "where record_id=#{recordId} GROUP BY file_style")
-
-    List<DocumentMaterialFileStyle> getFileStyleInfo(@Param("recordId") int recordId);
-
-    @Select("select if(count(*) < max(page_number), false, true) as res from document_materials where record_id=#{recordId}")
-    boolean isPageNumberLegal(@Param("recordId") int recordId);
-
-
-    //鎷垮埌闄ゅ叾瀹冩潗鏂欎箣澶栫殑鍏ㄩ儴鏁版嵁鐨勪釜鏁�
-    @Select("select count(*) FROM document_materials where file_style!='鍏朵粬鏉愭枡' and record_id=#{recordId}")
-    int getCount(@Param("recordId") int recordId);
-
-
-    //鍒ゆ柇鍗峰唴鐩綍鏄惁鍏ㄩ儴涓婁紶浜嗛檮浠�
-    @Select("select if(num=total_count, true, false) as res from (\n" +
-            "SELECT\n" +
-            " ROW_NUMBER() OVER (ORDER BY page_number) AS num,  SUM(CASE WHEN dm.url IS NOT NULL THEN 1 ELSE 0 END) OVER() AS total_count\n" +
-            " from document_materials as dm, archive_records as ar \n" +
-            "         WHERE ar.id = dm.record_id and page_number  IN (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 desc limit 1) as res ")
-    Boolean judgeArchiveInfo(   @Param("recordId") int recordId);
-
-}
+package com.ruoyi.mapper;
+
+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 org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+/**
+ * 銆愭枃浠舵潗鏂欑患鍚堜俊鎭�慚apper鎺ュ彛
+ *
+ * @author ruoyi
+ * @date 2025-07-26
+ */
+@Mapper
+public interface DocumentMaterialsMapper extends BaseMapper<DocumentMaterials> {
+
+    @Select("update document_materials SET url = #{url},size_type=#{sizeType}, file_number=#{fileNumber},page_order=#{pageOrder},width=#{width},height=#{height},horizontal_resolution=#{horizontalResolution},vertical_resolution=#{verticalResolution},file_size=#{fileSize}, format=#{format} where page_number = #{pageNumber} and record_id=#{recordId}")
+    Long updateInfoByPageNumber(@Param("pageNumber") Long pageNumber,@Param("sizeType") String sizeType, @Param("fileNumber") Long fileNumber,@Param("pageOrder") Long pageOrder,@Param("width") int width, @Param("height") int height,  @Param("horizontalResolution") int horizontalResolution, @Param("verticalResolution") int verticalResolution, @Param("fileSize") Double fileSize,@Param("url")  String url,@Param("format")  String format, @Param("recordId") Long recordId);
+
+
+    //鏍规嵁棰樺悕鎷垮埌鏈�澶х殑pageOrder
+    @Select("select count(*) from document_materials where title=#{title} and page_number<#{pageNumber} and stage=#{stage} and record_id=#{recordId}")
+    Long getMaxPageOrder(@Param("title")String title,@Param("pageNumber") Long pageNumber,@Param("stage") String stage, @Param("recordId") Long recordId);
+
+    //璁$畻鏂囦欢鐨勫簭鍙凤紝title鏈夊彲鑳介噸澶�
+    @Select("select count(distinct(concat_ws(',', title, stage)))-1 from document_materials where  page_number<=#{pageNumber} and record_id=#{recordId}")
+    Long getFileNumber(@Param("pageNumber") Long pageNumber, @Param("recordId") Long recordId);
+
+
+
+
+    //鏌ヨ鍗峰唴鐩綍
+    @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" +
+            "            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,ar.record_id, file_number, \n" +
+            "            document_number, creator, title, date, page_number, page_order, \n" +
+            "            stage, publicity, is_attachment, dm.retention_period, security_level, is_sensitive,\n" +
+            "            is_canceled, format, size_type, horizontal_resolution, vertical_resolution, width,\n" +
+            "            height, file_size, attachment_history_numbers,url, dm.remarks\n" +
+            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
+            "and dm.record_id=#{recordId} and file_style!='鍏跺畠鏉愭枡' ")
+    List<DocumentMaterialsVoLarge> getDocumentMaterialsvoLarge(@Param("recordId") int recordId);
+    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,file_style, ar.record_id, ar.inquiry_number, ar.case_title, " +
+            "            document_number, title, page_number, \n" +
+            "            publicity, dm.retention_period, dm.remarks\n" +
+            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
+            "and dm.record_id=#{recordId} and file_style!='鍏跺畠鏉愭枡' ")
+    List<DocumentMaterialsFileList> getDocumentMaterialsFileList(@Param("recordId") int recordId);
+    @Select("select count(*) as cnt, file_style from document_materials " +
+            "where record_id=#{recordId} GROUP BY file_style")
+
+    List<DocumentMaterialFileStyle> getFileStyleInfo(@Param("recordId") int recordId);
+
+    @Select("select if(count(*) < max(page_number), false, true) as res from document_materials where record_id=#{recordId}")
+    boolean isPageNumberLegal(@Param("recordId") int recordId);
+
+
+    //鎷垮埌闄ゅ叾瀹冩潗鏂欎箣澶栫殑鍏ㄩ儴鏁版嵁鐨勪釜鏁�
+    @Select("select count(*) FROM document_materials where file_style!='鍏朵粬鏉愭枡' and record_id=#{recordId}")
+    int getCount(@Param("recordId") int recordId);
+    
+    //鑾峰彇鎸囧畾妗堝嵎鐨勬渶澶ч〉鍙�
+    @Select("select max(page_number) FROM document_materials where record_id=#{recordId}")
+    Long getMaxPageNumber(@Param("recordId") int recordId);
+
+
+    //鍒ゆ柇鍗峰唴鐩綍鏄惁鍏ㄩ儴涓婁紶浜嗛檮浠�
+    @Select("select if(num=total_count, true, false) as res from (\n" +
+            "SELECT\n" +
+            " ROW_NUMBER() OVER (ORDER BY page_number) AS num,  SUM(CASE WHEN dm.url IS NOT NULL THEN 1 ELSE 0 END) OVER() AS total_count\n" +
+            " from document_materials as dm, archive_records as ar \n" +
+            "         WHERE ar.id = dm.record_id and page_number  IN (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 desc limit 1) as res ")
+    Boolean judgeArchiveInfo(   @Param("recordId") int recordId);
+
+}
+
\ No newline at end of file
diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
index a95650e..a0ff67e 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
@@ -97,6 +97,8 @@
     public int updateStatusByIds(Long [] ids);
     public List<ArchiveRecordSmall> findByIds(ArchiveRecords archiveRecords);
 
+    AjaxResult mySave(ArchiveRecords archiveRecords);
+
     boolean whether(@Param("recordId") Long recordId);
 
 
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
index 8e31b4c..b11b386 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -15,13 +15,13 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.domain.ArchiveRecords;
-import com.ruoyi.domain.Archiverecordstouser;
 import com.ruoyi.domain.vo.AnalysisResult;
 import com.ruoyi.domain.vo.ArchiveInfoVo;
 import com.ruoyi.domain.vo.ArchiveRecordSmall;
 import com.ruoyi.mapper.ArchiveRecordsMapper;
 import com.ruoyi.mapper.ArchiverecordstouserMapper;
 import com.ruoyi.service.IArchiveRecordsService;
+import com.ruoyi.service.IArchiverecordstouserService;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -41,6 +41,9 @@
 //    @Autowired
 //    private ArchiveRecordsMapper archiveRecordsMapper;
 
+
+    @Autowired
+    private IArchiverecordstouserService archiverecordstouserService;
     @Autowired
     private ArchiverecordstouserMapper archiverecordstouserMapper;
 
@@ -373,6 +376,11 @@
 
     @Override
     public int updateArchiveById(String status, Long id) {
+
+        // 鑾峰彇褰撳墠鐢ㄦ埛ID
+        Long userId = SecurityUtils.getUserId();
+        // 鍙互鍦ㄨ繖閲屼娇鐢╱serId杩涜鎺堟潈鎿嶄綔
+        archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
         this.baseMapper.updateStatusById(status, id);
         return 0;
     }
@@ -394,10 +402,9 @@
     }
 
 
+    @Override
     public AjaxResult mySave(ArchiveRecords archiveRecords) {
-
-
-        //妫�鏌ユ槸鍚︽湁閲嶅鏁版嵁鎻掑叆
+        // 妫�鏌ユ槸鍚︽湁閲嶅鏁版嵁鎻掑叆
         LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>();
         lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId());
         List<ArchiveRecords> list = list(lqw);
@@ -430,3 +437,4 @@
         return this.baseMapper.whether(recordId);
     }
 }
+
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
index 90cc40f..a483197 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -129,8 +129,9 @@
 
     @Override
     public int insertDocumentMaterials(DocumentMaterials documentMaterials) {
+     
+        
         LocalDateTime time = LocalDateTime.now();
-
         Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
         documentMaterials.setCreatedAt(date);
         System.out.println(documentMaterials.getFileStyle());
@@ -142,7 +143,6 @@
         boolean res = false;
         try {
              res = this.save(documentMaterials);
-
         } catch (Exception e) {
             System.out.println(e);
             throw new ErrorcodeExceptionextends(500, "鍚屼竴涓鍗峰唴锛屼笉鍏佽椤电爜閲嶅锛�");
@@ -265,7 +265,32 @@
 
     @Override
     public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
-        return this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
+        // 鑾峰彇鍘熷鏁版嵁鍒楄〃
+        List<DocumentMaterialsVo> dataList = this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
+        
+        // 鑾峰彇璇ユ鍗风殑鏈�澶ч〉鍙凤紙鎬婚〉鏁帮級
+        Long totalPages = 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++) {
+                DocumentMaterialsVo 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
@@ -291,6 +316,32 @@
             BeanUtils.copyProperties(archiveCategory, documentMaterials);
             documentMaterials.setRecordId(Long.parseLong(recordId));
             documentMaterials.setVisible(1);
+               // 楠岃瘉蹇呭~瀛楁
+        if (StringUtils.isEmpty(documentMaterials.getTitle())) {
+            throw new ErrorcodeExceptionextends(400, "鏂囦欢棰樺悕涓嶈兘涓虹┖");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getFileStyle())) {
+            throw new ErrorcodeExceptionextends(400, "鏉愭枡绫诲瀷涓嶈兘涓虹┖");
+        }
+        // 鏉愭枡绫诲瀷涓嶆槸"鍏跺畠鏉愭枡"鏃讹紝椤靛彿蹇呴』杈撳叆
+        if (!"鍏朵粬鏉愭枡".equals(documentMaterials.getFileStyle()) && documentMaterials.getPageNumber() == null) {
+            throw new ErrorcodeExceptionextends(400, "褰撳墠鏉愭枡绫诲瀷闈炲叾瀹冩潗鏂欙紝椤靛彿蹇呴』杈撳叆");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getIsAttachment())) {
+            throw new ErrorcodeExceptionextends(400, "鏄惁涓洪檮浠朵笉鑳戒负绌�");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getStage())) {
+            throw new ErrorcodeExceptionextends(400, "鎵�澶勯樁娈典笉鑳戒负绌�");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getRetentionPeriod())) {
+            throw new ErrorcodeExceptionextends(400, "淇濈鏈熼檺涓嶈兘涓虹┖");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getIsSensitive())) {
+            throw new ErrorcodeExceptionextends(400, "鏄惁鏁忔劅涓嶈兘涓虹┖");
+        }
+        if (StringUtils.isEmpty(documentMaterials.getIsCanceled())) {
+            throw new ErrorcodeExceptionextends(400, "鏄惁娉ㄩ攢涓嶈兘涓虹┖");
+        }
             this.insertDocumentMaterials(documentMaterials);
         }
 
@@ -431,3 +482,5 @@
 }
 
 
+
+
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index e6a092d..3f00a86 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -139,11 +139,15 @@
 
     <build>
         <plugins>
+
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <version>2.5.15</version>
                 <configuration>
+
+                    <includeSystemScope>true</includeSystemScope>
+                    <mainClass>com.ruoyi.RuoYiApplication</mainClass>
                     <fork>true</fork> <!-- 濡傛灉娌℃湁璇ラ厤缃紝devtools涓嶄細鐢熸晥 -->
                 </configuration>
                 <executions>
@@ -169,9 +173,16 @@
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+<!--                    <compilerArgs>-->
+<!--                        <arg>-XDignore.symbol.file</arg>-->
+<!--                    </compilerArgs>-->
+<!--                    <fork>true</fork>-->
                 </configuration>
             </plugin>
+
         </plugins>
+
         <finalName>${project.artifactId}</finalName>
     </build>
 
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
index 41253a7..5c4332c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
@@ -14,7 +14,6 @@
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.common.utils.poi.ExcelExp;
 import com.ruoyi.common.utils.poi.ExcelUtilManySheetFour;
-import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
 import com.ruoyi.domain.ArchiveRecords;
 import com.ruoyi.domain.DocumentMaterials;
 import com.ruoyi.domain.vo.*;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
index 9412e5e..df76b7d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -25,17 +25,20 @@
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.text.Convert;
 import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.common.utils.poi.ExcelExp;
 import com.ruoyi.common.utils.poi.ExcelUtilManySheet;
 import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
 import com.ruoyi.domain.ArchiveCategory;
+import com.ruoyi.domain.ArchiveProjectName;
 import com.ruoyi.domain.ArchiveRecords;
 import com.ruoyi.domain.DocumentMaterials;
 import com.ruoyi.domain.vo.*;
 import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.framework.web.domain.server.Sys;
+import com.ruoyi.service.IArchiveProjectNameService;
 import com.ruoyi.service.IArchiveRecordsService;
 import com.ruoyi.service.IDocumentMaterialsService;
 import com.ruoyi.service.impl.BarcodeService;
@@ -72,6 +75,8 @@
 @RequestMapping("/system/materials")
 public class DocumentMaterialsController extends BaseController
 {
+    @Autowired
+    private IArchiveProjectNameService iArchiveProjectNameService;
     @Autowired
     private BarcodeService barcodeService;
     @Autowired
@@ -452,6 +457,23 @@
     {
         //09-澶囪�冭〃.pdf
         String pdf09Path = "09-澶囪�冭〃.pdf";
+
+        //鏍规嵁椤圭洰鍚嶇О鎷垮埌鍏徃鍚嶇О鍜岄」鐩礋璐d汉
+
+        String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+        String li_person = "浠囩縺";
+        String sh_person = "鏇剧憺鑾�";
+        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+        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()))
+                li_person = projectName.get(0).getCreatePerson();
+        }
         //  pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id);
         //鎷垮埌鐩稿叧鏁版嵁
         List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
@@ -484,6 +506,7 @@
         hs.put("picPages", picPages);
         hs.put("texPages", texPages);
         hs.put("volumeNumber", recordId);
+        hs.put("company", compName);
         hs.put("time", cdt);
 
         if (!getLicense()) {
@@ -494,9 +517,21 @@
         try {
 
             // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
-            String filepath = "09-澶囪�冭〃.docx";
+//            String filepath = "09-澶囪�冭〃.docx";
+//            // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+//            XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+//            );
+            // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
+            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";
@@ -530,7 +565,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);
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 59a8c6f..56375d6 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;
 
@@ -569,12 +573,30 @@
                             picPages = documentMaterialFileStyle.getCnt();
                     }
                 }
+
+
+                String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+                String li_person = "浠囩縺";
+                String sh_person = "鏇剧憺鑾�";
+                ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
+                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()))
+                        li_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("time", cdt);
 
                 if (!getLicense()) {
@@ -584,10 +606,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";
@@ -726,7 +754,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);
@@ -1097,12 +1125,30 @@
                         picPages = documentMaterialFileStyle.getCnt();
                 }
             }
+
+            String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+            String li_person = "浠囩縺";
+            String sh_person = "鏇剧憺鑾�";
+            ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+            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()))
+                    li_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("time", cdt);
 
             if (!getLicense()) {
@@ -1113,10 +1159,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);
@@ -1148,7 +1206,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");
 
 
 
@@ -1271,7 +1329,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);
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 7599128..d14b982 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -69,7 +69,7 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
-  
+
         <!-- JSON宸ュ叿绫� -->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
@@ -147,10 +147,40 @@
             <version>5.5.13</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.sun.xml.messaging.saaj</groupId>
+            <artifactId>saaj-impl</artifactId>
+            <version>3.0.2</version>
+        </dependency>
 
+        <!-- 涔熷彲浠ュ悓鏃舵坊鍔犺繖涓� -->
+        <dependency>
+            <groupId>javax.xml.soap</groupId>
+            <artifactId>javax.xml.soap-api</artifactId>
+            <version>1.4.0</version>
+        </dependency>
     </dependencies>
 <!--    <build>-->
 <!--        <plugins>-->
+<!--            <plugin>-->
+<!--                <groupId>org.apache.maven.plugins</groupId>-->
+<!--                <artifactId>maven-compiler-plugin</artifactId>-->
+<!--                <version>3.1</version>-->
+<!--                <configuration>-->
+<!--                    <source>1.8</source>-->
+<!--                    <target>1.8</target>-->
+<!--                    <encoding>UTF-8</encoding>-->
+<!--                    <compilerArgs>-->
+<!--                        <arg>-XDignore.symbol.file</arg>-->
+<!--                    </compilerArgs>-->
+<!--                    <fork>true</fork>-->
+<!--                </configuration>-->
+<!--            </plugin>-->
+<!--        </plugins>-->
+<!--    </build>-->
+
+<!--    <build>-->
+<!--        <plugins>-->
 
 <!--        <plugin>-->
 <!--        <groupId>org.apache.maven.plugins</groupId>-->
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
index 39c5d24..cf5d9cb 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -541,7 +541,7 @@
                 style.setWrapText(true);
                 Font headerFont = wb.createFont();
                 headerFont.setFontName(excel.headerFontName());
-                headerFont.setFontHeightInPoints((short) 12);
+                headerFont.setFontHeightInPoints((short) 10);
                 headerFont.setBold(excel.headerFontBold());
                 headerFont.setColor(excel.headerColor().index);
                 style.setFont(headerFont);
@@ -1026,4 +1026,4 @@
         }
         return val;
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1