Jelajahi Sumber

Merge branch 'develop' of http://112.172.147.34:4936/style24/style24.front into develop

jsshin 4 tahun lalu
induk
melakukan
d22f4e5430

+ 445 - 433
src/main/java/com/style24/front/biz/thirdparty/EigeneaiApi.java

@@ -1,434 +1,446 @@
-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.Item;
+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=5&span=10";
+
+		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);
+	}
+
 }

+ 20 - 2
src/main/java/com/style24/persistence/domain/eigene/Eigeneai.java

@@ -16,8 +16,10 @@ import lombok.Data;
 public class Eigeneai implements Serializable {
 
 	private String recType;					// 추천영역코드
-	private Collection<Product> products;	// 인풋상품정보
-	private Collection<Result> results;		// 결과상품정보
+	private Collection<Product> products;	// 인풋상품정보 목록
+	private Collection<Result> results;		// 결과상품정보 목록
+	private Collection<Item> items;			// 실시간상품정보 목록
+	private Item item;						// 실시간상품정보
 
 	// 인풋상품정보
 	@Data
@@ -31,6 +33,7 @@ public class Eigeneai implements Serializable {
 		private String category3;		// 3레벨카테고리
 		private double originalPrice;	// 정상가
 		private double salePrice;		// 판매가
+		private String brandId;			// 브랜드ID(브랜드그룹번호)
 		private String brandName;		// 브랜드명
 	}
 
@@ -44,4 +47,19 @@ public class Eigeneai implements Serializable {
 		private Product product;	// 상품정보
 	}
 
+	// 실시간 상품정보
+	@Data
+	public class Item {
+		private int count;				// view건수
+		private String itemId;			// 상품코드
+		private String imageUrl;		// 상품이미지URL
+		private String itemName;		// 상품명
+		private String itemUrl;			// 상품상세페이지URL
+		private String categoryId;		// 카테고리ID
+		private double originalPrice;	// 정상가
+		private double salePrice;		// 판매가
+		private String brandId;			// 브랜드ID(브랜드그룹번호)
+		private String brandName;		// 브랜드명
+	}
+
 }

+ 5 - 3
src/main/webapp/WEB-INF/views/mob/goods/GoodsDealDescFormMob.html

@@ -354,12 +354,14 @@
    $(document).ready( function() {
 	   $(".pd_descrp .cont_body").find('img').each(function() {
 			let tmpImgSrc = $(this).attr('src');
-			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
- 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
- 			}else if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
+			if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
 				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
 			}
 			
+			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
+ 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
+ 			} 
+			
 		});
 	   
 	 	//210526_ 추가 : 이미지 style 속성 제거

+ 20 - 18
src/main/webapp/WEB-INF/views/mob/goods/GoodsDetailFormMob.html

@@ -340,10 +340,10 @@
 					<div style="height:4rem"></div><!-- 여백용 html -->
 					<th:block th:utext="${#strings.unescapeJava(#strings.escapeJava(goodsInfo.goodsTopDesc))}"></th:block>
 				</div>
-				<th:block th:if="${goodsInfo.tobeFormYn == 'N' and goodsInfo.goodsDesc != null  and !goodsInfo.goodsDesc.empty}" >	
+				<th:block th:if="${goodsInfo.tobeFormYn == 'N' and goodsInfo.goodsDesc != null  and !goodsInfo.goodsDesc.empty}" >
+				<div style="height:4rem"></div><!-- 여백용 html -->	
 				<div class="mdhtml_box"	>
-						<div style="height:4rem"></div><!-- 여백용 html -->
-						<div id="goodsDescHtml"></div>
+					<div id="goodsDescHtml"></div>
 				</div>
 				</th:block>
 					
@@ -434,9 +434,11 @@
 				<th:block th:if="${goodsInfo.goodsType == 'G056_S' and goodsComposeList != null and !goodsComposeList.empty}">
 				<th:block  th:each="goodsCompose, status : ${goodsComposeList}">
 					<th:block th:if="${ goodsCompose.tobeFormYn == 'N' and goodsCompose.goodsDesc != null  and !goodsCompose.goodsDesc.empty}" >
+					<div style="height:4rem"></div><!-- 여백용 html -->
 					<div class="mdhtml_box"	>
-						<div style="height:4rem"></div><!-- 여백용 html -->
-						<div th:id="${'goodsDescHtml_' + goodsCompose.compsGoodsCd}"></div>
+						<div class="mdhtml_box"	>
+							<div th:id="${'goodsDescHtml_' + goodsCompose.compsGoodsCd}"></div>
+						</div>
 					</div>
 					</th:block>
 					
@@ -2886,6 +2888,18 @@
 			$('.modal.photo_comment_popup .pop_detail').toggleClass('active');
 		});
 		
+		 // 상품상세 asis html  이지미 경로 수정
+		$(".pd_descrp .cont_body").find('img').each(function() {
+			let tmpImgSrc = $(this).attr('src');
+			if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
+				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
+			}
+			
+			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
+ 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
+ 			} 
+			
+		});
 	});
 	
 
@@ -2927,19 +2941,7 @@
 	let vh = window.innerHeight * 0.01;
 	document.documentElement.style.setProperty('--vh', `${vh}px`);
 	
-	 // 상품상세 asis html  이지미 경로 수정
-	window.onload = function(){
-   	 $(".pd_descrp .cont_body").find('img').each(function() {
-			let tmpImgSrc = $(this).attr('src');
-			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
- 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
- 			}else if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
-				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
-			}
-			
-		});
-		
-	};
+	
 	
    	let goodsVideoList = [[${goodsVideoList}]];
 	let videoFlag = false;

+ 5 - 3
src/main/webapp/WEB-INF/views/web/goods/GoodsDealDescFormWeb.html

@@ -311,12 +311,14 @@
    $(document).ready( function() {
    	 $(".pd_descrp_pop .cont_body").find('img').each(function() {
 			let tmpImgSrc = $(this).attr('src');
-			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
- 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
- 			}else if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
+			if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
 				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
 			}
 			
+			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
+ 				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
+ 			} 
+			
 		});
    //210526_ 추가 : 이미지 style 속성 제거
 	$(".mdhtml_box style").remove();$(".mdhtml_box img").removeAttr("style");

+ 8 - 4
src/main/webapp/WEB-INF/views/web/goods/GoodsDetailFormWeb.html

@@ -825,7 +825,9 @@
 				<th:block  th:each="goodsCompose, status : ${goodsComposeList}">
 					<th:block th:if="${ goodsCompose.tobeFormYn == 'N' and goodsCompose.goodsDesc != null  and !goodsCompose.goodsDesc.empty}" >
 						<div style="height:100px"></div>
+						<div class="mdhtml_box">
 						<div th:id="${'goodsDescHtml_' + goodsCompose.compsGoodsCd}"></div>
+						</div>
 					</th:block>
 
 					<th:block th:if="${goodsCompose.tobeFormYn == 'Y'}">
@@ -2723,11 +2725,13 @@
      window.onload = function(){
     	 $(".pd_descrp .cont_body").find('img').each(function() {
  			let tmpImgSrc = $(this).attr('src');
- 			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
+ 			if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
+				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
+			}
+			
+			if (tmpImgSrc.indexOf('/Upload/Local') > 0 ){  // /Upload
  				$(this).attr('src' , tmpImgSrc.replace('/Upload/Local', "/Local"));
- 			}else if (tmpImgSrc.indexOf('Upload') == 1 ){  // /Upload
- 				$(this).attr('src' , tmpImgSrc.replace('/Upload', _imgUrl+"/Local"));
- 			}
+ 			} 
  			
  		});
  	}