Sfoglia il codice sorgente

Merge branch 'develop' into bin2107

bin2107 5 anni fa
parent
commit
2867d26626

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

@@ -106,6 +106,16 @@ public interface TsfCouponDao {
 	 */
 	Collection<Coupon> getPlanCouponInfo(Coupon coupon);
 
+	/**
+	 * 등급정책 쿠폰 발급 여부(지급월 1일 ~ 말일)
+	 *
+	 * @param coupon - 쿠폰정보
+	 * @return Coupon
+	 * @author jsshin
+	 * @since 2021.04.08
+	 */
+	int getCustGradePolicyCouponCount(Coupon coupon);
+
 	/**
 	 * 등급정책 쿠폰 정보
 	 *

+ 10 - 21
src/main/java/com/style24/front/biz/service/TsfCouponService.java

@@ -309,6 +309,7 @@ public class TsfCouponService {
 			custCoupon.setEndAlimSendYn("N");		// 알림 발송 여부(발송되면 Y)
 			custCoupon.setUpdNo(coupon.getCustNo());
 			custCoupon.setRegNo(coupon.getCustNo());
+			coreCouponDao.saveCouponCustPub(custCoupon);
 		}
 	}
 
@@ -497,42 +498,30 @@ public class TsfCouponService {
 	/**
 	 * 등급쿠폰 발급
 	 *
-	 * @param cpnId - 쿠폰 아이디
+	 * @param coupon - 쿠폰 아이디, 고객번호
 	 * @return int - 결과
 	 * @author jsshin
 	 * @since 2021.04.08
 	 */
-	public int saveCustGradeCoupon(String cpnId) {
+	@Transactional("shopTxnManager")
+	public int saveCustGradeCoupon(Coupon coupon) {
 		int resultCnt = 0;
-		if (org.apache.commons.lang3.StringUtils.isNotBlank(cpnId)) {
-			Coupon params = new Coupon();
-			Coupon custGradeCoupon = couponDao.getCustGradePolicyCoupon(params);
-
+		if (coupon.getCpnId() > 0) {
+			Coupon custGradeCoupon = couponDao.getCustGradePolicyCoupon(coupon);
 			if (custGradeCoupon != null) {
 				CustCoupon custCoupon = new CustCoupon();
+				custCoupon.setCustNo(coupon.getCustNo());
 				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());
+				custCoupon.setUpdNo(coupon.getCustNo());
+				custCoupon.setRegNo(coupon.getCustNo());
+				resultCnt = coreCouponDao.saveCouponCustPub(custCoupon);
 			}
-
-			resultCnt = 1;
 		}
 		return resultCnt;
 	}
 
-	/**
-	 * 생일쿠폰 발급
-	 *
-	 * @param cpnId - 쿠폰 아이디
-	 * @return int - 결과
-	 * @author jsshin
-	 * @since 2021.04.08
-	 */
-	public int saveCustBirthDayCoupon(String cpnId) {
-		return 0;
-	}
 }

+ 45 - 21
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -7,6 +7,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
+import com.gagaframework.web.util.GagaDateUtil;
 import com.style24.persistence.domain.CustGrade;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -689,6 +690,8 @@ public class TsfCustomerService {
 		GagaMap resultMap = new GagaMap();
 		customer.setRegNo(customer.getCustNo());
 		customer.setUpdNo(customer.getCustNo());
+		customer.setHypenCellPhone();
+		customer.encryptData();
 		boolean isSuccess = false;
 		// CI 유효성 체크
 		Customer custInfo = getCustomerFindByCi(customer.getCi());
@@ -990,37 +993,58 @@ public class TsfCustomerService {
 	 * 정책 등급쿠폰 발급
 	 *
 	 * @param  custGrade - 고객번호
-	 * @return CustGrade
+	 * @return boolean - true : 모두 다운/ false 이미 쿠폰 다운
 	 * @author jsshin
 	 * @since 2021. 04. 06
 	 */
-	public GagaMap downloadCustGradeCoupon(Integer custNo) {
-		GagaMap result = new GagaMap();
+	@Transactional("shopTxnManager")
+	public boolean downloadCustGradeCoupon(Integer custNo) {
+		// 1. 고객정보 조회
 		Customer custInfo = getCustomerFindByCustNo(custNo);
+
+		// 2. 등급쿠폰 조회
 		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);
+		CustGrade custGradePolicy = custGradeCollection.get(0);
 
+		// 3.WELCOME 등급 - 첫번째 쿠폰은 회원 가입시 지급
+		if (TscConstants.CustGrade.WELCOME.value().equals(custGradePolicy.getGradeCd())) {
+			custGradePolicy.setGradeCpnId1("0");
 		}
-		return result;
+
+		String frontGb = TsfSession.getFrontGb();
+		// 4. 회원등급 정책 쿠폰1 발급
+		Coupon couponFirst = new Coupon();
+		couponFirst.setCustNo(custNo);
+		couponFirst.setCpnId(Integer.parseInt(custGradePolicy.getGradeCpnId1()));
+		couponFirst.setFrontGb(frontGb);
+		int custGradeCpnFirst = couponService.saveCustGradeCoupon(couponFirst);
+
+		// 5. 회원등급 정책 쿠폰2 발급
+		Coupon couponSecond = new Coupon();
+		couponSecond.setCustNo(custNo);
+		couponSecond.setCpnId(Integer.parseInt(custGradePolicy.getGradeCpnId2()));
+		couponSecond.setFrontGb(frontGb);
+		int custGradeCpnSecond = couponService.saveCustGradeCoupon(couponSecond);
+
+		// 6. 회원등급 정책 쿠폰3 발급(생일쿠폰)
+		int birthCpn = 0;
+		if (StringUtils.isNotBlank(custInfo.getBirthYmd()) && custInfo.getBirthYmd().length() > 7) {
+			String currentMonth = GagaDateUtil.getToday().substring(4, 6);
+			String birthMonth = custInfo.getBirthYmd().substring(4, 6);
+			log.info("currentMonth ===> {}, birthMonth ===> {}", currentMonth, birthMonth);
+			if (currentMonth.equals(birthMonth)) {
+				Coupon couponThird = new Coupon();
+				couponThird.setCustNo(custNo);
+				couponThird.setCpnId(Integer.parseInt(custGradePolicy.getGradeCpnId3()));
+				couponThird.setFrontGb(frontGb);
+				birthCpn = couponService.saveCustGradeCoupon(couponThird);
+			}
+		}
+		return custGradeCpnFirst + custGradeCpnSecond + birthCpn > 0;
 	}
+
 }

+ 8 - 2
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -721,9 +721,15 @@ public class TsfCustomerController extends TsfBaseController {
 		if (StringUtils.isBlank(custNo) || StringUtils.isBlank(customer.getEncData())) {
 			throw new IllegalStateException("로그인 다시 시도해 주세요.");
 		}
-		GagaMap resultInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
-		customer.setCi(resultInfo.getString("sCi"));
+		GagaMap authInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
+		customer.setSexGb(authInfo.getString("sGender"));
+		customer.setCustNm(authInfo.getString("sName"));
+		customer.setBirthYmd(authInfo.getString("sBirthDate"));
+		customer.setForeignerYn(authInfo.getString("sforeignerYn"));
+		customer.setCi(authInfo.getString("sCi"));
+		customer.setCellPhnno(authInfo.getString("sMobileNo"));
 		customer.setCustNo(Integer.parseInt(custNo));
+
 		session.removeAttribute("custNo"); // 고객번호 세션 삭제
 		return customerService.saveCertification(customer);
 	}

+ 4 - 1
src/main/java/com/style24/front/biz/web/TsfPlanningController.java

@@ -515,7 +515,10 @@ public class TsfPlanningController extends TsfBaseController {
 	 */
 	@GetMapping("/event/custgrade/coupon/down")
 	public GagaMap downCustGradeCoupon() {
-		return customerService.downloadCustGradeCoupon(TsfSession.getInfo().getCustNo());
+		GagaMap result = new GagaMap();
+		boolean isDownload = customerService.downloadCustGradeCoupon(TsfSession.getInfo().getCustNo());
+		result.setBoolean("isDownload", isDownload);
+		return result;
 	}
 
 	

+ 15 - 14
src/main/java/com/style24/persistence/mybatis/shop/TsfCart.xml

@@ -590,6 +590,8 @@
 		        ON     C.CART_SQ = CD.CART_SQ
 		        INNER  JOIN TB_GOODS G
 		        ON     C.GOODS_CD = G.GOODS_CD
+		        AND    G.SELF_MALL_YN = 'Y'
+		        AND    G.GOODS_STAT <![CDATA[ <> ]]> 'G008_99'
 		        INNER  JOIN TB_BRAND BR
 		        ON     G.BRAND_CD = BR.BRAND_CD
 		        INNER  JOIN TB_DELV_FEE_POLICY DFP
@@ -617,6 +619,7 @@
 		                                ON     C.CART_SQ = CD.CART_SQ
 		                                INNER  JOIN TB_GOODS G
 		                                ON     C.GOODS_CD = G.GOODS_CD
+		                                AND    G.SELF_MALL_YN = 'Y'
 		                                INNER  JOIN TB_GOODS COMP_GOODS
 		                                ON     CD.ITEM_CD = COMP_GOODS.GOODS_CD
 		                                INNER  JOIN TB_GOODS_COMPOSE GC
@@ -627,7 +630,6 @@
 		                                AND    CD.OPT_CD = VS.OPT_CD
 		                                WHERE  1=1
 		                                AND    C.CART_GB = 'G026_BC'
-		                                AND    G.SELF_MALL_YN = 'Y'
 		                                <if test="custNo == 0">
 		                                AND    C.CUST_NO = 0
 		                                AND    C.JSESSION_ID = #{jsessionId}
@@ -650,12 +652,12 @@
 		                                ON     C.CART_SQ = CD.CART_SQ
 		                                INNER  JOIN TB_GOODS G
 		                                ON     C.GOODS_CD = G.GOODS_CD
+		                                AND    G.SELF_MALL_YN = 'Y'
 		                                INNER  JOIN VW_STOCK VS
 		                                ON     C.GOODS_CD = VS.GOODS_CD
 		                                AND    CD.OPT_CD = VS.OPT_CD
 		                                WHERE  1=1
 		                                AND    C.CART_GB = 'G026_BC'
-		                                AND    G.SELF_MALL_YN = 'Y'
 		                                <if test="custNo == 0">
 		                                AND    C.CUST_NO = 0
 		                                AND    C.JSESSION_ID = #{jsessionId}
@@ -669,8 +671,7 @@
 		        ON     C.CART_SQ = STOCK.CART_SQ
 		        LEFT   OUTER JOIN TB_GOODS_QUICK_DELEVERY_SKIP GQDS
 		        ON     G.GOODS_CD = GQDS.GOODS_CD
-		        WHERE  G.SELF_MALL_YN = 'Y'
-		        AND    G.GOODS_STAT <![CDATA[ <> ]]> 'G008_99'
+		        WHERE  1=1
 		        <if test="custNo == 0">
 		        AND    C.CUST_NO = 0
 		        AND    C.JSESSION_ID = #{jsessionId}
@@ -686,30 +687,30 @@
 		        </if>
 		        ORDER BY G.SUPPLY_COMP_CD ) Z
 		WHERE  1=1
-		GROUP  BY Z.CART_SQ
-		     , WISH_CNT
+		GROUP  BY WISH_CNT
+		     , Z.CART_SQ
 		     , Z.GOODS_STAT
 		     , Z.GOODS_CD
-		     , Z.GOODS_QTY
-		     , Z.DELV_RES_DT
-		     , Z.GOODS_TYPE
-		     , Z.SUPPLY_COMP_CD
 		     , Z.GOODS_NM
 		     , Z.BRAND_ENM
 		     , Z.BRAND_KNM
-		     , LIST_PRICE
 		     , Z.SUPPLY_COMP_NM
+		     , Z.GOODS_QTY
+		     , Z.DELV_RES_DT
+		     , Z.GOODS_TYPE
+		     , Z.SUPPLY_COMP_CD
 		     , Z.DELV_FEE_CD
 		     , Z.MIN_ORD_AMT
 		     , Z.DELV_FEE
 		     , Z.CART_DELV_FEE_CD
-		     , CURR_PRICE
 		     , ORD_CAN_YN
 		     , Z.ORD_CAN_QTY
 		     , Z.MIN_ORD_QTY
 		     , Z.MAX_ORD_QTY
-		     , Z.PNT_PRATE
-		     , Z.PNT_MRATE
+		     , CURR_PRICE
+		     , LIST_PRICE
+		     , Z.SOLDOUT_YN
+		     , SAVE_PNT_AMT
 		     , SYS_IMG_NM
 		ORDER  BY Z.DELV_FEE_CD DESC
 		     , Z.GOODS_CD DESC

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

@@ -523,6 +523,10 @@
 		/* TsfCustomer.updateCustomerCi */
 		UPDATE TB_CUSTOMER
 		SET    CI = #{ci}
+		     , CUST_NM = #{encodedCustNm}
+		     , CELL_PHNNO = #{encodedCellPhnno}
+		     , SEX_GB = #{encodedSexGb}
+		     , BIRTH_YMD = #{encodedBirthYmd}
 		     , AUTH_DT = NOW()
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()

+ 10 - 0
src/main/webapp/WEB-INF/views/web/customer/IdFindFormWeb.html

@@ -312,6 +312,16 @@
 		};
 
 		$(document).ready( function() {
+			$(document).on('click','.mb .registration_tap > .form_group > .form_field > div',function(e){
+				// form 데이터 리셋
+				$('#searchCustInfo')[0].reset();
+
+				$(this).find('input').prop('checked', true);
+				$(this).parents('.form_group').find('.regist_box').removeClass('on');
+				$(this).parents('.form_group').find('.regist_box').eq($(this).index()).addClass('on');
+				return false;
+			});
+
 			$('#searchCustInfo')[0].reset();
 		});
 

+ 6 - 0
src/main/webapp/WEB-INF/views/web/customer/PasswordFindFormWeb.html

@@ -278,6 +278,12 @@
 		};
 
 		$(document).ready( function() {
+			$(document).on('click','.mb .registration_tap > .form_group >.form_field > div',function(e){
+				$(this).find('input').prop('checked', true);
+				$(this).parents('.form_group').find('.regist_box').removeClass('on');
+				$(this).parents('.form_group').find('.regist_box').eq($(this).index()).addClass('on');
+				return false;
+			});
 			$('#searchCustInfo')[0].reset();
 		});
 

+ 18 - 3
src/main/webapp/WEB-INF/views/web/planning/PlanningCustGradeBenefitFormWeb.html

@@ -43,7 +43,7 @@
 									이번 달 회원등급은<br />
 									<span class="my_rank" th:text="${customerInfo.custGradeNm}">GOLD</span> 입니다.
 								</p>
-								<button type="button" id="btnDownGradeCoupon" class="btn btn_dark cou_btn" >등급 쿠폰 다운로드</button>
+								<button type="button" id="btnGradeCoupon" class="btn btn_dark cou_btn" >등급 쿠폰 다운로드</button>
 							</div>
 							<!-- 회원 등급 progress바 -->
 							<div class="my_rank_progress">
@@ -359,10 +359,25 @@
 		}
 	}
 
-	$('#btnDownGradeCoupon').on('click', function () {
-		gagajf.ajaxJsonSubmit('')
+	$('#btnGradeCoupon').on('click', function () {
+		let params = JSON.stringify({});
+		gagajf.ajaxJsonSubmit('/planning/event/custgrade/coupon/down', params, fnDownloadCallback)
 	});
 
+ 	var fnDownloadCallback = function (result) {
+ 		let message = '이미 쿠폰을 다운로드하셨습니다.';
+		if (result.isDownload) {
+			message = '모두 다운로드되었습니다. 쿠폰 정보는 마이페이지 > 나의 쿠폰에서 확인하실 수 있습니다.';
+		}
+
+		mcxDialog.alertC(message, {
+			sureBtnText: "확인",
+			sureBtnClick: function () {
+			}
+		});
+
+	}
+
 	$(document).ready(function() {
 
 		fnInit();