Procházet zdrojové kódy

프론트서비스 처음 로딩 시 전체카테고리리스트와 메타정보 가져오기에 따른 수정

gagamel před 5 roky
rodič
revize
71d3ba5c79

+ 25 - 30
src/main/java/com/style24/front/biz/web/TsfDisplayController.java

@@ -4,7 +4,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Locale;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -22,18 +21,14 @@ import com.style24.core.biz.service.TscEnvsetService;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfDisplayService;
 import com.style24.front.support.controller.TsfBaseController;
-import com.style24.front.support.env.TsfConstants;
+import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.domain.BrandGroup;
-import com.style24.persistence.domain.Cate1;
+import com.style24.persistence.domain.Cate4Srch;
 import com.style24.persistence.domain.Contents;
 import com.style24.persistence.domain.GnbTab;
-
-
-import com.style24.front.support.security.session.TsfSession;
-
-import com.style24.persistence.domain.MainLayout;
-import com.style24.persistence.domain.Cate4Srch;
 import com.style24.persistence.domain.GoodsSearch;
+import com.style24.persistence.domain.MainLayout;
+
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -66,9 +61,9 @@ public class TsfDisplayController extends TsfBaseController {
 	public ModelAndView mallMain(Device device, @RequestParam HashMap<String, String> paramMap) {
 		ModelAndView mav = new ModelAndView();
 		String mainCateNo = "";
-		if(device.isMobile() || "Y".equals(paramMap.get("mobileYn"))){
+		if (device.isMobile() || "Y".equals(paramMap.get("mobileYn"))) {
 			mainCateNo = "1720";
-		}else{
+		} else {
 			mainCateNo = "1700";
 		}
 		Collection<MainLayout> mainLayoutCollection = displayService.getMainLayout(mainCateNo);
@@ -76,10 +71,10 @@ public class TsfDisplayController extends TsfBaseController {
 		//mav.addObject("preview", paramMap.get("preview"));
 		//mav.addObject("viewDt", paramMap.get("viewDt"));
 		//mav.addObject("viewPage", "20");
-		for(MainLayout mainLayout : mainLayoutCollection){
+		for (MainLayout mainLayout : mainLayoutCollection) {
 			String contentsLoc = mainLayout.getContentsLoc();
 			Contents contents = new Contents();
-			log.info("mallMain contentsLoc:::{}",contentsLoc);
+			log.info("mallMain contentsLoc:::{}", contentsLoc);
 			contents.setContentsLoc(contentsLoc);
 			contents.setPreview(paramMap.get("preview"));
 			contents.setViewDt(paramMap.get("viewDt"));
@@ -90,10 +85,10 @@ public class TsfDisplayController extends TsfBaseController {
 			cate4Srch = displayService.getCate4srch(cate4Srch);
 			mainLayout.setCate4Srch(cate4Srch);
 
-			if("C".equals(mainLayout.getContentsYn())){
+			if ("C".equals(mainLayout.getContentsYn())) {
 				mainLayout.setContentsList(displayService.getContentsList(contents));
-			}else{
-				log.info("nullpoint contentsLoc::::{}",contentsLoc);
+			} else {
+				log.info("nullpoint contentsLoc::::{}", contentsLoc);
 				GoodsSearch goodsSearch = new GoodsSearch();
 				goodsSearch.setCateType("G031_20");
 				goodsSearch.setSoldoutGoodsDisplayYn("N");
@@ -102,11 +97,11 @@ public class TsfDisplayController extends TsfBaseController {
 				goodsSearch.setFrontGb(getSession().getFrontGb());
 				//int floorUnit = envsetService.getPayUnit(TscConstants.Site.STYLE24.value()); // 가격 원단위 관리
 				//goodsSearch.setFloorUnit(floorUnit);
-				if(TsfSession.getInfo() != null){
+				if (TsfSession.getInfo() != null) {
 					goodsSearch.setCustGb(TsfSession.getInfo().getCustGb());
 					goodsSearch.setCustNo(TsfSession.getInfo().getCustNo());
 					goodsSearch.setCustGrade(TsfSession.getInfo().getCustGrade());
-				}else{
+				} else {
 					goodsSearch.setCustGb("00");
 				}
 
@@ -119,7 +114,7 @@ public class TsfDisplayController extends TsfBaseController {
 			}
 			mainLayoutList.add(mainLayout);
 		}
-		log.info("mainLayoutList::{}",mainLayoutList);
+		log.info("mainLayoutList::{}", mainLayoutList);
 		mav.addObject("mainLayoutList", mainLayoutList);
 		mav.setViewName(super.getDeviceViewName("display/MallMainForm"));
 
@@ -141,17 +136,17 @@ public class TsfDisplayController extends TsfBaseController {
 		return displayService.getGnbBrandGroupList(contents);
 	}
 
-	/**
-	 * 전체 카테고리 목록
-	 * @return
-	 * @author gagamel
-	 * @since 2021. 3. 15
-	 */
-	@GetMapping("/all/cate/list")
-	@ResponseBody
-	public Collection<Cate1> getAllCategoryList() {
-		return displayService.getAllCategoryList(TsfConstants.CateGb.BYITEM.value());
-	}
+//	/**
+//	 * 전체 카테고리 목록
+//	 * @return
+//	 * @author gagamel
+//	 * @since 2021. 3. 15
+//	 */
+//	@GetMapping("/all/cate/list")
+//	@ResponseBody
+//	public Collection<Cate1> getAllCategoryList() {
+//		return displayService.getAllCategoryList(TsfConstants.CateGb.BYITEM.value());
+//	}
 
 	/**
 	 * GNB 탭 목록

+ 23 - 0
src/main/java/com/style24/front/support/controller/TsfBaseController.java

@@ -2,6 +2,7 @@ package com.style24.front.support.controller;
 
 import java.sql.SQLException;
 import java.sql.SQLRecoverableException;
+import java.util.Collection;
 import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
@@ -41,7 +42,10 @@ import com.fasterxml.jackson.databind.JsonMappingException;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.support.env.TsfConstants;
 import com.style24.front.support.security.session.TsfSession;
+import com.style24.front.support.startup.TsfEnvsetInfo;
+import com.style24.persistence.domain.Cate1;
 import com.style24.persistence.domain.Login;
+import com.style24.persistence.domain.Meta;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -116,6 +120,25 @@ public class TsfBaseController {
 		return TsfConstants.SNSLOGIN_PREFIX;
 	}
 
+	/**
+	 * 쇼핑몰 메타정보
+	 * @return
+	 */
+	@ModelAttribute("metaInfo")
+	public Meta getMetaInfo() {
+//		return TsfEnvsetInfo.getInstance().getMetaInfo();
+		return (new TsfEnvsetInfo()).getMetaInfo();
+	}
+
+	/**
+	 * 전체카테고리 목록
+	 * @return
+	 */
+	@ModelAttribute("allCateList")
+	public Collection<Cate1> getAllCateList() {
+		return (new TsfEnvsetInfo()).getAllCateList();
+	}
+
 	@ModelAttribute("osType")
 	public String getOsType() {
 		return TsfSession.getAttribute("osType");

+ 77 - 0
src/main/java/com/style24/front/support/startup/TsfEnvsetInfo.java

@@ -0,0 +1,77 @@
+package com.style24.front.support.startup;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.style24.core.biz.service.TscEnvsetService;
+import com.style24.core.support.env.TscConstants;
+import com.style24.front.biz.service.TsfDisplayService;
+import com.style24.front.support.env.TsfConstants;
+import com.style24.persistence.domain.Cate1;
+import com.style24.persistence.domain.Meta;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 각종 환경설정 정보 조회. 초기 로딩 시 가져옴
+ * 		1. 메타정보
+ * 		2. 카테고리정보
+ * @author gagamel
+ * @since 2021. 3. 19
+ */
+@Component
+@Slf4j
+public class TsfEnvsetInfo {
+
+	private static Meta meta = new Meta();
+	private static Collection<Cate1> allCateList = new ArrayList<>();
+
+	@Autowired
+	private TscEnvsetService envsetService;
+
+	@Autowired
+	private TsfDisplayService displayService;
+
+	@PostConstruct
+	public void init() {
+		meta = envsetService.getMetaInfo(TscConstants.Site.STYLE24.value());
+		log.info("\n\n---- Meta Info. ------------------------------------------");
+		log.info("meta: [{}]", meta);
+		log.info("\n------------------------------------------------------------\n");
+
+		allCateList = displayService.getAllCategoryList(TsfConstants.CateGb.BYITEM.value());
+		log.info("\n\n---- All Category List -----------------------------------");
+		log.info("allCateList: [{}]", allCateList);
+		log.info("\n------------------------------------------------------------\n");
+	}
+
+	/**
+	 * 쇼핑몰 메타정보
+	 * @return
+	 */
+	public Meta getMetaInfo() {
+		if (meta == null) {
+			meta = envsetService.getMetaInfo(TscConstants.Site.STYLE24.value());
+		}
+
+		return meta;
+	}
+
+	/**
+	 * 전체 카테고리 목록
+	 * @return
+	 */
+	public Collection<Cate1> getAllCateList() {
+		if (allCateList == null) {
+			allCateList = displayService.getAllCategoryList(TsfConstants.CateGb.BYITEM.value());
+		}
+
+		return allCateList;
+	}
+
+}

+ 59 - 9
src/main/webapp/WEB-INF/views/web/common/fragments/FooterWeb.html

@@ -724,8 +724,8 @@
 					<h3>스타일24 카테고리</h3>
 				</div>
 				<div class="quick_body">
-					<ul class="quick_cate_wrap">
-						<li><a href="javascript:;"><span>홈</span></a></li>
+					<ul class="quick_cate_wrap" id="ulQuickMenuCate">
+						<!-- <li><a href="javascript:;"><span>홈</span></a></li>
 						<li class="has_children">
 							<a href="javascript:;"><span>여성</span></a>
 							<ul class="quick_depth">
@@ -738,7 +738,7 @@
 								<li><a href="javascript:;"><span>트레이닝/스포츠</span></a></li>
 								<li><a href="javascript:;"><span>여성잡화</span></a></li>
 								<li><a href="javascript:;"><span>언더웨어</span></a></li>
-							</ul>   
+							</ul>
 						</li>
 						<li class="has_children">
 							<a href="javascript:;"><span>남성</span></a>
@@ -815,12 +815,13 @@
 							</ul>
 						</li>
 						<li><a href="/"><span>룩북</span></a></li>
-						<li><a href="/"><span>이벤트/혜택</span></a></li>
+						<li><a href="/"><span>이벤트/혜택</span></a></li> -->
 					</ul>
 					<div class="quick_cate_txt">
-						<a href="javascript:;">로그인</a>
-						<a href="javascript:;">회원가입</a>
-						<a href="javascript:;">마이페이지</a>
+						<a th:if="${sessionInfo == null}" href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_LOGIN);">로그인</a>
+						<a th:if="${sessionInfo != null}" href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_LOGOUT);">로그아웃</a>
+						<a th:if="${sessionInfo == null}" href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_CUSTOMER_JOIN_TYPE);">회원가입</a>
+						<a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MYPAGE);">마이페이지</a>
 					</div>
 				</div>
 			</div>
@@ -875,9 +876,58 @@
 				}
 		});
 	}
-		
-	/* familysite */
+	
+	// 퀵메뉴카테고리
+	let fnGetQuickMenuCategory = function(cate1) {
+		let tag = '';
+		if (cate1 != null) {
+			tag += '<li class="has_children">\n';
+			tag += '	<a href="javascript:;"><span>' + cate1.cate1Nm + '</span></a>\n';
+			if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
+				tag += '	<ul class="quick_depth">\n';
+				tag += '		<li><a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate1.cateGb + '\',\'' + cate1.cate1No + '\');"><span>메인</span></a>\n';
+				tag += '		<li><a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate1.cateGb + '\',\'' + cate1.cate1No + '\');"><span>전체</span></a>\n';
+				$.each(cate1.cate2List, function(idx2, cate2) {
+					tag += '		<li><a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate2.cateGb + '\',\'' + cate2.cate1No + '\',\'' + cate2.cate2No + '\');"><span>' + cate2.cate2Nm + '</span></a>\n';
+				});
+				tag += '	</ul>\n';
+			}
+			tag += '</li>\n';
+		}
+		return tag;
+	}
+	
+	// 퀵메뉴탭 생성
+	let fnCreateQuickMenuTab = function() {
+		$.getJSON('/display/gnb/tab/list'
+			, function(result, status) {
+				if (status == 'success') {
+					if (result.length > 0) {
+						$('#ulQuickMenuCate').html('');
+						$('#ulQuickMenuCate').append('<li><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);"><span>홈</span></a></li>\n');
+						
+						let allCate = [[${allCateList}]];
+						$.each(result, function(idx, item) {
+							if (item.contentsType == 'C' || item.contentsType == 'O') { // 컨텐츠유형:카테고리, 아울렛
+								$.each(allCate, function(allCateIdx, allCateItem) {
+									if (item.cate1No == allCateItem.cate1No) {
+										$('#ulQuickMenuCate').append(fnGetQuickMenuCategory(allCateItem));
+									}
+								});
+							} else if (item.contentsType == 'L') { // 컨텐츠유형:링크
+								$('#ulQuickMenuCate').append('<li><a href="' + item.linkUrl + '"><span>' + item.gtabNm + '</span></a></li>');
+							}
+						});
+					}
+				}
+			});
+	}
+	
 	$(document).ready( function() {
+		// 퀵메뉴탭 조회
+		fnCreateQuickMenuTab();
+		
+		// 패미리사이트 조회
 		fnGetFamilySite();
 		
 		// Family Site

+ 23 - 20
src/main/webapp/WEB-INF/views/web/common/fragments/GnbWeb.html

@@ -169,46 +169,46 @@
 	<script th:inline="javascript">
 		/*<![CDATA[*/
 		// 전체카테고리 조회
-		let allCate;
-		let fnGetAllCategory = function() {
-			$.getJSON('/display/all/cate/list'
-				, function(result, status) {
-					if (status == 'success') {
-						allCate = result;
+// 		let allCate;
+// 		let fnGetAllCategory = function() {
+// 			$.getJSON('/display/all/cate/list'
+// 				, function(result, status) {
+// 					if (status == 'success') {
+// 						allCate = result;
 						
-						// GNB탭 > 브랜드 생성
-						fnCreateGnbBrandGroup();
-					}
-			});
-		}
+// 						// GNB탭 > 브랜드 생성
+// 						fnCreateGnbBrandGroup();
+// 					}
+// 			});
+// 		}
 		
 		// GNB탭 > 카테고리
 		let fnGetGnbCategory = function(cate1) {
 			let tag = '';
 			if (cate1 != null) {
 				tag += '<li class="has_depth">\n'; //depth_menu 있을 시 has_depth 클래스 추가
-				tag += '	<a href="javascript:void(0);" onclick="cfnGoToCategory(' + cate1.cate1Nm + ');">' + cate1.cate1Nm + '</a>\n';
+				tag += '	<a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate1.cate1Gb + '\',\'' + cate1.cate1No + '\');">' + cate1.cate1Nm + '</a>\n';
 				tag += '	<div class="depth_menu category">\n';
 				tag += '		<div class="head_category">\n';
 				tag += '			<div class="tit">\n';
 				tag += '				<p>' + cate1.cate1Nm + '</p>\n';
-				tag += '				<a href="javascript:void(0);" onclick="cfnGoToCategory(' + cate1.cate1No + ');" class="more">전체보기</a>\n';
+				tag += '				<a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate1.cate1Gb + '\',\'' + cate1.cate1No + '\');" class="more">전체보기</a>\n';
 				tag += '			</div>\n';
 				if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
 					tag += '			<div class="menu">\n';
 					tag += '				<ul class="maintabs">\n';
 					$.each(cate1.cate2List, function(idx2, cate2) {
 						tag += '					<li>\n';
-						tag += '						<a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate2.cateGb + '\',\'' + cate2.cate1No + '\',\'' + cate2.cate2No + '\');">' + cate2.cate2Nm + '</a>\n';
+						tag += '						<a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate2.cateGb + '\',\'' + cate2.cate1No + '\',\'' + cate2.cate2No + '\');">' + cate2.cate2Nm + '</a>\n';
 						if (cate2.leafYn == 'N' && cate2.cate3List != null && cate2.cate3List.length > 0) {
 							tag += '						<ul class="box_depth2">\n';
 							$.each(cate2.cate3List, function(idx3, cate3) {
 								tag += '							<li>\n';
-								tag += '								<a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate3.cateGb + '\',\'' + cate3.cate1No + '\',\'' + cate3.cate2No + '\',\'' + cate3.cate3No + '\');">' + cate3.cate3Nm + '</a>\n';
+								tag += '								<a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate3.cateGb + '\',\'' + cate3.cate1No + '\',\'' + cate3.cate2No + '\',\'' + cate3.cate3No + '\');">' + cate3.cate3Nm + '</a>\n';
 								if (cate3.leafYn == 'N' && cate3.cate4List != null && cate3.cate4List.length > 0) {
 									tag += '								<ul class="box_depth3">\n';
 									$.each(cate3.cate4List, function(idx4, cate4) {
-										tag += '									<li><a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate4.cateGb + '\',\'' + cate4.cate1No + '\',\'' + cate4.cate2No + '\',\'' + cate4.cate3No + '\',\'' + cate4.cate4No + '\');">' + cate4.cate4Nm + '</a></li>\n';
+										tag += '									<li><a href="javascript:void(0);" onclick="cfnGoToItemMain(\'' + cate4.cateGb + '\',\'' + cate4.cate1No + '\',\'' + cate4.cate2No + '\',\'' + cate4.cate3No + '\',\'' + cate4.cate4No + '\');">' + cate4.cate4Nm + '</a></li>\n';
 									});
 									tag += '								</ul>\n';
 								}
@@ -264,9 +264,9 @@
 						if (result.length > 0) {
 							$('#divGnbTab').html('');
 							$('#ulGnbTab').html('');
+							
+							let allCate = [[${allCateList}]];
 							$.each(result, function(idx, item) {
-								//console.log(item);
-								
 								if (item.contentsType == 'C' || item.contentsType == 'O') { // 컨텐츠유형:카테고리, 아울렛
 									$.each(allCate, function(allCateIdx, allCateItem) {
 										if (item.cate1No == allCateItem.cate1No) {
@@ -390,8 +390,11 @@
 				},
 			});
 
-			// 전체 카테고리 조회
-			fnGetAllCategory();
+// 			// 전체 카테고리 조회
+// 			fnGetAllCategory();
+			
+			// GNB탭 > 브랜드 생성
+			fnCreateGnbBrandGroup();
 		});
 		/*]]>*/
 	</script>

+ 7 - 7
src/main/webapp/WEB-INF/views/web/common/fragments/HeadWeb.html

@@ -8,16 +8,16 @@
 <!-- 	<meta http-equiv="cache-control" content="no-cache"/> -->
 <!-- 	<meta http-equiv="expires" content="0"/> -->
 <!-- 	<meta http-equiv="pragma" content="no-cache"/> -->
-	<meta name="Title" th:content="${metaBrowserTitle}" content="한세공식몰 스타일24"/>
-	<meta name="description" th:content="${metaOgDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
-	<meta name="keywords" th:content="${metaKeywords}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	<meta name="Title" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
+	<meta name="description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	<meta name="keywords" th:content="${metaInfo.keywords}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta property="og:type" content="website"/>
-	<meta property="og:image" th:content="${metaOgImage}" content="/image/web/common/og_style24.png"/>
+	<meta property="og:image" th:content="${metaInfo.ogImage}" content="/image/web/common/og_style24.png"/>
 	<meta property="og:url" th:content="${@environment.getProperty('domain.front')}" content="http://www.style24.com"/>
-	<meta property="og:title" th:content="${metaBrowserTitle}" content="스타일24"/>
-	<meta property="og:description" th:content="${metaOgDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
+	<meta property="og:title" th:content="${metaInfo.browserTitle}" content="스타일24"/>
+	<meta property="og:description" th:content="${metaInfo.ogDesc}" content="한세공식몰,TBJ,FRJ,NBA,NBA KIDS,LPGA,PGATOUR,컬리수,모이몰른,MOIMOLN,리카앤,리바이스키즈,ANDEW,BUCKAROO,나이키키즈"/>
 	<meta property="og:locale" content="ko_KR"/>
-	<meta property="og:site_name" th:content="${metaBrowserTitle}" content="한세공식몰 스타일24"/>
+	<meta property="og:site_name" th:content="${metaInfo.browserTitle}" content="한세공식몰 스타일24"/>
 	
 	<!-- 추천솔루션 meta -->
 	<meta property="eg:cuid" content="" />