1. @Configuration
    2. public class SessionCheckInterceptor implements HandlerInterceptor {
    3. @Override
    4. public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
    5. throws Exception {
    6. HttpSession httpSession = request.getSession();
    7. if(httpSession.getAttribute(Constant.SESSION_DEPT_SPACE_CODE)==null) {
    8. httpSession.setAttribute(Constant.SESSION_DEPT_SPACE_RELATION_DEPT_CODE, Constant.NO_RELATION_DEPT_CODE);
    9. httpSession.setAttribute(Constant.SESSION_DEPT_SPACE_CODE, Constant.NO_DEPT_SPACE_CODE);
    10. }
    11. // if(httpSession.getAttribute(Constant.SESSION_DGDPS_ROLE_TYPE)==null) {
    12. // httpSession.setAttribute(Constant.SESSION_DGDPS_ROLE_TYPE, DgdpsportalConstant.DGDPS_ROLE_TYPE_OTHER);
    13. // }
    14. return true;
    15. }
    16. }

    springmvc中会调用
    D55C34FD-9DDB-4671-B2CD-DAAEA2472694.png