|
|
@ -64,16 +64,20 @@ public class CommonController |
|
|
|
String uploadType = JianweiConfig.getUploadType(); |
|
|
|
if (uploadType.equals("disk")) { |
|
|
|
// 本地资源路径
|
|
|
|
String localPath = JianweiConfig.getProfile(); |
|
|
|
// 数据库资源地址
|
|
|
|
String downloadPath = localPath + StringUtils.substringAfter(fileName, Constants.RESOURCE_PREFIX); |
|
|
|
// 下载名称
|
|
|
|
String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); |
|
|
|
// String localPath = JianweiConfig.getProfile();
|
|
|
|
// // 数据库资源地址
|
|
|
|
// String downloadPath = localPath + StringUtils.substringAfter(fileName, Constants.RESOURCE_PREFIX);
|
|
|
|
|
|
|
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
|
|
|
String filePath = JianweiConfig.getDownloadPath() + fileName; |
|
|
|
|
|
|
|
// // 下载名称
|
|
|
|
// String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
response.setContentType("multipart/form-data"); |
|
|
|
response.setHeader("Content-Disposition", |
|
|
|
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); |
|
|
|
FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
|
|
|
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); |
|
|
|
FileUtils.writeBytes(filePath, response.getOutputStream()); |
|
|
|
} else { |
|
|
|
|
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|