fixbug upload file
This commit is contained in:
@@ -147,27 +147,4 @@ public class AppVenueLessonController {
|
|||||||
}
|
}
|
||||||
return venueItems;
|
return venueItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询数据库
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/fetchFile/{fileUrl}", method = {RequestMethod.GET,RequestMethod.POST})
|
|
||||||
public void fetchFile(String fileUrl, HttpServletResponse response) throws IOException {
|
|
||||||
String findFile = url + healthDir + fileUrl;
|
|
||||||
InputStream inputStream = Request.Get(findFile).execute().returnContent().asStream();
|
|
||||||
ServletOutputStream servletOutputStream = response.getOutputStream();
|
|
||||||
if (inputStream != null && servletOutputStream != null) {
|
|
||||||
int temp = 0;
|
|
||||||
// 开始拷贝
|
|
||||||
while ((temp = inputStream.read()) != -1) {
|
|
||||||
// 边读边写
|
|
||||||
servletOutputStream.write(temp);
|
|
||||||
}
|
|
||||||
// 关闭输入输出流
|
|
||||||
inputStream.close();
|
|
||||||
servletOutputStream.flush();
|
|
||||||
servletOutputStream.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,10 +143,7 @@ public class OSSClientUtil {
|
|||||||
|
|
||||||
private String getUploadUrl(String fileName) {
|
private String getUploadUrl(String fileName) {
|
||||||
if (!StringUtils.isEmpty(fileName)) {
|
if (!StringUtils.isEmpty(fileName)) {
|
||||||
// String[] split = fileUrl.split("/");
|
return this.url + this.healthDir + fileName;
|
||||||
// return this.healthDir + split[split.length - 1];
|
|
||||||
String result = "https://api.hongyutiyu.top/fetchFile/" + fileName;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user