提交 cc4932d6 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 ac7207be
......@@ -235,8 +235,10 @@ public class FileController {
@ApiOperation(value = "获取epub文件地址")
@RequestMapping(value = "/getFilePathSL", method = RequestMethod.GET)
public CallBack<String> downLoad(String fileName) throws Exception {
public CallBack<String> downLoadsl(String fileName , HttpServletRequest request, HttpServletResponse response, boolean isOnLine) throws Exception {
String filePath = null;
File realFile;
String epubFilePath="";
if (StringUtils.isNotBlank(fileName)) {
FileInfo entity = new FileInfo();
entity.setFileName(fileName);
......@@ -255,6 +257,22 @@ public class FileController {
}
}
File f = new File(filePath);
realFile=f;
if (!f.exists()) {
File ef = new File(epubFilePath);
realFile=ef;
if(!ef.exists()) {
throw new BaseException("没有找到该文件!");
}
}
response.reset(); // 非常重要
if (isOnLine) { // 在线打开方式
DownloadUtil.startOpen(response, realFile);
} else { // 纯下载方式
DownloadUtil.start(response, realFile, fileName);
}
return CallBack.success(filePath);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论