TASK: 全局异常优化;
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
@@ -53,7 +54,9 @@ public class ElementController {
|
||||
@RequestParam(value = "level1Type") String level1Type,
|
||||
@ApiParam("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
@RequestParam(value = "timeZone") String timeZone) {
|
||||
Assert.isTrue(!StringUtils.isEmpty(file.getOriginalFilename()), "Please select a file!");
|
||||
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
return Response.success(collectionElementService.upload(
|
||||
new CollectionElementUploadDTO(file, level1Type, timeZone, MD5Utils.encryptFile(file))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user