Quellcode durchsuchen

메인전시 관련 수정

bin2107 vor 5 Jahren
Ursprung
Commit
d6aa962c5b

+ 8 - 0
src/main/java/com/style24/admin/biz/dao/TsaDisplayDao.java

@@ -371,4 +371,12 @@ public interface TsaDisplayDao {
 	 * @since 2021. 3. 19
 	 */
 	void saveGnbTabPreview(GnbTab gnbTab);
+
+	/**
+	 * 메인전시 컨텐츠 미리보기 상품 리스트
+	 * @return
+	 * @author bin2107
+	 * @since 2021. 6. 9
+	 */
+	Collection<Goods> getContentsForGoodsList(Contents contents);
 }

+ 6 - 1
src/main/java/com/style24/admin/biz/service/TsaDisplayService.java

@@ -523,7 +523,12 @@ public class TsaDisplayService {
 	 * @since 2021. 2. 23
 	 */
 	public Collection<Contents> getContentsPreviewList(Contents contents) {
-		return displayDao.getContentsPreviewList(contents);
+		Collection<Contents> previewList = displayDao.getContentsPreviewList(contents);
+		for(Contents tempGoods : previewList){
+			tempGoods.setContentsGoodsList(displayDao.getContentsForGoodsList(tempGoods));
+		}
+
+		return previewList;
 	}
 
 	/**

+ 3 - 0
src/main/java/com/style24/persistence/domain/Contents.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 import lombok.Data;
 
+import java.util.Collection;
 import java.util.List;
 
 @SuppressWarnings("serial")
@@ -94,4 +95,6 @@ public class Contents extends TscBaseDomain {
     private String group3brandCd;
     private String group3brandNm;
     private String group3brandImg;
+
+    Collection<Goods> contentsGoodsList;	//상품목록
 }

+ 16 - 38
src/main/java/com/style24/persistence/mybatis/shop/TsaDsiplay.xml

@@ -1347,44 +1347,6 @@
 		     , A.BRAND_GROUP_NO
 		     , A.BRAND_GROUP_IMG
 		     , A.MD_TITLE
-		     ,(SELECT GROUP_CONCAT(B.GOODS_CD ORDER BY B.DISP_ORD SEPARATOR ',')
-		        FROM  TB_CONTENTS_GOODS B
-		       WHERE  1=1
-		       <if test="contentsLoc != 'SMM012'">
-		         AND  B.CATE_NO = A.CATE_NO
-		       </if>
-		         AND  B.CONTENTS_LOC = A.CONTENTS_LOC
-		         AND  B.CONTENTS_SQ = A.DISP_ORD
-		       <if test="contentsLoc != 'SMM012'">
-		         AND  B.CATE_NO = #{cateNo}
-		       </if>
-		         AND  B.CONTENTS_LOC = #{contentsLoc}) AS GOODS_CD_LIST
-		     ,(SELECT 	GROUP_CONCAT(B.GOODS_NM ORDER BY B.DISP_ORD SEPARATOR ',')
-		       FROM	TB_CONTENTS_GOODS B
-		       WHERE 1=1
-		       <if test="contentsLoc != 'SMM012'">
-		         AND B.CATE_NO = A.CATE_NO
-		       </if>
-		         AND B.CONTENTS_LOC = A.CONTENTS_LOC
-		         AND B.CONTENTS_SQ = A.DISP_ORD
-		       <if test="contentsLoc != 'SMM012'">
-		         AND  B.CATE_NO = #{cateNo}
-		       </if>
-		         AND B.CONTENTS_LOC = #{contentsLoc}) AS GOODS_NM_LIST
-		     ,(SELECT GROUP_CONCAT(GI.SYS_IMG_NM ORDER BY B.DISP_ORD SEPARATOR ',')
-		       FROM TB_CONTENTS_GOODS B
-		       JOIN TB_GOODS G ON B.GOODS_CD = G.GOODS_CD
-		       JOIN TB_GOODS_IMG GI ON G.GOODS_CD = GI.GOODS_CD AND G.MAIN_COLOR_CD = COLOR_CD AND GI.DEFAULT_IMG_YN = 'Y'
-		       WHERE 1=1
-		       <if test="contentsLoc != 'SMM012'">
-		         AND B.CATE_NO = A.CATE_NO
-		       </if>
-		        AND B.CONTENTS_LOC = A.CONTENTS_LOC
-		        AND B.CONTENTS_SQ = A.DISP_ORD
-		       <if test="contentsLoc != 'SMM012'">
-		        AND  B.CATE_NO = #{cateNo}
-		       </if>
-		        AND B.CONTENTS_LOC = #{contentsLoc}) AS GOODS_IMG_LIST
 		     , A.USE_YN
 		     , A.REG_NO
 		     , A.REG_DT
@@ -1964,4 +1926,20 @@
 			</if>
 		</if>
 	</insert>
+
+	<select id="getContentsForGoodsList" parameterType="Contents" resultType="Goods">
+		/* TsaDisplay.getContentsForGoodsList */
+		SELECT CG.GOODS_CD
+		     , G.GOODS_NM
+		     , GI.SYS_IMG_NM
+		FROM TB_CONTENTS_GOODS CG
+		JOIN TB_GOODS G ON CG.GOODS_CD = G.GOODS_CD
+		JOIN TB_GOODS_IMG GI ON G.GOODS_CD = GI.GOODS_CD AND G.MAIN_COLOR_CD = COLOR_CD AND GI.DEFAULT_IMG_YN = 'Y'
+		WHERE 1=1
+		<if test="contentsLoc != 'SMM012'">
+		AND CG.CATE_NO = #{cateNo}
+		</if>
+		AND CG.CONTENTS_LOC = #{contentsLoc}
+		AND CG.CONTENTS_SQ = #{dispOrd}
+	</select>
 </mapper>

+ 47 - 9
src/main/webapp/WEB-INF/views/display/MainContentsPopupForm.html

@@ -809,7 +809,7 @@
 		if(contentsLoc=='SGNB001'){
 			gagaSn.setContents('#openBannerDesc'+dataIdx, '');
 		}
-
+		fnResetDispOrd();
 		tableLen = tableLen+1;
 	});
 
@@ -882,6 +882,7 @@
 
 	// SMM001 데이터 validation 체크
 	function smm001DataValidation(){
+		var dataBool = true;
 		$(".mcTable").each(function(i){
 			var thisIdx = $(this).find("input[name=tableIdx]").val();
 			var contentsTypeVal = $(this).find("input:radio[name=contentsType"+thisIdx+"]:checked").val();
@@ -889,21 +890,48 @@
 
 			if(gagajf.isNull(contentsTypeVal)){
 				mcxDialog.alert('컨텐츠 유형을 선택해주세요.');
-				return false;
+				dataBool = false;
 			}
 			if(contentsTypeVal=='P'){
 				if(gagajf.isNull($(this).find("input[name=planSq"+thisIdx+"]").val())){
 					mcxDialog.alert('기획전 번호를 입력해주세요.');
-					return false;
+					$(this).find("input[name=planSq"+thisIdx+"]").focus();
+					dataBool = false;
 				}
 			}
 			if(gagajf.isNull(textColorVal)){
 				mcxDialog.alert('썸네일 글자 색상을 선택해주세요.');
-				return false;
+				dataBool = false;
 			}
 		});
+		if(!dataBool){
+			return false;
+		}else{
+			return true;
+		}
+	}
 
-		return true;
+	// 전시 일시 체크
+	function dateValidation(){
+		var dateBool = true;
+		$(".mcTable").each(function(i){
+			var thisIdx = $(this).find("input[name=tableIdx]").val();
+			var dispStdt = $(this).find("[name=dispStdt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=stTimeHour]").val().replace('시', '') + "" +$(this).find("[name=stTimeMin]").val().replace('분', '') + "00";
+			var dispEddt = $(this).find("[name=dispEddt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=edTimeHour]").val().replace('시', '') + "" +$(this).find("[name=edTimeMin]").val().replace('분', '') + "59";
+
+			let fromDate = dispStdt.replace(/[^0-9]/g, '');
+			let toDate = dispEddt.replace(/[^0-9]/g, '');
+			if(fromDate > toDate){
+				mcxDialog.alert("시작일자는 종료일자 보다 클 수 없습니다.");
+				$(this).find('input[name=dispStdt]').focus();
+				dateBool = false;
+			}
+		});
+		if(!dateBool){
+			return false;
+		}else{
+			return true;
+		}
 	}
 
 	/**
@@ -915,6 +943,11 @@
 			return;
 		}
 
+		// 전시일시 체크
+		if(!dateValidation()){
+			return false;
+		}
+
 		if(contentsLoc=='SMM001' || contentsLoc=='SOM001'){
 			if(!smm001DataValidation()){
 				return false;
@@ -1215,7 +1248,6 @@
 	 */
 	var brandDescIndex = 0;
 	var fnAddBrandDescRow = function (param){
-		console.log('here');
 		var val = typeof param=='object'?'':param;
 		var html = '<tr name="subTextPopRow">'
 		html += '<th>브랜드소개';
@@ -1373,7 +1405,14 @@
 
 	// 컨텐츠 행삭제
 	var fnDeleteContentsRow = function (obj){
-		$(obj).closest("table").remove();
+		mcxDialog.confirm('삭제시 전시순서가 초기화됩니다. 삭제하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				$(obj).closest("table").remove();
+				fnResetDispOrd();
+			}
+		});
 	}
 
 	// 행삭제
@@ -1428,8 +1467,7 @@
 
 	let fnBrandDesc = function (){
 		$(".mcTable").each(function (idx){
-			console.log(idx);
-			// cfnGetTextLength($(this).find('textarea[name=subText]'), 4000, $('#brandDescContent'+idx));
+			cfnGetTextLength($(this).find('textarea[name=subText]'), 4000, $('#brandDescContent'+idx));
 		});
 	}
 

+ 36 - 2
src/main/webapp/WEB-INF/views/display/MainGnbContentsPopupForm.html

@@ -192,7 +192,7 @@
 			$("#brandListTd2").sortable();
 			$("#brandListTd3").sortable();
 		}
-
+		fnResetDispOrd();
 		tableIdx = tableIdx+1;
 	}
 
@@ -266,7 +266,36 @@
 
 	// 컨텐츠 행삭제
 	var fnDeleteContentsRow = function (obj){
-		$(obj).closest("table").remove();
+		mcxDialog.confirm('삭제시 전시순서가 초기화됩니다. 삭제하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				$(obj).closest("table").remove();
+				fnResetDispOrd();
+			}
+		});
+	}
+
+	// 전시 일시 체크
+	function dateValidation(){
+		var dateBool = true;
+		$(".tabTable").each(function(i){
+			var dispStdt = $(this).find("[name=dispStdt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=stTimeHour]").val().replace('시', '') + "" +$(this).find("[name=stTimeMin]").val().replace('분', '') + "00";
+			var dispEddt = $(this).find("[name=dispEddt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=edTimeHour]").val().replace('시', '') + "" +$(this).find("[name=edTimeMin]").val().replace('분', '') + "59";
+
+			let fromDate = dispStdt.replace(/[^0-9]/g, '');
+			let toDate = dispEddt.replace(/[^0-9]/g, '');
+			if(fromDate > toDate){
+				mcxDialog.alert("시작일자는 종료일자 보다 클 수 없습니다.");
+				$(this).find('input[name=dispStdt]').focus();
+				dateBool = false;
+			}
+		});
+		if(!dateBool){
+			return false;
+		}else{
+			return true;
+		}
 	}
 
 	/**
@@ -278,6 +307,11 @@
 			return;
 		}
 
+		// 전시일시 체크
+		if(!dateValidation()){
+			return false;
+		}
+
 		dataArr = [];
 		$("#gnbTabList .tabTable").each(function (){
 			var newImgFileArr = [];

+ 2 - 1
src/main/webapp/WEB-INF/views/display/MainListForm.html

@@ -640,7 +640,8 @@
 			}
 		});
 		if(!contentLocCheck){
-			mcxDialog.alert('위치코드가 중복 되었습니다.');
+			// mcxDialog.alert('위치코드가 중복 되었습니다.');
+			mcxDialog.alert('이미 레이아웃 설정된 컨텐츠입니다.');
 			return;
 		}
 

+ 51 - 38
src/main/webapp/WEB-INF/views/display/MainMultiContentsPopupForm.html

@@ -106,7 +106,7 @@ console.log('brandGroupNo:'+brandGroupNo);
 				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
 				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
 			}
-			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this,this,this);">상품추가</button>';
+			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this);">상품추가</button>';
 			html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
 			html += '</tr>';
 			if(contentsLoc=='SMM009' || contentsLoc=='SMM012'){
@@ -174,8 +174,9 @@ console.log('brandGroupNo:'+brandGroupNo);
 					}
 				}
 			}
-			if(!gagajf.isNull(result[i].goodsCdList)){
-				html += fnAddGoodsRow(result[i].goodsCdList,result[i].goodsNmList,result[i].goodsImgList);
+			if(!gagajf.isNull(result[i].contentsGoodsList)){
+				console.log(fnAddGoodsRow(result[i].contentsGoodsList));
+				html += fnAddGoodsRow(result[i].contentsGoodsList);
 			}
 			html += '</tbody></table>';
 		}
@@ -268,7 +269,7 @@ console.log('brandGroupNo:'+brandGroupNo);
 			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
 			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
 		}
-		html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this,this,this);">상품추가</button>';
+		html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this);">상품추가</button>';
 		html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
 		html += '</tr>';
 		if(contentsLoc=='SMM009' || contentsLoc=='SMM012'){
@@ -495,8 +496,14 @@ console.log('brandGroupNo:'+brandGroupNo);
 
 	// 컨텐츠 행삭제
 	var fnDeleteBrandRow = function (obj){
-		$(obj).closest("table").remove();
-		fnReloadIdx();
+		mcxDialog.confirm('삭제시 전시순서가 초기화됩니다. 삭제하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				$(obj).closest("table").remove();
+				fnReloadIdx();
+			}
+		});
 	}
 
 	// 행삭제
@@ -537,6 +544,28 @@ console.log('brandGroupNo:'+brandGroupNo);
 		uifnPopupClose('popupMainMultiContents');
 	}
 
+	// 전시 일시 체크
+	function dateValidation(){
+		var dateBool = true;
+		$(".tableTest").each(function(i){
+			var dispStdt = $(this).find("[name=dispStdt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=stTimeHour]").val().replace('시', '') + "" +$(this).find("[name=stTimeMin]").val().replace('분', '') + "00";
+			var dispEddt = $(this).find("[name=dispEddt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=edTimeHour]").val().replace('시', '') + "" +$(this).find("[name=edTimeMin]").val().replace('분', '') + "59";
+
+			let fromDate = dispStdt.replace(/[^0-9]/g, '');
+			let toDate = dispEddt.replace(/[^0-9]/g, '');
+			if(fromDate > toDate){
+				mcxDialog.alert("시작일자는 종료일자 보다 클 수 없습니다.");
+				$(this).find('input[name=dispStdt]').focus();
+				dateBool = false;
+			}
+		});
+		if(!dateBool){
+			return false;
+		}else{
+			return true;
+		}
+	}
+
 	/**
 	 * 임시저장
 	 */
@@ -546,6 +575,11 @@ console.log('brandGroupNo:'+brandGroupNo);
 			return;
 		}
 
+		// 전시일시 체크
+		if(!dateValidation()){
+			return false;
+		}
+
 		dataArr = [];
 		$("#multiPopSortable .tableTest").each(function(){	//$("#multiPopSortable table").each(function(){
 			var newImgFileArr = [];
@@ -745,60 +779,39 @@ console.log('brandGroupNo:'+brandGroupNo);
 	 * 상품추가
 	 */
 	var goodsIdx = 0;
-	var fnAddGoodsRow = function (param, param2, param3){
+	var fnAddGoodsRow = function (param){
 		var addRow = "goodsListTd"+goodsIdx;
-		//console.log('addRow::'+addRow);
 
 		var html = '<tr name="goodsRow">';
 		html += '<th>상품추가<br><button type="button" class="btn btn-base btn-lg" onclick="fnSearchGoods(\''+addRow+'\');">상품조회</button>';
 		html += '<br></br><button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteTrRow(this);">삭제</button>';
 		html += '</th>';
 		html += '<td colspan="3">';
-		//html += '<table style="border-style: solid;border-color: #ac2925; width:100%; height:20px;">';
-		//html += '<colgroup>';
-		//html += '<col style="width:90%;"/>';
-		//html += '<col style="width:10%;"/>';
-		//html += '<col/>';
-		//html += '</colgroup>';
-		//html += '<thead>';
 		html += '<div class="sortableWrap" data-unit="7" style="overflow-y:scroll;">';
 		html += '<div class="itemWrap" id="goodsListTd'+goodsIdx+'">';
 		if(typeof param!='object'){
-			var goodsCdList = [];
-			var goodsNmList = [];
-			var goodsImgList = [];
-			goodsCdList = param;
-			goodsNmList = param2;
-			goodsImgList = param3;
-			// 여기서 부터 시작! 상품불러오는거 똑같이 html 추가해서 체크
-			// +) 저장할때 TB_CONTENTS_GOODS 에 상품코드, 상품명, 상품이미지경로 추가해서 3개다 불러와서 데이터 뿌릴수 있게
-			$.each(goodsCdList.split(','),function (i){
+			var imgPath = _goodsUrl;
+			for(let i=0; i<param.length; i++){
 				html += '<ul id="goodsUl'+i+'" class="item ui-state-default goodsClass" style="min-height:140px;"> ';
-				goodsImg = goodsImgList.split(',')[i];
-				goodsCd = goodsCdList.split(',')[i];
-				goodsNm = goodsNmList.split(',')[i];
 				html += '<li class="img">';
-				var imgPath = _goodsUrl;
-				html += '<img src="'+imgPath+ "/" +goodsImg+'" onerror="this.src=\'/image/no.png\';"/>';
+				html += '<img src="'+imgPath+ "/" +param[i].sysImgNm+'" onerror="this.src=\'/image/no.png\';"/>';
 				html += '</li>';
 				html += '<li class="cont">';
 				html += '<ul>';
-				html += '<li class="no" name="goodsCdLi"><span>'+goodsCd+'</span>';
-				html += '<input type="hidden" name="goodsImgPath" value="'+goodsImg+'">';
-				html += '<input type="hidden" name="goodsCd" value="'+goodsCd+'">';
-				html += '<input type="hidden" name="goodsNm" value="'+goodsNm+'">';
+				html += '<li class="no" name="goodsCdLi"><span>'+param[i].goodsCd+'</span>';
+				html += '<input type="hidden" name="goodsImgPath" value="'+param[i].sysImgNm+'">';
+				html += '<input type="hidden" name="goodsCd" value="'+param[i].goodsCd+'">';
+				html += '<input type="hidden" name="goodsNm" value="'+param[i].goodsNm+'">';
 				html += '<span style="margin-left:5px;"><a href="javascript:void(0);" id="delId" onclick="fnRemoveGoods(this,'+i+');">X</a></span>';
 				html += '</li>';
 				html += '</li>';
-				html += '<li class="title">'+goodsNm+'</li>';
+				html += '<li class="title">'+param[i].goodsNm+'</li>';
 				html += '</ul>';
 				html += '</ul>';
-			});
+			}
 		}
 		html += '</div>';
 		html += '</div>';
-		//html += '</thead>';
-		//html += '</table>';
 		html += '</td>';
 		html += '</tr>';
 		if(typeof param == 'object'){
@@ -808,7 +821,7 @@ console.log('brandGroupNo:'+brandGroupNo);
 			}
 			goodsIdx++;
 			$(param).closest("table").find("tbody").append(html);
-
+			return html;
 		}else{
 			goodsIdx++;
 			return html;