Просмотр исходного кода

브랜드/카테고리 메인 추천솔루션 추가

bin2107 4 лет назад
Родитель
Сommit
98e0d7cb5b

+ 27 - 1
src/main/java/com/style24/front/biz/service/TsfDisplayService.java

@@ -3,6 +3,8 @@ package com.style24.front.biz.service;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.style24.front.biz.thirdparty.EigeneaiApi;
+import com.style24.persistence.domain.eigene.Eigeneai;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
@@ -60,6 +62,9 @@ public class TsfDisplayService {
 	@Autowired
 	private Environment env;
 
+	@Autowired
+	private EigeneaiApi eigeneaiApi;
+
 	/**
 	 * GNB 브랜드그룹 목록
 	 * @param contents - 컨텐츠 정보
@@ -591,6 +596,7 @@ public class TsfDisplayService {
 	 */
 	public Collection<Contents> getBestItemForGoods(Contents contents) {
 		contents.setContentsLoc("SCM003");
+		contents.setCateNo(null);
 		Collection<Contents> contentsList = displayDao.getBestItemCategoryList(contents);
 		Cate4Srch tempCate = new Cate4Srch();
 
@@ -601,7 +607,27 @@ public class TsfDisplayService {
 			tempCate.setCateNo(data.getCateNo());
 			tempCate.setSiteCd(data.getSiteCd());
 			tempCate.setCateGb(data.getCateGb());
-			data.setGoodsList(goodsDao.getContentsCategoryGoodsList(tempCate));
+			Collection<Goods> cateGoodsList = goodsDao.getContentsCategoryGoodsList(tempCate);
+			if(10 > cateGoodsList.size()){
+				//TODO : 추천솔루션
+				int cnt = 0;
+				cnt = 10 - cateGoodsList.size();
+
+				Collection<Eigeneai.Result> itemList = eigeneaiApi.getCategoryWeeklySellBestGoodsList(cnt, data.getCateNo());
+				for(Eigeneai.Result tempData : itemList){
+					Goods tempBest = new Goods();
+					tempBest.setBrandGroupNm(tempData.getProduct().getBrandName());
+					tempBest.setGoodsCd(tempData.getProduct().getItemId());
+					tempBest.setGoodsFullNm(tempData.getProduct().getItemName());
+					tempBest.setListPrice((int) tempData.getProduct().getOriginalPrice());
+					tempBest.setCurrPrice((int) tempData.getProduct().getSalePrice());
+					tempBest.setSysImgNm(tempData.getProduct().getItemImage());
+					tempBest.setItemUrl(tempData.getProduct().getItemUrl());
+					cateGoodsList.add(tempBest);
+				}
+			}
+
+			data.setGoodsList(cateGoodsList);
 		}
 
 		return contentsList;

+ 36 - 2
src/main/java/com/style24/front/biz/service/TsfGoodsService.java

@@ -3,6 +3,7 @@ package com.style24.front.biz.service;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.style24.front.biz.thirdparty.EigeneaiApi;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -35,6 +36,7 @@ import com.style24.persistence.domain.ReinboundInform;
 import com.style24.persistence.domain.SizeInfo;
 import com.style24.persistence.domain.Tmtb;
 import com.style24.persistence.domain.searchengine.SearchEngine;
+import com.style24.persistence.domain.eigene.Eigeneai;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -62,6 +64,9 @@ public class TsfGoodsService {
 	@Autowired
 	private ObjectMapper mapper;
 
+	@Autowired
+	private EigeneaiApi eigeneaiApi;
+
 	/**
 	 * 상품뷰이력 생성
 	 *
@@ -1049,11 +1054,40 @@ public class TsfGoodsService {
 					goodsList.addAll(goodsDao.getContentsCategoryNewGoodsList(cate));
 				}
 			}
-		} else if (cate.getContentsLoc().equals("SCM003") || cate.getContentsLoc().equals("SBM008")) { // 베스트상품인 경우
+		} else if (cate.getContentsLoc().equals("SCM003") || cate.getContentsLoc().equals("SBM008") || cate.getContentsLoc().equals("SBM009")) { // 베스트상품인 경우
 			// TODO: 추천솔루션
+			int dispCnt = cate.getMaxRow();
 
-			// 추천솔루션 데이터가 없으면 베스트로 등록된 상품 조회
 			goodsList = goodsDao.getContentsCategoryGoodsList(cate);
+			// 수동설정 데이터 없거나 노출갯수보다 작으면 추천솔루션 데이터 표출
+			if(dispCnt > goodsList.size()){
+				int cnt = 0;
+				cnt = dispCnt - goodsList.size();
+
+				// TODO : 추천솔루션
+				Collection<Eigeneai.Result> itemList = new ArrayList<>();
+				if(cate.getContentsLoc().equals("SCM003")){
+					itemList = eigeneaiApi.getCategoryWeeklySellBestGoodsList(cnt, cate.getCate1No());
+				}else if(cate.getContentsLoc().equals("SBM008")){
+					itemList = eigeneaiApi.getBrandWeeklySellBestGoodsList(cnt, cate.getBrandGroupNo());
+				}else{
+					// SBM009 브랜드메인 MD PICK
+					itemList = eigeneaiApi.getBrandMonthlyClickBestGoodsList(cnt, cate.getBrandGroupNo());
+				}
+
+				for(Eigeneai.Result tempData: itemList){
+					Goods tempBest = new Goods();
+					tempBest.setBrandGroupNm(tempData.getProduct().getBrandName());
+					tempBest.setGoodsCd(tempData.getProduct().getItemId());
+					tempBest.setGoodsFullNm(tempData.getProduct().getItemName());
+					tempBest.setListPrice((int) tempData.getProduct().getOriginalPrice());
+					tempBest.setCurrPrice((int) tempData.getProduct().getSalePrice());
+					tempBest.setSysImgNm(tempData.getProduct().getItemImage());
+					tempBest.setItemUrl(tempData.getProduct().getItemUrl());
+					goodsList.add(tempBest);
+				}
+			}
+
 			for (Goods temp : goodsList) {
 				if (temp.getSizes() != null) {
 					temp.setSizeArr(temp.getSizes().split(","));

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

@@ -9,6 +9,8 @@ import java.util.HashMap;
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.style24.persistence.domain.eigene.Eigeneai;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.mobile.device.Device;
@@ -511,12 +513,16 @@ public class TsfDisplayController extends TsfBaseController {
 				contents.setMaxRow(1);
 				Collection<Contents> conList = displayService.getContentsList(contents);
 				mav.addObject("bestGoodsList", null);
+
+				Collection<Goods> bestList = new ArrayList<>();
 				for (Contents contentsData : conList) {
 					cate.setContentsLoc("SCM003");
 					cate.setMaxRow(Integer.parseInt(contentsData.getStrVar1()));
 					cate.setCateNo(contents.getCateNo());
-					mav.addObject("bestGoodsList", goodsService.getContentsCategoryGoodsList(cate));
+					bestList = goodsService.getContentsCategoryGoodsList(cate);
 				}
+
+				mav.addObject("bestGoodsList", bestList);
 			}
 
 			cateMainLayoutList.add(cateMain);

+ 1 - 0
src/main/java/com/style24/persistence/domain/Goods.java

@@ -228,5 +228,6 @@ public class Goods extends TscBaseDomain {
 	private String sql;
 
 	private String keyword;	// 검색엔진 로그.
+	private String itemUrl;	// 추천솔루션 상품URL
 
 }

+ 2 - 2
src/main/webapp/WEB-INF/views/mob/display/BrandMainFormMob.html

@@ -176,7 +176,7 @@
 																	<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 																	<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 																</th:block>
-																<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm}" onerror="noneImg(this)">
+																<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 															</div>
 															<p class="itemBrand" th:text="${goodsData.brandGroupNm}">BRAND NAME</p>
 															<div class="itemName"th:text="${goodsData.goodsFullNm}">남성 헤링본 기모 팬츠 헤링본 기모 팬츠</div>
@@ -262,7 +262,7 @@
 																	<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 																	<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 																</th:block>
-																<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm}" onerror="noneImg(this)">
+																<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 															</div>
 															<p class="itemBrand" th:text="${goodsData.brandGroupNm}">BRAND NAME</p>
 															<div class="itemName" th:text="${goodsData.goodsFullNm}">남성 헤링본 기모 팬츠 헤링본 기모 팬츠</div>

+ 7 - 1
src/main/webapp/WEB-INF/views/mob/display/CategoryMainFormMob.html

@@ -114,7 +114,7 @@
 														<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 														<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 													</th:block>
-													<img alt="BLUE-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm}" onerror="noneImg(this)">
+													<img alt="BLUE-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 												</div>
 												<p class="itemBrand" th:text="${item.brandGroupNm}">BRAND NAME</p>
 												<div class=" itemName" th:text="${item.goodsFullNm}">여성 체인 프린트 큐롯 스커트 프린트 큐롯 스커트</div>
@@ -236,6 +236,12 @@
 				$(this).append(tag);
 			}
 		});
+
+		function noneImg(noneSrc){
+			$(noneSrc).parents('.itemPic').css({'background':'url(/images/pc/thumb/bg_item_none.png)'});
+			$(noneSrc).css({'opacity':'0'});
+			//$(noneSrc).attr("src", no_src);
+		}
 	</script>
 
 </th:block>

+ 1 - 1
src/main/webapp/WEB-INF/views/mob/display/MallMainFormMob.html

@@ -180,7 +180,7 @@
 																			<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 																			<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 																		</th:block>
-																		<img alt="" class=" pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + bestItemData.sysImgNm}" onerror="noneImg(this)">
+																		<img alt="" class=" pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + bestItemData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 																	</div>
 																	<p class="itemBrand" th:text="${bestItemData.brandGroupNm}">TBJ</p>
 																	<div class="itemComment" th:if="${not #strings.isEmpty(bestItemData.goodsTnm)}" th:text="${bestItemData.goodsTnm}"># 가을 느낌 물씬!</div>

+ 2 - 2
src/main/webapp/WEB-INF/views/web/display/BrandMainFormWeb.html

@@ -191,7 +191,7 @@
 																<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 																<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 															</th:block>
-															<img alt="BLACK-a" class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm}" onerror="noneImg(this)">
+															<img alt="BLACK-a" class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 														</div>
 														<p class="itemBrand" th:text="${goodsData.brandGroupNm}"></p>
 														<div class="itemName" th:text="${goodsData.goodsFullNm}"></div>
@@ -271,7 +271,7 @@
 															<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 															<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 														</th:block>
-														<img alt="BLACK-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm}" onerror="noneImg(this)">
+														<img alt="BLACK-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + goodsData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 													</div>
 													<p class=" itemBrand" th:text="${goodsData.brandGroupNm}">BRAND NAME</p>
 													<div class=" itemName" th:text="${goodsData.goodsFullNm}">남성 로고 자카드 방풍 패딩 스웨터 가디건 자카드 방풍 패딩 스웨터 가디건 자카드 방풍 패딩 스웨터 가디건</div>

+ 7 - 1
src/main/webapp/WEB-INF/views/web/display/CategoryMainFormWeb.html

@@ -146,7 +146,7 @@
 													<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 													<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 												</th:block>
-												<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm}" th:alt="${item.goodsCd}" onerror="noneImg(this)"/>
+												<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" th:alt="${item.goodsCd}" onerror="noneImg(this)"/>
 											</div>
 											<p class="itemBrand" th:text="${item.brandGroupNm}">BRAND NAME</p>
 											<div class="itemName" th:text="${item.goodsFullNm}">남성 헤링본 기모 팬츠 헤링본 기모 팬츠</div>
@@ -288,6 +288,12 @@
 			$(this).append(tag);
 		}
 	});
+
+	function noneImg(noneSrc){
+		$(noneSrc).parents('.itemPic').css({'background':'url(/images/pc/thumb/bg_item_none.png)'});
+		$(noneSrc).css({'opacity':'0'});
+		//$(noneSrc).attr("src", no_src);
+	}
 /*]]>*/
 </script>
 

+ 1 - 1
src/main/webapp/WEB-INF/views/web/display/MallMainFormWeb.html

@@ -184,7 +184,7 @@
 																	<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
 																	<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
 																</th:block>
-																<img alt="BLACK-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + bestItemData.sysImgNm}" onerror="noneImg(this)">
+																<img alt="BLACK-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + bestItemData.sysImgNm.replace('//image.istyle24.com/Upload/ProductImage/','')}" onerror="noneImg(this)">
 															</div>
 															<p class=" itemBrand" th:text="${bestItemData.brandGroupNm}">BRAND NAME</p>
 															<div class="itemComment" th:unless="${bestItemData.goodsTnm == null or bestItemData.goodsTnm == ''}" th:text="${bestItemData.goodsTnm}">#데일리웨어로 매일입고싶은</div>