1. 调整文件上传大小限制

topo_dev
xueqingkun 9 months ago
parent 232667bf43
commit 5a8b2ff0f5

@ -36,6 +36,7 @@ public enum ResultStatusEnum {
ILLEGAL_ARGUMENT(508, "参数校验失败!"),
RUNTIME_EXCEPTION(509, "程序运行异常!"),
EXCEED_FILE_SIZE(510, "文件大小超出限制!"),
IMPORT_COMPANY_FORMAT_ERROR(521,"Excel表格格式错误"),
IMPORT_COMPANY_FAIL(522,"部分数据导入失败"),
INSERT_FAIL(600,"新增失败"),

@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
/**
*
@ -39,4 +40,12 @@ public class ExceptionHandlerConfig {
log.error("<<<=========运行异常=========");
return R.fail(ResultStatusEnum.RUNTIME_EXCEPTION,exception.getMessage());
}
@ExceptionHandler(MaxUploadSizeExceededException.class)
public R<?> handleMaxSizeException(MaxUploadSizeExceededException exception) {
log.error("=========文件大小超出限制异常=========>>>");
log.error(exception.getMessage(), exception);
log.error("<<<=========文件大小超出限制异常=========");
return R.fail(ResultStatusEnum.EXCEED_FILE_SIZE,exception.getMessage());
}
}

@ -4,6 +4,10 @@ spring:
main:
allow-bean-definition-overriding: true
allow-circular-references: true
servlet:
multipart:
max-file-size: 10MB
max-request-size: 200MB
mvc:
path match:
matching-strategy: ANT_PATH_MATCHER

Loading…
Cancel
Save