TASK: 全局异常优化;

This commit is contained in:
shahaibo
2023-10-31 14:07:43 +08:00
parent 68d28995b8
commit 44a30bf9b5
40 changed files with 517 additions and 211 deletions

View File

@@ -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))));
}