|
|
@ -101,21 +101,20 @@ public class CommonController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 上传文件路径
|
|
|
|
// 上传文件路径
|
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
|
String filePath = RuoYiConfig.getUploadPath();
|
|
|
|
String fileNames = "";
|
|
|
|
List<String> fileNames = new ArrayList<>();
|
|
|
|
String urls = "";
|
|
|
|
List<String> urls = new ArrayList<>();
|
|
|
|
for (MultipartFile file : files)
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// 上传并返回新文件名称
|
|
|
|
// 上传并返回新文件名称
|
|
|
|
String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
|
String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
|
String url = serverConfig.getUrl() + fileName;
|
|
|
|
String url = serverConfig.getUrl() + fileName;
|
|
|
|
fileNames += fileName + FILE_DELIMETER;
|
|
|
|
fileNames.add(fileName);
|
|
|
|
urls += url + FILE_DELIMETER;
|
|
|
|
urls.add(url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
|
ajax.put("fileNames", StringUtils.lastStringDel(fileNames, FILE_DELIMETER));
|
|
|
|
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
|
|
|
ajax.put("urls", StringUtils.lastStringDel(urls, FILE_DELIMETER));
|
|
|
|
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
|
|
|
return ajax;
|
|
|
|
return ajax;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
@ -152,4 +151,4 @@ public class CommonController
|
|
|
|
log.error("下载文件失败", e);
|
|
|
|
log.error("下载文件失败", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|