| 
															
																@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.springframework.stereotype.Service; 
															 | 
															
															 | 
															
																 import org.springframework.stereotype.Service; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.io.File; 
															 | 
															
															 | 
															
																 import java.io.File; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import java.util.ArrayList; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.util.List; 
															 | 
															
															 | 
															
																 import java.util.List; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 @Service 
															 | 
															
															 | 
															
																 @Service 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -121,6 +122,8 @@ public class NoteNationDataServiceImpl implements INoteNationDataService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																         String oldPath = file.getPath(); 
															 | 
															
															 | 
															
																         String oldPath = file.getPath(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        Long count = file.getCount(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (oldPath != null) { 
															 | 
															
															 | 
															
																         if (oldPath != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             String filePath = RuoYiConfig.getUploadPath(); 
															 | 
															
															 | 
															
																             String filePath = RuoYiConfig.getUploadPath(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -133,7 +136,7 @@ public class NoteNationDataServiceImpl implements INoteNationDataService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																             String deletaPath = filePath + StringUtils.substringAfter(oldPath, Constants.RESOURCE_PREFIX); 
															 | 
															
															 | 
															
																             String deletaPath = filePath + StringUtils.substringAfter(oldPath, Constants.RESOURCE_PREFIX); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             System.out.println("5." + deletaPath); 
															 | 
															
															 | 
															
																             System.out.println("5." + deletaPath); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            if (deleteFileRecursive(deletaPath)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (deleteFileRecursive(deletaPath, count)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // 执行特定文件夹删除操作 
															 | 
															
															 | 
															
																                 // 执行特定文件夹删除操作 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 String fileExtension = getFileExtensionFromPath(deletaPath); 
															 | 
															
															 | 
															
																                 String fileExtension = getFileExtensionFromPath(deletaPath); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (fileExtension.equalsIgnoreCase("pdf")) { 
															 | 
															
															 | 
															
																                 if (fileExtension.equalsIgnoreCase("pdf")) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -203,14 +206,86 @@ public class NoteNationDataServiceImpl implements INoteNationDataService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      * @param ids 文件 
															 | 
															
															 | 
															
																      * @param ids 文件 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      * @return 
															 | 
															
															 | 
															
																      * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																      */ 
															 | 
															
															 | 
															
																      */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    public static boolean deleteFileRecursive(String ids) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        File file = new File(ids); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        System.out.println("11." + file.getPath()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        if (file.isFile() && file.exists()) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            return file.delete(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    public static boolean deleteFileRecursive(String ids, Long count) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+       for (String s : deleteFileList(ids, count)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+           File file = new File(s); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+           System.out.println("11. " + s); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+           if (file.isFile() && file.exists()) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+               if (!file.delete()){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                   return false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+               } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+           } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+       } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        return true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * 获取要删除的文件列表 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    public static List<String> deleteFileList(String str, Long count){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        //获取/前的str 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String path = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 查找最后一个 '/' 的索引 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        int lastSlashIndex = str.lastIndexOf('/'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 确保找到 '/' 并且 '/' 不是第一个字符 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (lastSlashIndex > 0 && lastSlashIndex < str.length() - 1) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            // 获取 '/' 前面的字符 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            path = str.substring(0, lastSlashIndex); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        System.out.println(false); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        return false; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 获取文件名 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String fileName = str.substring(lastSlashIndex+1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String[] strings = splitFileName(fileName); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        List<String> list = new ArrayList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        int i = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 如果文件不从0开始 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (!strings[1].equals("00")){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            i = 1; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            count++; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        for (; i < count; i++){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            String fileNumber = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            System.out.println(strings[1]); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (i < 100){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                fileNumber = String.format("%02d", i); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            }else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                fileNumber = String.valueOf(i); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            String filename = path + "/" + strings[0] + "_" + fileNumber + "." + strings[2]; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            System.out.println("filename"+filename); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            list.add(filename); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        return list; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * 分解格式为 xxx_00.jpg 的字符串 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * @param fileName 要处理的字符串 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * @return 分解后的字符串数组,其中包含_前面的部分,_和.之间的部分,以及.后面的部分 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    public static String[] splitFileName(String fileName) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 找到 '_' 和 '.' 的索引 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        int underscoreIndex = fileName.indexOf('_'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        int dotIndex = fileName.indexOf('.'); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 检查索引有效性 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (underscoreIndex == -1 || dotIndex == -1 || underscoreIndex >= dotIndex) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            throw new IllegalArgumentException("字符串格式不正确"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 获取 _ 前面的部分 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String partBeforeUnderscore = fileName.substring(0, underscoreIndex); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 获取 _ 和 . 之间的部分 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String partBetweenUnderscoreAndDot = fileName.substring(underscoreIndex + 1, dotIndex); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 获取 . 后面的部分 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String partAfterDot = fileName.substring(dotIndex + 1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        return new String[] { partBeforeUnderscore, partBetweenUnderscoreAndDot, partAfterDot }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																     // 递归删除文件夹及其内容 
															 | 
															
															 | 
															
																     // 递归删除文件夹及其内容 
															 |