ChoiSooHwan 5 лет назад
Родитель
Сommit
4380542d97

+ 17 - 0
src/main/java/com/style24/front/biz/dao/TsfPointDao.java

@@ -1,6 +1,9 @@
 package com.style24.front.biz.dao;
 
+import java.util.Collection;
+
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Point;
 
 /**
  * 포인트 Dao
@@ -10,5 +13,19 @@ import com.style24.core.support.annotation.ShopDs;
  */
 @ShopDs
 public interface TsfPointDao {
+	
+	/**
+	 * 포인트정보 조회
+	 *
+	 * @param Point
+	 * @author csh9191
+	 * @since 2021. 02. 25
+	 */	
+	Point getUsablePointInfo(Point point);
+	Point getExpectedPointInfo(Point point);
+	Point getExtinctPointInfo(Point point);
+	Collection<Point> getAccumulatePointList(Point point);
+	
+	
 
 }

+ 26 - 0
src/main/java/com/style24/front/biz/service/TsfPointService.java

@@ -1,9 +1,14 @@
 package com.style24.front.biz.service;
 
+import java.util.Collection;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.style24.front.biz.dao.TsfPointDao;
+
+import com.style24.persistence.domain.Point;
+
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -18,5 +23,26 @@ public class TsfPointService {
 
 	@Autowired
 	private TsfPointDao pointDao;
+	
+	/**
+	 * 포인트정보 조회
+	 *
+	 * @param Point
+	 * @author csh9191
+	 * @since 2021. 02. 25
+	 */	
+	public Point getUsablePointInfo(Point point) {
+		return pointDao.getUsablePointInfo(point);
+	}
+	
+	public Point getExpectedPointInfo(Point point) {
+		return pointDao.getExpectedPointInfo(point);
+	}
+	public Point getExtinctPointInfo(Point point) {
+		return pointDao.getExtinctPointInfo(point);
+	}
+	public Collection<Point> getAccumulatePointList(Point point) {
+		return pointDao.getAccumulatePointList(point);
+	}
 
 }

+ 29 - 2
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -36,6 +36,7 @@ import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.Order;
+import com.style24.persistence.domain.Point;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -82,7 +83,7 @@ public class TsfMypageController extends TsfBaseController {
 	
 	@Autowired
 	private TsfRendererService rendererService;
-
+	
 	/**
 	 * 마이페이지 메인 화면
 	 *
@@ -339,5 +340,31 @@ public class TsfMypageController extends TsfBaseController {
 		
 		return mav;
 	}
-
+	
+	/**
+	 * 마이페이지 STYLE24 포인트화면
+	 *
+	 * @param 
+	 * @return ModelAndView
+	 * @author csh9191
+	 * @since 2021. 02. 25
+	 */
+	@GetMapping("/point/form")
+	public ModelAndView stylePointForm(Point point) {
+		ModelAndView mav = new ModelAndView();
+		
+		int custNo = TsfSession.getInfo().getCustNo();
+		point.setCustNo(custNo);
+		// 잔여포인트
+		mav.addObject("pointInfo", pointService.getUsablePointInfo(point));		
+		// 적립예정포인트 expectedPntAmt
+		mav.addObject("expectedpointInfo", pointService.getExpectedPointInfo(point));
+		// 한달 이내 소멸 예정 포인트
+		mav.addObject("extinctpointInfo", pointService.getExtinctPointInfo(point));
+		// 적립내역
+		mav.addObject("accumulatePointList", pointService.getAccumulatePointList(point));
+		
+		mav.setViewName(super.getDeviceViewName("mypage/MypagePointForm"));
+		return mav;
+	}
 }

+ 53 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfPoint.xml

@@ -14,6 +14,58 @@
 		WHERE  NUMB BETWEEN #{pageable.startRow} AND #{pageable.endRow}
 	</sql>
 	
+	<!-- 사용가능 포인트조회-->
+	<select id="getUsablePointInfo" parameterType="Point" resultType="Point">
+	/* TsfPoint.getUsablePointInfo */
+		SELECT SUM(RM_PNT_AMT) AS RM_PNT_AMT
+		FROM   TB_CUST_POINT
+		WHERE  CUST_NO = #{custNo}
+		AND    EXP_BE_DT <![CDATA[>]]> NOW();
+	</select>
 	
-
+	<!-- 적립예정 포인트조회-->
+	<select id="getExpectedPointInfo" parameterType="Point" resultType="Point">
+	/* TsfPoint.getExpectedPointInfo */
+		SELECT IFNULL(SUM(GV_PNT_AMT),0) AS expectedPntAmt
+		FROM   TB_CUST_POINT
+		WHERE  CUST_NO = #{custNo}
+		AND    EXP_BE_DT <![CDATA[>]]> NOW()
+	</select>
+	
+	<!-- 한달 이내 소멸예정 포인트조회-->
+	<select id="getExtinctPointInfo" parameterType="Point" resultType="Point">
+	/* TsfPoint.getExtinctPointInfo */
+		SELECT IFNULL(SUM(PNT_AMT),0) AS expectedExpirePntAmt
+		FROM   tb_cust_point_hst
+		WHERE  PNT_UPLOAD_STAT = 'G070_10'
+		AND    CUST_NO = #{custNo}
+		AND    SWITCH_DUE_DT <![CDATA[>]]> NOW()
+	</select>
+	
+		<!-- 적립내역 조회-->
+	<select id="getAccumulatePointList" parameterType="Point" resultType="Point">
+	/* TsfPoint.getAccumulatePointList */
+		SELECT
+		CASE   TCC.CD_NM
+		WHEN   '예정포인트적립' THEN '상품 구매'
+		WHEN   '온라인이벤트' THEN '이벤트'
+		WHEN   '기타' THEN '관리자'
+		END AS OCCUR_GB ,	
+		CASE   TCC.CD  	
+		WHEN   'G069_12' THEN TG.GOODS_NM 
+		WHEN   'G069_30' THEN TCHP.OCCUR_DTL_DESC
+		WHEN   'G069_90' THEN TCHP.OCCUR_DTL_DESC
+		END AS OCCUR_DTL_DESC
+			 , TCHP.PNT_AMT AS pntAmt
+			 , TCHP.UPD_DT  AS pntUploadDt
+		FROM TB_CUST_POINT_HST TCHP
+		INNER JOIN TB_COMMON_CODE TCC
+		ON TCC.CD = TCHP.OCCUR_GB
+		INNER JOIN TB_ORDER_DETAIL TOD
+		ON TOD.ORD_NO = TCHP.ORD_NO
+		INNER JOIN TB_GOODS TG 
+		ON TG.GOODS_CD = TOD.GOODS_CD 
+		WHERE TCHP.CUST_NO = #{custNo}
+		GROUP BY CD_NM, PNT_AMT, GOODS_NM, CD,OCCUR_DTL_DESC, TCHP.UPD_DT
+	</select>
 </mapper>

+ 148 - 0
src/main/webapp/WEB-INF/views/web/mypage/MypagePointFormWeb.html

@@ -0,0 +1,148 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+	layout:decorator="web/common/layout/MypageLayoutWeb">
+<!--
+ *******************************************************************************
+ * @source  : MypagePointForm.html
+ * @desc    : 마이페이지 > STYLE24포인트 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.02.25   csh9191     최초 작성
+ *******************************************************************************
+ -->
+<body>
+
+<th:block layout:fragment="content">
+	<div class="my_cont">
+						<div class="sec_head">
+							<h3>STYLE24 포인트</h3>
+						</div>
+						<div class="sec_body">
+							<div class="save_area mypage_coupon">
+								<p>사용 가능한 보유 포인트<strong th:text="${#numbers.formatDecimal(pointInfo.rmPntAmt, 0, 'COMMA', 0, 'POINT')}"></strong>P</p>
+								<ul>
+									<li>적립 예정 포인트 <span>
+										<th:block th:text="${#numbers.formatDecimal(expectedpointInfo.expectedPntAmt, 0, 'COMMA', 0, 'POINT')}"></th:block>P
+									</span></li>
+									<li>한달 이내 소멸 예정 <span>
+										<th:block th:text="${#numbers.formatDecimal(extinctpointInfo.expectedExpirePntAmt, 0, 'COMMA', 0, 'POINT')}"></th:block>P
+									</span></li>
+								</ul>
+							</div>
+							<div class="my_tab coupon_tab">
+								<ul>
+									<li><a href="javascript:void(0);" id="fnSetSearchFullHistory">전체내역</a></li>
+									<li><a href="javascript:void(0);" class="on" id="fnSetSearchCollectHistory">적립내역</a></li>
+									<li><a href="javascript:void(0);" id="fnSetSearchUsedHistory">사용내역</a></li>
+								</ul>
+								<div class="form_field">
+									<select id="mounth">
+										<option value="hide">2020년 10월</option>
+										<option value="Test_SELECT_OPTION_1" rel="icon-temperature">2020년 9월</option>
+										<option value="Test_SELECT_OPTION_2">2020년 8월</option>
+										<option value="Test_SELECT_OPTION_3">2020년 7월</option>
+									</select> 
+								</div>
+							</div>
+							<div class="order_list">
+								<section class="order_row">
+									<div class="tbl point_tbl track_tbl type2">
+										<table>
+											<colgroup>
+												<col width="150px">
+												<col width="660px">
+												<col width="*">
+												<col width="200px">
+											</colgroup>   
+											<thead>
+												<tr>
+													<th>사유</th>
+													<th>내용</th>
+													<th>차감</th>
+													<th>일자</th>
+												</tr>
+											</thead>
+											<tbody>
+												<tr id="pointAjaxList" >
+													<td id="occurGb">구매사유</td>
+													<td class="t_l pl40" id="occurDtlDesc">남성 라그란 소매배색 싸이로 티셔츠</td>
+													<td class="c_blue" id="pntAmt">150P</td>
+													<td id="pntUploadDt">2020.10.06 22:50:14</td>
+												</tr>
+											</tbody>
+										</table>
+									</div>
+								</section>
+							</div>
+						</div>
+					</div>
+<script th:inline="javascript">
+	let accumulatePointList = [[${accumulatePointList}]];
+	
+	console.log(accumulatePointList);
+	// 전체내역 조회
+	$("#fnSetSearchFullHistory").click(function(){
+		// Class제거 추가
+		$("#fnSetSearchCollectHistory").removeClass("on");
+		$("#fnSetSearchUsedHistory").removeClass("on");
+		$("#fnSetSearchFullHistory").addClass("on");
+		
+		// 적립내역 + 사용내역(sum)으로 표시
+		
+	});
+	
+	// 적립내역 조회
+	$("#fnSetSearchCollectHistory").click(function(){
+		// Class제거 추가
+		$("#fnSetSearchFullHistory").removeClass("on");
+		$("#fnSetSearchUsedHistory").removeClass("on");
+		$("#fnSetSearchCollectHistory").addClass("on");
+		
+		// 적립내역 포인트 블루
+		$("#pntAmt").removeClass("c_primary");
+		$("#pntAmt").addClass("c_blue");
+
+		$.ajax(
+				{
+					type 	 : "POST",
+					url 	 : '',
+  					dataType : 'html',
+					success  : function(result){
+						$("#pointAjaxList").html(result);
+					}
+				}
+		)
+	});
+	
+	// 사용내역 조회
+	$("#fnSetSearchUsedHistory").click(function(){
+		// Class제거 추가
+		$("#fnSetSearchCollectHistory").removeClass("on");
+		$("#fnSetSearchFullHistory").removeClass("on");
+		$("#fnSetSearchUsedHistory").addClass("on");
+		
+		// 사용내역 포인트 블루
+		$("#pntAmt").removeClass("c_blue");
+		$("#pntAmt").addClass("c_primary");
+	});
+	
+	$(document).ready(function() {
+		// 마이페이지 LNB 설정
+		fnSetMypageLnbList(5);
+		
+		// 마이페이지 location 설정
+		fnSetMypageLocation('STYLE24 포인트', '_PAGE_MYPAGE_POINT');
+		
+	});
+
+</script>
+</th:block>
+
+</body>
+</html>