Explorar o código

추천솔루션 관련 로직 수정

gagamel %!s(int64=4) %!d(string=hai) anos
pai
achega
a61adbac7b

+ 239 - 65
src/main/java/com/style24/front/biz/thirdparty/EigeneaiApi.java

@@ -46,42 +46,118 @@ public class EigeneaiApi {
 	}
 
 	/**
-	 * 주간베스트추천상품 목록
+	 * 카테고리별 주간판매베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		메인 > 베스트 영역
+	 * 		카테고리메인 > 베스트 상품
+	 * 		베스트 > 카테고리별 베스트
 	 * @param size - 결과에 포함할 상품수
-	 * @param cate1No - 카테고리1번호
+	 * @param cate1No - 카테고리번호1
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getWeeklyBestGoodsList(int size, Integer cate1No) {
+	public Collection<Result> getCategoryWeeklySellBestGoodsList(int size, Integer cate1No) {
 		String requestUrl = apiUrl + "/m060?cuid=" + cuid + "&size=" + size + "&incids=" + cate1No;
-		return this.getRecommendationGoodsList(requestUrl);
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
 	}
 
+//	/**
+//	 * 매출급상승 카테고리 목록
+//	 * 사용되는 화면 영역)
+//	 * 		메인 > MD추천상품
+//	 * @return
+//	 * @author gagamel
+//	 * @since 2021. 6. 30
+//	 */
+//	public Collection<Result> getSoaringSalesCategoryList() {
+//		String requestUrl = apiUrl + "/m063?cuid=" + cuid;
+//
+//		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+//		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+//			return eigeneai.getResults();
+//		}
+//
+//		return new ArrayList<Result>();
+//	}
+//
+//	/**
+//	 * MD추천상품 목록. 매출급상승 카테고리별 상품 목록
+//	 * 사용되는 화면 영역)
+//	 * 		메인 > MD추천상품
+//	 * @param size - 결과에 포함할 상품수
+//	 * @param cateId - 카테고리ID
+//	 * @return
+//	 * @author gagamel
+//	 * @since 2021. 6. 30
+//	 */
+//	public Collection<GagaMap> getMdRecommendGoodsList(int size, String cateId) {
+//		// 1.매출급상승 카테고리 목록
+//		String requestUrl = apiUrl + "/m063?cuid=" + cuid;
+//		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+//		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+//			Collection<Result> cateList = eigeneai.getResults();
+//
+//			if (cateList != null && !cateList.isEmpty()) {
+//				for (Result cateInfo : cateList) {
+//					if (StringUtils.isNotBlank(cateInfo.getCategoryId())) {
+//						GagaMap dataMap = new GagaMap();
+//						dataMap.setString("styleNm", cateInfo.getCategoryId());
+//
+//						// 2.카테고리별 상품 목록
+//						requestUrl = apiUrl + "/c001?cuid=" + cuid + "&size=" + size + "&cids=" + cateInfo.getCategoryId();
+//						eigeneai = this.getEigeneaiInfo(requestUrl);
+//						if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+//							dataMap.set("", eigeneai.getResults());
+//						}
+//					}
+//				}
+//			}
+//		}
+//
+//		return new ArrayList<GagaMap>();
+//	}
+
 	/**
-	 * 카테고리별 주간베스트추천상품 목록
+	 * 주간판매베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		베스트 > 전체 베스트
 	 * @param size - 결과에 포함할 상품수
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getCategoryWeeklyBestGoodsList(int size) {
-		// TODO: 카테고리ID는 어떻게 조회? 아이겐 미개발
-		String requestUrl = apiUrl + "/m008?cuid=" + cuid + "&cids=" + "" + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
+	public Collection<Result> getWeeklySellBestGoodsList(int size) {
+		String requestUrl = apiUrl + "/m061?cuid=" + cuid + "&size=" + size;
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
 	}
 
 	/**
-	 * 월간클릭베스트추천상품 목록
+	 * 브랜드 주간판매베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		브랜드메인 > 베스트 상품
 	 * @param size - 결과에 포함할 상품수
+	 * @param brandGroupNo - 브랜드그룹번호
 	 * @return
 	 * @author gagamel
-	 * @since 2021. 5. 14
+	 * @since 2021. 6. 30
 	 */
-	public Collection<Result> getMonthlyClickBestGoodsList(int size, Integer brandGroupNo) {
-		String requestUrl = apiUrl + "/m062?cuid=" + cuid + "&cids=" + "" + "&size=" + size + "&bids=" + brandGroupNo;
+	public Collection<Result> getBrandWeeklySellBestGoodsList(int size, Integer brandGroupNo) {
+		String requestUrl = apiUrl + "/m061?cuid=" + cuid + "&size=" + size + "&bids=" + brandGroupNo;
 
-		Eigeneai eigeneai = this.getRecommendationGoodsList(requestUrl);
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
 		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
 			return eigeneai.getResults();
 		}
@@ -90,15 +166,100 @@ public class EigeneaiApi {
 	}
 
 	/**
-	 * 실시간베스트상품 목록
+	 * 아울렛 주간판매베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		아울렛메인 > 베스트
 	 * @param size - 결과에 포함할 상품수
 	 * @return
 	 * @author gagamel
-	 * @since 2021. 5. 14
+	 * @since 2021. 6. 30
 	 */
-	public Eigeneai getRealtimeBestGoodsList(int size) {
-		String requestUrl = apiUrl + "/stats-transition?cuid=" + cuid + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
+	public Collection<Result> getOutletWeeklySellBestGoodsList(int size) {
+		String requestUrl = apiUrl + "/m064?cuid=" + cuid + "&size=" + size;
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
+	}
+
+	/**
+	 * 브랜드 월간클릭베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		브랜드메인 > MD Pick
+	 * @param size - 결과에 포함할 상품수
+	 * @param brandGroupNo - 브랜드그룹번호
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 6. 30
+	 */
+	public Collection<Result> getBrandMonthlyClickBestGoodsList(int size, Integer brandGroupNo) {
+		String requestUrl = apiUrl + "/m062?cuid=" + cuid + "&size=" + size + "&bids=" + brandGroupNo;
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
+	}
+
+	/**
+	 * 아울렛 월간클릭베스트추천상품 목록
+	 * 사용되는 화면 영역)
+	 * 		아울렛메인 > MD Pick
+	 * @param size - 결과에 포함할 상품수
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 6. 30
+	 */
+	public Collection<Result> getOutletMonthlyClickBestGoodsList(int size) {
+		String requestUrl = apiUrl + "/m065?cuid=" + cuid + "&cids=" + "" + "&size=" + size;
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
+	}
+
+	/**
+	 * 실시간 많이 조회되고 있는 상품 목록
+	 * 사용되는 화면 영역)
+	 * 		퀵메뉴 > 쇼핑백 (담은 상품 없는 경우)
+	 * 		쇼핑백 > 추천상품 (담은 상품 없는 경우)
+	 * 		검색 > 검색 시작화면
+	 * @param size - 결과에 포함할 상품수
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 6. 30
+	 */
+	public Collection<Result> getRealtimeViewGoodsList(int size) {
+		String requestUrl = rtsApiUrl + "/stream?cuid=" + cuid + "&size=" + size + "&type=view";
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
+	}
+
+	/**
+	 * 실시간 많이 조회되고 있는 베스트 상품 목록
+	 * 사용되는 화면 영역)
+	 * 		베스트 > 베스트상품_실시간 베스트
+	 * @param size - 결과에 포함할 상품수
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 6. 30
+	 */
+	public Eigeneai getRealtimeViewBestGoodsList(int size) {
+		String requestUrl = rtsApiUrl + "/stats-transition?cuid=" + cuid + "&size=" + size + "&type=view&interval=30&span=30&offset=0";
+		return this.getEigeneaiInfo(requestUrl);
 	}
 
 	/**
@@ -111,11 +272,14 @@ public class EigeneaiApi {
 	public Eigeneai getSalesSoaringGoodsList() {
 		// TODO: 매출급상승 카테고리 5개 조회 후 카테고리별 상품 7개 조회
 		String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
-		return this.getRecommendationGoodsList(requestUrl);
+		return this.getEigeneaiInfo(requestUrl);
 	}
 
 	/**
 	 * 고객의 최근검색어별 상품 목록
+	 * 사용되는 화면 영역)
+	 * 		검색 > 검색결과 추천상품
+	 * 		메인 > 당신을 위한 제안 > 검색어 연관상품 추천
 	 * @param size - 결과에 포함할 상품수
 	 * @return
 	 * @author gagamel
@@ -126,51 +290,56 @@ public class EigeneaiApi {
 
 		// 고객별 최근검색어 목록. TODO: 아이겐에서 미개발
 		String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
-		Eigeneai eigeneai = this.getRecommendationGoodsList(requestUrl);
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
 
 		Collection<Eigeneai.Result> resultList = eigeneai.getResults();
 		if (resultList == null || resultList.isEmpty()) {
 			return dataList;
 		}
 
-		// 고객별 최근검색어 기준 검색어연관상품 목록 조회
-		for (Eigeneai.Result result : resultList) {
-			dataList.add(this.getKeywordGoodsList(result.getCategoryId(), 10));
+		try {
+			// 고객별 최근검색어 기준 검색어연관상품 목록 조회
+			for (Eigeneai.Result result : resultList) {
+				dataList.add(this.getKeywordGoodsList(10, result.getCategoryId()));
+			}
+		} catch (UnsupportedEncodingException e) {
+			// Do nothing
 		}
 
 		return dataList;
 	}
 
 	/**
-	 * 검색어연관상품 목록
-	 * @param keyword - 키워드
+	 * 검색어 연관상품 목록
+	 * 사용되는 화면 영역)
+	 * 		검색 > 검색결과 추천상품
 	 * @param size - 결과에 포함할 상품수
+	 * @param keyword - 키워드
+	 * @exception UnsupportedEncodingException
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getKeywordGoodsList(String keyword, int size) {
-		String requestUrl = apiUrl + "/s001?cuid=" + cuid + "&size=" + size;
-		try {
-			requestUrl += "&st=" + URLEncoder.encode(keyword, "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return this.getRecommendationGoodsList(requestUrl);
+	private Eigeneai getKeywordGoodsList(int size, String keyword) throws UnsupportedEncodingException {
+		String requestUrl = apiUrl + "/s003?cuid=" + cuid + "&size=" + size + "&st=" + URLEncoder.encode(keyword, "UTF-8") + "&cps=true&cpt=m004";
+		return this.getEigeneaiInfo(requestUrl);
 	}
 
 	/**
-	 * 실시간 많이 조회되고 있는 상품 목록
+	 * 연관상품 목록
+	 * 사용되는 화면 영역)
+	 * 		쇼핑백 > 추천상품 (담은 상품이 있는 경우)
+	 * 		상품상세 > 함께 본 상품
+	 * @param goodsCd - 상품코드
 	 * @param size - 결과에 포함할 상품수
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Collection<Result> getRealtimeGoodsList(int size) {
-		String requestUrl = rtsApiUrl + "/stream?cuid=" + cuid + "&size=" + size + "&type=view";
+	public Collection<Result> getRelatedGoodsList(String goodsCd, int size) {
+		String requestUrl = apiUrl + "/a037?cuid=" + cuid + "&size=" + size + "&iids=" + goodsCd + "&cps=true&cpt=m001";
 
-		Eigeneai eigeneai = this.getRecommendationGoodsList(requestUrl);
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
 		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
 			return eigeneai.getResults();
 		}
@@ -178,67 +347,72 @@ public class EigeneaiApi {
 		return new ArrayList<Result>();
 	}
 
-	/**
-	 * 연관상품 목록
-	 * @param goodsCd - 상품코드
-	 * @param size - 결과에 포함할 상품수
-	 * @return
-	 * @author gagamel
-	 * @since 2021. 5. 14
-	 */
-	public Eigeneai getRelatedGoodsList(String goodsCd, int size) {
-		String requestUrl = apiUrl + "/a003?cuid=" + cuid + "&iids=" + goodsCd + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
-	}
-
 	/**
 	 * 브랜드 연관상품 목록
+	 * 사용되는 화면 영역)
+	 * 		상품상세 > 브랜드연관상품
 	 * @param size - 결과에 포함할 상품수
+	 * @param goodsCd - 상품코드
+	 * @param brandGroupNo - 브랜드그룹번호
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getBrandRelatedGoodsList(int size) {
-		// TODO: 아이겐 미개발 (a004&cids=category3 or a002&inbids=brandId)
-		String requestUrl = apiUrl + "/a004?cuid=" + cuid + "&cids=" + "" + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
+	public Collection<Result> getBrandRelatedGoodsList(int size, String goodsCd, Integer brandGroupNo) {
+		String requestUrl = apiUrl + "/a038?cuid=" + cuid + "&size=" + size + "&iids=" + goodsCd + "&cps=true&cpt=c001&cpcids=" + brandGroupNo;
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
 	}
 
 	/**
 	 * 동일 카테고리 연관상품 목록
-	 * @param goodsCd - 상품코드
+	 * 사용되는 화면 영역)
+	 * 		상품상세 > 비슷한 상품
 	 * @param size - 결과에 포함할 상품수
+	 * @param goodsCd - 상품코드
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	public Eigeneai getSameCategoryRelatedGoodsList(String goodsCd, int size) {
-		String requestUrl = apiUrl + "/a002?cuid=" + cuid + "&iids=" + goodsCd + "&size=" + size;
-		return this.getRecommendationGoodsList(requestUrl);
+	public Collection<Result> getSameCategoryRelatedGoodsList(int size, String goodsCd) {
+		String requestUrl = apiUrl + "/a039?cuid=" + cuid + "&size=" + size + "&iids=" + goodsCd + "&cps=true&cpt=m002";
+
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
+		if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
+			return eigeneai.getResults();
+		}
+
+		return new ArrayList<Result>();
 	}
 
 	/**
 	 * 상품의 실시간 조회수
+	 * 사용되는 화면 영역)
+	 * 		상품상세 > 실시간 뷰
 	 * @param goodsCd - 상품코드
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
 	public Eigeneai getRealtimeViewCount(String goodsCd) {
-		// TODO: 아이겐 미개발 (건수를 가져오는 걸로 해야하지 않을까?)
-		String requestUrl = apiUrl + "/stat?cuid=" + cuid + "&cids=" + goodsCd;
-		Eigeneai eigeneai = this.getRecommendationGoodsList(requestUrl);
+		String requestUrl = rtsApiUrl + "/stat?cuid=" + cuid + "&itemid=" + goodsCd + "&type=view";
+		Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
 		return eigeneai;
 	}
 
 	/**
-	 * 추천상품 목록
+	 * 아이겐 정보 조회
 	 * @param requestUrl - Reqeust URL
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 5. 14
 	 */
-	private Eigeneai getRecommendationGoodsList(String requestUrl) {
+	private Eigeneai getEigeneaiInfo(String requestUrl) {
 		log.info("requestUrl: {}", requestUrl);
 		URI url = URI.create(requestUrl);
 

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

@@ -1181,15 +1181,15 @@ public class TsfDisplayController extends TsfBaseController {
 	}
 
 	/**
-	 * 주간베스트추천상품 목록
+	 * 주간판매베스트추천상품 목록
 	 * @return
 	 * @author gagamel
 	 * @since 2021. 6. 29
 	 */
 	@GetMapping("/weekly/best/list")
 	@ResponseBody
-	public Collection<Result> getWeeklyBestGoodsList() {
-		return eigeneaiApi.getWeeklyBestGoodsList(30, 1100).getResults();
+	public Collection<Result> getWeeklySellBestGoodsList() {
+		return eigeneaiApi.getWeeklySellBestGoodsList(30);
 	}
 
 }

+ 3 - 3
src/main/java/com/style24/front/biz/web/TsfGoodsController.java

@@ -51,7 +51,7 @@ import com.style24.persistence.domain.ReinboundInform;
 import com.style24.persistence.domain.Review;
 import com.style24.persistence.domain.SizeInfo;
 import com.style24.persistence.domain.WishList;
-import com.style24.persistence.domain.eigene.Eigeneai;
+import com.style24.persistence.domain.eigene.Eigeneai.Result;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -1801,8 +1801,8 @@ public class TsfGoodsController extends TsfBaseController {
 	 */
 	@GetMapping("/same/category/goods/list/{goodsCd}")
 	@ResponseBody
-	public Eigeneai getSameCategoryGoodsList(@PathVariable String goodsCd) {
-		return eigeneaiApi.getSameCategoryRelatedGoodsList(goodsCd, 10);
+	public Collection<Result> getSameCategoryGoodsList(@PathVariable String goodsCd) {
+		return eigeneaiApi.getSameCategoryRelatedGoodsList(10, goodsCd);
 	}
 
 }