优化业务校验失败普通请求跳转页面

dep_wangsr
RuoYi 6 years ago committed by Limy
parent bd45acf54d
commit f271017e49

@ -17,7 +17,5 @@
<a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a> <a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a>
</div> </div>
</div> </div>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
</body> </body>
</html> </html>

@ -18,7 +18,5 @@
<a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a> <a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a>
</div> </div>
</div> </div>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
</body> </body>
</html> </html>

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RuoYi - 403</title>
<link href="/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/css/animate.css" rel="stylesheet"/>
<link href="/css/style.css" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="middle-box text-center animated fadeInDown">
<h3 class="font-bold">操作异常!</h3>
<div class="error-desc">
[[${errorMessage}]]
</div>
</div>
</body>
</html>

@ -18,7 +18,5 @@
<a href="javascript:top.document.location.href='/'" class="btn btn-outline btn-primary btn-xs">返回主页</a> <a href="javascript:top.document.location.href='/'" class="btn btn-outline btn-primary btn-xs">返回主页</a>
</div> </div>
</div> </div>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
</body> </body>
</html> </html>

@ -77,11 +77,22 @@ public class GlobalExceptionHandler
* *
*/ */
@ExceptionHandler(BusinessException.class) @ExceptionHandler(BusinessException.class)
public AjaxResult businessException(BusinessException e) public Object businessException(HttpServletRequest request, BusinessException e)
{ {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
if (ServletUtils.isAjaxRequest(request))
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
else
{
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("errorMessage", e.getMessage());
modelAndView.setViewName("error/business");
return modelAndView;
}
}
/** /**
* *

Loading…
Cancel
Save