Ver Fonte

Merge remote-tracking branch 'TSIT/ST24PRJ-651' into develop

card007 há 4 anos atrás
pai
commit
0f12479e46

+ 5 - 0
src/main/java/com/style24/front/biz/service/TsfDisplayService.java

@@ -301,6 +301,7 @@ public class TsfDisplayService {
 					cate1.setCate1No(cate4srch1.getCate1No());
 					cate1.setCate1Nm(cate4srch1.getCate1Nm());
 					cate1.setFormalGb(cate4srch1.getFormalGb());
+					cate1.setDispOrd(cate4srch1.getDispOrd());
 
 					Collection<Cate2> cate2List = new ArrayList<Cate2>();
 					for (Cate4Srch cate4srch2 : cateList) {
@@ -314,6 +315,7 @@ public class TsfDisplayService {
 								cate2.setCate2Nm(cate4srch2.getCate2Nm());
 								cate2.setCate1No(cate4srch2.getCate1No());
 								cate2.setFormalGb(cate4srch2.getFormalGb());
+								cate2.setDispOrd(cate4srch2.getDispOrd());
 
 								Collection<Cate3> cate3List = new ArrayList<Cate3>();
 								for (Cate4Srch cate4srch3 : cateList) {
@@ -328,6 +330,7 @@ public class TsfDisplayService {
 											cate3.setCate1No(cate4srch3.getCate1No());
 											cate3.setCate2No(cate4srch3.getCate2No());
 											cate3.setFormalGb(cate4srch3.getFormalGb());
+											cate3.setDispOrd(cate4srch3.getDispOrd());
 
 											Collection<Cate4> cate4List = new ArrayList<Cate4>();
 											for (Cate4Srch cate4srch4 : cateList) {
@@ -343,6 +346,7 @@ public class TsfDisplayService {
 														cate4.setCate2No(cate4srch4.getCate2No());
 														cate4.setCate3No(cate4srch4.getCate3No());
 														cate4.setFormalGb(cate4srch4.getFormalGb());
+														cate4.setDispOrd(cate4srch4.getDispOrd());
 
 														Collection<Cate5> cate5List = new ArrayList<Cate5>();
 														for (Cate4Srch cate4srch5 : cateList) {
@@ -359,6 +363,7 @@ public class TsfDisplayService {
 																	cate5.setCate3No(cate4srch5.getCate3No());
 																	cate5.setCate4No(cate4srch5.getCate4No());
 																	cate5.setFormalGb(cate4srch5.getFormalGb());
+																	cate5.setDispOrd(cate4srch5.getDispOrd());
 																	cate5.setLeafYn("Y");
 																	cate5List.add(cate5);
 																}

+ 112 - 2
src/main/java/com/style24/front/biz/web/TsfDisplayController.java

@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
 import com.gagaframework.web.parameter.GagaMap;
 import com.gagaframework.web.util.GagaCookieUtil;
 import com.style24.core.biz.service.TscEnvsetService;
@@ -41,7 +43,11 @@ import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.BrandGroup;
 import com.style24.persistence.domain.Cate1;
+import com.style24.persistence.domain.Cate2;
+import com.style24.persistence.domain.Cate3;
+import com.style24.persistence.domain.Cate4;
 import com.style24.persistence.domain.Cate4Srch;
+import com.style24.persistence.domain.Cate5;
 import com.style24.persistence.domain.Contents;
 import com.style24.persistence.domain.GnbTab;
 import com.style24.persistence.domain.Goods;
@@ -836,7 +842,9 @@ public class TsfDisplayController extends TsfBaseController {
 		cate1.setSiteCd(TscConstants.Site.STYLE24.value());
 		cate1.setCateGb("G032_101");
 		cate1.setCate1No(params.getCate1No());
-		mav.addObject("cateList", diquest.getCategoryList(cate1));
+		Collection<Cate1> diquestCateList = getSortCategoryList(cate1);
+		mav.addObject("cateList", diquestCateList);
+		
 		if (params.getBrandGroupNo() != null && params.getBrandGroupNo() > 0) {
 			cate1.setCate1No(null);
 			mav.addObject("brandCateList", diquest.getCategoryList(cate1));
@@ -1566,7 +1574,9 @@ public class TsfDisplayController extends TsfBaseController {
 		cate1.setCateGb("G032_101");
 //		cate1.setCate1No(params.getCate1No());
 
-		return diquest.getCategoryList(cate1);
+		Collection<Cate1> diquestCateList = getSortCategoryList(cate1);
+		//return diquest.getCategoryList(cate1);
+		return diquestCateList;
 	}
 
 	/**
@@ -1620,4 +1630,104 @@ public class TsfDisplayController extends TsfBaseController {
 
 		return mav;
 	}
+	
+	/**
+	 * 검색어 연관 상품 추천 목록
+	 * @return
+	 * @author jmh
+	 * @since 2021. 12. 16
+	 */
+	public Collection<Cate1> getSortCategoryList(SearchEngine cate1) {
+		
+		Collection<Cate1> diquestCateList = diquest.getCategoryList(cate1);
+		Collection<Cate1> dbCateList = displayService.getAllCategoryList(TsfConstants.CateGb.BYITEM.value());// envsetInfo.getAllCateList();
+		
+		// 21.12.16 메뉴 노출 순서 정렬요청 (검색엔진에 order by로 정렬해서 내려달라고 했으나, 추가 개발건이라고 유지보수로 해줄 수 없다고 함.) 
+		ObjectMapper mapper = new ObjectMapper();
+		Collection<Cate1> dbList =  mapper.convertValue(dbCateList, TypeFactory.defaultInstance().constructCollectionType(Collection.class, Cate1.class));
+		Collection<Cate1> sortCate1List = new ArrayList<Cate1>();
+		Collection<Cate2> sortCate2List = new ArrayList<Cate2>();
+		Collection<Cate3> sortCate3List = new ArrayList<Cate3>();
+		Collection<Cate4> sortCate4List = new ArrayList<Cate4>();
+		Collection<Cate5> sortCate5List = new ArrayList<Cate5>();
+		
+		for(Cate1 dbCate1 : dbList) {
+			for( Cate1 diqCate1 : diquestCateList ) {
+				if(dbCate1.getCate1No().equals(diqCate1.getCate1No())) {
+					
+					// Cate2 정렬 시작
+					sortCate2List = new ArrayList<Cate2>();
+					if( null != dbCate1.getCate2List() && null != diqCate1.getCate2List()) {
+						for( Cate2 dbCate2 : dbCate1.getCate2List()) {
+							for( Cate2 diqCate2 : diqCate1.getCate2List()) {
+								if( dbCate2.getCate2No().equals(diqCate2.getCate2No())) {
+									
+									// Cate3 정렬 시작
+									sortCate3List = new ArrayList<Cate3>();
+									if( null != dbCate2.getCate3List() && null != diqCate2.getCate3List()) {
+										for( Cate3 dbCate3 : dbCate2.getCate3List()) {
+											for( Cate3 diqCate3 : diqCate2.getCate3List()) {
+												if( dbCate3.getCate3No().equals(diqCate3.getCate3No())) {
+													
+													
+													// Cate4 정렬 시작
+													sortCate4List = new ArrayList<Cate4>();
+													if( null != dbCate3.getCate4List() && null != diqCate3.getCate4List()) {
+														for( Cate4 dbCate4 : dbCate3.getCate4List()) {
+															for( Cate4 diqCate4 : diqCate3.getCate4List()) {
+																if( dbCate4.getCate4No().equals(diqCate4.getCate4No())) {
+																	
+																	// Cate5 정렬 시작
+																	sortCate5List = new ArrayList<Cate5>();
+																	if( null != dbCate4.getCate5List() && null != diqCate4.getCate5List()) {
+																		for( Cate5 dbCate5 : dbCate4.getCate5List()) {
+																			for( Cate5 diqCate5 : diqCate4.getCate5List()) {
+																				if( dbCate5.getCate4No().equals(diqCate5.getCate4No())) {
+																					sortCate5List.add(diqCate5);
+																					break;
+																				}
+																			}
+																		}
+																	}
+																	
+																	// Cate3 정렬
+																	diqCate4.setCate5List(sortCate5List);
+																	
+																	sortCate4List.add(diqCate4);
+																	break;
+																}
+															}
+														}
+													}
+													
+													// Cate3 정렬
+													diqCate3.setCate4List(sortCate4List);
+													
+													sortCate3List.add(diqCate3);
+													break;
+												}
+											}
+										}
+									}
+									// Cate3 정렬
+									diqCate2.setCate3List(sortCate3List);
+									
+									sortCate2List.add(diqCate2);
+									break;
+								}
+							}
+						}
+					}
+					// Cate2 정렬
+					diqCate1.setCate2List(sortCate2List);
+					
+					// Cate1 정렬
+					sortCate1List.add(diqCate1);
+					break;
+				}
+			}
+		}
+		
+		return sortCate1List;
+	}
 }