Commit 24f58e2a by zhiwj

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-enterprise-base into developer
parents 19787365 a2423d57
......@@ -24,9 +24,10 @@ import com.gic.enterprise.error.ErrorCode;
* 全局异常处理类
*
* @author hua
*/
*
@ControllerAdvice
@ResponseBody
*/
public class GlobalExceptionHandler {
private static Logger logger = LogManager.getLogger(GlobalExceptionHandler.class);
......
......@@ -88,6 +88,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
return true;
}
if (userDetail == null || userDetail.getUserInfo() == null) {
response.setStatus(6666);
response.sendError(6666, "登录信息不存在,请登录");
throw new CommonException(ErrorCode.LOGIN_INVALID.getErrorCode(), "登录信息不存在,请登录");
}
request.setAttribute("user", userDetail);
......@@ -109,6 +111,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//判断是否有权限
Map<String, Object> menuUrlMap = userDetail.getMenuUrlMap();
if (menuUrlMap == null || menuUrlMap.isEmpty()) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
}
......@@ -116,12 +120,16 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//说明是操作项
//如果匹配上了,说明是没权限
if (menuUrlMap.containsKey(uri)) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
}
} else {
//说明是页面
//如果没有匹配上,说明没权限
if (!menuUrlMap.containsKey(uri)) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
}
}
......
......@@ -4,16 +4,29 @@
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:interceptors>
<bean class="com.gic.enterprise.interceptor.RequestInteceptor"></bean>
<bean class="com.gic.commons.interceptor.HeaderTagInterceptor"/>
<bean class="com.gic.enterprise.interceptor.AuthInterceptor"></bean>
<bean class="com.gic.commons.interceptor.HeaderSignInterceptor"></bean>
<bean class="com.gic.commons.interceptor.HeaderTagInterceptor"/>
<mvc:interceptor>
<!-- 拦截所有的请求,这个必须写在前面,也就是写在【不拦截】的上面 -->
<mvc:mapping path="/**" />
<!-- 但是排除下面这些,也就是不拦截请求 -->
<mvc:exclude-mapping path="/login" />
<mvc:exclude-mapping path="/logout" />
<mvc:exclude-mapping path="/list-enterprise-by-phone" />
<mvc:exclude-mapping path="/login-user-menu" />
<mvc:exclude-mapping path="/login-user-operation-item" />
<mvc:exclude-mapping path="/get-login-user-info" />
<mvc:exclude-mapping path="/login-for-operation" />
<bean class="com.gic.commons.interceptor.HeaderSignInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>
</beans>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment