feat: expand EasyCode software factory workflows

This commit is contained in:
王鹏
2026-07-15 12:48:50 +08:00
parent fcfa4374d7
commit 79dea897bc
1108 changed files with 163774 additions and 21593 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
@@ -90,6 +91,22 @@ public class GlobalExceptionHandler
return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), value));
}
/**
* 上传文件大小超限
*/
@ExceptionHandler(MaxUploadSizeExceededException.class)
public AjaxResult handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e, HttpServletRequest request)
{
String requestURI = request.getRequestURI();
log.warn("请求地址'{}',上传文件大小超出限制'{}'", requestURI, e.getMessage());
long maxUploadSize = e.getMaxUploadSize();
if (maxUploadSize > 0)
{
return AjaxResult.error(String.format("上传文件大小不能超过 %s", formatFileSize(maxUploadSize)));
}
return AjaxResult.error("上传文件大小超出限制");
}
/**
* 拦截未知的运行时异常
*/
@@ -142,4 +159,14 @@ public class GlobalExceptionHandler
{
return AjaxResult.error("演示模式,不允许操作");
}
private String formatFileSize(long bytes)
{
long mb = 1024L * 1024L;
if (bytes % mb == 0)
{
return (bytes / mb) + "MB";
}
return bytes + "B";
}
}