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

Merge remote-tracking branch 'origin/develop' into develop

bin2107 5 лет назад
Родитель
Сommit
72b019e8b6

+ 20 - 2
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaMarketingDao.java

@@ -1,9 +1,12 @@
 package com.style24.admin.biz.dao;
 
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.FreeGoodsPromotion;
+import com.style24.persistence.domain.Itemkind;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 /**
@@ -25,11 +28,26 @@ public interface TsaMarketingDao {
 	 * @since 2020. 12. 17
 	 */
 	Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion marketing);
-
-	/* // xodud1202 진행 */
+    /* // xodud1202 진행 */
 
 	/* JSM 진행 */
+	/**
+	 * 쿠폰 리스트 조회
+	 * @param  Coupon
+	 * @return ArrayList<Coupon>
+	 * @author xyzp1539
+	 * @since 2020-12-22
+	 */
+	ArrayList<Coupon> getCouponList(Coupon param);
 
+	/**
+	 * 쿠폰 리스트 카운트 조회
+	 * @param  Coupon
+	 * @return int
+	 * @author xyzp1539
+	 * @since 2020-12-22
+	 */
+	int getCouponListCnt(Coupon param);
 	/* // JSM 진행 */
 
 }

+ 24 - 3
style24.admin/src/main/java/com/style24/admin/biz/service/TsaMarketingService.java

@@ -26,6 +26,7 @@ import org.springframework.util.StringUtils;
 
 import java.io.IOException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Collection;
 
 /**
@@ -77,19 +78,39 @@ public class TsaMarketingService {
 
 	/**
 	 * 사은품 프로모션 리스트
-	 * @param param
+	 * @param marketing
 	 * @return
 	 * @author xodud1202
 	 * @since 2020. 12. 17
 	 */
-	public Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion param) {
-		return marketingDao.getFreeGoodsPromotionList(param);
+	public Collection<FreeGoodsPromotion> getFreeGoodsPromotionList(FreeGoodsPromotion marketing) {
+		return marketingDao.getFreeGoodsPromotionList(marketing);
 	}
 
 	/* // xodud1202 진행 */
 
 	/* JSM 진행 */
+	/**
+	 * 쿠폰 리스트 조회
+	 * @param  Coupon
+	 * @return ArrayList<Coupon>
+	 * @author xyzp1539
+	 * @since 2020-12-22
+	 */
+	public ArrayList<Coupon> getCouponList(Coupon param) {
+		return marketingDao.getCouponList(param);
+	}
 
+	/**
+	 * 쿠폰리스트 카운트 조회
+	 * @param  Coupon
+	 * @return int
+	 * @author xyzp1539
+	 * @since 2020-12-22
+	 */
+	public int getCouponListCnt(Coupon param) {
+		return marketingDao.getCouponListCnt(param);
+	}
 	/* // JSM 진행 */
 
 }

+ 127 - 28
style24.admin/src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -1,14 +1,18 @@
 package com.style24.admin.biz.web;
 
 import com.gagaframework.web.parameter.GagaMap;
-import com.gagaframework.web.util.GagaDateUtil;
-import com.style24.admin.biz.service.*;
+import com.style24.admin.biz.service.TsaCommonService;
+import com.style24.admin.biz.service.TsaMarketingService;
+import com.style24.admin.biz.service.TsaRendererService;
+import com.style24.admin.biz.service.TsaSystemService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.TsaPageRequest;
+import com.style24.persistence.domain.CommonCode;
+import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.FreeGoodsPromotion;
-import com.style24.persistence.domain.SupplyCompany;
+
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
@@ -16,7 +20,9 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
+import java.lang.reflect.Array;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -38,9 +44,6 @@ public class TsaMarketingController extends TsaBaseController {
 	@Autowired
 	private TsaMarketingService marketingService;
 
-	@Autowired
-	private TsaBusinessService businessService;
-
 	@Autowired
 	private TsaRendererService rendererService;
 
@@ -53,6 +56,7 @@ public class TsaMarketingController extends TsaBaseController {
 	/* xodud1202 진행 */
 	/**
 	 * 사은품 프로모션 관리 화면
+	 * @return
 	 * @author xodud1202
 	 * @since 2020. 12. 16
 	 */
@@ -65,53 +69,148 @@ public class TsaMarketingController extends TsaBaseController {
 
 	/**
 	 * 사은품 프로모션 목록 조회
+	 *
+	 * @return
 	 * @author xodud1202
 	 * @since 2020. 10. 17
 	 */
 	@PostMapping("/freeGoodsPromotion/list")
 	@ResponseBody
-	public GagaMap getFreeGoodsPromotionList(@RequestBody FreeGoodsPromotion param) {
+	public GagaMap getFreeGoodsPromotionList(@RequestBody FreeGoodsPromotion marketing) {
 		GagaMap result = new GagaMap();
 
-		List<FreeGoodsPromotion> marketingList = (ArrayList<FreeGoodsPromotion>) marketingService.getFreeGoodsPromotionList(param);
+		List<FreeGoodsPromotion> marketingList = (ArrayList<FreeGoodsPromotion>) marketingService.getFreeGoodsPromotionList(marketing);
 
-		param.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
-		param.setPageable(new TsaPageRequest(param.getPageNo() - 1, param.getPageSize()));
-		param.getPageable().setTotalCount(marketingList.size());
+		marketing.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
+		marketing.setPageable(new TsaPageRequest(marketing.getPageNo() - 1, marketing.getPageSize()));
+		marketing.getPageable().setTotalCount(marketingList.size());
 
-		result.set("pageing", param);
+		result.set("pageing", marketing);
 		result.set("freeGoodsList", marketingList);
 
 		return result;
 	}
 
 
+	/* // xodud1202 진행 */
+
+	/* JSM 진행 */
 	/**
-	 * 세트상품구성 화면
-	 *
-	 * @param
-	 * @return
-	 * @author eskim
-	 * @since 2020. 05. 26
+	 * 쿠폰 리스트 목록 화면
+	 * @author xyzp1539
+	 * @since 2020-12-21
 	 */
-	@ResponseBody
-	@GetMapping("/freeGoodsRegiPopup/form")
-	public ModelAndView freeGoodsRegiForm(FreeGoodsPromotion param) {
+	@GetMapping("/coupon/form")
+	public ModelAndView couponListForm(){
 		ModelAndView mav = new ModelAndView();
 
-		// 상품상태
-		String[] exceptCds = {"G008_00"};
-		mav.addObject("goodsStatList", rendererService.getCommonCodeList("G008", "Y", exceptCds));
+		// 쿠폰 유형 조회
+		mav.addObject("cpnTypeList" ,  rendererService.getCommonCodeList("G230"));
+		// 할인 유형 조회
+		mav.addObject("dcWayList" , rendererService.getCommonCodeList("G240"));
+		// 사이트 조회
+		mav.addObject("siteCdList" , rendererService.getCommonCodeList("G000"));
+
+		mav.setViewName("marketing/CouponListForm");
 
-		mav.addObject("param", param);
-		mav.setViewName("marketing/FreeGoodsPromotionRegiForm");
 		return mav;
 	}
 
+	/**
+	 * 쿠폰 리스트 조회
+	 * @param  Coupon
+	 * @return GagaMap
+	 * @author xyzp1539
+	 * @since 2020-12-22
+	 */
+	@PostMapping("/coupon/list")
+	@ResponseBody
+	public GagaMap getCouponList(@RequestBody Coupon param){
+		GagaMap result =  new GagaMap();
+
+		ArrayList<Coupon> cpnList = marketingService.getCouponList(param);
+		int cpnTotCnt = marketingService.getCouponListCnt(param);
 
-	/* // xodud1202 진행 */
+		param.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
+		param.setPageable(new TsaPageRequest(param.getPageNo() - 1, param.getPageSize()));
+		param.getPageable().setTotalCount(cpnTotCnt);
 
-	/* JSM 진행 */
+		result.set("pageing" , param);
+		result.set("cpnTotCnt" , cpnTotCnt);
+		result.set("cpnList" , cpnList);
+
+		return result;
+	}
+
+	/**
+	 * 쿠폰 등록 팝업 화면
+	 * @return ModelAndView
+	 * @author xyzp1539
+	 * @since 2020-12-23
+	 */
+	@GetMapping("/coupon/popup/form")
+	@ResponseBody
+	public ModelAndView couponCreatePopup() {
+		ModelAndView mav = new ModelAndView();
+		String num = "";
+
+		// 일시 시 리스트 세팅
+		Collection<CommonCode> hhList = new ArrayList<CommonCode>();
+		for(int i = 0; i < 24; i++) {
+			num = "";
+			CommonCode temp = new CommonCode();
+			if(i < 10) {
+				num = "0" + i;
+			} else {
+				num = String.valueOf(i);
+			}
+
+		// 상품상태
+		String[] exceptCds = {"G008_00"};
+		mav.addObject("goodsStatList", rendererService.getCommonCodeList("G008", "Y", exceptCds));
 
+			temp.setCd(num);
+			temp.setCdNm(num+"시");
+
+			hhList.add(temp);
+		}
+		// 일시 분 리스트 세팅
+		Collection<CommonCode> mmList = new ArrayList<CommonCode>();
+		for(int i = 0 ; i < 60; i++) {
+			num = "";
+			CommonCode temp = new CommonCode();
+			if(i < 10) {
+				num = "0" + i;
+			} else {
+				num = String.valueOf(i);
+			}
+			temp.setCd(num);
+			temp.setCdNm(num+"분");
+
+			mmList.add(temp);
+		}
+
+		// 쿠폰 유형 조회
+		mav.addObject("cpnTypeList" ,  rendererService.getCommonCodeList("G230"));
+		// 사용가능 고객구분 조회
+		mav.addObject("usableCustGbList", rendererService.getCommonCodeList("G100"));
+		// 사용가능 고객등급 조회
+		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G110"));
+		// 사이트코드 조회
+		mav.addObject("siteCdList" , rendererService.getCommonCodeList("G000"));
+		// 재발급 여부 조회
+		mav.addObject("reissuanceList" , rendererService.getCommonCodeList("G231"));
+		// 할인방식 조회
+		mav.addObject("dcWayList" , rendererService.getCommonCodeList("G240"));
+		// 쿠폰다운로드 방식 조회
+		mav.addObject("dnGbList" , rendererService.getCommonCodeList("G058"));
+		// 시간 분 리스트 세팅
+		mav.addObject("mmList" , mmList);
+		// 시간 시 리스트 세팅
+		mav.addObject("hhList" , hhList);
+
+		mav.setViewName("marketing/CouponCreatePopupForm");
+		return mav;
+	}
 	/* // JSM 진행 */
 }

+ 114 - 16
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaMarketing.xml

@@ -1,38 +1,136 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!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.TsaMarketingDao">
-	<!-- xodud1202 진행 -->
 
 	<!-- 품목 목록 -->
 	<select id="getFreeGoodsPromotionList" parameterType="FreeGoodsPromotion" resultType="FreeGoodsPromotion">
 		/* TsaMarketing.getFreeGoodsPromotionList */
 		SELECT FG.FREEGIFT_SQ
-		, FG.FREEGIFT_NM
-		, FG.FREEGIFT_STAT
-		, DATE_FORMAT(FG.FREEGIFT_STDT, '%Y.%m.%d') AS FREEGIFT_STDT
-		, DATE_FORMAT(FG.FREEGIFT_EDDT, '%Y.%m.%d') AS FREEGIFT_EDDT
-		, (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
-		, DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
-		, (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
-		, DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
-		FROM TB_FREEGIFT FG
-		WHERE 1=1
+		     , FG.FREEGIFT_NM
+		     , FG.FREEGIFT_STAT
+		     , DATE_FORMAT(FG.FREEGIFT_STDT, '%Y.%m.%d') AS FREEGIFT_STDT
+		     , DATE_FORMAT(FG.FREEGIFT_EDDT, '%Y.%m.%d') AS FREEGIFT_EDDT
+		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
+		     , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
+		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
+		     , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
+          FROM TB_FREEGIFT FG
+         WHERE 1=1
 		<if test="searchTxt != null and searchTxt != ''">
-			<if test="promotionGubun != null and promotionGubun == 'freegiftSq'">
+			<if test="promotionGubun != null and promotionGubun == 'freeGiftSq'">
 				AND FG.FREEGIFT_SQ = #{searchTxt}
 			</if>
-			<if test="promotionGubun != null and promotionGubun == 'freegiftNm'">
-				AND FG.FREEGIFT_NM = #{searchTxt}
+			<if test="promotionGubun != null and promotionGubun == 'freeGiftName'">
+				AND FG.FREEGIFT_NAME = #{searchTxt}
 			</if>
 		</if>
-		ORDER BY REG_DT DESC
+         ORDER BY REG_DT DESC
 	</select>
 
-
+	<!-- xodud1202 진행 -->
 
 	<!-- // xodud1202 진행 -->
 
 	<!-- JSM 진행 -->
+	<!-- 쿠폰리스트 조회 -->
+	<select id="getCouponList" parameterType="Coupon" resultType="Coupon">
+		/* marketing.getCouponList */
+		SELECT T.*
+		     , COUNT(CUST_CPN_SQ) AS ISSUE_CNT
+		     , COUNT(USED_DT) AS USE_CNT
+		FROM (
+				SELECT SITE_CD
+					 , CPN_ID
+					 , CPN_NM
+					 , USABLE_CUST_GB
+					 , CPN_TYPE
+					 , DC_WAY
+					 , DC_PVAL
+					 , DC_MVAL
+					 , MAX_DC_AMT
+					 , PD_GB
+					 , AVAIL_STDT
+					 , AVAIL_EDDT
+					 , REG_NO
+					 , REG_DT
+			 	  FROM TB_COUPON
+				 WHERE 1=1
+				<if test="siteCd != null and siteCd != ''">
+				   AND SITE_CD = #{siteCd}
+				</if>
+			    <if test="cpnId != null and cpnId != ''">
+			       AND CPN_ID = #{cpnId}
+				</if>
+			    <if test="cpnType != null and cpnType != ''">
+			       AND CPN_TYPE = #{cpnType}
+			    </if>
+			    <if test="regNo != null and regNo != ''">
+			       AND REG_NO = #{regNo}
+			    </if>
+			    <if test="dcWay != null and dcWay != ''">
+			       AND DC_WAY = #{dcWay}
+			    </if>
+			    <if test="cpnNm != null and cpnNm != ''">
+			       AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+			    </if>
+			    <if test="pdGb != null and pdGb != ''">
+			       AND PD_GB = #{pdGb}
+			    </if>
+			    <if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
+			      AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+			      AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+			    </if>
+			) T
+			LEFT OUTER JOIN TB_CUST_COUPON CC
+					     ON T.CPN_ID = CC.CPN_ID
+            GROUP BY  T.SITE_CD
+					, T.CPN_ID
+					, T.CPN_NM
+					, T.USABLE_CUST_GB
+					, T.CPN_TYPE
+					, T.DC_WAY
+					, T.DC_PVAL
+					, T.DC_MVAL
+					, T.MAX_DC_AMT
+					, T.PD_GB
+					, T.AVAIL_STDT
+					, T.AVAIL_EDDT
+					, T.REG_NO
+					, T.REG_DT
+            ORDER BY  T.REG_DT DESC
+	</select>
 
+	<!-- 쿠폰 리스트 카운트 조회-->
+	<select id="getCouponListCnt" parameterType="Coupon" resultType="int">
+		/* marketing.getCouponListCnt */
+		SELECT COUNT(1)
+		  FROM TB_COUPON
+	    WHERE 1=1
+		<if test="siteCd != null and siteCd != ''">
+		  AND SITE_CD = #{siteCd}
+		</if>
+		<if test="cpnId != null and cpnId != ''">
+		  AND CPN_ID = #{cpnId}
+		</if>
+		<if test="cpnType != null and cpnType != ''">
+		  AND CPN_TYPE = #{cpnType}
+		</if>
+		<if test="regNo != null and regNo != ''">
+		  AND REG_NO = #{regNo}
+		</if>
+		<if test="dcWay != null and dcWay != ''">
+		  AND DC_WAY = #{dcWay}
+		</if>
+		<if test="cpnNm != null and cpnNm != ''">
+		  AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+		</if>
+		<if test="pdGb != null and pdGb != ''">
+		  AND PD_GB = #{pdGb}
+		</if>
+		<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
+		  AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+		  AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+		</if>
+	</select>
 	<!-- // JSM 진행 -->
 </mapper>