|
|
@@ -1,434 +1,445 @@
|
|
|
-package com.style24.front.biz.thirdparty;
|
|
|
-
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
-import java.net.URI;
|
|
|
-import java.net.URLEncoder;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collection;
|
|
|
-
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-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;
|
|
|
-
|
|
|
-/**
|
|
|
- * 추천솔루션 - Eigene.ai
|
|
|
- *
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
-@Component
|
|
|
-@Slf4j
|
|
|
-public class EigeneaiApi {
|
|
|
-
|
|
|
- private String apiUrl = "https://api.eigene.io/rec";
|
|
|
- private String rtsApiUrl = "https://rts-api.eigene.io/api";
|
|
|
- private String cuid = "1252aed4-78dc-46e8-b784-94ac42e86dd4";
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RestTemplate restTemplate;
|
|
|
-
|
|
|
- @PostConstruct
|
|
|
- public void init() {
|
|
|
- log.debug("\n\n---- Eigene.ai initialization started ----");
|
|
|
- log.debug("apiUrl: [{}]", apiUrl);
|
|
|
- log.debug("cuid: [{}]", cuid);
|
|
|
- log.debug("\n--- Eigene.ai initialization completed ----\n");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 카테고리별 주간판매베스트추천상품 목록
|
|
|
- * 사용되는 화면 영역)
|
|
|
- * 메인 > 베스트 영역
|
|
|
- * 카테고리메인 > 베스트 상품
|
|
|
- * 베스트 > 카테고리별 베스트
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @param cate1No - 카테고리번호1
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- public Collection<Result> getCategoryWeeklySellBestGoodsList(int size, Integer cate1No) {
|
|
|
- String requestUrl = apiUrl + "/m060?cuid=" + cuid + "&size=" + size + "&incids=" + cate1No;
|
|
|
-
|
|
|
- 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 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. 6. 30
|
|
|
- */
|
|
|
- public Collection<Result> getBrandWeeklySellBestGoodsList(int size, Integer brandGroupNo) {
|
|
|
- String requestUrl = apiUrl + "/m061?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>();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 아울렛 주간판매베스트추천상품 목록
|
|
|
- * 사용되는 화면 영역)
|
|
|
- * 아울렛메인 > 베스트
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 6. 30
|
|
|
- */
|
|
|
- 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);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 매출급상승 카테고리별 상품 목록
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- public Eigeneai getSalesSoaringGoodsList() {
|
|
|
- // TODO: 매출급상승 카테고리 5개 조회 후 카테고리별 상품 7개 조회
|
|
|
- String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
|
|
|
- return this.getEigeneaiInfo(requestUrl);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 고객의 최근검색어별 상품 목록
|
|
|
- * 사용되는 화면 영역)
|
|
|
- * 검색 > 검색결과 추천상품
|
|
|
- * 메인 > 당신을 위한 제안 > 검색어 연관상품 추천
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- public Collection<Eigeneai> getCustomerKeywordGoodsList() {
|
|
|
- Collection<Eigeneai> dataList = new ArrayList<>();
|
|
|
-
|
|
|
- // 고객별 최근검색어 목록. TODO: 아이겐에서 미개발
|
|
|
- String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
|
|
|
- Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
-
|
|
|
- Collection<Eigeneai.Result> resultList = eigeneai.getResults();
|
|
|
- if (resultList == null || resultList.isEmpty()) {
|
|
|
- return dataList;
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- // 고객별 최근검색어 기준 검색어연관상품 목록 조회
|
|
|
- for (Eigeneai.Result result : resultList) {
|
|
|
- dataList.add(this.getKeywordGoodsList(10, result.getCategoryId()));
|
|
|
- }
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- // Do nothing
|
|
|
- }
|
|
|
-
|
|
|
- return dataList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 검색어 연관상품 목록
|
|
|
- * 사용되는 화면 영역)
|
|
|
- * 검색 > 검색결과 추천상품
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @param keyword - 키워드
|
|
|
- * @exception UnsupportedEncodingException
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- 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> getRelatedGoodsList(String goodsCd, int size) {
|
|
|
- String requestUrl = apiUrl + "/a037?cuid=" + cuid + "&size=" + size + "&iids=" + goodsCd + "&cps=true&cpt=m001";
|
|
|
-
|
|
|
- Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
- if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
|
|
|
- return eigeneai.getResults();
|
|
|
- }
|
|
|
-
|
|
|
- return new ArrayList<Result>();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 브랜드 연관상품 목록
|
|
|
- * 사용되는 화면 영역)
|
|
|
- * 상품상세 > 브랜드연관상품
|
|
|
- * @param size - 결과에 포함할 상품수
|
|
|
- * @param goodsCd - 상품코드
|
|
|
- * @param brandGroupNo - 브랜드그룹번호
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- 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 size - 결과에 포함할 상품수
|
|
|
- * @param goodsCd - 상품코드
|
|
|
- * @return
|
|
|
- * @author gagamel
|
|
|
- * @since 2021. 5. 14
|
|
|
- */
|
|
|
- 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) {
|
|
|
- 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 getEigeneaiInfo(String requestUrl) {
|
|
|
- log.info("requestUrl: {}", requestUrl);
|
|
|
- URI url = URI.create(requestUrl);
|
|
|
-
|
|
|
- // GET방식으로 호출
|
|
|
- ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
|
|
|
- log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
-
|
|
|
- String responseJson = responseEntity.getBody();
|
|
|
- log.info("responseEntity.getBody(): {}", responseJson);
|
|
|
-
|
|
|
- if (!responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- Gson gson = new Gson();
|
|
|
- return gson.fromJson(responseJson, Eigeneai.class);
|
|
|
- }
|
|
|
-
|
|
|
+package com.style24.front.biz.thirdparty;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URI;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+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;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 추천솔루션 - Eigene.ai
|
|
|
+ *
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class EigeneaiApi {
|
|
|
+
|
|
|
+ private String apiUrl = "https://api.eigene.io/rec";
|
|
|
+ private String rtsApiUrl = "https://rts-api.eigene.io/api";
|
|
|
+ private String cuid = "1252aed4-78dc-46e8-b784-94ac42e86dd4";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ log.debug("\n\n---- Eigene.ai initialization started ----");
|
|
|
+ log.debug("apiUrl: [{}]", apiUrl);
|
|
|
+ log.debug("cuid: [{}]", cuid);
|
|
|
+ log.debug("\n--- Eigene.ai initialization completed ----\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 카테고리별 주간판매베스트추천상품 목록
|
|
|
+ * 사용되는 화면 영역)
|
|
|
+ * 메인 > 베스트 영역
|
|
|
+ * 카테고리메인 > 베스트 상품
|
|
|
+ * 베스트 > 카테고리별 베스트
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @param cate1No - 카테고리번호1
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ public Collection<Result> getCategoryWeeklySellBestGoodsList(int size, Integer cate1No) {
|
|
|
+ String requestUrl = apiUrl + "/m060?cuid=" + cuid + "&size=" + size + "&incids=" + cate1No;
|
|
|
+
|
|
|
+ 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 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. 6. 30
|
|
|
+ */
|
|
|
+ public Collection<Result> getBrandWeeklySellBestGoodsList(int size, Integer brandGroupNo) {
|
|
|
+ String requestUrl = apiUrl + "/m061?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>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 아울렛 주간판매베스트추천상품 목록
|
|
|
+ * 사용되는 화면 영역)
|
|
|
+ * 아울렛메인 > 베스트
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 6. 30
|
|
|
+ */
|
|
|
+ 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<Item> getRealtimeViewGoodsList(int size) {
|
|
|
+// String requestUrl = rtsApiUrl + "/stream?cuid=" + cuid + "&size=" + size + "&type=view";
|
|
|
+//
|
|
|
+// Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
+// if (eigeneai.getItems() != null && !eigeneai.getItems().isEmpty()) {
|
|
|
+// return eigeneai.getItems();
|
|
|
+// }
|
|
|
+//
|
|
|
+// return new ArrayList<Item>();
|
|
|
+// }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 실시간 많이 조회되고 있는 베스트 상품 목록
|
|
|
+// * 사용되는 화면 영역)
|
|
|
+// * 베스트 > 베스트상품_실시간 베스트
|
|
|
+// * @param size - 결과에 포함할 상품수
|
|
|
+// * @return
|
|
|
+// * @author gagamel
|
|
|
+// * @since 2021. 6. 30
|
|
|
+// */
|
|
|
+// public Collection<Item> getRealtimeViewBestGoodsList(int size) {
|
|
|
+// String requestUrl = rtsApiUrl + "/stats-transition?cuid=" + cuid + "&size=" + size + "&type=view&interval=30&span=30";
|
|
|
+//
|
|
|
+// Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
+// if (eigeneai.getItems() != null && !eigeneai.getItems().isEmpty()) {
|
|
|
+// return eigeneai.getItems();
|
|
|
+// }
|
|
|
+//
|
|
|
+// return new ArrayList<Item>();
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 매출급상승 카테고리별 상품 목록
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ public Eigeneai getSalesSoaringGoodsList() {
|
|
|
+ // TODO: 매출급상승 카테고리 5개 조회 후 카테고리별 상품 7개 조회
|
|
|
+ String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
|
|
|
+ return this.getEigeneaiInfo(requestUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 고객의 최근검색어별 상품 목록
|
|
|
+ * 사용되는 화면 영역)
|
|
|
+ * 검색 > 검색결과 추천상품
|
|
|
+ * 메인 > 당신을 위한 제안 > 검색어 연관상품 추천
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ public Collection<Eigeneai> getCustomerKeywordGoodsList() {
|
|
|
+ Collection<Eigeneai> dataList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 고객별 최근검색어 목록. TODO: 아이겐에서 미개발
|
|
|
+ String requestUrl = apiUrl + "/m010?cuid=" + cuid + "&size=5";
|
|
|
+ Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
+
|
|
|
+ Collection<Eigeneai.Result> resultList = eigeneai.getResults();
|
|
|
+ if (resultList == null || resultList.isEmpty()) {
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객별 최근검색어 기준 검색어연관상품 목록 조회
|
|
|
+ for (Eigeneai.Result result : resultList) {
|
|
|
+ dataList.add(this.getKeywordGoodsList(10, result.getCategoryId()));
|
|
|
+ }
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 검색어 연관상품 목록
|
|
|
+ * 사용되는 화면 영역)
|
|
|
+ * 검색 > 검색결과 추천상품
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @param keyword - 키워드
|
|
|
+ * @exception UnsupportedEncodingException
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ 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> getRelatedGoodsList(String goodsCd, int size) {
|
|
|
+ String requestUrl = apiUrl + "/a037?cuid=" + cuid + "&size=" + size + "&iids=" + goodsCd + "&cps=true&cpt=m001";
|
|
|
+
|
|
|
+ Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
+ if (eigeneai.getResults() != null && !eigeneai.getResults().isEmpty()) {
|
|
|
+ return eigeneai.getResults();
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ArrayList<Result>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 브랜드 연관상품 목록
|
|
|
+ * 사용되는 화면 영역)
|
|
|
+ * 상품상세 > 브랜드연관상품
|
|
|
+ * @param size - 결과에 포함할 상품수
|
|
|
+ * @param goodsCd - 상품코드
|
|
|
+ * @param brandGroupNo - 브랜드그룹번호
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ 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 size - 결과에 포함할 상품수
|
|
|
+ * @param goodsCd - 상품코드
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ 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 int getRealtimeViewCount(String goodsCd) {
|
|
|
+// String requestUrl = rtsApiUrl + "/stat?cuid=" + cuid + "&itemid=" + goodsCd + "&type=view";
|
|
|
+//
|
|
|
+// Eigeneai eigeneai = this.getEigeneaiInfo(requestUrl);
|
|
|
+// if (eigeneai.getItem() != null) {
|
|
|
+// return eigeneai.getItem().getCount();
|
|
|
+// }
|
|
|
+//
|
|
|
+// return 0;
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 아이겐 정보 조회
|
|
|
+ * @param requestUrl - Reqeust URL
|
|
|
+ * @return
|
|
|
+ * @author gagamel
|
|
|
+ * @since 2021. 5. 14
|
|
|
+ */
|
|
|
+ private Eigeneai getEigeneaiInfo(String requestUrl) {
|
|
|
+ log.info("requestUrl: {}", requestUrl);
|
|
|
+ URI url = URI.create(requestUrl);
|
|
|
+
|
|
|
+ // GET방식으로 호출
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
|
|
|
+ log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
+
|
|
|
+ String responseJson = responseEntity.getBody();
|
|
|
+ log.info("responseEntity.getBody(): {}", responseJson);
|
|
|
+
|
|
|
+ if (!responseEntity.getStatusCode().equals(HttpStatus.OK)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ Gson gson = new Gson();
|
|
|
+ return gson.fromJson(responseJson, Eigeneai.class);
|
|
|
+ }
|
|
|
+
|
|
|
}
|