| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | String filePath = RuoYiConfig.getUploadPath(); |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | |
| | | //因为serverConfig.getUrl()拿到的端口号,不是tomcat的端口号,这里需要转一下 |
| | | String url1 = serverConfig.getUrl(); |
| | | url1 = url1.substring(0, url1.lastIndexOf(":")) + ":" + tomcatPort; |
| | | log.info("url1的值:{} ,port的值:{}", url1, tomcatPort); |
| | | String url = url1 + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("url", url); |