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

Merge branch 'sowon' into develop

sowon4187 5 лет назад
Родитель
Сommit
4e15ffb58c

+ 11 - 1
src/main/java/com/style24/front/biz/dao/TsfPlanningDao.java

@@ -273,7 +273,7 @@ public interface TsfPlanningDao {
 	int getCustAnswerCount(Plan plan);
 	
 	/**
-	 * 설문조사 선착순 운트
+	 * 설문조사 선착순 운트
 	 *
 	 * @param poll
 	 * @return int
@@ -332,6 +332,16 @@ public interface TsfPlanningDao {
 	 */
 	int getAttendEntryCount(Plan plan);
 	
+	/**
+	 * 출석체크 혜택 리스트
+	 *
+	 * @param Plan
+	 * @return Collection<Plan>
+	 * @author sowon
+	 * @date 2021. 4. 14
+	 */
+	Collection<Plan> getAttendBenefitList(Plan plan);
+	
 	/**
 	 * 고객이 출석한 일 리스트
 	 *

+ 12 - 0
src/main/java/com/style24/front/biz/service/TsfPlanningService.java

@@ -516,6 +516,18 @@ public class TsfPlanningService {
 		plan.setCustNo(TsfSession.getInfo().getCustNo());
 		return planningDao.getCustAttendEntryList(plan);
 	}
+	
+	/**
+	 * 출석체크 혜택 리스트
+	 *
+	 * @param Plan
+	 * @return Collection<Plan>
+	 * @author sowon
+	 * @date 2021. 4. 14
+	 */
+	public Collection<Plan> getAttendBenefitList(Plan plan){
+		return planningDao.getAttendBenefitList(plan);
+	}
 
 	/**
 	 * 기획전/이벤트 댓글

+ 16 - 0
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -1303,6 +1303,22 @@ public class TsfMypageController extends TsfBaseController {
 
 		return mav;
 	}
+	
+	/**
+	 * 퀵메뉴 보유한 쿠폰리스트
+	 * @return
+	 * @author sowon
+	 * @since 2021. 4. 14
+	 */
+	@GetMapping("/quick/own/coupon/list")
+	@ResponseBody
+	public Collection<Coupon> getQuickOwnCouponList() {
+		Coupon coupon = new Coupon();
+		Collection<Coupon> ownCouponList = new ArrayList<>();
+		coupon.setQuickYn("Y");
+		ownCouponList  = couponService.getMypageCouponList(coupon);
+		return ownCouponList;
+	}
 
 	/**
 	 * 마이페이지 쿠폰 상세보기 팝업

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

@@ -20,6 +20,7 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.style24.core.biz.service.TscCouponService;
 import com.style24.core.biz.service.TscCustomerService;
+import com.style24.core.biz.service.TscPointService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCouponService;
@@ -32,6 +33,7 @@ import com.style24.persistence.domain.CustDeliveryAddr;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.Goods;
 import com.style24.persistence.domain.Plan;
+import com.style24.persistence.domain.Point;
 import com.style24.persistence.domain.Poll;
 import com.style24.persistence.domain.Review;
 import com.style24.persistence.domain.WishList;
@@ -72,6 +74,9 @@ public class TsfPlanningController extends TsfBaseController {
 
 	@Autowired
 	private TsfDisplayService displayService;
+	
+	@Autowired
+	private TscPointService corePointService;
 
 	/**
 	 * 기획전 메인 화면
@@ -585,18 +590,46 @@ public class TsfPlanningController extends TsfBaseController {
 	@ResponseBody
 	public GagaMap planningAttendEntry(@RequestBody Plan plan) throws Exception {
 		GagaMap result = new GagaMap();
+		plan.setEntryAllYn("N");
 		int count = planningService.getAttendEntryCount(plan);
 		if (count > 0) {
 			result.set("msg", "이미 출석체크 되었습니다.");
 		}else {
-			// 여기서 한번 더 풀어야 할듯?
 			planningService.saveAttendEntry(plan);
-			result.set("msg", "출석체크 되었습니다.");
-			result.set("custAttendList",planningService.getCustAttendEntryList(plan));
 			
+			// 총 출석일 수 구해보장.. 
+			Collection<Plan> benefitList = planningService.getAttendBenefitList(plan);
+			plan.setEntryAllYn("Y");
+			count = planningService.getAttendEntryCount(plan);
+			for (Plan tPlan : benefitList) {
+				if (tPlan.getBasDays() == count) {
+					System.out.println("여기들어오니?1");
+					// 지급 방식이 포인트일 경우
+					if (tPlan.getBenefitGb().equals("P")) {
+						Point point = new Point();
+						int pointAmt = tPlan.getPntAmt();
+						point.setRegNo(TsfSession.getInfo().getCustNo());
+						point.setUpdNo(TsfSession.getInfo().getCustNo());
+						point.setCustNo(TsfSession.getInfo().getCustNo());
+						point.setPntUploadStat(TscConstants.PntUploadStat.APPLY_COMPLETE.value());
+						point.setGvPntAmt(pointAmt);
+						point.setRmPntAmt(pointAmt);
+						point.setOccurGb("G069_37"); //출석체크 이벤트
+						corePointService.saveCustomerPoint(point);
+						System.out.println("여기들어오니?2");
+						String msg =  "축하합니다." + pointAmt + "포인트가 지급 되었습니다!";
+						result.set("msg", msg);
+						break;
+					}
+
+				}else {
+					result.set("msg", "출석체크 되었습니다.");
+					break;
+				}
+			}
 		}
 		
+		result.set("custAttendList",planningService.getCustAttendEntryList(plan));
 		return result;
-
 	}
 }

+ 5 - 0
src/main/java/com/style24/persistence/domain/Plan.java

@@ -270,6 +270,11 @@ public class Plan extends TscBaseDomain {
 	private Integer planEntrySq;		//참여일련번호
 	private String orgFileNm;
 	private String sysFileNm;
+	private String entryAllYn;
+	private int basDays;
+	private String benefitGb;
+	private int pntAmt;
+	private Integer cpnId;
 	
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] multiReplyOrgFile;			//댓글 이미지

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

@@ -474,7 +474,13 @@
 		WHERE  CC.CPN_ID = C.CPN_ID
 		AND    C.CPN_STAT = 'G232_11' /*진행중인쿠폰*/
 		AND    C.SITE_CD = #{siteCd}
-		ORDER  BY CC.EXPIRE_YN, CC.AVAIL_EDDT
+		<if test="quickYn != null and quickYn != ''">
+		AND    CC.CC.EXPIRE_YN = 'N'
+		</if>
+		ORDER  BY CC.EXPIRE_YN, CC.AVAIL_EDDT, DC_VAL DESC, MAX_DC_AMT DESC
+		<if test="quickYn != null and quickYn != ''">
+		LIMIT 30
+		</if>
 	</select>
 	
 	<select id="getMypageCouponInfo" resultType="Coupon" parameterType="Coupon">

+ 13 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfPlanning.xml

@@ -1185,7 +1185,9 @@
 		FROM TB_PLAN_ENTRY
 		WHERE 1=1 
 		 AND PLAN_SQ = #{planSq}
+		 <if test='entryAllYn == "N"'>
 		 AND DATE_FORMAT(ENTRY_DT, '%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+		 </if>
 		 AND ENTRY_CUST_NO = #{custNo}
 	</select>
 	
@@ -1202,6 +1204,17 @@
 		AND ENTRY_CUST_NO = #{custNo}
 	</select>
 	
+	<select id="getAttendBenefitList" resultType="Plan" parameterType="Plan">
+		/* TsfPlanning.getAttendBenefitList */	
+		SELECT PLAN_SQ 
+		      ,BAS_DAYS 
+		      ,BENEFIT_GB 
+		      ,PNT_AMT 
+		      ,CPN_ID 
+		FROM TB_PLAN_ATTEND 
+		WHERE PLAN_SQ = #{planSq}	
+	</select>
+	
 	<!-- 댓글 리스트  (수정필)-->
 	<select id="getReplyList" resultType="Plan" parameterType="Plan">
 		/* TsfPlanning.getReplyList */	

+ 104 - 14
src/main/webapp/WEB-INF/views/web/common/fragments/FooterWeb.html

@@ -174,7 +174,7 @@
 			<li>
 				<button type="button" id="quick04" class="quick_btn04" data-tab="quick04">
 					<img src="/images/pc/ico_qk_coupon.png" alt="쿠폰"/>
-					<span class="count">100</span>
+					<span class="count">0</span>
 				</button>
 			</li>
 			<li>
@@ -489,16 +489,16 @@
 			</div>
 			<div class="coupon quick_con quick04"> <!-- 퀵메뉴_나의 쿠폰 -->
 				<div class="quick_head">
-					<h3><a href="">나의 쿠폰</a></h3>
+					<h3><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MYPAGE_COUPON);">나의 쿠폰</a></h3>
 				</div>
-				<div class="quick_body"> <!-- 비로그인 시 need_login 클래스 추가 -->
+				<div class="quick_body" id="couponList"> <!-- 비로그인 시 need_login 클래스 추가 -->
 					<div class="coupon_tab">
-						<a href="#coupon_type01" id="" class="">발급 가능 쿠폰</a>
-						<a href="#coupon_type02" id="" class="">보유 쿠폰</a>
+						<a href="#coupon_type01" onclick="issueCouponBtn()">발급 가능 쿠폰</a>
+						<a href="#coupon_type02" onclick="ownCouponBtn()">보유 쿠폰</a>
 					</div>
 					<div id="coupon_type01" class="coupon_area">
-						<div class="pop_cont">
-							<ul class="coupon_list">
+						<div class="pop_cont" id="issueCoupon">
+							<!-- <ul class="coupon_list">
 								<li>
 									<div class="coupon">
 										<div>
@@ -601,12 +601,14 @@
 										<button type="button" class="btn btn_dark btn_block btn_coupon_done" disabled=""><span>받기완료</span></button>
 									</div>
 								</li>
-							</ul>
+							</ul> -->
 						</div>
+						<a href="javascript:void(0);" class="more_btn" onclick="cfnGoToPage(_PAGE_EVENT_MAIN);">더 보기</a>_
 					</div>
+					
 					<div id="coupon_type02" class="coupon_area">
-						<div class="coupon_list">
-							<ul class="clear">
+						<div class="coupon_list" id="ownCoupon">
+							<!-- <ul class="clear">
 								<li>
 									<div class="cp_top">
 										<div class="cp_detail">
@@ -641,16 +643,17 @@
 										<button type="button" class="coupon_pop_btn"><span>사용안내</span></button>
 									</div>
 								</li>
-							</ul>
+							</ul> -->
 						</div>
+						<a href="javascript:void(0);" class="more_btn" onclick="cfnGoToPage(_PAGE_MYPAGE_COUPON);">더 보기</a>_
 					</div>
-					<a href="" class="more_btn">더 보기</a>
+					
 					<div class="login_con">
 						<div>
 							<p>로그인 후 이용 가능한 서비스입니다.</p>
-							<button type="button" class="btn btn_sm"><span>로그인</span></button>
+							<button type="button" class="btn btn_sm" onclick="cfnGoToPage(_PAGE_LOGIN);"><span>로그인</span></button>
 						</div>
-					</div>
+					</div> 
 				</div>
 			</div>
 			<div class="category quick_con quick05"> <!-- 퀵메뉴_카테고리 -->
@@ -861,6 +864,16 @@
 	<!-- //배송요청사항수정 팝업 -->
 	<!-- //2021.04.02 배송지변경팝업 공통화 작업 -->
 	
+	<!-- 쿠폰 사용 내역 팝업 -->
+	<div class="modal fade couponInfo_pop" id="couponInfoPop" tabindex="-1" role="dialog" aria-labelledby="couponInfoLabel" aria-hidden="true">
+	<div class="modal-dialog" role="document">
+		<div class="modal-content">
+               <!-- 쿠폰사용안내 팝업 내용 -->      
+		</div>
+	</div>
+	<a href="#close-modal" rel="modal:close" id="couponInfoPop_close" class="close-modal">Close</a>
+	</div>
+	
 <script th:inline="javascript">
 /*<![CDATA[*/
 	// 패밀리 사이트
@@ -1229,6 +1242,80 @@
 		}
 	}
 	
+	// 쿠폰리스트
+	let issueCouponBtn = function() {
+		if (!cfCheckLogin()) {
+			$('#couponList').addClass('need_login');
+			return false;
+		}else{
+			
+		}
+	}
+	
+	// 보유 쿠폰 클릭 시 
+	let ownCouponBtn = function() {
+		$.getJSON('/mypage/quick/own/coupon/list'
+				, function(result, status) {
+					if (status == 'success') {
+						if (result.length > 0) {
+							let tag = '';
+							tag += '<ul class="clear">';
+							$.each(result, function (idx, item) {
+								tag += '	<li>';
+								tag += '		<div class="cp_top">';
+								tag += '			<div class="cp_detail">';
+								tag += '				<p class="tit">'+item.cpnNm+'</p>';
+								if (item.dcWay == '%') {
+									tag += '				<strong class="sale_t won_t"><span>'+item.dcVal+'</span>%</strong>';
+								}else{
+									tag += '				<strong class="sale_t won_t"><span>'+item.dcVal+'</span>원</strong>';
+								}
+								
+								tag += '				<p class="cp_cont">'+item.useCondition+'</p>';
+								tag += '				<span class="cp_cnt"><span>'+item.cpnCnt+'</span>장 보유</span>';
+								tag += '			</div>';
+								tag += '			<span class="cp_shape"></span>';
+								tag += '		</div>';
+								tag += '		<div class="cp_date">';
+								tag += '			<span>'+item.availStdt+'</span> ~ <span>'+item.availEddt+'</span>';
+								tag += '		</div>';
+								tag += '		<div class="cp_info">';
+								tag += '			<button type="button" class="coupon_pop_btn" onclick="useInfoCoupon('+item.cpnId+')"><span>사용안내</span></button>';
+								tag += '		</div>';
+								tag += '	</li>';
+							});
+							tag += '<ul>';
+							
+							$('#ownCoupon').html(tag);
+						} else {
+							$('#ownCoupon').addClass('nodata');
+						}
+					}
+			});
+	}
+	
+	// 소유한 쿠폰 사용안내 모달
+	var useInfoCoupon = function (id) {
+		var data = {cpnId : id};
+		var jsonData = JSON.stringify(data);
+		
+		 $.ajax( {
+			type		: "POST",
+			url 		: '/mypage/coupon/detailPop',
+			data		: jsonData,
+			contentType: 'application/json',
+			dataType 	: 'html',
+			success 	: function(result) {
+				if (result != null) {
+					$("#couponInfoPop").html(result);
+					$("#couponInfoPop").modal("show");
+				}
+			}
+		});
+		
+		return false; 
+	}
+	
 	// 팝업
 	let fnGetPopup = function(){
 		let data = {viewPage : [[${viewPage}]]
@@ -1350,6 +1437,9 @@
 		// 팝업조회
 		fnGetPopup();
 		
+		// 쿠폰조회
+		$("#issueCouponBtn").trigger("click");	
+		
 		// Family Site
 		$('.family_link').on('click','.btn',function(e){
 			e.preventDefault();