Selaa lähdekoodia

Merge branch 'sowon' into develop

sowon4187 5 vuotta sitten
vanhempi
commit
f7f0638b8b

+ 9 - 0
src/main/java/com/style24/admin/biz/dao/TsaPlanDao.java

@@ -446,6 +446,15 @@ public interface TsaPlanDao {
 	 */
 	Collection<Plan> getPlanContentCouponList(Plan param);
 	
+	/**
+	 * 기획전 템플릿 상세조회 - 쿠폰 유의사항
+	 *
+	 * @param
+	 * @author sowon
+	 * @since 2021. 5. 26
+	 */
+	Plan getPlanContentCouponNotice(Plan param);
+	
 	/**
 	 * 기획전 템플릿 상세조회 - 파일
 	 *

+ 35 - 1
src/main/java/com/style24/admin/biz/service/TsaPlanService.java

@@ -914,7 +914,29 @@ public class TsaPlanService {
 			cuPlan.setDispYn(param.getCuDispYn());
 			cuPlan.setDispOrd(param.getCuDispOrd());
 			cuPlan.setPlanContSq(param.getCuPlanContSq());
-			cuPlan.setNote(param.getNote());
+			String[] cpnNote = param.getMultiPlanCouponNotice();
+			for (int i = 0; i < cpnNote.length; i++) {
+				if(i==0) 
+					cuPlan.setCpnNote0(cpnNote[i]);
+				else if(i==1) 
+					cuPlan.setCpnNote1(cpnNote[i]);
+				else if(i==2) 
+					cuPlan.setCpnNote2(cpnNote[i]);
+				else if(i==3) 
+					cuPlan.setCpnNote3(cpnNote[i]);
+				else if(i==4) 
+					cuPlan.setCpnNote4(cpnNote[i]);
+				else if(i==5) 
+					cuPlan.setCpnNote5(cpnNote[i]);
+				else if(i==6) 
+					cuPlan.setCpnNote6(cpnNote[i]);
+				else if(i==7) 
+					cuPlan.setCpnNote7(cpnNote[i]);
+				else if(i==8) 
+					cuPlan.setCpnNote8(cpnNote[i]);
+				else if(i==9) 
+					cuPlan.setCpnNote9(cpnNote[i]);
+			}
 			planDao.createPlanContents(cuPlan);
 			
 			// 기존 쿠폰아이템 삭제
@@ -1449,6 +1471,18 @@ public class TsaPlanService {
 		return planDao.getPlanContentCouponList(param);
 	}
 	
+	/**
+	 * 기획전 템플릿 상세조회 - 쿠폰유의사항
+	 *
+	 * @param 
+	 * @return
+	 * @author sowon
+	 * @since 2021. 5 .26
+	 */
+	public Plan getPlanContentCouponNotice(Plan param){
+		return planDao.getPlanContentCouponNotice(param);
+	}
+	
 	
 	/**
 	 * 기획전 템플릿 상세조회 - 파일

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

@@ -2225,6 +2225,7 @@ public class TsaMarketingController extends TsaBaseController {
 			//쿠폰리스트
 			param.setTmplType("G082_20");
 			mav.addObject("couponList", planService.getPlanContentCouponList(param));
+			mav.addObject("couponNotice", planService.getPlanContentCouponNotice(param));
 
 			//파일리스트
 			param.setTmplType("G082_30");

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

@@ -192,6 +192,17 @@ public class Plan extends TscBaseDomain{
 		private String reviewDispStdt;		//리뷰노출시작일시
 		private String reviewDispEddt;		//리뷰노툴종료일시
 		private String linkOpenGb;			// 링크 본장,새창여부
+		private String cpnNote0;
+		private String cpnNote1;
+		private String cpnNote2;
+		private String cpnNote3;
+		private String cpnNote4;
+		private String cpnNote5;
+		private String cpnNote6;
+		private String cpnNote7;
+		private String cpnNote8;
+		private String cpnNote9;
+		
 		
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] multiPlanReview;		//리뷰상품목록
@@ -208,6 +219,8 @@ public class Plan extends TscBaseDomain{
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] multiPlanNotice;			//유의사항목록
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+		private String[] multiPlanCouponNotice;		//쿠폰유의사항목록
+		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] multiPlanFile;			//이미지목록
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] multiPlanFile2;			//이미지새장본창

+ 66 - 6
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -1043,7 +1043,16 @@
 							, TITLE
 							, LINK_URL
 							, LINK_OPEN_GB
-							, NOTE							
+							, CPN_NOTE0
+							, CPN_NOTE1
+							, CPN_NOTE2
+							, CPN_NOTE3
+							, CPN_NOTE4
+							, CPN_NOTE5
+							, CPN_NOTE6
+							, CPN_NOTE7
+							, CPN_NOTE8
+							, CPN_NOTE9
 							, DISP_YN
 							, DISP_ORD
 							, REG_NO
@@ -1059,7 +1068,16 @@
 					 , #{title}
 					 , #{linkUrl}
 					 , #{linkOpenGb}
-					 , #{note}
+					 , #{cpnNote0}
+					 , #{cpnNote1}
+					 , #{cpnNote2}
+					 , #{cpnNote3}
+					 , #{cpnNote4}
+					 , #{cpnNote5}
+					 , #{cpnNote6}
+					 , #{cpnNote7}
+					 , #{cpnNote8}
+					 , #{cpnNote9}
 					 , #{dispYn}
 					 , #{dispOrd}
 					 , #{regNo}
@@ -1074,7 +1092,16 @@
 			 	 , TMPL_TYPE = #{tmplType}
 			   	 , LINK_URL=#{linkUrl}
 			   	 , LINK_OPEN_GB=#{linkOpenGb}
-			   	 , NOTE = #{note}
+			   	 , CPN_NOTE0 = #{cpnNote0}
+		         , CPN_NOTE1 = #{cpnNote1}
+		         , CPN_NOTE2 = #{cpnNote2}
+		         , CPN_NOTE3 = #{cpnNote3}
+		         , CPN_NOTE4 = #{cpnNote4}
+		         , CPN_NOTE5 = #{cpnNote5}
+		         , CPN_NOTE6 = #{cpnNote6}
+		         , CPN_NOTE7 = #{cpnNote7}
+		         , CPN_NOTE8 = #{cpnNote8}
+		         , CPN_NOTE9 = #{cpnNote9}
 			     , DISP_YN=#{dispYn}
 			     , DISP_ORD=#{dispOrd}
 			     , UPD_NO=#{updNo}
@@ -1133,7 +1160,6 @@
 		      ,A.TITLE 
 		      ,A.LINK_URL 
 		      ,A.LINK_OPEN_GB
-		      ,A.NOTE
 		      ,A.DISP_YN 
 		      ,A.DISP_ORD 
 		      ,A.REG_NO 
@@ -1156,7 +1182,16 @@
 		      ,A.TITLE 
 		      ,A.LINK_URL 
 		      ,A.LINK_OPEN_GB
-		      ,A.NOTE
+		      ,A.CPN_NOTE0
+		      ,A.CPN_NOTE1
+		      ,A.CPN_NOTE2
+		      ,A.CPN_NOTE3
+		      ,A.CPN_NOTE4
+		      ,A.CPN_NOTE5
+		      ,A.CPN_NOTE6
+		      ,A.CPN_NOTE7
+		      ,A.CPN_NOTE8
+		      ,A.CPN_NOTE9
 		      ,A.DISP_YN 
 		      ,A.DISP_ORD 
 		      ,A.REG_NO 
@@ -1168,6 +1203,31 @@
 		WHERE A.PLAN_SQ = #{planSq} AND A.TMPL_TYPE = #{tmplType}
 	</select>
 	
+	<select id="getPlanContentCouponNotice" parameterType="Plan" resultType="Plan">
+		/* TsaPlan.getPlanContentCouponNotice */
+		SELECT A.PLAN_CONT_SQ 
+			  ,A.PLAN_SQ 
+		      ,A.TMPL_TYPE 
+		      ,A.TITLE 
+		      ,A.LINK_URL 
+		      ,A.LINK_OPEN_GB
+		      ,A.CPN_NOTE0
+		      ,A.CPN_NOTE1
+		      ,A.CPN_NOTE2
+		      ,A.CPN_NOTE3
+		      ,A.CPN_NOTE4
+		      ,A.CPN_NOTE5
+		      ,A.CPN_NOTE6
+		      ,A.CPN_NOTE7
+		      ,A.CPN_NOTE8
+		      ,A.CPN_NOTE9
+		      ,A.DISP_YN 
+		      ,A.DISP_ORD 
+		      ,A.REG_NO 
+		FROM TB_PLAN_CONTENTS A  
+		WHERE A.PLAN_SQ = #{planSq} AND A.TMPL_TYPE = #{tmplType}
+	</select>
+	
 	<select id="getPlanContentFileList" parameterType="Plan" resultType="Plan">
 		/* TsaPlan.getPlanContentFileList */
 		SELECT A.PLAN_CONT_SQ 
@@ -1251,7 +1311,7 @@
 		      ,C.GOODS_STAT 
 		      ,D.BRAND_KNM 
 		      ,D.BRAND_ENM 
-		FROM tb_plan_contents_item B LEFT JOIN TB_GOODS C ON B.ITEM_VAL = C.GOODS_CD 
+		FROM TB_PLAN_CONTENTS_ITEM B LEFT JOIN TB_GOODS C ON B.ITEM_VAL = C.GOODS_CD 
 									 LEFT JOIN TB_BRAND D ON C.BRAND_CD = D.BRAND_CD
 		WHERE B.PLAN_CONT_SQ IN 
 								(

+ 100 - 20
src/main/webapp/WEB-INF/views/marketing/PlanTemplatePopupForm.html

@@ -119,8 +119,29 @@
 													<td><input type="text" name="cuDispOrd" class="w100 aR" data-valid-type="numeric"></td>
 												</tr>
 												<tr>
-													<th>쿠폰유의사항</th>
-													<td><textarea class="textareaR4 summernote" name="note" id="note" rows="15" cols="40" style="width: 860px;"></textarea></td>
+													<th>쿠폰 유의사항</th>
+													<td colspan="5">
+														<div id="registeredFile"></div>
+														<div style="display: block">
+															<select name="couponCnt" id="couponCnt">
+																<th:block th:each="num: ${#numbers.sequence(1,10)}">
+																	<option th:value="${num}" th:text="${num}"></option>
+																</th:block>
+															</select>* 쿠폰 유의사항 개수 선택(10개까지 가능)
+														</div> 
+														<th:block th:each="num: ${#numbers.sequence(1,10)}">
+															<div>
+																<table>
+																	<tr th:id="${'coupon'+num}">
+																		<th th:text="${'유의사항' + num}"></th>
+																		<td>
+																			<input type="text"	th:id="${'cpnNote' + (num-1)}" th:name="${'cpnNote' + (num-1)}" class="w300 aR">
+																		</td>
+																	</tr>
+																</table>
+															</div>
+														</th:block>
+													</td>
 												</tr>
 											</table>
 											<div class="padding10">
@@ -128,15 +149,7 @@
 													<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnAddCoupone()">쿠폰 추가</button>
 												</span> <br />
 											<table class="frmStyle" id="couponTable">
-												<!-- <tr>
-													<td colspan="3">
-														<input type="checkbox">
-														<input type="text" class="w300" name="cuItemVal1" onkeypress="if (window.event.keyCode == 13) { fnOpenCouponRetrievePopup('input[name=cuItemVal1]', 'input[name=cuItemNm1]'); }"/>
-														<button type="button" class="btn icn" onclick="fnOpenCouponRetrievePopup('input[name=cuItemVal1]', 'input[name=cuItemNm1]');"><i class="fa fa-search cpn" aria-hidden="true"></i></button>
-														<input name="cuItemVal1" type="text" class="w100" maxlength="20" readonly="readonly"/>
-														<button type="button" class="btn icn" onclick="$('input[name=cuItemVal1], input[name=cuItemNm1]').val('');"><i class="fa fa-eraser" aria-hidden="true"></i></button>
-													</td>
-												</tr> -->
+												
 											</table>
 											</div>
 										</td>
@@ -1067,6 +1080,7 @@
 	let goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
 	let reviewList = [[${reviewList}]];
 	let couponList = [[${couponList}]];
+	let couponNotice = [[${couponNotice}]];
 	let fileList = [[${fileList}]];
 	let noticeList = [[${noticeList}]];
 	let fsrcListTop = [[${fsrcListTop}]];
@@ -1549,6 +1563,18 @@
 			$('#notice' + i).parent().parent().parent().hide();
 		}
 	});
+	
+	// 쿠폰 개수 선택시
+	$("#couponCnt").on("change", function() {
+		for (var i = 1; i <= 10; i++) {
+			$('#coupon' + i).parent().parent().show();
+		}
+
+		var couponCnt = $(this).val();
+		for (var i = 10; i > couponCnt; i--) {
+			$('#coupon' + i).parent().parent().hide();
+		}
+	});
 
 	// 파일첨부 선택 시
 	$('#file1').on('change', function() { fnChooseFile(this, 1); });
@@ -1707,6 +1733,18 @@
 			}
 		}
 		
+		//쿠폰 유의사항관련 데이터 담기
+		var multiPlanCouponNotice = [];
+		
+		var count = $("#planTemplateForm select[name=couponCnt]").val();
+		for (var i = 0; i < count; i++) {
+			if($('#cpnNote'+i).val() == '' || typeof $('#cpnNote'+i).val() == 'undeifined'){
+				false;
+			}else{
+				multiPlanCouponNotice.push($('#cpnNote'+i).val());
+			}
+		}
+		
 		// 리뷰 전시 클릭했을 경우
 		if($("input:checkbox[name=reDispYn]").prop("checked")){
 			$("input:checkbox[name=reDispYn]").val('Y');
@@ -1742,10 +1780,12 @@
 				mcxDialog.alert('쿠폰을 선택하세요.');
 				return;
 			}
-			if($("textarea[name=note]").val()=='' && $("textarea[name=note]").val()==''){
-				mcxDialog.alert('쿠폰 유의사항 내용을  입력하세요.');
+			/* 
+			if(multiPlanCouponNotice.length == 0){
+				mcxDialog.alert('쿠폰 유의사항을 입력하세요.');
 				return;
-			}
+			} */
+			
 			
 		}else{
 			$("input:checkbox[name=cuDispYn]").val('N');
@@ -2135,7 +2175,7 @@
 						   ,cuDispOrd : $('#planTemplateForm input[name=cuDispOrd]').val()        
 						   ,cuPlanContSq : $('#planTemplateForm input[name=cuPlanContSq]').val()
 						   ,cuDispYn :  $('#planTemplateForm input:checkbox[name=cuDispYn]').val()  
-						   ,note :  $('#planTemplateForm textarea[name=note]').val()  
+						   ,multiPlanCouponNotice : multiPlanCouponNotice
 						   ,multiPlanFile : multiPlanFile
 						   ,multiPlanFile2 : multiPlanFile2
 						   ,multiPlanFile3 : multiPlanFile3
@@ -2257,13 +2297,52 @@ $(document).ready(function() {
 			}
 			if(typeof couponList[0] != 'undefined'){
 				//쿠폰
-				$('#planTemplateForm input[name=cuTitle]').val(couponList[0].title);
-				$('#planTemplateForm input[name=cuDispOrd]').val(couponList[0].dispOrd);
-				$('#planTemplateForm input[name=cuPlanContSq]').val(couponList[0].planContSq);
-				$('#note').summernote('code', couponList[0].note);
-				if (couponList[0].dispYn == 'Y') {
+				$('#planTemplateForm input[name=cuTitle]').val(couponNotice.title);
+				$('#planTemplateForm input[name=cuDispOrd]').val(couponNotice.dispOrd);
+				$('#planTemplateForm input[name=cuPlanContSq]').val(couponNotice.planContSq);
+				if (couponNotice.dispYn == 'Y') {
 					$('#planTemplateForm input:checkbox[name="cuDispYn"]').prop('checked', true);
 				}
+				if (couponNotice.cpnNote0 != null && couponNotice.cpnNote0 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(1);
+					$("#cpnNote0").val(couponNotice.cpnNote0);
+				}
+				if (couponNotice.cpnNote1 != null && couponNotice.cpnNote1 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(2);
+					$("#cpnNote1").val(couponNotice.cpnNote1);
+				}
+				if (couponNotice.cpnNote2 != null && couponNotice.cpnNote2 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(3);
+					$("#cpnNote2").val(couponNotice.cpnNote2);
+				}
+				if (couponNotice.cpnNote3 != null && couponNotice.cpnNote3 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(4);
+					$("#cpnNote3").val(couponNotice.cpnNote3);
+				}
+				if (couponNotice.cpnNote4 != null && couponNotice.cpnNote4 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(5);
+					$("#cpnNote4").val(couponNotice.cpnNote4);
+				}
+				if (couponNotice.cpnNote5 != null && couponNotice.cpnNote5 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(6);
+					$("#cpnNote5").val(couponNotice.cpnNote5);
+				}
+				if (couponNotice.cpnNote6 != null && couponNotice.cpnNote6 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(7);
+					$("#cpnNote6").val(couponNotice.cpnNote6);
+				}
+				if (couponNotice.cpnNote7 != null && couponNotice.cpnNote7 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(8);
+					$("#cpnNote7").val(couponNotice.cpnNote7);
+				}
+				if (couponNotice.cpnNote8 != null && couponNotice.cpnNote8 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(9);
+					$("#cpnNote8").val(couponNotice.cpnNote8);
+				}
+				if (couponNotice.cpnNote9 != null && couponNotice.cpnNote9 != '') {
+					$("#planTemplateForm select[name=couponCnt]").val(10);
+					$("#cpnNote9").val(couponNotice.cpnNote9);
+				}
 				if(couponList.length > 0)
 				{
 					for (var i = 0; i <couponList.length; i++) {
@@ -2409,6 +2488,7 @@ $(document).ready(function() {
 
 		$("#fileCnt").trigger('change');
 		$("#noticeCnt").trigger('change');
+		$("#couponCnt").trigger('change');
 		
 });