Browse Source

수정 중

jsshin 5 years ago
parent
commit
fd73f74109

+ 22 - 0
src/main/java/com/style24/admin/biz/dao/TsaGiftCardDao.java

@@ -5,6 +5,8 @@ import org.springframework.stereotype.Repository;
 
 import com.style24.core.support.annotation.ShopDs;
 
+import java.util.Collection;
+
 /**
  * 상품권 Dao
  *
@@ -66,4 +68,24 @@ public interface TsaGiftCardDao {
 	 */
 	int updateGfcdBulkReg(GiftCard giftCard);
 
+	/**
+	 * 상품권 대량 등록수
+	 *
+	 * @param giftCard - 상품권, 고객 정보
+	 * @author jsshin
+	 * @since 2021. 5. 12
+	 */
+	int getGiftCardListCount(GiftCard giftCard);
+
+
+	/**
+	 * 상품권 대량등록 목록
+	 *
+	 * @param giftCard - 상품권, 고객 정보
+	 * @author jsshin
+	 * @since 2021. 5. 12
+	 */
+	 Collection<GiftCard> getGiftCardList(GiftCard giftCard);
+
+
 }

+ 53 - 28
src/main/java/com/style24/admin/biz/service/TsaGiftCardService.java

@@ -11,10 +11,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Collection;
+
 /**
  * 상품권 Service
  *
- * @author
+ * @author jsshin
  * @since 2021. 05. 12
  */
 @Service
@@ -27,70 +29,93 @@ public class TsaGiftCardService {
 	@Autowired
 	private Yes24Giftcard yes24Giftcard;
 
+
+	/**
+	 * 상품권 대량 등록수
+	 *
+	 * @param giftCard - 상품권, 고객 정보
+	 * @author jsshin
+	 * @since 2021. 5. 12
+	 */
+	public int getGiftCardListCount(GiftCard giftCard) {
+		return giftCardDao.getGiftCardListCount(giftCard);
+	}
+
+	/**
+	 * 상품권 대량등록 목록
+	 *
+	 * @param giftCard - 상품권, 고객 정보
+	 * @author jsshin
+	 * @since 2021. 5. 12
+	 */
+	public Collection<GiftCard> getGiftCardList(GiftCard giftCard) {
+		return giftCardDao.getGiftCardList(giftCard);
+	}
+
 	/**
 	 * 상품권 저장
 	 *
-	 * @param giftcard - 상품권, 고객 정보
+	 * @param giftCard - 상품권, 고객 정보
 	 * @author jsshin
 	 * @throws Exception
 	 * @since 2021. 5. 12
 	 */
 	@Transactional("shopTxnManager")
-	public void saveGiftcardUseConfirm(GiftCard giftcard) throws Exception {
+	public void saveGiftcardUseConfirm(GiftCard giftCard) throws Exception {
 		// 고객번호 설정
 		Integer userNo = TsaSession.getInfo().getUserNo();
 		String ip = TsaSession.getIpAddress();
-		giftcard.setRegNo(userNo);
-		giftcard.setUpdNo(userNo);
-		giftcard.setIpAddr(ip);  // 아이피주소
+		giftCard.setRegNo(userNo);
+		giftCard.setUpdNo(userNo);
+		giftCard.setIpAddr(ip);  // 아이피주소
 
-		Integer custNo = giftcard.getCustNo();
-		String pubNo = giftcard.getGfcdNo().trim();
+		Integer custNo = giftCard.getCustNo();
+		String pubNo = giftCard.getGfcdNo().trim();
 		String result = yes24Giftcard.soapDataTransfer(pubNo, ip, custNo);
 
 		String resultMsg;
 		if ("01".equals(result)) {
-			giftcard.setResultVal(result);  // 승인 결과 insert
+			giftCard.setResultVal(result);  // 승인 결과 insert
 			resultMsg = "존재하지 않는 상품권";
 		} else if ("02".equals(result)) {
-			giftcard.setResultVal(result);
+			giftCard.setResultVal(result);
 			resultMsg = "이미 등록된 상품권";
 		} else if ("03".equals(result)) {
-			giftcard.setResultVal(result);
+			giftCard.setResultVal(result);
 			resultMsg = "삭제된 상품권";
 		} else if ("04".equals(result)) {
-			giftcard.setResultVal(result);
+			giftCard.setResultVal(result);
 			resultMsg = "기간이 만료된 상품권";
 		} else if ("99".equals(result)) {
-			giftcard.setResultVal(result);
+			giftCard.setResultVal(result);
 			resultMsg = "시스템 오류";
 		} else {
-			giftcard.setResultVal("00");
+			giftCard.setResultVal("00");
 			resultMsg = "상품권등록 성공";
 		}
-		giftcard.setResultMsg(resultMsg);
-		giftCardDao.createGiftcardApi(giftcard);
+		giftCard.setResultMsg(resultMsg);
+		giftCardDao.createGiftcardApi(giftCard);
 
 		// 성공일 경우
-		if ("00".equals(giftcard.getResultVal())) {
+		if ("00".equals(giftCard.getResultVal())) {
 			String[] param = result.split("[|]");
 			// [2021-04-01, 오전, 12:00:00]
 			String[] param2 = param[2].split(" ");
 			String[] param3 = param[3].split(" ");
 
-			giftcard.setGfcdNm("YES24상품권");
-			giftcard.setChgGfcdAmt(Integer.parseInt(param[1])); // 승인금액
-			giftcard.setRmGfcdAmt(Integer.parseInt(param[1])); // 승인금액
-			giftcard.setUseStDate(param2[0]);
-			giftcard.setUseExpDate(param3[0]);
-			giftCardDao.createGiftcardUseConfirm(giftcard);
-			giftcard.setOccurGb(TscConstants.GiftCardOccurGb.REGISTER_GIFTCARD.value());
-			giftcard.setOccurDtlDesc("상품권등록");
-			giftcard.setGfcdAmt(Integer.parseInt(param[1]));
-			giftCardDao.createCustGiftcardHistory(giftcard);
+			giftCard.setGfcdNm("YES24상품권");
+			giftCard.setChgGfcdAmt(Integer.parseInt(param[1])); // 승인금액
+			giftCard.setRmGfcdAmt(Integer.parseInt(param[1])); // 승인금액
+			giftCard.setUseStDate(param2[0]);
+			giftCard.setUseExpDate(param3[0]);
+			giftCardDao.createGiftcardUseConfirm(giftCard);
+			giftCard.setOccurGb(TscConstants.GiftCardOccurGb.REGISTER_GIFTCARD.value());
+			giftCard.setOccurDtlDesc("상품권등록");
+			giftCard.setGfcdAmt(Integer.parseInt(param[1]));
+			giftCardDao.createCustGiftcardHistory(giftCard);
 		}
 
-		giftCardDao.updateGfcdBulkReg(giftcard);
+		giftCardDao.updateGfcdBulkReg(giftCard);
 
 	}
 

+ 60 - 11
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -8,6 +8,12 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
 
+import com.style24.admin.biz.dao.TsaGiftCardDao;
+import com.style24.admin.biz.service.TsaGiftCardService;
+import com.style24.core.support.session.TscSession;
+import com.style24.core.support.util.CryptoUtils;
+import com.style24.persistence.domain.CustomerSearch;
+import com.style24.persistence.domain.GiftCard;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -128,6 +134,10 @@ public class TsaMarketingController extends TsaBaseController {
 	@Autowired
 	private TsaSocialService socialService;
 
+	@Autowired
+	private TsaGiftCardService giftCardService;
+
+
 	@Value("${upload.default.target.path}")
 	private String uploadTargetPath;
 
@@ -2394,7 +2404,6 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜쇼핑관리 화면
 	 *
-	 * @param
 	 * @author sowon
 	 * @since 2021. 3. 3 
 	 */
@@ -2423,8 +2432,8 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜 저장
 	 *
-	 * @param 소셜 정보
-	 * @return
+	 * @param  param - 소셜정보
+	 * @return GagaResponse - 메시지
 	 * @author sowon
 	 * @since 2021. 3. 3
 	 */
@@ -2439,8 +2448,8 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜 목록
 	 *
-	 * @param 
-	 * @return 
+	 * @param params - 소셜정보
+	 * @return GagaResponse - 결과메시지
 	 * @author sowon
 	 * @since 2021. 3. 3
 	 */
@@ -2462,8 +2471,8 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜 상품 저장
 	 *
-	 * @param 소셜 상품 정보
-	 * @return
+	 * @param  paramList - 소셜상품정보
+	 * @return GagaResponse - 결과메시지
 	 * @author sowon
 	 * @since 2021. 3. 4
 	 */
@@ -2477,8 +2486,8 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜 상품 목록
 	 *
-	 * @param 소셜 상품 정보
-	 * @return 소셜 상품 목록
+	 * @param params - 소셜상품정보
+	 * @return Collection<Social> - 소셜상품목록
 	 * @author sowon
 	 * @since 2021. 3. 4
 	 */
@@ -2492,8 +2501,8 @@ public class TsaMarketingController extends TsaBaseController {
 	/**
 	 * 소셜 상품 삭제
 	 *
-	 * @param 소셜 상품 정보
-	 * @return
+	 * @param paramList - 소셜상품정보
+	 * @return GagaResponse - 결과메시지
 	 * @author sowon
 	 * @since 2021. 3. 4
 	 */
@@ -2504,4 +2513,44 @@ public class TsaMarketingController extends TsaBaseController {
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
 
+	/**
+	 * 상품권 대량 등록 화면
+	 *
+	 * @return ModelAndView
+	 * @author jsshin
+	 * @since 2021. 05. 13
+	 */
+	@GetMapping("/giftcard/list/form")
+	public ModelAndView getGiftCardListForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 사이트 목록
+		mav.addObject("siteList", rendererService.getCommonCodeList("G000", "Y"));
+
+		mav.setViewName("marketing/GiftCardListForm");
+
+		return mav;
+	}
+
+	/**
+	 * 상품권 등록 목록
+	 *
+	 * @param giftCard - 검색조건
+	 * @return GagaMap - 페이징, 결과
+	 * @author jsshin
+	 * @since 2021. 01. 12
+	 */
+	@PostMapping("/giftcard/list")
+	@ResponseBody
+	public GagaMap getGiftCardList(@RequestBody GiftCard giftCard) {
+		GagaMap result = new GagaMap();
+		giftCard.setRegNo(TsaSession.getInfo().getUserNo());
+		giftCard.setPageable(new TscPageRequest(giftCard.getPageNo()-1, giftCard.getPageSize()));
+		giftCard.getPageable().setTotalCount(giftCardService.getGiftCardListCount(giftCard));
+		TscSession.setAttribute("maskingYn", TsaSession.getInfo().getMaskingYn());
+		result.set("pageing", giftCard);
+		result.set("giftCardList", giftCardService.getGiftCardList(giftCard));
+		return result;
+	}
+
 }

+ 61 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaGiftCard.xml

@@ -2,6 +2,67 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.style24.admin.biz.dao.TsaGiftCardDao">
 
+	<!-- 페이징을 위한 select절 상단 -->
+	<sql id="selectForPagingHeader">
+		SELECT *
+		FROM (
+	</sql>
+
+	<!-- 페이징을 위한 select절 하단 -->
+	<sql id="selectForPagingFooter">
+		) ORIGINAL
+		WHERE NUMB BETWEEN #{pageable.startRow} AND #{pageable.endRow}
+	</sql>
+
+	<!-- 상품권 대량 등록 수-->
+	<select id="getGiftCardListCount" parameterType="GiftCard" resultType="int">
+		/*TsaGiftCard.getGiftCardListCount*/
+		SELECT COUNT(*)  AS CNT
+		FROM   TB_GFCD_BULK_REG GBR
+		LEFT JOIN
+		       TB_GIFTCARD_API_HST GAH
+		ON     GBR.GFCD_API_HST_SQ = GAH.GFCD_API_HST_SQ
+		WHERE  1 = 1
+		<if test="custId != null and custId != ''">
+		AND    LOWER(GBR.CUST_ID) LIKE CONCAT('%',LOWER(#{custId}),'%')
+		</if>
+		<if test="stDate != null and edDate != '' and stDate != null and edDate != ''">
+		AND    GBR.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		AND    GBR.REG_DT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		</if>
+	</select>
+
+	<!--상품권 대량 등록 목록-->
+	<select id="getGiftCardList" parameterType="GiftCard" resultType="GiftCard">
+		/*TsaGiftCard.getGiftCardList*/
+		<include refid="selectForPagingHeader"/>
+		SELECT GBR.GFCD_BULK_REG_SQ
+		     , GBR.CUST_ID
+		     , GBR.GFCD_NO
+		     , GBR.RESULT_MSG
+		     , FN_GET_USER_NM(GBR.REG_NO)              AS REG_NM
+		     , DATE_FORMAT(GBR.REG_DT, '%Y%m%d%H%i%S') AS REG_DT
+		     , FN_GET_USER_NM(GBR.UPD_NO)              AS UPD_NM
+		     , DATE_FORMAT(GBR.UPD_DT, '%Y%m%d%H%i%S') AS UPD_DT
+		     , GAH.CUST_NO
+		     , GAH.IP_ADDR
+		     , GAH.RESULT_VAL
+		     , ROW_NUMBER() OVER(ORDER BY GBR.REG_DT DESC)   AS NUMB
+		FROM   TB_GFCD_BULK_REG GBR
+		LEFT JOIN
+		       TB_GIFTCARD_API_HST GAH
+		ON     GBR.GFCD_API_HST_SQ = GAH.GFCD_API_HST_SQ
+		WHERE  1 = 1
+		<if test="custId != null and custId != ''">
+		AND    LOWER(GBR.CUST_ID) LIKE CONCAT('%',LOWER(#{custId}),'%')
+		</if>
+		<if test="stDate != null and edDate != '' and stDate != null and edDate != ''">
+		AND    GBR.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		AND    GBR.REG_DT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		</if>
+		<include refid="selectForPagingFooter"/>
+	</select>
+
 	<!--상품권 대량 엑셀 정보 등록-->
 	<insert id="createGfcdBulkReg" parameterType="GiftCard" keyProperty="gfcdBulkRegSq">
 		/*TsaGiftCard.createGfcdBulkReg*/

+ 165 - 0
src/main/webapp/WEB-INF/views/marketing/GiftCardListForm.html

@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html lang="ko"
+	  xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : GiftCardListForm.html
+ * @desc    : 상품권 등록 화면 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.05.13   jsshin     최초 작성
+ *******************************************************************************
+ -->
+<div id="main">
+	<!-- 메인타이틀 영역 -->
+	<div class="main-title">
+	</div>
+	<!-- //메인타이틀 영역 -->
+
+	<!-- 메뉴 설명 -->
+	<div class="infoBox menu-desc">
+	</div>
+	<!-- //메뉴 설명 -->
+
+	<!-- 검색조건 영역 -->
+	<div class="panelContent">
+		<form id="giftCardForm" name="giftCardForm" action="#" th:action="@{'/marketing/giftcard/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+		<div class="panelStyle">
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:20%;"/>
+						<col style="width:10%;"/>
+						<col style="width:15%;"/>
+						<col style="width:10%;"/>
+						<col style="width:20%;"/>
+						<col/>
+					</colgroup>
+					<tbody>
+					<tr>
+						<th class="dashR">검색구분</th>
+
+						<th class="dashR">사이트</th>
+						<td class="dashR">
+							<select name="siteCd">
+								<option value="">전체</option>
+								<option th:if="${siteList}" th:each="oneData, status : ${siteList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th class="dashR">조회일자</th>
+						<td class="dashR" >
+							<span id="terms"></span>
+						</td>
+					</tr>
+					</tbody>
+				</table>
+
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
+						<button type="button" class="btn btn-gray btn-lg" onclick="$('#giftCardForm')[0].reset();">초기화</button>
+					</li>
+				</ul>
+		</div>
+		<!-- //검색조건 영역 -->
+
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<ul class="panelBar">
+				<li class="right">
+					검색결과 : <strong><span id="gridRowTotalCount">0</span> 건</strong>&nbsp;
+					쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>&nbsp;&nbsp;
+					<select id="pageSize" name="pageSize">
+						<option value="50" selected="selected">50개씩 보기</option>
+						<option value="100">100개씩 보기</option>
+						<option value="500">500개씩 보기</option>
+						<option value="1000">1000개씩 보기</option>
+					</select>
+					<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
+				</li>
+			</ul>
+			<div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
+			<ul class="panelBar">
+				<li class="center">
+					<div class="tablePaging" id="custListPagination"></div>
+				</li>
+			</ul>
+		</div>
+		</form>
+	</div>
+</div>
+<script type="text/javascript" th:src="@{'/ux/plugins/gaga/gaga.paging.js?v=' + ${#calendars.format(#calendars.createNow(), 'yyyyMMddHHmmss')}}" src="/ux/plugins/gaga/gaga.paging.js"></script>
+<script th:inline="javascript">
+	/*<![CDATA[*/
+	const siteList = gagajf.convertToArray([[${siteList}]]);				// 사이트목록
+
+	// specify the columns
+	const columnDefs = [
+		{
+			headerName: "사이트", field:'siteCd', width:100, cellClass: 'text-center',
+			valueGetter: function (params) { return gagaAgGrid.lookupValue(siteList, params.data.siteCd); }
+		},
+		{
+			headerName: "회원ID", field:'maskingCustId', width:120, cellClass: 'text-left',
+			valueGetter: function (params) {
+				return gagajf.isNull(params.data.custNo) ?
+					params.data.maskingCustId :'<a href="javascript:void(0);" onclick="cfnOpenCustDetailPopup(\''+params.data.custNo+'\')">' + params.data.maskingCustId + '</a>'
+			}
+		},
+		{headerName: "상품권번호", field:'gfcdNo', width:100, cellClass: 'text-center'},
+		{headerName: "결과메시지", field:'resultMsg', width:100, cellClass: 'text-center'},
+		{
+			headerName: "등록일자", field:'regDt', width:120, cellClass: 'text-center',
+			valueGetter: function (params) { return gagaAgGrid.toDateFormat(params.data.regDt); }
+		}
+
+	];
+
+	// Get GridOptions
+	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// 셀 클릭 이벤트
+	gridOptions.onCellClicked = function(event) {
+
+	}
+
+	// 조회
+	$('#btnSearch').on('click', function() {
+		fnSearch();
+	});
+
+	// 검색
+	var fnSearch = function() {
+		gagaPaging.init('giftCardForm', fnSearchCallBack, 'giftCardForm', $('#giftCardForm select[name=pageSize]').val());
+		gagaPaging.load($('#giftCardForm input[name=pageNo]').val());
+	};
+
+	var fnSearchCallBack = function (result) {
+		$('#gridRowTotalCount').html(result.pageing.pageable.totalCount.addComma());
+		$('#giftCardForm input[name=pageNo]').val(result.pageing.pageable.pageNo.addComma());
+		$('#pgNo').html(result.pageing.pageable.pageNo.addComma());
+		$('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
+
+		gridOptions.api.setRowData(result.giftCardList);
+		gagaPaging.createPagination(result.pageing.pageable);
+	};
+
+	$(document).ready(function() {
+		// 공통 달력 생성
+		cfnCreateCalendar('#terms', 'stDate', 'edDate', true);
+		$('.btnToday').trigger('click');
+
+		// Create a agGrid
+		//gagaAgGrid.createGrid('gridList', gridOptions);
+	});
+
+	/*]]>*/
+</script>
+
+</html>