| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | |
| | | } |
| | | |
| | | @GetMapping("/downLoadFile") |
| | | public AjaxResult downLoadFile(@RequestParam("path") String path,HttpServletResponse response) throws Exception { |
| | | return downLoadFileService.downLoadFile(path,response); |
| | | public void downLoadFile(@PathParam("path") String path, HttpServletResponse response) throws Exception { |
| | | downLoadFileService.downLoadFile(path,response); |
| | | } |
| | | |
| | | |
| | |
| | | String url = serverConfig.getUrl() + fileName; |
| | | |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("url", url); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("newFileName", FileUtils.getName(fileName)); |
| | | ajax.put("originalFilename", file.getOriginalFilename()); |
| | | |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | data.put("url", url); |
| | | data.put("fileName", fileName); |
| | | data.put("newFileName", FileUtils.getName(fileName)); |
| | | data.put("originalFilename", file.getOriginalFilename()); |
| | | |
| | | ajax.put("msg","操作成功"); |
| | | ajax.put("data",data); |
| | | return ajax; |
| | | } |
| | | catch (Exception e) |