Przeglądaj źródła

Merge branch 'bin2107' into develop

bin2107 5 lat temu
rodzic
commit
613debdb1e

+ 24 - 0
src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java

@@ -240,4 +240,28 @@ public interface TsaCouponDao {
 	 * @since 2021. 02. 02
 	 */
 	void createCouponPayType(Coupon params);
+
+	/**
+	 * 쿠폰사용가능고객구분 조회
+	 * @param cpnId
+	 * @author bin2107
+	 * @since 2021. 02. 02
+	 */
+	ArrayList<Coupon> getCouponCustGbList(int cpnId);
+
+	/**
+	 * 쿠폰사용가능고객등급 조회
+	 * @param cpnId
+	 * @author bin2107
+	 * @since 2021. 02. 02
+	 */
+	ArrayList<Coupon> getCouponCustGradeList(int cpnId);
+
+	/**
+	 * 쿠폰사용가능결제수단 조회
+	 * @param cpnId
+	 * @author bin2107
+	 * @since 2021. 02. 02
+	 */
+	ArrayList<Coupon> getCouponPayTypeList(int cpnId);
 }

+ 33 - 112
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -126,118 +126,6 @@ public class TsaCouponService {
 			couponDao.saveCouponBurden(couponBurden);
 		}
 
-		return "SUCCESS";
-	}
-	@Transactional("shopTxnManager")
-	public String saveCoupon2(Coupon params){
-		int cpnId = params.getCpnId();		// 쿠폰ID (신규생성인지 수정인지 구분하기 위해 params의 cpnId를 먼저 가져옴 > 쿠폰 생성시 cpnId를 저장하기때문임)
-		params.setRegNo(TsaSession.getInfo().getUserNo());
-		params.setUpdNo(TsaSession.getInfo().getUserNo());
-
-		couponDao.couponInsert(params);
-
-		Gson gson = new Gson();
-		Integer sequence;
-		// 적용대상 - 공급업체
-		/*
-		Collection<CouponRefval> supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
-		for(CouponRefval supplyComp : supplyCompList) {
-			sequence = null;
-
-			if(supplyComp.getCpnRefvalSq() != null && supplyComp.getCpnRefvalSq() > 0){
-				sequence = supplyComp.getCpnRefvalSq();
-			}
-
-			supplyComp.setCpnId(cpnId);
-			supplyComp.setCpnRefvalSq(sequence);
-			supplyComp.setCpnTarget("G260_13");
-			supplyComp.setRefVal(supplyComp.getSupplyCompCd());
-			supplyComp.setRegNo(TsaSession.getInfo().getUserNo());
-			supplyComp.setUpdNo(TsaSession.getInfo().getUserNo());
-			couponDao.saveCouponRefVal(supplyComp);
-		}
-		// 적용대상 - 브랜드
-		Collection<CouponRefval> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
-		for(CouponRefval brand : brandList) {
-			sequence = null;
-
-			if(brand.getCpnRefvalSq() != null && brand.getCpnRefvalSq() > 0){
-				sequence = brand.getCpnRefvalSq();
-			}
-
-			brand.setCpnId(cpnId);
-			brand.setCpnRefvalSq(sequence);
-			brand.setCpnTarget("G260_12");
-			brand.setRefVal(brand.getBrandCd());
-			brand.setRegNo(TsaSession.getInfo().getUserNo());
-			brand.setUpdNo(TsaSession.getInfo().getUserNo());
-
-			couponDao.saveCouponRefVal(brand);
-		}
-		// 적용대상 - 적용상품
-		Collection<CouponRefval> applyGoodsList = gson.fromJson(params.getApplyGoodsList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
-		for(CouponRefval applyGoods : applyGoodsList ) {
-			sequence = null;
-
-			if(applyGoods.getCpnRefvalSq() != null && applyGoods.getCpnRefvalSq() > 0){
-				sequence = applyGoods.getCpnRefvalSq();
-			}
-			applyGoods.setCpnId(cpnId);
-			applyGoods.setCpnRefvalSq(sequence);
-			applyGoods.setCpnTarget("G260_10");
-			applyGoods.setRefVal(applyGoods.getGoodsCd());
-			applyGoods.setRegNo(TsaSession.getInfo().getUserNo());
-			applyGoods.setUpdNo(TsaSession.getInfo().getUserNo());
-
-			couponDao.saveCouponRefVal(applyGoods);
-		}
-		// 적용대상 - 카테고리
-		Collection<CouponRefval> cateList = gson.fromJson(params.getCateList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
-		for(CouponRefval cate : cateList ) {
-			sequence = null;
-
-			if(cate.getCpnRefvalSq() != null && cate.getCpnRefvalSq() > 0){
-				sequence = cate.getCpnRefvalSq();
-			}
-			cate.setCpnId(cpnId);
-			cate.setCpnRefvalSq(sequence);
-			cate.setCpnTarget("G260_11");
-			cate.setRefVal(cate.getCateNo());
-			cate.setRefFormalGb(cate.getFormalGb());
-			cate.setRefBrandCd(cate.getBrandCd());		// ag-grid 브랜드코드
-			cate.setRegNo(TsaSession.getInfo().getUserNo());
-			cate.setUpdNo(TsaSession.getInfo().getUserNo());
-
-			couponDao.saveCouponRefVal(cate);
-		}
-		// 적용대상 - 제외상품
-		Collection<CouponRefval> exceptGoodsList = gson.fromJson(params.getExceptGoodsList() , new TypeToken<Collection<CouponRefval>>(){}.getType());
-		for(CouponRefval exceptGoods: exceptGoodsList ) {
-			sequence = null;
-
-			if(exceptGoods.getCpnRefvalSq() != null && exceptGoods.getCpnRefvalSq() > 0){
-				sequence = exceptGoods.getCpnRefvalSq();
-			}
-
-			exceptGoods.setCpnId(cpnId);
-			exceptGoods.setCpnRefvalSq(sequence);
-			exceptGoods.setCpnTarget("G260_14");
-			exceptGoods.setRefVal(exceptGoods.getGoodsCd());
-			exceptGoods.setRegNo(TsaSession.getInfo().getUserNo());
-			exceptGoods.setUpdNo(TsaSession.getInfo().getUserNo());
-
-			couponDao.saveCouponRefVal(exceptGoods);
-		}
-		// 입점업체분담율
-		Collection<CouponBurden> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<CouponBurden>>(){}.getType());
-		for(CouponBurden burden: burdenList ) {
-			burden.setCpnId(cpnId);
-			burden.setRegNo(TsaSession.getInfo().getUserNo());
-			burden.setUpdNo(TsaSession.getInfo().getUserNo());
-
-			couponDao.saveCouponBurden(burden);
-		}
-		*/
 		// 수정모드이고 변경된 쿠폰상태가 대기 , 중지 인경우 고객이 발급받은 내용도 변경
 		if(cpnId != 0 &&
 				(params.getCpnStat().equals("G232_10") || params.getCpnStat().equals("G232_12")) ) {
@@ -511,4 +399,37 @@ public class TsaCouponService {
 	public void saveCouponIssue(CustCoupon coupon) {
 		couponDao.saveCouponCustPub(coupon);
 	}
+
+	/**
+	 * 쿠폰사용가능고객구분 조회
+	 * @param
+	 * @return
+	 * @author bin2107
+	 * @since 2021-02-02
+	 */
+	public ArrayList<Coupon> getCouponCustGbList(int cpnId) {
+		return couponDao.getCouponCustGbList(cpnId);
+	}
+
+	/**
+	 * 쿠폰사용가능고객등급 조회
+	 * @param
+	 * @return
+	 * @author bin2107
+	 * @since 2021-02-02
+	 */
+	public ArrayList<Coupon> getCouponCustGradeList(int cpnId) {
+		return couponDao.getCouponCustGradeList(cpnId);
+	}
+
+	/**
+	 * 쿠폰사용가능결제수단 조회
+	 * @param
+	 * @return
+	 * @author bin2107
+	 * @since 2021-02-02
+	 */
+	public ArrayList<Coupon> getCouponPayTypeList(int cpnId) {
+		return couponDao.getCouponPayTypeList(cpnId);
+	}
 }

+ 6 - 0
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -464,6 +464,12 @@ public class TsaMarketingController extends TsaBaseController {
 			mav.addObject("cpnDtlBurdenList", couponService.getCouponBurdenList(cpnId));
 			// 시리얼 및 난수 쿠폰 조회
 			mav.addObject("randomCpnList", couponService.getRandomCouponInfo(cpnId));
+			// 쿠폰사용가능고객구분 조회
+			mav.addObject("cpnCustGbList", couponService.getCouponCustGbList(cpnId));
+			// 쿠폰사용가능고객등급 조회
+			mav.addObject("cpnCustGradeList", couponService.getCouponCustGradeList(cpnId));
+			// 쿠폰사용가능결제수단 조회
+			mav.addObject("cpnPayTypeList", couponService.getCouponPayTypeList(cpnId));
 		}
 
 		//issueCnt = 3;

+ 27 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml

@@ -466,11 +466,9 @@
 		/* TsaCoupon.getCouponRefvalExceptGoodsList */
 		SELECT B.BRAND_CD
 			 , B.BRAND_ENM
-		     , C.SUPPLY_COMP_NM
 			 , A.CPN_REFVAL_SQ
 		  FROM TB_COUPON_REFVAL A
 		 INNER JOIN TB_BRAND B ON A.REF_VAL = B.BRAND_CD
-		 INNER JOIN TB_SUPPLY_COMPANY C ON B.SUPPLY_COMP_CD = C.SUPPLY_COMP_CD
 		 WHERE A.CPN_ID = #{cpnId}
 		   AND A.CPN_TARGET = #{cpnTarget}
 		   AND A.DEL_YN = 'N'
@@ -714,4 +712,31 @@
 			 , CURRENT_TIMESTAMP()
 		)
 	</insert>
+
+	<!-- 쿠폰사용가능고객구분 조회-->
+	<select id="getCouponCustGbList" parameterType="int" resultType="Coupon">
+		/* TsaCoupon.getCouponCustGbList */
+		SELECT CPN_ID
+			 , USABLE_CUST_GB
+		FROM TB_COUPON_CUST_GBN
+		WHERE CPN_ID = #{cpnId}
+	</select>
+
+	<!-- 쿠폰사용가능고객등급 조회-->
+	<select id="getCouponCustGradeList" parameterType="int" resultType="Coupon">
+		/* TsaCoupon.getCouponCustGradeList */
+		SELECT CPN_ID
+			 , USABLE_CUST_GRADE
+		FROM TB_COUPON_CUST_GRADE
+		WHERE CPN_ID = #{cpnId}
+	</select>
+
+	<!-- 쿠폰사용가능결제수단 조회-->
+	<select id="getCouponPayTypeList" parameterType="int" resultType="Coupon">
+		/* TsaCoupon.getCouponPayTypeList */
+		SELECT CPN_ID
+			 , PAY_TYPE
+		FROM TB_COUPON_PAYTYPE
+		WHERE CPN_ID = #{cpnId}
+	</select>
 </mapper>

+ 49 - 2
src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html

@@ -492,6 +492,10 @@
 	var randomCpnList = [[${randomCpnList}]];
 	var issueCnt = [[${issueCnt}]];
 
+	var cpnCustGbList = [[${cpnCustGbList}]];
+	var cpnCustGradeList = [[${cpnCustGradeList}]];
+	var cpnPayTypeList = [[${cpnPayTypeList}]];
+
 	// 공통코드 리스트
 	var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
 	var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
@@ -533,7 +537,7 @@
 		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
 		{ headerName : "브랜드ID" , field: "brandCd" , width: 120, cellClass : 'text-center'} ,
 		{ headerName : "브랜드명" , field: "brandEnm" , width: 120, cellClass: 'text-center'} ,
-		{ headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
+		//{ headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
 		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
 	];
 
@@ -682,7 +686,6 @@
 	});
 
 	// 쿠폰 등록 버튼 클릭시
-
 	function fnCouponCreate(){
 		mcxDialog.confirm('저장하시겠습니까?' , {
 			cancelBtnText:"취소",
@@ -773,6 +776,8 @@
 
 	var fnCouponSaveCollback = function (result){
 		console.log('AAAAAA');
+		uifnPopupClose('CouponRegForm');
+		$('#btnSearch').trigger('click');
 	}
 
 	function fnCouponCreate2(){
@@ -1611,6 +1616,48 @@
 				$('#CouponForm .dcCdCheck1').hide();
 			}
 		} else {
+			if(cpnCustGbList.length > 0){
+				var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGbArr]').length;
+				var dataCnt = cpnCustGbList.length;
+				for(let i=0; i<chkboxCnt; i++){
+					for(let j=0; j<dataCnt; j++){
+						var data = cpnCustGbList[j].usableCustGb;
+						if($('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).val() == data){
+							$('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).prop('checked', true);
+							$("#CouponForm input:checkbox[name=usableCustGbArr]").eq(i).parent().addClass('checked');
+						}
+					}
+				}
+			}
+
+			if(cpnCustGradeList.length > 0){
+				var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGradeArr]').length;
+				var dataCnt = cpnCustGradeList.length;
+				for(let i=0; i<chkboxCnt; i++){
+					for(let j=0; j<dataCnt; j++){
+						var data = cpnCustGradeList[j].usableCustGrade;
+						if($('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).val() == data){
+							$('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).prop('checked', true);
+							$("#CouponForm input:checkbox[name=usableCustGradeArr]").eq(i).parent().addClass('checked');
+						}
+					}
+				}
+			}
+
+			if(cpnPayTypeList.length > 0){
+				var chkboxCnt = $('#CouponForm input:checkbox[name=payTypeArr]').length;
+				var dataCnt = cpnPayTypeList.length;
+				for(let i=0; i<chkboxCnt; i++){
+					for(let j=0; j<dataCnt; j++){
+						var data = cpnPayTypeList[j].payType;
+						if($('#CouponForm input:checkbox[name=payTypeArr]').eq(i).val() == data){
+							$('#CouponForm input:checkbox[name=payTypeArr]').eq(i).prop('checked', true);
+							$("#CouponForm input:checkbox[name=payTypeArr]").eq(i).parent().addClass('checked');
+						}
+					}
+				}
+			}
+
 			// 수정모드시 그리드 세팅
 			inComGridOptions.api.setRowData(cpnDtlBurdenList);
 			supplyGridOptions.api.setRowData(cpnDtlRefvalSupplyCompList);