fix: 로그인 요청인 경우만 메뉴목록과 공지사항 조회 하도록 변경

main
Jonguk. Lim 2 years ago
parent f5338ecbc2
commit a3c9d7fa43

@ -2,6 +2,7 @@ package kr.xit.framework.core.interceptor;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -23,14 +24,19 @@ import kr.xit.framework.support.util.constants.MessageKey;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
* * <pre>
* @: Interceptor * @: Interceptor
* @: . * @: .
* @: 2020. 3. 24. 4:33:06 * @: 2020. 3. 24. 4:33:06
* @: * @:
* @
*
* , return
* return
* @author () * @author ()
* @since 2002. 2. 2. * @since 2002. 2. 2.
* @version 1.0 Copyright(c) XIT All rights reserved. * @version 1.0 Copyright(c) XIT All rights reserved.
* </pre>
*/ */
@Slf4j @Slf4j
@Service @Service
@ -44,25 +50,17 @@ public class MenuIntercepter extends HandlerInterceptorAdapter {
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Override @Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mv) throws Exception public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mv) throws Exception {
{
if(mv==null) //return page가 없으면 stop if(mv == null) return;
return;
log.debug("MenuIntercepter interceptor START !!");
/**
*
*/
//타일즈 적용 여부 //타일즈 적용 여부
String viewName = mv.getViewName(); String viewName = mv.getViewName();
boolean isTiles = (viewName.endsWith(TILES_TYPE.NONE.getVal())||viewName.endsWith(TILES_TYPE.POPUP.getVal())||viewName.endsWith(TILES_TYPE.FIMS_POPUP.getVal()))? false: true; boolean isTiles = (viewName.endsWith(TILES_TYPE.NONE.getVal())||viewName.endsWith(TILES_TYPE.POPUP.getVal())||viewName.endsWith(TILES_TYPE.FIMS_POPUP.getVal()))? false: true;
//사용자의 인증 여부 확인 //사용자의 인증 여부 확인
boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
String reqPath = request.getRequestURI();//.split("\\.")[0];
/** /**
* *
*/ */
@ -82,68 +80,33 @@ public class MenuIntercepter extends HandlerInterceptorAdapter {
//익명사용자 메뉴 목록 조회 //익명사용자 메뉴 목록 조회
allMenuList = CacheServiceUtils.findMenuListByAuthorCode("ROLE_ANONYMOUS"); allMenuList = CacheServiceUtils.findMenuListByAuthorCode("ROLE_ANONYMOUS");
} }
// main page만 메뉴목록 / 공지사항 조회
//요청페이지 URL GET if(reqPath.contains("/framework/biz/cmm/mainPage")) {
String url = request.getRequestURI(); mv.addObject("allMenuList", allMenuList);
// String[] arrUrl = url.split("/");
// String[] jobUrl = arrUrl[arrUrl.length-1].split("_"); // XitRollingNotiVO notiVO = xitRollingNotiVO;
// String jobSort = jobUrl[0]; // if(XitCmmnUtil.notEmpty(notiVO.getBbsId())) { //BBS_ID 값이 없으면 롤링 미사용으로 간주(globals.properties의 Globals.Xit.RollingNotiBbsId 에서 설정 가능)
// String chkUrl = "/"; // notiVO.setList(xitFrameUnitService.findLatestBbsList(false));
// for(int i=1; i < arrUrl.length-1; i++) { // mv.addObject("rollingNotiList", notiVO.getList());
// chkUrl += arrUrl[i] + "/"; // }
// } mv.addObject("rollingNotiList", CacheServiceUtils.findLatestBbsList());
// chkUrl += jobSort; }
// if(chkUrlAddLength.containsKey(chkUrl)) {
// int addLength = chkUrlAddLength.get(chkUrl);
// for(int i=1; i<=addLength; i++)
// chkUrl += "_"+jobUrl[i];
// }
// //요청페이지 URL에서 ContextPath 제거
// String contextPath = request.getContextPath();
// if(!"/".equals(contextPath))
// chkUrl = chkUrl.substring(contextPath.length());
//요청페이지 정보 Setting //요청페이지 정보 Setting
for(int i=0; i < allMenuList.size(); i++) { for(int i=0; i < allMenuList.size(); i++) {
Map<String, String> mUrlInfo = allMenuList.get(i); Map<String, String> mUrlInfo = allMenuList.get(i);
// if (mUrlInfo.get("menuUrl").toString().contains(chkUrl)) {
if (Checks.isNotEmpty(mUrlInfo.get("menuUrl")) && mUrlInfo.get("menuUrl").toString().contains(url)) { if (Checks.isNotEmpty(mUrlInfo.get("menuUrl")) && mUrlInfo.get("menuUrl").toString().contains(reqPath)) {
log.info("RequestURL Matched OK !!");
String[] arrPath = mUrlInfo.get("menuPath").toString().split("_"); String[] arrPath = mUrlInfo.get("menuPath").toString().split("_");
mUrlInfo.put("secondMenu", arrPath[1]); mUrlInfo.put("secondMenu", arrPath[1]);
mv.addObject("urlInfoMap", mUrlInfo); mv.addObject("urlInfoMap", mUrlInfo);
break; break;
} }
} }
mv.addObject("allMenuList", allMenuList);
/**
* Rolling
*/
// XitRollingNotiVO notiVO = xitRollingNotiVO;
// if(XitCmmnUtil.notEmpty(notiVO.getBbsId())) { //BBS_ID 값이 없으면 롤링 미사용으로 간주(globals.properties의 Globals.Xit.RollingNotiBbsId 에서 설정 가능)
// notiVO.setList(xitFrameUnitService.findLatestBbsList(false));
// mv.addObject("rollingNotiList", notiVO.getList());
// }
mv.addObject("rollingNotiList", CacheServiceUtils.findLatestBbsList());
} }
log.debug("MenuIntercepter interceptor COMPLETE !!");
} }
//@Resource
//private XitRollingNotiVO xitRollingNotiVO;
public Map<String, Integer> getChkUrlAddLength() { public Map<String, Integer> getChkUrlAddLength() {
return chkUrlAddLength; return chkUrlAddLength;
} }

Loading…
Cancel
Save