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

Merge remote-tracking branch 'origin/order' into xodud1202

xodud1202 5 лет назад
Родитель
Сommit
82efb10ef2

+ 10 - 1
src/main/java/com/style24/front/biz/dao/TsfCouponDao.java

@@ -105,7 +105,16 @@ public interface TsfCouponDao {
 	 * @since 2021.03.24
 	 */
 	Collection<Coupon> getPlanCouponInfo(Coupon coupon);
-	
+
+	/**
+	 * 등급정책 쿠폰 정보
+	 *
+	 * @param coupon - 쿠폰정보
+	 * @return Coupon
+	 * @author jsshin
+	 * @since 2021.04.08
+	 */
+	Coupon getCustGradePolicyCoupon(Coupon coupon);
 	
 	
 }

+ 3 - 0
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -9,6 +9,8 @@ import com.style24.persistence.domain.WishList;
 
 import java.util.Collection;
 
+import org.springframework.stereotype.Repository;
+
 /**
  * 고객(회원) Dao
  * 
@@ -16,6 +18,7 @@ import java.util.Collection;
  * @since 2020. 12. 29
  */
 @ShopDs
+@Repository
 public interface TsfCustomerDao {
 
 	/**

+ 41 - 1
src/main/java/com/style24/front/biz/service/TsfCouponService.java

@@ -494,5 +494,45 @@ public class TsfCouponService {
 		return count;
 	}
 
-	
+	/**
+	 * 등급쿠폰 발급
+	 *
+	 * @param cpnId - 쿠폰 아이디
+	 * @return int - 결과
+	 * @author jsshin
+	 * @since 2021.04.08
+	 */
+	public int saveCustGradeCoupon(String cpnId) {
+		int resultCnt = 0;
+		if (org.apache.commons.lang3.StringUtils.isNotBlank(cpnId)) {
+			Coupon params = new Coupon();
+			Coupon custGradeCoupon = couponDao.getCustGradePolicyCoupon(params);
+
+			if (custGradeCoupon != null) {
+				CustCoupon custCoupon = new CustCoupon();
+				custCoupon.setCpnId(custGradeCoupon.getCpnId());
+				custCoupon.setAvailStdt(custGradeCoupon.getAvailStdt());
+				custCoupon.setAvailEddt(custGradeCoupon.getAvailEddt());
+				custCoupon.setPubReason(TscConstants.PubReason.CHANGE_CUSTOMER_GRADE.value());
+				custCoupon.setEndAlimSendYn("N");		// 알림 발송 여부(발송되면 Y)
+				custCoupon.setUpdNo(custGradeCoupon.getCustNo());
+				custCoupon.setRegNo(custGradeCoupon.getCustNo());
+			}
+
+			resultCnt = 1;
+		}
+		return resultCnt;
+	}
+
+	/**
+	 * 생일쿠폰 발급
+	 *
+	 * @param cpnId - 쿠폰 아이디
+	 * @return int - 결과
+	 * @author jsshin
+	 * @since 2021.04.08
+	 */
+	public int saveCustBirthDayCoupon(String cpnId) {
+		return 0;
+	}
 }

+ 33 - 8
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -635,7 +635,7 @@ public class TsfCustomerService {
 	/**
 	 * 위시리스트 삭제처리
 	 *
-	 * @param paramList - 고객 일련번호
+	 * @param wishlist - 고객 일련번호
 	 * @return void
 	 * @author eskim
 	 * @since 2021. 03. 08
@@ -985,17 +985,42 @@ public class TsfCustomerService {
 		return result;
 	}
 
+
+	/*
+	 * 정책 등급쿠폰 발급
+	 *
+	 * @param  custGrade - 고객번호
+	 * @return CustGrade
+	 * @author jsshin
+	 * @since 2021. 04. 06
+	 */
 	public GagaMap downloadCustGradeCoupon(Integer custNo) {
 		GagaMap result = new GagaMap();
 		Customer custInfo = getCustomerFindByCustNo(custNo);
-		// TB_CUST_GRADE_POLICY
-
-		// 1. 등급정책 정보
-		// 1.1 WELCOME 첫번째 쿠폰은 무시
-		// 1.2 두번쨰 쿠폰은 저장
-		// 1.3 세번째 쿠폰은 생일 쿠폰이여서 생일 판단 후 등록
-
+		CustGrade params = new CustGrade();
+		params.setCustNo(custInfo.getCustNo());
+		params.setSiteCd(custInfo.getSiteCd());
+		params.setGradeCd(custInfo.getCustGrade());
+		List<CustGrade> custGradeCollection = (List<CustGrade>)customerDao.getCustGradePolicy(params);
+		CustGrade custGrade = custGradeCollection.get(0);
+
+		// WELCOME 등급 첫 번째 쿠폰은 회원가입시 쿠폰
+		if (TscConstants.CustGrade.WELCOME.value().equals(custGrade.getGradeCd())) {
+			custGrade.setGradeCpnId1("");
+			// 1. 회원등급 정책 쿠폰1, 쿠폰2 발급
+			int gradeCpn1 = couponService.saveCustGradeCoupon(custGrade.getGradeCpnId1());
+			int gradeCpn2 = couponService.saveCustGradeCoupon(custGrade.getGradeCpnId2());
+
+			// 2. 생일쿠폰 발급
+			int birthCpn = 0;
+			if (StringUtils.isNotBlank(custInfo.getBirthYmd()) && custInfo.getBirthYmd().length() > 7) {
+				birthCpn = couponService.saveCustBirthDayCoupon(custGrade.getGradeCpnId3());
+			}
+			result.setInt("gradeCpn1", gradeCpn1);
+			result.setInt("gradeCpn2", gradeCpn2);
+			result.setInt("birthCpn", birthCpn);
 
+		}
 		return result;
 	}
 }

+ 3 - 0
src/main/java/com/style24/front/biz/web/TsfGoodsController.java

@@ -135,7 +135,10 @@ public class TsfGoodsController extends TsfBaseController {
 		if (StringUtils.isEmpty(paramsGoods.getColorCd())) {
 			paramsGoods.setColorCd(goods.getMainColorCd());
 			paramsGoods.setOptCd1(goods.getMainColorCd());
+		}else {
+			paramsGoods.setOptCd1(paramsGoods.getColorCd());
 		}
+		
 		paramsGoods.setSelfGoodsYn(goods.getSelfGoodsYn());
 		if (TscConstants.GoodsType.DEAL.value().equals(goods.getGoodsType()) || TscConstants.GoodsType.SET.value().equals(goods.getGoodsType())) {
 			paramsGoods.setColorCd("XX");

+ 1 - 1
src/main/java/com/style24/front/support/security/handler/TsfLoginSuccessHandler.java

@@ -144,7 +144,7 @@ public class TsfLoginSuccessHandler implements AuthenticationSuccessHandler {
 		// 상품상세 바로구매 > 로그인 한 경우
 		if (returnUrl.indexOf(GOODS_DETAIL_FORM) > -1)  {
 			if (StringUtils.isNotBlank(cartSqArr)) {
-				returnUrl = "/order/form?cartSqArr="+ cartSqArr;
+				returnUrl = "/order/noMember?cartSqArr="+ cartSqArr;
 			}
 		}
 

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

@@ -164,6 +164,7 @@
 		     , CP.END_ALIM_YN
 		     , CASE WHEN #{frontGb} = 'P' THEN CP.DC_PVAL
 		            WHEN #{frontGb} = 'M' THEN CP.DC_MVAL
+		            WHEN #{frontGb} = 'A' THEN CP.DC_AVAL
 		            ELSE CP.DC_AVAL                                              END AS DC_VAL
 		     , CASE WHEN CP.PD_GB = 'D' THEN DATE_FORMAT(NOW(), '%Y%m%d%H%i%S')
 		            ELSE DATE_FORMAT(CP.AVAIL_STDT, '%Y%m%d%H%i%S')              END AS AVAIL_STDT
@@ -703,6 +704,31 @@
 						) A
 				) Z
 		 <!-- WHERE Z.DOWNLOAD_CNT <![CDATA[>=]]> 0 -->
-	
 	</select>
+
+	<!--회원등급쿠폰 정보-->
+	<select id="getCustGradePolicyCoupon" parameterType="Coupon" resultType="Coupon">
+		/*TsfCoupon.getCustGradePolicyCoupon*/
+		SELECT CP.CPN_ID
+		     , CP.END_ALIM_YN
+		     , CASE WHEN #{frontGb} = 'P' THEN CP.DC_PVAL
+		            WHEN #{frontGb} = 'M' THEN CP.DC_MVAL
+		            WHEN #{frontGb} = 'A' THEN CP.DC_AVAL
+		            ELSE CP.DC_AVAL
+		       END                                       AS DC_VAL
+		     , DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH)+ INTERVAL 1 DAY, '%Y%m%d%H%i%S') AS AVAIL_STDT
+		     , DATE_FORMAT(CONCAT(LAST_DAY(NOW()), ' 23:59:59'), '%Y%m%d%H%i%S')               AS AVAIL_EDDT
+		FROM  TB_COUPON CP
+		WHERE CP.CPN_ID = #{cpnId}
+		AND   CP.SITE_CD = #{siteCd}
+		AND   NOT EXISTS (
+		                  SELECT 1
+		                  FROM   TB_CUST_COUPON CC
+		                  WHERE  CC.CPN_ID = CP.CPN_ID
+		                  AND    CC.CUST_NO = #{custNo}
+		                  AND    CC.REG_DT >= DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH)+ INTERVAL 1 DAY, '%Y%m%d%H%i%S')
+		                  AND    CC.REG_DT <![CDATA[<=]]> DATE_FORMAT(CONCAT(LAST_DAY(NOW()), ' 23:59:59'), '%Y%m%d%H%i%S')
+		                  )
+	</select>
+
 </mapper>

+ 3 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -588,6 +588,9 @@
 		FROM  TB_CUST_GRADE_POLICY
 		WHERE SITE_CD = #{siteCd}
 		AND   USE_YN = 'Y'
+		<if test="gradeCd != null and gradeCd != ''">
+		AND   GRADE_CD = #{gradeCd}
+		</if>
 		ORDER BY GRADE_CD
 	</select>
 	

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

@@ -125,7 +125,7 @@
 										<span class="save_point" th:if="${goodsInfo.pntAmt > 0}">
 											스타일포인트 <th:block th:text="${#numbers.formatInteger(goodsInfo.pntAmt, 0,'COMMA')}"></th:block>P 적립예정
 										</span>
-										<button type="button" id="btn_saleCoupon_pop" class="btn btn_primary btn_sm btn_coupon"  th:if="${goodsCouponList != null and !goodsCouponList.empty}" th:onclick="cfGoodsCouponInfo([[${goodsInfo.goodsCd}]],[[${goodsInfo.goodsType})"><span>쿠폰받기</span></button>
+										<button type="button" id="btn_saleCoupon_pop" class="btn btn_primary btn_sm btn_coupon"  th:if="${goodsCouponList != null and !goodsCouponList.empty}" th:onclick="cfGoodsCouponInfo([[${goodsInfo.goodsCd}]],[[${goodsInfo.goodsType}]])"><span>쿠폰받기</span></button>
 									</div>
 								</div>
 								<div class="desc_status" th:if="${not #strings.isEmpty(goodsInfo.delvResDt) }">

+ 0 - 2
src/main/webapp/WEB-INF/views/web/mypage/MypageCreListFormWeb.html

@@ -284,8 +284,6 @@
 				tag += '							</div>\n';
 				tag += '							<div class="goods_cont">\n';
 				$.each(creList.creList, function (index, cre) {
-					console.log(index);
-					console.log(cre);
 					tag += '								<!-- 주문상품1 -->\n';
 					tag += '								<div class="goods_info">\n';
 					tag += '									<div class="order_desc">\n';

+ 2 - 2
src/main/webapp/WEB-INF/views/web/order/OrderFormWeb.html

@@ -26,7 +26,7 @@
 <script type="text/javascript" src="/biz/payment.js"></script>
 
 <!-- 주문정보form -->
-<form id="order_info" name="order_info" method="post" action="/order/pay/result/response" ></form>
+<form id="order_info" name="order_info" method="post" action="/order/pay/result/response" style="display:none"></form>
 <!-- //주문정보form -->
 
 <!-- 주문금액정보표현 -->
@@ -1071,7 +1071,7 @@ var paymentInfoSet = function() {
 							
 							var pgGb = $("#order_info input[name=pgGb]").val();
 							
-							if (pgGb == "NAVFER") {
+							if (pgGb == "NAVER") {
 								fnNaverPaymentReady();
 							} else if (pgGb == "KAKAO") {
 								fnKakaoPaymentReady();