Przeglądaj źródła

아이겐 추천솔루션 로직 추가

gagamel 4 lat temu
rodzic
commit
ab0b9f61dc

+ 13 - 6
src/main/java/com/style24/front/biz/thirdparty/EigeneaiApi.java

@@ -16,6 +16,7 @@ import org.springframework.web.client.RestTemplate;
 
 import com.google.gson.Gson;
 import com.style24.persistence.domain.eigene.Eigeneai;
+import com.style24.persistence.domain.eigene.Eigeneai.Result;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -46,12 +47,13 @@ public class EigeneaiApi {
 	/**
 	 * 주간베스트추천상품 목록
 	 * @param size - 결과에 포함할 상품수
+	 * @param cate1No - 카테고리1번호
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getWeeklyBestGoodsList(int size) {
-		String requestUrl = apiUrl + "/m008?cuid=" + cuid + "&size=" + size;
+	public Eigeneai getWeeklyBestGoodsList(int size, Integer cate1No) {
+		String requestUrl = apiUrl + "/m060?cuid=" + cuid + "&size=" + size + "&incids=" + cate1No;
 		return this.getRecommendationGoodsList(requestUrl);
 	}
 
@@ -75,10 +77,15 @@ public class EigeneaiApi {
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getMonthlyClickBestGoodsList(int size) {
-		// TODO: 아이겐 미개발
-		String requestUrl = apiUrl + "/m008?cuid=" + cuid + "&cids=" + "" + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
+	public Collection<Result> getMonthlyClickBestGoodsList(int size, Integer brandGroupNo) {
+		String requestUrl = apiUrl + "/m062?cuid=" + cuid + "&cids=" + "" + "&size=" + size + "&bids=" + brandGroupNo;
+
+		Eigeneai eigeneai = this.getRecommendationGoodsList(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
 	}
 
 	/**

+ 51 - 34
src/main/java/com/style24/front/biz/web/TsfDisplayController.java

@@ -9,8 +9,6 @@ import java.util.HashMap;
 
 import javax.servlet.http.HttpServletResponse;
 
-import com.style24.persistence.domain.searchengine.PlanningResponse;
-import com.style24.persistence.domain.searchengine.AutoCompleteResponse;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.mobile.device.Device;
@@ -32,6 +30,7 @@ import com.style24.front.biz.service.TsfDisplayService;
 import com.style24.front.biz.service.TsfGoodsService;
 import com.style24.front.biz.service.TsfPlanningService;
 import com.style24.front.biz.service.TsfSocialService;
+import com.style24.front.biz.thirdparty.EigeneaiApi;
 import com.style24.front.biz.thirdparty.SearchEngineDiquest;
 import com.style24.front.support.controller.TsfBaseController;
 import com.style24.front.support.env.TsfConstants;
@@ -49,8 +48,11 @@ import com.style24.persistence.domain.MainLayout;
 import com.style24.persistence.domain.Plan;
 import com.style24.persistence.domain.Popup;
 import com.style24.persistence.domain.Social;
+import com.style24.persistence.domain.eigene.Eigeneai.Result;
+import com.style24.persistence.domain.searchengine.AutoCompleteResponse;
 import com.style24.persistence.domain.searchengine.Filter;
 import com.style24.persistence.domain.searchengine.GoodsListResponse;
+import com.style24.persistence.domain.searchengine.PlanningResponse;
 import com.style24.persistence.domain.searchengine.SearchEngine;
 
 import lombok.extern.slf4j.Slf4j;
@@ -96,6 +98,9 @@ public class TsfDisplayController extends TsfBaseController {
 	@Autowired
 	private TsfCommonService commonService;
 
+	@Autowired
+	private EigeneaiApi eigeneaiApi;
+
 	/**
 	 * PC보기. 모바일에서 <PC> 형태로 볼 때
 	 * @return
@@ -162,7 +167,7 @@ public class TsfDisplayController extends TsfBaseController {
 			if (contentsLoc.equals("SGNB001") || contentsLoc.equals("SGNB002") || contentsLoc.equals("STAB001") || contentsLoc.equals("SMM003") || contentsLoc.equals("SMM004") || contentsLoc.equals("SMM006")) {
 				contents.setMaxRow(1);
 			}
-			if(contentsLoc.equals("SMM011")){
+			if (contentsLoc.equals("SMM011")) {
 				contents.setMaxRow(5);
 			}
 
@@ -207,13 +212,13 @@ public class TsfDisplayController extends TsfBaseController {
 			}
 
 			if (contentsLoc.equals("SMM009") || contentsLoc.equals("SMM012")) {
-				if(contentsLoc.equals("SMM009")){
+				if (contentsLoc.equals("SMM009")) {
 					contents.setMaxRow(5);
 				}
 				mainLayout.setMdPickList(displayService.getContentsForGoods(contents));
 			}
 
-			if (contentsLoc.equals("SMM003")||contentsLoc.equals("SBM007")){
+			if (contentsLoc.equals("SMM003") || contentsLoc.equals("SBM007")) {
 				mainLayout.setNewItemList(displayService.getContentsForGoods(contents));
 			}
 
@@ -345,20 +350,20 @@ public class TsfDisplayController extends TsfBaseController {
 			brandMain.setCate4Srch(cate4Srch);
 
 			if ("C".equals(brandMain.getContentsYn())) {
-				if(contentsLoc.equals("SBM017") || contentsLoc.equals("SBM018")||contentsLoc.equals("SBM019")){
+				if (contentsLoc.equals("SBM017") || contentsLoc.equals("SBM018") || contentsLoc.equals("SBM019")) {
 					cate4Srch.setBrandGroupNo(brandMain.getBrandGroupNo());
 					cate4Srch.setMaxRow(20);
 					Collection<Goods> goodsList = goodsService.getContentsCategoryGoodsList(cate4Srch);
 					brandMain.setGoodsList(goodsList);
 				}
 				brandMain.setContentsList(displayService.getContentsList(contents));
-			} else if("E".equals(brandMain.getContentsYn())){
+			} else if ("E".equals(brandMain.getContentsYn())) {
 				Cate4Srch cate4Srch2 = new Cate4Srch();
 				cate4Srch2.setBrandGroupNo(brandMain.getBrandGroupNo());
 				cate4Srch2.setContentsLoc(contentsLoc);
 				if (contentsLoc.equals("SBM013") || contentsLoc.equals("SBMM013")) {
 					cate4Srch2.setMaxRow(50);
-				}else{
+				} else {
 					cate4Srch2.setMaxRow(20);
 				}
 				Collection<Goods> goodsList = goodsService.getContentsCategoryGoodsList(cate4Srch2);
@@ -648,20 +653,20 @@ public class TsfDisplayController extends TsfBaseController {
 		// 검색엔진 연동 여부
 //		String syncYn = commonService.getSearchEngineSyncYn();
 //		if (syncYn.equals("Y")) { // 검색엔진을 통한 상품리스트 조회
-			mav.setViewName(super.getDeviceViewName("display/CategoryGoodsListForm"));
-			// 카테고리 목록
-			mav.addObject("allCateList", displayService.getAllCategoryList("G032_101"));
-			// 상품검색키워드 카테고리 목록
-			SearchEngine cate1 = new SearchEngine();
-			cate1.setBrandGroupNo(params.getBrandGroupNo() == null ? 0 : params.getBrandGroupNo());
-			cate1.setFrontGb(TsfSession.getFrontGb());
-			cate1.setSiteCd(TscConstants.Site.STYLE24.value());
-			cate1.setCateGb("G032_101");
-			cate1.setCate1No(params.getCate1No());
-			mav.addObject("cateList", diquest.getCategoryList(cate1));
-
-			// 상품리스트 카테고리별 필터 목록
-			filterList = diquest.getFilterList(params);
+		mav.setViewName(super.getDeviceViewName("display/CategoryGoodsListForm"));
+		// 카테고리 목록
+		mav.addObject("allCateList", displayService.getAllCategoryList("G032_101"));
+		// 상품검색키워드 카테고리 목록
+		SearchEngine cate1 = new SearchEngine();
+		cate1.setBrandGroupNo(params.getBrandGroupNo() == null ? 0 : params.getBrandGroupNo());
+		cate1.setFrontGb(TsfSession.getFrontGb());
+		cate1.setSiteCd(TscConstants.Site.STYLE24.value());
+		cate1.setCateGb("G032_101");
+		cate1.setCate1No(params.getCate1No());
+		mav.addObject("cateList", diquest.getCategoryList(cate1));
+
+		// 상품리스트 카테고리별 필터 목록
+		filterList = diquest.getFilterList(params);
 //		}else{
 //			// 카테고리 목록
 //			mav.addObject("cateList", displayService.getAllCategoryList(params.getCateGb()));
@@ -677,13 +682,13 @@ public class TsfDisplayController extends TsfBaseController {
 		mav.addObject("filterSeasonList", displayService.getCategoryFilterList(filterList, "SEASON"));
 		mav.addObject("filterColorList", displayService.getCategoryFilterList(filterList, "COLOR"));
 		mav.addObject("filterBenefitList", displayService.getCategoryFilterList(filterList, "BENEFIT"));
-		if(params.getFormalGb()!=null){
+		if (params.getFormalGb() != null) {
 			params.setFormalGb(params.getFormalGb().toUpperCase());
 		}
 		mav.addObject("params", params);
 
-		log.info("categoryGoodsListForm params:::::{}",params);
-		log.info("filterPriceList:::{}",displayService.getCategoryFilterList(filterList, "PRICE"));
+		log.info("categoryGoodsListForm params:::::{}", params);
+		log.info("filterPriceList:::{}", displayService.getCategoryFilterList(filterList, "PRICE"));
 
 		return mav;
 	}
@@ -722,8 +727,8 @@ public class TsfDisplayController extends TsfBaseController {
 		result.set("paging", pageable);
 		result.set("dataList", dataList);
 
-		log.info("pageable>>>>{}",pageable);
-		log.info("dataList>>>>{}",dataList);
+		log.info("pageable>>>>{}", pageable);
+		log.info("dataList>>>>{}", dataList);
 
 		return result;
 	}
@@ -981,7 +986,7 @@ public class TsfDisplayController extends TsfBaseController {
 		mav.addObject("filterBenefitList", displayService.getCategoryFilterList(filterList, "BENEFIT"));
 		mav.addObject("params", params);
 
-		log.info("filterPriceList:::{}",displayService.getCategoryFilterList(filterList, "PRICE"));
+		log.info("filterPriceList:::{}", displayService.getCategoryFilterList(filterList, "PRICE"));
 
 		return mav;
 	}
@@ -1008,13 +1013,13 @@ public class TsfDisplayController extends TsfBaseController {
 		params.setCustGb(TsfSession.getCustGb());
 
 		Collection<SearchEngine> dataList = new ArrayList<SearchEngine>();
-		log.info("getSearchGoodsList params::{}",params);
+		log.info("getSearchGoodsList params::{}", params);
 		// 검색엔진 연동 여부
 //		String syncYn = commonService.getSearchEngineSyncYn();
 //		if (syncYn.equals("Y")) { // 검색엔진을 통한 상품리스트 조회
-			GoodsListResponse response = diquest.getGoodsList(params);
-			pageable.setTotalCount(response.getTotalCount());
-			dataList = response.getResponse();
+		GoodsListResponse response = diquest.getGoodsList(params);
+		pageable.setTotalCount(response.getTotalCount());
+		dataList = response.getResponse();
 //		} else { // DB를 통한 상품리스트 조회
 //			pageable.setTotalCount(goodsService.getSearchGoodsCount(params));
 //			params.setPageable(pageable);
@@ -1049,7 +1054,7 @@ public class TsfDisplayController extends TsfBaseController {
 
 		Collection<SearchEngine> planList = new ArrayList<SearchEngine>();
 
-		PlanningResponse responsePlan = diquest.getPlanningList(params.getKeyword(),params.getPageNo(),params.getPageSize());
+		PlanningResponse responsePlan = diquest.getPlanningList(params.getKeyword(), params.getPageNo(), params.getPageSize());
 		pageable.setTotalCount(responsePlan.getTotalSize());
 		planList = responsePlan.getResponse();
 
@@ -1081,7 +1086,7 @@ public class TsfDisplayController extends TsfBaseController {
 
 		Collection<SearchEngine> eventList = new ArrayList<SearchEngine>();
 
-		PlanningResponse responsePlan = diquest.getEventList(params.getKeyword(),params.getPageNo(),params.getPageSize());
+		PlanningResponse responsePlan = diquest.getEventList(params.getKeyword(), params.getPageNo(), params.getPageSize());
 		pageable.setTotalCount(responsePlan.getTotalSize());
 		eventList = responsePlan.getResponse();
 
@@ -1175,4 +1180,16 @@ public class TsfDisplayController extends TsfBaseController {
 		return result;
 	}
 
+	/**
+	 * 주간베스트추천상품 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 6. 29
+	 */
+	@GetMapping("/weekly/best/list")
+	@ResponseBody
+	public Collection<Result> getWeeklyBestGoodsList() {
+		return eigeneaiApi.getWeeklyBestGoodsList(30, 1100).getResults();
+	}
+
 }