| 
															
																@@ -1,5 +1,6 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 package com.ruoyi.project.common; 
															 | 
															
															 | 
															
																 package com.ruoyi.project.common; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import com.alibaba.fastjson2.JSONObject; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import com.ruoyi.common.constant.Constants; 
															 | 
															
															 | 
															
																 import com.ruoyi.common.constant.Constants; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import com.ruoyi.common.utils.StringUtils; 
															 | 
															
															 | 
															
																 import com.ruoyi.common.utils.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import com.ruoyi.common.utils.file.FileUploadUtils; 
															 | 
															
															 | 
															
																 import com.ruoyi.common.utils.file.FileUploadUtils; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -12,14 +13,12 @@ import org.slf4j.Logger; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.slf4j.LoggerFactory; 
															 | 
															
															 | 
															
																 import org.slf4j.LoggerFactory; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																 import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.springframework.http.MediaType; 
															 | 
															
															 | 
															
																 import org.springframework.http.MediaType; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import org.springframework.web.bind.annotation.GetMapping; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import org.springframework.web.bind.annotation.PostMapping; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import org.springframework.web.bind.annotation.RequestMapping; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-import org.springframework.web.bind.annotation.RestController; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import org.springframework.web.bind.annotation.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.springframework.web.multipart.MultipartFile; 
															 | 
															
															 | 
															
																 import org.springframework.web.multipart.MultipartFile; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import javax.servlet.http.HttpServletRequest; 
															 | 
															
															 | 
															
																 import javax.servlet.http.HttpServletRequest; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import javax.servlet.http.HttpServletResponse; 
															 | 
															
															 | 
															
																 import javax.servlet.http.HttpServletResponse; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import java.io.File; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.util.ArrayList; 
															 | 
															
															 | 
															
																 import java.util.ArrayList; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.util.List; 
															 | 
															
															 | 
															
																 import java.util.List; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -97,6 +96,34 @@ public class CommonController 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     * 通用删除请求(单个) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    @PostMapping("/delete") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    public AjaxResult deleteFile(@RequestBody JSONObject jsonObject) throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String filePath = jsonObject.getString("filePath"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String ruoyiPath = RuoYiConfig.getUploadPath(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        //由于在RuoYiConfig.getUploadPath()中带有upload导致文件搜索失败,所以去除 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String keyword = "/upload"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        int endIndex = ruoyiPath.indexOf(keyword); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (endIndex != -1) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            ruoyiPath = ruoyiPath.substring(0, (ruoyiPath.length()-7)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        String deletaPath = ruoyiPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        File file = new File(deletaPath); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (file.isFile() && file.exists()) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (!file.delete()){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                return AjaxResult.error(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        return AjaxResult.success(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     @Anonymous 
															 | 
															
															 | 
															
																     @Anonymous 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     @PostMapping("/uploadWithoutToken") 
															 | 
															
															 | 
															
																     @PostMapping("/uploadWithoutToken") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     public AjaxResult uploadWithoutToken(MultipartFile file) throws Exception 
															 | 
															
															 | 
															
																     public AjaxResult uploadWithoutToken(MultipartFile file) throws Exception 
															 |