From 5d91a329768a2a86e01e4b9b6bc6a2b939b87adb Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 16 一月 2026 22:48:51 +0800
Subject: [PATCH] 修改了对应代码

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java |   87 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 11 deletions(-)

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 caaf3c0..ae9400b 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
@@ -1,10 +1,10 @@
 package com.ruoyi.web.controller.archive;
 
+import java.io.File;
+import java.io.FileFilter;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.bean.BeanUtil;
@@ -172,7 +172,64 @@
         System.out.println("090sdfsdf");
         return new AjaxResult(0, archiveRecordsService.updateStatusByIds(ids) + "");
     }
+    /**
+     *
+     */
+    @PreAuthorize("@ss.hasPermi('system:records:list')")
+    @Log(title = "妗f璁板綍", businessType = BusinessType.UPDATE)
+    @PostMapping(value = "/getAllFilesCounts")
 
+    public AjaxResult getAllFileCounts(@RequestBody Long[] ids) {
+
+
+
+
+// 1. 鍒濆鍖朚ap锛岀敤浜庡瓨鍌╮ecordId鍜屽搴旂殑鏂囦欢鏁�
+        Map<Long, Integer> recordFileCountMap = new HashMap<>();
+
+// 2. 鑾峰彇鍩虹涓婁紶璺緞
+        String filePath = RuoYiConfig.getUploadPath();
+
+// 3. 閬嶅巻姣忎釜recordId锛岃绠楁枃浠舵暟骞舵斁鍏ap
+        for (Long recordId : ids) {
+            // 鎷兼帴褰撳墠recordId鐨勭洰褰曡矾寰�
+            File desc = new File(filePath + File.separator + recordId);
+            int fileCount = 0;
+
+            try {
+                // 鍒ゆ柇鐩綍鏄惁瀛樺湪涓旀槸鐩綍
+                if (desc.exists() && desc.isDirectory()) {
+                    // 杩囨护鍑轰粎鏂囦欢锛堟帓闄ゅ瓙鐩綍锛�
+                    File[] files = desc.listFiles(new FileFilter() {
+                        @Override
+                        public boolean accept(File file) {
+                            return file.isFile(); // 鍙粺璁℃枃浠讹紝涓嶇粺璁$洰褰�
+                        }
+                    });
+
+                    // 閬垮厤绌烘寚閽堬紙绌虹洰褰曟椂listFiles杩斿洖null锛�
+                    if (files != null) {
+                        fileCount = files.length;
+                    }
+                } else {
+                    // 鐩綍涓嶅瓨鍦�/涓嶆槸鐩綍锛屾枃浠舵暟涓�0
+                    fileCount = 0;
+                    // 鍙�夛細鏃ュ織鎻愮ず
+                    // log.warn("鐩綍涓嶅瓨鍦ㄦ垨闈炵洰褰曪細{}", desc.getAbsolutePath());
+                }
+            } catch (SecurityException e) {
+                // 鏉冮檺涓嶈冻绛夊紓甯革紝鏂囦欢鏁扮疆0
+                fileCount = 0;
+                // 鍙�夛細鏃ュ織璁板綍寮傚父
+                // log.error("鑾峰彇鐩綍[{}]鏂囦欢鏁板け璐ワ細{}", recordId, e.getMessage(), e);
+            }
+
+            // 4. 灏唕ecordId鍜屽搴旂殑鏂囦欢鏁版斁鍏ap
+            recordFileCountMap.put(recordId, fileCount);
+        }
+        return new AjaxResult(200,"鎷垮埌鎵�鏈夊搴旂殑鏁版嵁", recordFileCountMap);
+
+    }
     /**
      * 鍒犻櫎妗f璁板綍
      */
@@ -193,9 +250,9 @@
 
     @PreAuthorize("@ss.hasPermi('system:records:edit')")
     @Log(title = "淇敼鐘舵��", businessType = BusinessType.IMPORT)
-    @GetMapping(value = "/updateStatusById/{status}/{id}")
-    public AjaxResult updateStatusById(@PathVariable("status") String status, @PathVariable("id") String id) {
-        return new AjaxResult(200, archiveRecordsService.updateArchiveById(status, Long.parseLong(id)) + "");
+    @GetMapping(value = "/updateStatusById/{status}/{id}/{operator}")
+    public AjaxResult updateStatusById(@PathVariable("status") String status, @PathVariable("id") String id, @PathVariable("operator") String operator) {
+        return new AjaxResult(200, archiveRecordsService.updateArchiveById(status, Long.parseLong(id), operator)+"");
     }
 
 
@@ -203,7 +260,7 @@
     public void getExportModel(HttpServletResponse response) {
         List<ArchiveRecordModelExp> list = Collections.singletonList(new ArchiveRecordModelExp());
         ExcelUtil<ArchiveRecordModelExp> util = new ExcelUtil<>(ArchiveRecordModelExp.class);
-        util.exportExcel(response, list, "妗f淇℃伅瀵煎叆妯℃澘");
+        util.exportExcel(response, list, "妗f淇℃伅");
     }
 
 
@@ -211,7 +268,7 @@
     public void getExportModelOther(HttpServletResponse response) {
         List<ArchiveRecordModelOther> list = Collections.singletonList(new ArchiveRecordModelOther());
         ExcelUtil<ArchiveRecordModelOther> util = new ExcelUtil<>(ArchiveRecordModelOther.class);
-        util.exportExcel(response, list, "妗f淇℃伅瀵煎叆妯℃澘");
+        util.exportExcel(response, list, "妗f淇℃伅");
     }
 
     @PreAuthorize("@ss.hasPermi('system:records:list')")
@@ -259,11 +316,19 @@
         List<DocumentMaterialsFileList> arsi = new ArrayList<>();
 //        DocumentMaterials documentMaterials = new DocumentMaterials();
 //        documentMaterials.setRecordId(recordId);
-        List<DocumentMaterialsFileList> lst = iDocumentMaterialsService.selectDocumentMaterialsFileList(searSigAnn.getRecordId());
+
+                ArchiveRecords archiveRecords = archiveRecordsService.selectArchiveRecordsById(searSigAnn.getRecordId());
+        List<DocumentMaterialsVo> lst = iDocumentMaterialsService.findArchMInfo(searSigAnn.getRecordId().toString(), archiveRecords.getPageCount());
+       // List<DocumentMaterialsFileList> lst =
+        //鎷垮埌鍗峰唴鐩綍鐨別xcel
+//        List<DocumentMaterialsVoSmall> lst = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
+//                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
+
+        //iDocumentMaterialsService.selectDocumentMaterialsFileList(searSigAnn.getRecordId());
 
 
         // 澶嶅埗灞炴�у埌SmallObject鍒楄〃
-        for (DocumentMaterialsFileList bigObject : lst) {
+        for (DocumentMaterialsVo bigObject : lst) {
             DocumentMaterialsFileList smallObject = new DocumentMaterialsFileList();
             BeanUtil.copyProperties(bigObject, smallObject); // 澶嶅埗灞炴��
             System.out.println(bigObject);

--
Gitblit v1.9.1