Commit 431c4124 authored by liqin's avatar liqin 💬

bug fixed

parent 085f1561
......@@ -202,8 +202,8 @@ public class FileUploadController extends BaseController {
@RequiresAuthentication //@RequiresPermissions("file:image:upload")
@ApiOperation(value = "单图片上传(封面/缩略图)", notes = "单图片上传(封面/缩略图)")
public Map<String, Object> uploadImage(@RequestParam(value = "file") MultipartFile uploadFile) throws Exception {
if (uploadFile == null || uploadFile.getSize() == 0L) {
throw new InterfaceException(RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode(), "没有文件可供上传");
if (uploadFile == null) {
return getFailResult("没有文件可供上传");
}
String fileName = uploadFile.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName);
......@@ -231,8 +231,8 @@ public class FileUploadController extends BaseController {
@RequiresAuthentication //@RequiresPermissions("file:upload:allType")
@ApiOperation(value = "单文件上传(不限格式)", notes = "单文件上传(不限格式)")
public Map<String, Object> uploadAllType(@RequestParam(value = "file") MultipartFile uploadFile) throws Exception {
if (uploadFile == null || uploadFile.getSize() == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode(), "没有文件可供上传");
if (uploadFile == null) {
return getFailResult("没有文件可供上传");
}
String fileName = uploadFile.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName);
......@@ -258,7 +258,7 @@ public class FileUploadController extends BaseController {
@ApiOperation(value = "多音频上传", notes = "多音频上传")
public Map<String, Object> uploadAudio(@RequestPart(value = "file", required = false) MultipartFile[] files) throws IOException {
if (files == null || files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode(), "没有文件可供上传");
return getFailResult("没有文件可供上传");
}
final boolean existChineseAudio = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语"));
if (!existChineseAudio) {
......@@ -370,7 +370,7 @@ public class FileUploadController extends BaseController {
@ApiOperation(value = "展板视频上传", notes = "展板视频上传")
public Map<String, Object> uploadContentVideo(@RequestPart("file") MultipartFile[] files) throws Exception {
if (files == null || files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode(), "没有文件可供上传");
return getFailResult("没有文件可供上传");
}
final boolean matchChinese = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语"));
if (!matchChinese) {
......@@ -499,7 +499,7 @@ public class FileUploadController extends BaseController {
@ApiOperation(value = "多视频上传", notes = "多视频上传")
public Map<String, Object> uploadVideo(@RequestPart("file") MultipartFile[] files) throws IOException {
if (files == null || files.length == 0) {
throw new InterfaceException(RESPONSE_CODE_ENUM.SERVER_ERROR.getResultCode(), "没有文件可供上传");
return getFailResult("没有文件可供上传");
}
int successCount = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment