|
|
@@ -2,20 +2,26 @@ package com.style24.front.biz.web;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import com.style24.core.biz.service.TscEnvsetService;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
import com.style24.core.support.message.TscMessageByLocale;
|
|
|
import com.style24.front.biz.service.TsfGoodsService;
|
|
|
import com.style24.front.support.controller.TsfBaseController;
|
|
|
+import com.style24.front.support.env.TsfConstants;
|
|
|
import com.style24.front.support.security.session.TsfSession;
|
|
|
+import com.style24.persistence.domain.CardPromotion;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import com.gagaframework.web.util.GagaCookieUtil;
|
|
|
+
|
|
|
/**
|
|
|
* 상품 Controller
|
|
|
*
|
|
|
@@ -33,8 +39,12 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
@Autowired
|
|
|
private TsfGoodsService goodsService;
|
|
|
|
|
|
-// @Autowired
|
|
|
-// private TsfPolicyService policyService;
|
|
|
+ @Autowired
|
|
|
+ private TscEnvsetService envsetService;
|
|
|
+
|
|
|
+ @Value("${has-ssl}")
|
|
|
+ private String hasSsl;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 상품상세
|
|
|
@@ -60,12 +70,12 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
|
|
|
// 상품관련 기본값 설정(회원 등급, 앱, PC/모바일 등)
|
|
|
setGoods(paramsGoods);
|
|
|
-//
|
|
|
-// String mobileYn = paramsGoods.getMobileYn();
|
|
|
-// if ("Y".equals(mobileYn)) {
|
|
|
-// paramsGoods.setFrontGb("M");
|
|
|
-// }
|
|
|
-//
|
|
|
+
|
|
|
+ String mobileYn = paramsGoods.getMobileYn();
|
|
|
+ if ("Y".equals(mobileYn)) {
|
|
|
+ paramsGoods.setFrontGb("M");
|
|
|
+ }
|
|
|
+
|
|
|
Goods goods = goodsService.getGoodsInfo(paramsGoods);
|
|
|
|
|
|
if (goods == null || goods.getGoodsCd().isEmpty()) {
|
|
|
@@ -76,12 +86,20 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
}
|
|
|
return mav;
|
|
|
}
|
|
|
-//
|
|
|
-// // 다른컬러보기용 업체코드 인자 처리
|
|
|
-// paramsGoods.setSupplyCompCd(goods.getSupplyCompCd());
|
|
|
-// paramsGoods.setGoodsType(goods.getGoodsType());
|
|
|
-// paramsGoods.setFormalGb(goods.getFormalGb());
|
|
|
-// //
|
|
|
+
|
|
|
+ // 상품 상세
|
|
|
+ goods = goodsService.getGoodsDesc(goods);
|
|
|
+ // 핫딜정보
|
|
|
+ Goods socialGoods = goodsService.getSocialGoods(goods);
|
|
|
+ if (socialGoods != null && !StringUtils.isBlank(socialGoods.getGoodsCd())) {
|
|
|
+ goods.setSocialSq(socialGoods.getSocialSq());
|
|
|
+ goods.setSocialTnm(socialGoods.getSocialTnm());
|
|
|
+ goods.setSocialEddt(socialGoods.getSocialEddt());
|
|
|
+ goods.setSocialSq(socialGoods.getSocialSq());
|
|
|
+ }
|
|
|
+ // 예약판매정보
|
|
|
+ goods = goodsService.getGoodsResSell(goods);
|
|
|
+
|
|
|
// 상품 기본정보
|
|
|
mav.addObject("goodsInfo", goods);
|
|
|
// 상품 네비정보
|
|
|
@@ -98,15 +116,13 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
mav.addObject("goodsExtendList", goodsService.getGoodsDealComposeList(paramsGoods));
|
|
|
} else {
|
|
|
if ("N".equals(goods.getGoodsType())) { // 일반상품
|
|
|
- // 상품 옵션1 정보
|
|
|
- mav.addObject("goodsOtherColorList", goodsService.getGoodsOption1List(paramsGoods));
|
|
|
- // 상품 사이즈정보
|
|
|
- mav.addObject("goodsSizeList", goodsService.getGoodsSizeList(paramsGoods));
|
|
|
+ // 상품 옵션1(색상) 정보
|
|
|
+ mav.addObject("goodsOption1List", goodsService.getGoodsOption1List(paramsGoods));
|
|
|
+ // 상품 옵션2(사이즈) 정보
|
|
|
+ mav.addObject("goodsOption2List", goodsService.getGoodsOption2List(paramsGoods));
|
|
|
|
|
|
// // 상품 고시정보
|
|
|
-// mav.addObject("goodsNotiList", goodsService.getGoodsNotiList(goods));
|
|
|
-// // 상품 부위별 사이즈정보
|
|
|
-// mav.addObject("goodsRegionSizeHtml", goodsService.getGoodsRegionsizeList(paramsGoods));
|
|
|
+ mav.addObject("goodsNotiList", goodsService.getGoodsNotiList(goods));
|
|
|
|
|
|
} else if ("S".equals(goods.getGoodsType())) { // 셋트상품
|
|
|
// mav.addObject("goodsExtendList", goodsService.getGoodsSetExtendList(paramsGoods));
|
|
|
@@ -116,39 +132,40 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
}
|
|
|
//
|
|
|
// // 상품포인트사용방법
|
|
|
-// mav.addObject("goodsPointMothod", policyService.getPointMothod(TsfConstants.SITE_CD)); // A:정액, R:정율
|
|
|
+// mav.addObject("goodsPointMothod", envsetService.getPointMothod(TscConstants.Site.STYLE24.value())); // A:정액, R:정율
|
|
|
// // 상품포인트절사단위
|
|
|
// mav.addObject("goodsPointUnit", paramsGoods.getPointUnit()); // 10:원단위절사(int)
|
|
|
// // 상품평노출여부 - 미사용
|
|
|
-// //mav.addObject("reviewDisplayYn", policyService.getReviewDisplayYn(TsfConstants.SITE_CD));
|
|
|
-//
|
|
|
-// // 무이자 혜택안내 -- 배너 미사용
|
|
|
-// TsfCardInstallment cardInstallment = new TsfCardInstallment();
|
|
|
-// cardInstallment.setImonths99SkipYn("Y");
|
|
|
-// mav.addObject("cardInfoList", goodsService.getCardInfoList(cardInstallment));
|
|
|
-//
|
|
|
-// // 오늘본 상품 쿠키 담기
|
|
|
-// // SSL Server
|
|
|
-// boolean isSslServer = Boolean.parseBoolean(hasSsl);
|
|
|
-// log.debug("isSslServer: [{}]", isSslServer);
|
|
|
+// //mav.addObject("reviewDisplayYn", envsetService.getReviewDisplayYn(TsfConstants.SITE_CD));
|
|
|
//
|
|
|
-// //기존쿠키 가져오기
|
|
|
-// setTodayGoodsCd(paramsGoods);
|
|
|
-//
|
|
|
-// mav.addObject("params", paramsGoods);
|
|
|
-// if ("D".equals(goods.getGoodsType())) {
|
|
|
-// if ("Y".equals(mobileYn)) {
|
|
|
-// mav.setViewName("mob/goods/GoodsDealFormMob");
|
|
|
-// } else {
|
|
|
-// mav.setViewName(super.getDeviceViewName("goods/GoodsDealForm"));
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// if ("Y".equals(mobileYn)) {
|
|
|
-// mav.setViewName("mob/goods/GoodsDetailFormMob");
|
|
|
-// } else {
|
|
|
-// mav.setViewName(super.getDeviceViewName("goods/GoodsDetailForm"));
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // 카드 혜택안내
|
|
|
+ CardPromotion cardPromotion = new CardPromotion();
|
|
|
+ cardPromotion.setRegNo(1); // 혜택유형별로 1건씩
|
|
|
+ mav.addObject("cardInfoList", goodsService.getCardPromotionList(cardPromotion));
|
|
|
+
|
|
|
+ // 오늘본 상품 쿠키 담기
|
|
|
+ // SSL Server
|
|
|
+ boolean isSslServer = Boolean.parseBoolean(hasSsl);
|
|
|
+ //log.info("isSslServer: [{}]", isSslServer);
|
|
|
+
|
|
|
+ //기존쿠키 가져오기
|
|
|
+ setTodayGoodsCd(paramsGoods);
|
|
|
+
|
|
|
+ mav.addObject("params", paramsGoods);
|
|
|
+
|
|
|
+ if ("D".equals(goods.getGoodsType())) {
|
|
|
+ if ("Y".equals(mobileYn)) {
|
|
|
+ mav.setViewName("mob/goods/GoodsDealFormMob");
|
|
|
+ } else {
|
|
|
+ mav.setViewName(super.getDeviceViewName("goods/GoodsDealForm"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ("Y".equals(mobileYn)) {
|
|
|
+ mav.setViewName("mob/goods/GoodsDetailFormMob");
|
|
|
+ } else {
|
|
|
+ mav.setViewName(super.getDeviceViewName("goods/GoodsDetailForm"));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return mav;
|
|
|
}
|
|
|
@@ -164,9 +181,9 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
goods.setFrontGb(TsfSession.getFrontGb());
|
|
|
goods.setIsApp(TsfSession.getAttribute("isApp")); //앱여부 true
|
|
|
goods.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
-// goods.setSoldoutGoodsDisplayYn(policyService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value())); // 품절상품노출여부
|
|
|
-// goods.setPointUnit(policyService.getPointUnit(TscConstants.Site.STYLE24.value())); // 10:원단위절사(int)
|
|
|
-// goods.setFloorUnit(policyService.getPointUnit(TscConstants.Site.STYLE24.value()));
|
|
|
+// goods.setSoldoutGoodsDisplayYn(envsetService.getSoldoutGoodsDisplayYn(TscConstants.Site.STYLE24.value())); // 품절상품노출여부
|
|
|
+// goods.setPointUnit(envsetService.getPointUnit(TscConstants.Site.STYLE24.value())); // 10:원단위절사(int)
|
|
|
+// goods.setFloorUnit(envsetService.getPointUnit(TscConstants.Site.STYLE24.value()));
|
|
|
// 회원 구분
|
|
|
if (TsfSession.getInfo() != null) {
|
|
|
goods.setCustGb(TsfSession.getInfo().getCustGb());
|
|
|
@@ -179,4 +196,50 @@ public class TsfGoodsController extends TsfBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 상품 쿠키 생성
|
|
|
+ *
|
|
|
+ * @param paramsGoods
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 2. 17.
|
|
|
+ */
|
|
|
+ private void setTodayGoodsCd(Goods paramsGoods) {
|
|
|
+ String ckGoodsCd = GagaCookieUtil.getCookie(TsfSession.getHttpServletRequest(), TsfConstants.CK_PREFIX + "_today_goodsCd");
|
|
|
+ //log.info("[detail] ckGoodsCd = {}", ckGoodsCd);
|
|
|
+ String arrGetCkGoodsCd[] = ckGoodsCd.split("\\,");
|
|
|
+ String setCkGoodsCd = "";
|
|
|
+ StringBuilder ckGoodsCdSb = new StringBuilder();
|
|
|
+ if (arrGetCkGoodsCd.length > 0) {
|
|
|
+ for (String cookieGoodsCd : arrGetCkGoodsCd) {
|
|
|
+ if (!cookieGoodsCd.equals(paramsGoods.getGoodsCd()) && !StringUtils.isBlank(cookieGoodsCd)) {
|
|
|
+ ckGoodsCdSb.append(cookieGoodsCd).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ckGoodsCdSb.insert(0, ",");
|
|
|
+ ckGoodsCdSb.insert(0, paramsGoods.getGoodsCd());
|
|
|
+ } else {
|
|
|
+ ckGoodsCdSb.append(paramsGoods.getGoodsCd()).append(",");
|
|
|
+ }
|
|
|
+ setCkGoodsCd = ckGoodsCdSb.toString();
|
|
|
+ setCkGoodsCd = setCkGoodsCd.substring(0, setCkGoodsCd.lastIndexOf(","));
|
|
|
+
|
|
|
+ // 오늘본 상품 최대 30개 처리
|
|
|
+ String arrSetCkGoodsCd[] = setCkGoodsCd.split("\\,");
|
|
|
+ if (arrSetCkGoodsCd.length > 30) {
|
|
|
+ ckGoodsCdSb.setLength(0);
|
|
|
+ for (String tempSetCkGoodsCd : arrSetCkGoodsCd) {
|
|
|
+ ckGoodsCdSb.append(tempSetCkGoodsCd).append(",");
|
|
|
+ }
|
|
|
+ setCkGoodsCd = ckGoodsCdSb.toString();
|
|
|
+ setCkGoodsCd = setCkGoodsCd.substring(0, setCkGoodsCd.lastIndexOf(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ //log.info("[detail] setCkGoodsCd = {}", setCkGoodsCd);
|
|
|
+
|
|
|
+ // if (isSslServer) {
|
|
|
+ // GagaCookieUtil.setSecureCookie(TsfSession.getHttpServletResponse(), TsfConstants.CK_PREFIX + "_today_goodsCd", setCkGoodsCd, 1);
|
|
|
+ // } else {
|
|
|
+ GagaCookieUtil.setCookie(TsfSession.getHttpServletResponse(), TsfConstants.CK_PREFIX + "_today_goodsCd", setCkGoodsCd, 24 * 60 * 60);
|
|
|
+ // }
|
|
|
+ }
|
|
|
}
|