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

Merge branch 'eskim' into develop

eskim 5 лет назад
Родитель
Сommit
0654f7eb27

+ 20 - 12
src/main/java/com/style24/front/biz/dao/TsfCouponDao.java

@@ -58,7 +58,7 @@ public interface TsfCouponDao {
 	 * @since 2021. 03. 03
 	 */
 	Coupon getJoinCoupon(Coupon coupon);
-	
+
 	/**
 	 * 상품 쿠폰 조회
 	 * 
@@ -68,7 +68,17 @@ public interface TsfCouponDao {
 	 * @since 2021.03.11
 	 */
 	Collection<Coupon> getGoodsCouponList(Goods goods);
-	
+
+	/**
+	 * 상품 즉시할인 쿠폰 조회
+	 * 
+	 * @param goods
+	 * @return Collection<Coupon>
+	 * @author eskim
+	 * @since 2021.05.01
+	 */
+	Collection<Coupon> getGoodsCoupon1List(Goods goods);
+
 	/**
 	 * 상품 쿠폰 조회
 	 * 
@@ -78,7 +88,7 @@ public interface TsfCouponDao {
 	 * @since 2021.04.15
 	 */
 	Collection<Coupon> getGoodsEpCouponList(Goods goods);
-	
+
 	/**
 	 * 마이페이지 쿠폰 조회
 	 * 
@@ -88,7 +98,7 @@ public interface TsfCouponDao {
 	 * @since 2021.03.16
 	 */
 	Collection<Coupon> getMypageCouponList(Coupon coupon);
-	
+
 	/**
 	 * 마이페이지 (사용가능,만료예정)쿠폰 수 조회
 	 * @param coupon - 쿠폰정보
@@ -97,7 +107,7 @@ public interface TsfCouponDao {
 	 * @since 2021. 03. 16
 	 */
 	Coupon getMypageCouponInfo(Coupon coupon);
-	
+
 	/**
 	 * 마이페이지 쿠폰 디테일 정보
 	 * @param coupon - 쿠폰정보
@@ -106,7 +116,7 @@ public interface TsfCouponDao {
 	 * @since 2021. 03. 17
 	 */
 	Coupon getCouponDetailInfo(Coupon coupon);
-	
+
 	/**
 	 * 마이페이지 등급쿠폰 다운가능 쿠폰 정보 조회
 	 * 
@@ -136,8 +146,7 @@ public interface TsfCouponDao {
 	 * @since 2021.04.08
 	 */
 	Coupon getCustGradePolicyCoupon(Coupon coupon);
-	
-	
+
 	/**
 	 * 기획전 쿠폰 디테일 정보
 	 * @param coupon - 쿠폰정보
@@ -146,7 +155,7 @@ public interface TsfCouponDao {
 	 * @since 2021. 03. 17
 	 */
 	Coupon getPlanCouponDetailInfo(Coupon coupon);
-	
+
 	/**
 	 * 출석체크 쿠폰  정보
 	 * @param coupon - 쿠폰정보
@@ -155,7 +164,7 @@ public interface TsfCouponDao {
 	 * @since 2021. 04. 15
 	 */
 	CustCoupon getAttendCouponInfo(CustCoupon coupon);
-	
+
 	/**
 	 * 퀵메뉴 다운가능 쿠폰 리스트
 	 * 
@@ -165,6 +174,5 @@ public interface TsfCouponDao {
 	 * @since 2021.04.23
 	 */
 	Collection<Coupon> getQuickCouponDownList(Coupon coupon);
-	
-	
+
 }

+ 38 - 29
src/main/java/com/style24/front/biz/service/TsfCouponService.java

@@ -130,24 +130,24 @@ public class TsfCouponService {
 		cpn.setApplyScope(cpnInfo.getApplyScope());
 
 		// 쿠폰 적용 대상조건명 및 조건별 수량 조회
-		if(TscConstants.ApplyScope.INDIVIDUAL.value().equals(cpn.getApplyScope())) {
+		if (TscConstants.ApplyScope.INDIVIDUAL.value().equals(cpn.getApplyScope())) {
 			Collection<Coupon> cpnRefInfo = couponDao.getCpnRefName(cpn);
 
-			for(Coupon ref : cpnRefInfo) {
-				if(TscConstants.CpnTarget.GOODS.value().equals(ref.getCpnTarget())) {
+			for (Coupon ref : cpnRefInfo) {
+				if (TscConstants.CpnTarget.GOODS.value().equals(ref.getCpnTarget())) {
 					cpn.setRefGoodsNm(ref.getRefVal());
 					cpn.setRefGoodsCnt(ref.getCnt());
-				} else if(TscConstants.CpnTarget.BRAND.value().equals(ref.getCpnTarget())) {
-					if(ref.getCnt() > 1) {
+				} else if (TscConstants.CpnTarget.BRAND.value().equals(ref.getCpnTarget())) {
+					if (ref.getCnt() > 1) {
 						cpn.setRefBrandNm(ref.getRefVal() + " / " + ref.getSecondRefVal());
 					} else {
 						cpn.setRefBrandNm(ref.getRefVal());
 					}
 					cpn.setRefBrandCnt(ref.getCnt());
-				} else if(TscConstants.CpnTarget.COMP.value().equals(ref.getCpnTarget())) {
+				} else if (TscConstants.CpnTarget.COMP.value().equals(ref.getCpnTarget())) {
 					cpn.setRefSupplyCompNm(ref.getRefVal());
 					cpn.setRefSupplyCompCnt(ref.getCnt());
-				} else if(TscConstants.CpnTarget.CATE.value().equals(ref.getCpnTarget())) {
+				} else if (TscConstants.CpnTarget.CATE.value().equals(ref.getCpnTarget())) {
 					cpn.setRefCateNm(ref.getRefVal());
 					cpn.setRefCateCnt(ref.getCnt());
 				}
@@ -329,7 +329,18 @@ public class TsfCouponService {
 	public Collection<Coupon> getGoodsCouponList(Goods goods) {
 		return couponDao.getGoodsCouponList(goods);
 	}
-	
+
+	/**
+	 * 상품 즉시할인 쿠폰 조회
+	 * @param goods
+	 * @return
+	 * @author eskim
+	 * @since 2021.05.01
+	 */
+	public Collection<Coupon> getGoodsCoupon1List(Goods goods) {
+		return couponDao.getGoodsCoupon1List(goods);
+	}
+
 	/**
 	 * ep 쿠폰 조회
 	 * @param goods
@@ -436,7 +447,7 @@ public class TsfCouponService {
 
 		return result;
 	}
-	
+
 	/**
 	 * 마이페이지 쿠폰 조회
 	 * @param coupon
@@ -450,7 +461,7 @@ public class TsfCouponService {
 		coupon.setSiteCd(TscConstants.Site.STYLE24.value());
 		return couponDao.getMypageCouponList(coupon);
 	}
-	
+
 	/**
 	 * 마이페이지 (사용가능,만료예정)쿠폰 수 조회
 	 * @param param
@@ -464,7 +475,7 @@ public class TsfCouponService {
 		param.setSiteCd(TscConstants.Site.STYLE24.value());
 		return couponDao.getMypageCouponInfo(param);
 	}
-	
+
 	/**
 	 * 마이페이지 쿠폰 디테일 정보
 	 * @param cpnId
@@ -478,8 +489,7 @@ public class TsfCouponService {
 		coupon.setSiteCd(TscConstants.Site.STYLE24.value());
 		return couponDao.getCouponDetailInfo(coupon);
 	}
-	
-	
+
 	/**
 	 * 기획전 쿠폰 다운 처리
 	 *
@@ -497,7 +507,7 @@ public class TsfCouponService {
 		for (Coupon tmpCoupon : couponList) {
 			//int downloadCnt = tmpCoupon.getDownloadCnt();
 			for (int i = 0; i < couponList.size(); i++) {
-				if(couponList.iterator().next().getOwnCoupon()==0) {
+				if (couponList.iterator().next().getOwnCoupon() == 0) {
 					CustCoupon custCoupon = new CustCoupon();
 					custCoupon.setCustNo(tmpCoupon.getCustNo());
 					custCoupon.setCpnId(tmpCoupon.getCpnId());
@@ -610,7 +620,7 @@ public class TsfCouponService {
 		}
 		return resultCnt;
 	}
-	
+
 	/**
 	 * 기획전 쿠폰 디테일 정보
 	 * @param cpnId
@@ -623,9 +633,9 @@ public class TsfCouponService {
 		coupon.setSiteCd(TscConstants.Site.STYLE24.value());
 		return couponDao.getPlanCouponDetailInfo(coupon);
 	}
-	
-	/**
 
+	/**
+	
 	 * EP 쿠폰 다운 처리
 	 *
 	 * @param coupon
@@ -708,19 +718,18 @@ public class TsfCouponService {
 		return result;
 	}
 
-	 /* 출석체크 쿠폰  정보
-	 * @param coupon - 쿠폰정보
-	 * @return Coupon
-	 * @author sowon
-	 * @since 2021. 04. 15
-	 */
+	/* 출석체크 쿠폰  정보
+	* @param coupon - 쿠폰정보
+	* @return Coupon
+	* @author sowon
+	* @since 2021. 04. 15
+	*/
 	public CustCoupon getAttendCouponInfo(CustCoupon coupon) {
 		coupon.setSiteCd(TscConstants.Site.STYLE24.value());
 		coupon.setFrontGb(TsfSession.getFrontGb());
 		return couponDao.getAttendCouponInfo(coupon);
 	}
-	
-	
+
 	/**
 	 * 퀵메뉴 다운가능 쿠폰 리스트
 	 * 
@@ -729,7 +738,7 @@ public class TsfCouponService {
 	 * @author sowon
 	 * @since 2021.04.23
 	 */
-	public Collection<Coupon> getQuickCouponDownList(Coupon coupon){
+	public Collection<Coupon> getQuickCouponDownList(Coupon coupon) {
 		coupon.setSiteCd(TscConstants.Site.STYLE24.value());
 		coupon.setFrontGb(TsfSession.getFrontGb());
 		coupon.setCustGb(TsfSession.getCustGb());
@@ -737,7 +746,7 @@ public class TsfCouponService {
 		coupon.setCustGrade(TsfSession.getInfo().getCustGrade());
 		return couponDao.getQuickCouponDownList(coupon);
 	}
-	
+
 	/**
 	 * 퀵메뉴 쿠폰 다운
 	 *
@@ -755,14 +764,14 @@ public class TsfCouponService {
 		coupon.setCustNo(TsfSession.getInfo().getCustNo());
 		coupon.setCustGrade(TsfSession.getInfo().getCustGrade());
 		Collection<Coupon> quickCouponList = couponDao.getQuickCouponDownList(coupon);
-		
+
 		String result = "SUCESS";
 
 		if (quickCouponList == null || quickCouponList.isEmpty()) {
 			result = "ERROR_10";
 			return result;
 		}
-		
+
 		int count = 0;
 		if (coupon.getCpnId() > 0) {
 			for (Coupon quickCoupon : quickCouponList) {

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

@@ -92,7 +92,7 @@ public class TsfGoodsController extends TsfBaseController {
 
 	@Autowired
 	private TsfWishlistService wishListService;
-	
+
 	@Autowired
 	private TsfDisplayService displayService;
 
@@ -179,7 +179,7 @@ public class TsfGoodsController extends TsfBaseController {
 		mav.addObject("goodsVideoList", goodsService.getVideoList(goodsVideo));
 		// 상품 공지
 		mav.addObject("goodsNoticeList", goodsService.getGoodsNoticeList(paramsGoods));
-		
+
 		int goodsReviewCnt = 0;
 		if (TscConstants.GoodsType.DEAL.value().equals(goods.getGoodsType())) {	// 딜상품
 
@@ -202,7 +202,7 @@ public class TsfGoodsController extends TsfBaseController {
 			paramsGoods.setMaxRownum(1);
 			goodsCouponList = couponService.getGoodsCouponList(paramsGoods);
 			mav.addObject("goodsCouponList", goodsCouponList);
-			
+
 			// 다다익선
 			paramsGoods.setMaxRownum(1);
 			mav.addObject("tmtbList", goodsService.getTmtbList(paramsGoods));
@@ -210,7 +210,7 @@ public class TsfGoodsController extends TsfBaseController {
 			// 사은품
 			paramsGoods.setMaxRownum(1);
 			mav.addObject("freeGoodsList", goodsService.getFreeGoodsList(paramsGoods));
-			
+
 			// 딜용 상품평건수
 			Review review = new Review();
 			review.setGoodsCd(goods.getGoodsCd());
@@ -238,18 +238,17 @@ public class TsfGoodsController extends TsfBaseController {
 				mav.addObject("goodsNotiList", goodsService.getGoodsNotiList(goods));
 				// 상품 안전인증 정보
 				mav.addObject("goodsSafeNo", goodsService.getGoodsSafeNo(goods));
-				
 
 			} else if (TscConstants.GoodsType.SET.value().equals(goods.getGoodsType())) {		// 셋트상품
 				mav.addObject("goodsComposeList", goodsService.getGoodsSetComposeList(paramsGoods));
 			}
-			
+
 			// 룩북
 			Lookbook lookbook = new Lookbook();
 			lookbook.setGoodsCd(paramsGoods.getGoodsCd());
 			lookbook.setCustNo(paramsGoods.getCustNo());
 			mav.addObject("lookbookList", coreLookbookService.getLookbookListForGoods(lookbook));
-			
+
 			// 상품쿠폰
 			paramsGoods.setMaxRownum(1);
 			mav.addObject("goodsCouponList", couponService.getGoodsCouponList(paramsGoods));
@@ -284,9 +283,9 @@ public class TsfGoodsController extends TsfBaseController {
 			contents.setPreview(paramsGoods.getPreview());
 			contents.setViewDt(paramsGoods.getViewDt());
 			contents.setMaxRow(1);
-			if ("P".equals(paramsGoods.getFrontGb())){
+			if ("P".equals(paramsGoods.getFrontGb())) {
 				contents.setCateNo(1714);
-			}else {
+			} else {
 				contents.setCateNo(1724);
 			}
 			mav.addObject("goodsBannerList", displayService.getContentsList(contents));
@@ -611,8 +610,12 @@ public class TsfGoodsController extends TsfBaseController {
 
 				paramsGoods.setArrGoodsCd(arrGoodsCd);
 			}
-			}
-		// 쿠폰정보
+		}
+		// 상품 즉시할인 쿠폰정보
+		paramsGoods.setMaxRownum(1);
+		mav.addObject("goodsCoupon1List", couponService.getGoodsCoupon1List(paramsGoods));
+
+		// 상품 다운로드 쿠폰
 		paramsGoods.setMaxRownum(1);
 		mav.addObject("goodsCouponList", couponService.getGoodsCouponList(paramsGoods));
 		// 다다익선
@@ -1142,9 +1145,9 @@ public class TsfGoodsController extends TsfBaseController {
 			result.set("params", paramsGoods);
 			return result;
 		}
-		
+
 		log.info("createGoodsCoupon  goods {}", goods);
-		if (TscConstants.GoodsType.DEAL.value().equals(goods.getGoodsType())) { 
+		if (TscConstants.GoodsType.DEAL.value().equals(goods.getGoodsType())) {
 			Collection<Goods> goodsDealComposeList = goodsService.getGoodsDealComposeList(paramsGoods);
 			// 상품쿠폰
 			if (goodsDealComposeList != null && !goodsDealComposeList.isEmpty()) {
@@ -1158,7 +1161,7 @@ public class TsfGoodsController extends TsfBaseController {
 				paramsGoods.setArrGoodsCd(arrGoodsCd);
 			}
 		}
-		
+
 		// 쿠폰발급
 		// ERROR_10: 발급가능 쿠폰없음, 20: 발급완료 쿠폰, 30: 발급받은 쿠폰
 		//죄송합니다. 쿠폰이 모두 소진되었습니다
@@ -1332,7 +1335,7 @@ public class TsfGoodsController extends TsfBaseController {
 		mav.addObject("goodsNotiList", goodsService.getGoodsNotiList(goods));
 		// 상품 안전인증 정보
 		mav.addObject("goodsSafeNo", goodsService.getGoodsSafeNo(goods));
-		
+
 		// 상품 공통 베너
 		log.info("paramsGoods={}", paramsGoods);
 		Contents contents = new Contents();
@@ -1340,9 +1343,9 @@ public class TsfGoodsController extends TsfBaseController {
 		contents.setPreview(paramsGoods.getPreview());
 		contents.setViewDt(paramsGoods.getViewDt());
 		contents.setMaxRow(1);
-		if ("P".equals(paramsGoods.getFrontGb())){
+		if ("P".equals(paramsGoods.getFrontGb())) {
 			contents.setCateNo(1714);
-		}else {
+		} else {
 			contents.setCateNo(1724);
 		}
 		mav.addObject("goodsBannerList", displayService.getContentsList(contents));

+ 187 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfCoupon.xml

@@ -444,7 +444,7 @@
 		     , A.MAX_DC_AMT
 		     , A.CPN_TYPE
 		     , A.AVAIL_STDT
-		     , A.AVAIL_EDDT
+		    -- , A.AVAIL_EDDT
 		     , A.USABLE_CUST_GRADE
 		     , A.NEW_CUST_YN
 		     , A.CUST_JOIN_STDT 
@@ -681,6 +681,192 @@
 		</if> 
 	</select>
 	
+	<!--상품 즉시할인 쿠폰 조회-->
+	<select id="getGoodsCoupon1List" parameterType="Goods" resultType="Coupon">
+		/* TsfCoupon.getGoodsCoupon1List */
+		SELECT A.DC_AMT
+		     , A.DC_VAL
+		     , A.DC_WAY
+		     , A.CPN_ID
+		     , A.CPN_NM
+		     , A.CPN_TYPE
+		     , A.AVAIL_STDT
+		     , DATE_FORMAT(A.AVAIL_EDDT, '%Y-%m-%d') AS AVAIL_EDDT
+		     , A.GOODS_CD
+		     , RNUM
+		FROM (
+		SELECT  DISTINCT CPN_ID
+		       , CPN_NM
+		       , DC_AMT
+		       , DC_VAL
+		       , DC_WAY
+		       , CPN_TYPE
+		       , AVAIL_STDT
+		       , AVAIL_EDDT
+		       , GOODS_CD
+		       , RANK() OVER(ORDER BY DC_AMT DESC)  AS RNUM   -- 할인금액순
+		FROM   (
+		        SELECT CP.CPN_ID                                              -- 쿠폰ID
+		             , CP.CPN_NM                                              -- 쿠폰명
+		             , CP.DC_WAY                                              -- 할인방식
+		             , CP.DC_VAL                                              -- 할인값
+		             , CP.CPN_TYPE                                            -- 쿠폰타입
+		             , CP.AVAIL_STDT                                          -- 유효시작일시
+		             , CP.AVAIL_EDDT                                          -- 유효종료일시
+		             , CP.GOODS_CD                                            -- 상품코드
+		             <![CDATA[
+		             , (CASE WHEN CP.DC_WAY = 'G240_10' THEN CP.DC_VAL
+		                     ELSE FLOOR((CP.CURR_PRICE * CP.DC_VAL / 100) / #{pointUnit}) * #{pointUnit} 
+		                     END) AS DC_AMT
+		              ]]>
+		              
+		        FROM   (
+		                SELECT CP.CPN_ID
+		                     , CP.CPN_NM
+		                     , CP.DC_WAY
+		                     , (CASE WHEN 'P' = #{frontGb} THEN CP.DC_PVAL
+		                             WHEN 'M' = #{frontGb} THEN CP.DC_MVAL
+		                             ELSE CP.DC_AVAL END) AS DC_VAL
+		                     , CP.CPN_TYPE
+		                     , IF (CP.PD_GB = 'D', NOW(), CP.AVAIL_STDT) AS AVAIL_STDT
+		                     , IF (CP.PD_GB = 'D', CONCAT(CURRENT_DATE + INTERVAL Cp.AVAIL_DAYS DAY, ' 23:59:59'), CP.AVAIL_EDDT) AS AVAIL_EDDT
+		                     , G.GOODS_CD
+		                     , G.CURR_PRICE
+		                FROM   TB_GOODS G
+		                     , TB_COUPON CP
+		                WHERE 1 = 1
+		                <choose>
+		                    <when test="arrGoodsCd != null and arrGoodsCd != ''">
+		                AND G.GOODS_CD IN
+		                    <foreach collection="arrGoodsCd" item="item" index="index"  open="(" close=")" separator=",">
+		                    UPPER(#{item})
+		                    </foreach>
+		                    </when>
+		                    <otherwise>
+		                AND G.GOODS_CD = #{goodsCd}
+		                    </otherwise>
+		                </choose> 
+		                AND    CP.SITE_CD = #{siteCd}
+		                AND    CP.CPN_STAT = 'G232_11'   -- 쿠폰인 진행중인 쿠폰만
+		                <![CDATA[
+		                AND    NOW() <= IF (CP.PD_GB = 'D', CONCAT(CURRENT_DATE + INTERVAL CP.AVAIL_DAYS DAY, ' 23:59:59'), CP.AVAIL_EDDT)
+		                ]]>
+		                AND    NOW() BETWEEN CP.DOWN_STDT AND CP.DOWN_EDDT
+		                AND    CP.CPN_TYPE = 'G230_10' /*즉시할인쿠폰*/
+		                AND    CP.DC_CD_GB = 'G233_00'                         -- 일반유형(할인쿠폰구분)
+		                AND    (CASE WHEN 'P' = #{frontGb} THEN CP.DC_PVAL
+		                             WHEN 'M' = #{frontGb} THEN CP.DC_MVAL
+		                             ELSE CP.DC_AVAL END) > 0                  -- PC, MOBILE,APP 별로 0 보다 큰 쿠폰
+		                AND   (
+		                        (CP.APPLY_SCOPE = 'A' ) 
+		                        OR  /* 적용대상:상품*/
+		                        (CP.APPLY_SCOPE = 'I' AND (SELECT COUNT(1) FROM TB_COUPON_REFVAL
+		                                                   WHERE CPN_ID = CP.CPN_ID
+		                                                   AND CPN_TARGET = 'G260_10'
+		                                                   AND DEL_YN = 'N'
+		                                                   AND REF_VAL = G.GOODS_CD
+		                                                   ) > 0
+		                        ) 
+		                        OR /* 적용대상:카테고리*/
+		                        (CP.APPLY_SCOPE = 'I' AND (SELECT COUNT(1) FROM TB_COUPON_REFVAL
+		                                                   WHERE CPN_ID = CP.CPN_ID
+		                                                   AND CPN_TARGET = 'G260_11' 
+		                                                   AND DEL_YN = 'N'
+		                                                   AND IFNULL(REF_FORMAL_GB,G.FORMAL_GB) = G.FORMAL_GB
+		                                                   AND IFNULL(REF_BRAND_CD,G.BRAND_CD) = G.BRAND_CD
+		                                                   AND REF_VAL IN (SELECT DISTINCT X.CATE_NO 
+		                                                                   FROM 
+		                                                                        (SELECT LEAF_CATE_NO 
+		                                                                              , CATE_LVL 
+		                                                                              , CATE_NO
+		                                                                         FROM (
+		                                                                               SELECT LEAF_CATE_NO ,
+		                                                                                      CASE WHEN X = 1 THEN 'CATE1_NO'  -- 컬럼과 매핑(컬럼명)
+		                                                                                           WHEN X = 2 THEN 'CATE2_NO'
+		                                                                                           WHEN X = 3 THEN 'CATE3_NO'
+		                                                                                           WHEN X = 4 THEN 'CATE4_NO'
+		                                                                                           ELSE  'CATE5_NO' 
+		                                                                                      END CATE_LVL,
+		                                                                                      CASE WHEN X = 1 THEN CATE1_NO  -- 컬럼과 매핑(컬럼 데이터)
+		                                                                                           WHEN X = 2 THEN CATE2_NO
+		                                                                                           WHEN X = 3 THEN CATE3_NO
+		                                                                                           WHEN X = 4 THEN CATE4_NO
+		                                                                                           ELSE  CATE5_NO 
+		                                                                                      END CATE_NO
+		                                                                               FROM (
+		                                                                                      ( SELECT LEAF_CATE_NO
+		                                                                                             , CATE1_NO
+		                                                                                             , CATE2_NO
+		                                                                                             , CATE3_NO
+		                                                                                             , CATE4_NO
+		                                                                                             , CATE5_NO
+		                                                                                        FROM  TB_CATE_4SRCH
+		                                                                                        WHERE SITE_CD = 'G000_10'
+		                                                                                        AND CATE_TYPE = 'G031_10') A, -- 상품타입
+		                                                                                      (SELECT 1 AS X                  -- UNPIVOT 컬럼 수 만큼 선언
+		                                                                                       UNION ALL SELECT 2 AS X
+		                                                                                       UNION ALL SELECT 3 AS X
+		                                                                                       UNION ALL SELECT 4 AS X
+		                                                                                       UNION ALL SELECT 5 AS X
+		                                                                                     ) B
+		                                                                                    )  
+		                                                                               ORDER BY LEAF_CATE_NO, CATE_LVL
+		                                                                              ) K
+		                                                                              WHERE CATE_NO IS NOT NULL
+		                                                                        ) X, 
+		                                                                        (
+		                                                                         SELECT A.CATE_NO, A.GOODS_CD
+		                                                                         FROM TB_CATE_GOODS A
+		                                                                         WHERE GOODS_CD = G.GOODS_CD
+		                                                                        ) Y 
+		                                                                        WHERE X.LEAF_CATE_NO = Y.CATE_NO
+		                                                                  )
+		                                                  ) >0
+		                        ) 
+		                        OR /* 적용대상:브랜드*/
+		                        (CP.APPLY_SCOPE = 'I' AND (SELECT COUNT(1) FROM TB_COUPON_REFVAL
+		                                                   WHERE CPN_ID = CP.CPN_ID
+		                                                   AND CPN_TARGET = 'G260_12' 
+		                                                   AND DEL_YN = 'N'
+		                                                   AND REF_VAL = G.BRAND_CD
+		                                                   AND IFNULL(REF_FORMAL_GB,G.FORMAL_GB) = G.FORMAL_GB
+		                                                  ) >0
+		                        ) 
+		                        OR /* 적용대상:공급업체*/
+		                        (CP.APPLY_SCOPE = 'I' AND (SELECT COUNT(1) FROM TB_COUPON_REFVAL
+		                                                   WHERE CPN_ID = CP.CPN_ID
+		                                                   AND CPN_TARGET = 'G260_13' 
+		                                                   AND DEL_YN = 'N'
+		                                                   AND REF_VAL = G.SUPPLY_COMP_CD
+		                                                  ) >0
+		                        )
+		                      )
+		                AND NOT EXISTS (
+		                                SELECT 1
+		                                FROM   TB_COUPON_REFVAL SCPR
+		                                WHERE  SCPR.CPN_ID = CP.CPN_ID
+		                                AND    SCPR.REF_VAL = G.GOODS_CD
+		                                AND    SCPR.DEL_YN = 'N'      -- 삭제안된넘
+		                                AND    SCPR.CPN_TARGET = '40' -- 제외상품
+		                               )
+		                AND NOT EXISTS (
+		                                 SELECT 1
+		                                FROM TB_COUPON_BAN_GOODS
+		                                WHERE GOODS_CD = G.GOODS_CD
+		                                AND DEL_YN = 'N'
+		                               )
+		               ) CP
+		               WHERE 1 = 1
+		       ) Y
+		) A
+		WHERE 1 = 1
+		<if test="maxRownum != null and maxRownum > 0">
+		<![CDATA[
+		AND RNUM <= #{maxRownum}
+		]]>
+		</if> 
+	</select>
+	
 	<select id="getMypageCouponList" resultType="Coupon" parameterType="Coupon">
 		/* TsfCoupon.getMypageCouponList */
 		SELECT CC.CPN_ID                    /*쿠폰ID*/

+ 2 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfGoods.xml

@@ -78,7 +78,7 @@
 
 	<!-- 상품 정보 -->
 	<select id="getGoodsInfo" parameterType="Goods" resultType="Goods">
-		/* TsfGoods.getGoods */
+		/* TsfGoods.getGoodsInfo */
 		SELECT Z.*
 		     , 100 - ROUND((CURR_PRICE / LIST_PRICE) * 100 ,0) AS DC_RATE 
 		     , ((PNT_RATE * CURR_PRICE) / 100) AS PNT_AMT
@@ -1109,6 +1109,7 @@
 		      AND  A.FREEGIFT_STAT = 'G232_11'
 		      AND E.TARGET_VAL IS NULL
 		      AND A.DEL_YN = 'N'
+		      ORDER BY A.FREEGIFT_SQ, B.FREEGIFT_SECTION_SQ, C.FREEGIFT_VAL_SQ
 		) Z
 		WHERE 1 = 1
 		<if test="maxRownum != null and maxRownum > 0">

+ 4 - 2
src/main/webapp/WEB-INF/views/web/goods/GoodsDealDetailFormWeb.html

@@ -656,8 +656,10 @@
 			$('.pd_detail .opt_select .select_custom.deal_opt_item').find('.combo .select').html(dTag);
 			$('.pd_desc_wrap .opt_select .select_custom.deal_opt_item').find('.combo .select').html(dTag);
 			//$('.pd_descrp_pop .form_field .select_custom.deal_opt_item').find('.combo .select').html(dTag);
-
-			$('.form_field .select_custom.deal_opt1').attr('disabled', true);
+			if (flag  != "layer"){
+				$('.form_field .select_custom.deal_opt1').attr('disabled', true);
+				//$('.form_field .select_custom.deal_opt1').find('.combo .select').html('옵션1선택');	
+			}
 			$('.form_field .select_custom.deal_opt1').find('.combo .select').html('옵션1선택');
 			$('.form_field .select_custom.deal_opt2').attr('disabled', true);
 			$('.form_field .select_custom.deal_opt2').find('.combo .select').html('옵션2선택');

+ 18 - 6
src/main/webapp/WEB-INF/views/web/goods/GoodsDetailFormWeb.html

@@ -1348,24 +1348,36 @@
 				if (selfGoodsYn == "Y"){
 					if (ridx == 1){
 						var opt_selecter02_1 = new sCombo('.opt_set_select .select_custom.item_opt2.item_opt2_1');
-						$('.opt_set_select .select_custom.item_opt2.item_opt2_1').find('.combo .select').trigger('click');
+						//$('.opt_set_select .select_custom.item_opt2.item_opt2_1').find('.combo .select').trigger('click');
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_1").addClass("on");
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_1").children(".combo").children(".list").css("display", "block");
 					}else if (ridx == 2){
 						var opt_selecter02_2 = new sCombo('.opt_set_select .select_custom.item_opt2.item_opt2_2');
-						$('.opt_set_select .select_custom.item_opt2.item_opt2_2').find('.combo .select').trigger('click');
+						//$('.opt_set_select .select_custom.item_opt2.item_opt2_2').find('.combo .select').trigger('click');
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_2").addClass("on");
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_2").children(".combo").children(".list").css("display", "block");
 					}else if (ridx == 3){
 						var opt_selecter02_3 = new sCombo('.opt_set_select .select_custom.item_opt2.item_opt2_3');
-						$('.opt_set_select .select_custom.item_opt2.item_opt2_3').find('.combo .select').trigger('click');
+						//$('.opt_set_select .select_custom.item_opt2.item_opt2_3').find('.combo .select').trigger('click');
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_3").addClass("on");
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_3").children(".combo").children(".list").css("display", "block");
 					}else if (ridx == 4){
 						var opt_selecter02_4 = new sCombo('.opt_set_select .select_custom.item_opt2.item_opt2_4');
-						$('.opt_set_select .select_custom.item_opt2.item_opt2_4').find('.combo .select').trigger('click');
+						//$('.opt_set_select .select_custom.item_opt2.item_opt2_4').find('.combo .select').trigger('click');
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_4").addClass("on");
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_4").children(".combo").children(".list").css("display", "block");
 					}else{
 						var opt_selecter02_5 = new sCombo('.opt_set_select .select_custom.item_opt2.item_opt2_5');
-						$('.opt_set_select .select_custom.item_opt2.item_opt2_5').find('.combo .select').trigger('click');
+						//$('.opt_set_select .select_custom.item_opt2.item_opt2_5').find('.combo .select').trigger('click');
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_5").addClass("on");
+						$('.pd_detail .item_detail .opt_set_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_5").children(".combo").children(".list").css("display", "block");
 					}
 					
 				}else{
 					var opt_selecter02 = new sCombo('.opt_select .select_custom.item_opt2.item_opt2_1');
-					$('.opt_select .select_custom.item_opt2.item_opt2_1').find('.combo .select').trigger('click');
+					$('.pd_detail .item_detail .opt_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_1").addClass("on");
+					$('.pd_detail .item_detail .opt_select .set_option .list li').closest(".form_field").siblings(".form_field").children(".item_opt2.item_opt2_1").children(".combo").children(".list").css("display", "block");
+					//$('.opt_select .select_custom.item_opt2.item_opt2_1').find('.combo .select').trigger('click');
 					
 				}	
 			}

+ 7 - 4
src/main/webapp/WEB-INF/views/web/goods/GoodsShopBenefitFormWeb.html

@@ -21,7 +21,7 @@
 		</div>
 		<div class="modal-body">
 			<div class="pop_cont">
-				<div class="benefit_blk" th:if="${(goodsCouponList != null and !goodsCouponList.empty) or (goodsInfo.prePntUsableYn == 'Y')}">
+				<div class="benefit_blk" th:if="${(goodsCouponList != null and !goodsCouponList.empty) or (goodsCoupon1List != null and !goodsCoupon1List.empty)}">
 					<h6>할인혜택</h6>
 					<div class="tbl type1">
 						<table>
@@ -30,9 +30,12 @@
 								<col width="*">
 							</colgroup>
 							<tbody>
-								<tr th:if="${(goodsInfo.prePntUsableYn == 'Y')}">
-									<th>즉시 할인</th>
-									<td th:text="|${#numbers.formatInteger(goodsInfo.pntAmt, 0,'COMMA')}원 할인|">50% 할인</td>
+								<tr th:if="${(goodsCoupon1List != null and !goodsCoupon1List.empty)}">
+									<th>즉시할인</th>
+									<td th:each="goodsCoupon, status : ${goodsCoupon1List}" th:if="${status.first}">최대
+									<th:block th:if="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${#numbers.formatInteger(goodsCoupon.dcVal, 0,'COMMA')}원|"></th:block>
+									<th:block th:unless="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${goodsCoupon.dcVal}%|"></th:block>
+									 할인</td>
 								</tr>
 								<tr th:if="${(goodsCouponList != null and !goodsCouponList.empty)}">
 									<th>쿠폰할인</th>