From b86bbfe97cc2b01f31a28a05d9d5171d11886664 Mon Sep 17 00:00:00 2001 From: KNKIM Date: Thu, 28 Oct 2021 13:52:31 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=83=81=EB=8B=A8=20:=20?= =?UTF-8?q?=EC=B9=B4=ED=8A=B8=20=EA=B1=B4=EC=88=98,=20=EC=95=8C=EB=A6=BC?= =?UTF-8?q?=20=EA=B1=B4=EC=88=98=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/nlib/cmm/web/MainController.java | 46 +++++++++++- src/main/webapp/WEB-INF/tiles/inc/header.jsp | 74 +------------------ .../webapp/WEB-INF/tiles/tiles-layout.xml | 14 ++++ 3 files changed, 57 insertions(+), 77 deletions(-) diff --git a/src/main/java/nlib/cmm/web/MainController.java b/src/main/java/nlib/cmm/web/MainController.java index ffaf7ad1..5639a214 100644 --- a/src/main/java/nlib/cmm/web/MainController.java +++ b/src/main/java/nlib/cmm/web/MainController.java @@ -14,7 +14,9 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import nlib.cmm.NlibCommonController; +import nlib.cmm.service.NlibProperty; import nlib.cmm.service.NotificationService; +import nlib.col.service.CartService; import nlib.user.service.NlibLoginVO; import nlib.util.StringUtil; @@ -48,6 +50,9 @@ public class MainController extends NlibCommonController { @Resource(name="notificationService") private NotificationService notificationService; + @Resource(name = "cartService") + private CartService cartService; + @RequestMapping( {"/index.do"} ) public String setContent( HttpServletRequest req, @@ -61,17 +66,50 @@ public class MainController extends NlibCommonController { log.debug((authentication == null ? "손님 메인 접속" : authentication.getName() + " 메인 접속")); + return "nlib/cmm/home"; + } + + @RequestMapping( {"/cmm/headerSubPart.do"} ) + public String headerSub( + HttpServletRequest request, + HttpServletResponse response, + Authentication authentication, + ModelMap model) throws Exception { + + // 캐쉬된 Reqeust 히스토리 삭제 + RequestCache cache = new HttpSessionRequestCache(); + cache.removeRequest(request, response); + + log.debug((authentication == null ? "손님 메인 접속" : authentication.getName() + " 메인 접속")); + + String mbInfoId = getMbInfoId(request); + + // 카트 건수 확인 + + // 카트 목록 가져오기 + int cartCnt = 0; + if(StringUtil.isEmpty(mbInfoId)) { + // 카트 건수 + cartCnt = cartService.countCartItemsFromCookie(request, response, "1"); + cartCnt += cartService.countCartItemsFromCookie(request, response, "2"); + } else { + cartCnt = cartService.countCartItems(mbInfoId, "0"); + } + // 알림 확인 - String mbInfoId = getMbInfoId(req); int unreadNotiCnt = 0; - if(!isAlerted(req) && StringUtil.isNotEmpty(mbInfoId)) { + if(StringUtil.isNotEmpty(mbInfoId)) { unreadNotiCnt = notificationService.countUnreadNotification(mbInfoId); - setAlerted(req, true); } + if(!isAlerted(request)) { + setAlerted(request, true); + } + + model.addAttribute("cartCnt", cartCnt); model.addAttribute("unreadNotiCnt", unreadNotiCnt); - return "nlib/cmm/home"; + return "nlib/cmm/headerSubPart"; } } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/tiles/inc/header.jsp b/src/main/webapp/WEB-INF/tiles/inc/header.jsp index b16e2851..52658613 100644 --- a/src/main/webapp/WEB-INF/tiles/inc/header.jsp +++ b/src/main/webapp/WEB-INF/tiles/inc/header.jsp @@ -5,76 +5,4 @@ <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> - -<% -String councilCd = (String)session.getAttribute("councilCd"); -String councilNm = (String)session.getAttribute("councilNm"); -%> - -

헤더영역

-
- -

소장자료관

- -
-

검색

-
-
- 검색 -
- - - - -
-
- -
-
-
-
- -
- -
-
- - \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/tiles/tiles-layout.xml b/src/main/webapp/WEB-INF/tiles/tiles-layout.xml index c0b0bb1a..aaa7d1b7 100644 --- a/src/main/webapp/WEB-INF/tiles/tiles-layout.xml +++ b/src/main/webapp/WEB-INF/tiles/tiles-layout.xml @@ -19,6 +19,20 @@ + + + + + + + + + + + + + +