完善代码信息
This commit is contained in:
parent
ac9a7c8840
commit
aebf765b42
@ -40,7 +40,7 @@ public class FileController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadFileMore")
|
||||
public String uploadFileMore(MultipartFile[] files){
|
||||
public String uploadFileMore(MultipartFile[] files) throws Exception {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
if (null == files || files.length == 0){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale);
|
||||
@ -52,9 +52,11 @@ public class FileController {
|
||||
if(m == false){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale);
|
||||
}
|
||||
File file1 = fileFastDfs.multipartFileToFile(file);
|
||||
String dir = "fire_point";
|
||||
String info = fileFastDfs.uploadFile(file, dir);
|
||||
String info = fileFastDfs.uploadFile(file1, dir);
|
||||
Map<String, String> map = getUploadInfo(info);
|
||||
file1.delete();
|
||||
FilePath filePath = new FilePath();
|
||||
filePath.setFilePath(map.get("path"));
|
||||
filePath.setFileName(map.get("fileName"));
|
||||
@ -75,7 +77,7 @@ public class FileController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadFile")
|
||||
public String uploadFile(MultipartFile file){
|
||||
public String uploadFile(MultipartFile file) throws Exception {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
if (null == file){
|
||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_NULL, "result or fileType is null", locale);
|
||||
@ -84,9 +86,11 @@ public class FileController {
|
||||
if(m == false){
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "图片大小不能超过100M", locale);
|
||||
}
|
||||
File file1 = fileFastDfs.multipartFileToFile(file);
|
||||
String dir = "fire_point";
|
||||
String info = fileFastDfs.uploadFile(file, dir);
|
||||
String info = fileFastDfs.uploadFile(file1, dir);
|
||||
Map<String, String> map = getUploadInfo(info);
|
||||
file1.delete();
|
||||
FilePath filePath = new FilePath();
|
||||
filePath.setFilePath(map.get("path"));
|
||||
filePath.setFileName(map.get("fileName"));
|
||||
|
Loading…
Reference in New Issue
Block a user