Selaa lähdekoodia

Merge branch 'sowon' into develop

sowon4187 5 vuotta sitten
vanhempi
commit
b0a5484fcb

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

@@ -139,5 +139,32 @@ public interface TsaPlanDao {
 	 */
 	Collection<Plan> getPlanBrandList(Plan param);
 
+	/**
+	 * 기획전 코너 등록
+	 *
+	 * @param
+	 * @author sowon
+	 * @since 2021. 2. 15
+	 */
+	void createPlanCorner(Plan param);
+	
+	/**
+	 * 기획전 코너 목록
+	 *
+	 * @param 
+	 * @return
+	 * @author sowon
+	 * @since 2021. 2. 15
+	 */
+	Collection<Plan> getPlanCornerList(Plan param);
+	
+	/**
+	 * 기획전 코너 복사
+	 *
+	 * @param
+	 * @author sowon
+	 * @since 2021. 2. 15
+	 */
+	void createPlanCornerCopy(Plan param);
 
 }

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

@@ -73,6 +73,15 @@ public class TsaPlanService {
 			planDao.createPlanBrand(plan);
 		}
 		    
+		String[] corner = param.getMultiCorner();
+		// 기획전 코너insert
+		for (int j = 0; j < corner.length; j++) {
+			plan.setCateNo(corner[j]);
+			plan.setPlanSq(param.getPlanSq());
+			plan.setRegNo(TsaSession.getInfo().getUserNo());
+			plan.setUpdNo(TsaSession.getInfo().getUserNo());
+			planDao.createPlanCorner(plan);
+		}
 
 		log.debug("planSq : {}", param.getPlanSq());
 
@@ -415,15 +424,27 @@ public class TsaPlanService {
 		
 		// 02. 기획전 브랜드 복사
 		plan.setPlanSq(param.getCopyPlanSq());
-		Collection <Plan> list = planDao.getPlanBrandList(plan);
+		Collection <Plan> brandList = planDao.getPlanBrandList(plan);
 		
-		for(Plan brandCd : list){
+		for(Plan brandCd : brandList){
 			plan.setPlanSq(param.getPlanSq());
 			plan.setBrandCd(brandCd.getBrandCd());
 			plan.setCopyPlanSq(param.getCopyPlanSq()); 
 			planDao.createPlanBrandCopy(plan);
 		}
 		
+		// 02. 기획전 브랜드 복사
+		plan.setPlanSq(param.getCopyPlanSq());
+		Collection <Plan> cornerList = planDao.getPlanCornerList(plan);
+		
+		for(Plan cateNo : cornerList){
+			plan.setPlanSq(param.getPlanSq());
+			plan.setCateNo(cateNo.getCateNo());
+			plan.setCopyPlanSq(param.getCopyPlanSq()); 
+			planDao.createPlanCornerCopy(plan);
+		}
+		
+		
 		// 02. 기획전 코너 목록 조회
 //		Plan serchCorner = new Plan();
 //		serchCorner.setPlanSq(param.getCopyPlanSq());
@@ -484,5 +505,17 @@ public class TsaPlanService {
 	public Collection<Plan> getPlanBrandList(Plan param){
 		return planDao.getPlanBrandList(param);
 	}
+	
+	/**
+	 * 기획전 코너 목록
+	 *
+	 * @param 
+	 * @return
+	 * @author sowon
+	 * @since 2021. 2. 15
+	 */
+	public Collection<Plan> getPlanCornerList(Plan param){
+		return planDao.getPlanCornerList(param);
+	}
 
 }

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

@@ -1340,8 +1340,12 @@ public class TsaMarketingController extends TsaBaseController {
 
 			mav.addObject("fsrcMobile", planService.getPlanFsrcMobileList(param));
 			
+			// 등록했던 브랜드
 			mav.addObject("planBrandList", planService.getPlanBrandList(param));
 			
+			// 등록했던 코너
+			mav.addObject("planCornerList", planService.getPlanCornerList(param));
+			
 			mav.addObject("brandList", rendererService.getSupplyCompanyBrandList(""));
 
 			//mav.addObject("planQuestionList", planService.getPlanQuestionList(param));
@@ -1400,11 +1404,13 @@ public class TsaMarketingController extends TsaBaseController {
 		if (!StringUtils.isBlank(param.getCondition())) {
 			param.setConditionList(param.getCondition().replaceAll("\r", "").split("\n"));
 		}
-		Collection<Plan> planList = planService.getPlanList(param);
 		
 		param.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 		param.setPageable(new TscPageRequest(param.getPageNo() - 1, param.getPageSize()));
 		param.getPageable().setTotalCount(planService.getPlanListCnt(param));
+		
+		Collection<Plan> planList = planService.getPlanList(param);
+		
 		result.set("pageing", param);
 		result.set("planList", planList);
 

+ 8 - 2
src/main/java/com/style24/persistence/domain/Plan.java

@@ -92,6 +92,12 @@ public class Plan extends TscBaseDomain{
 		/* Multi CheckBox 항목*/
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] multiBrand;
+		private String[] multiCorner;
+		
+		// 코너
+		private String cateGb;		// 카테고리구분
+		private String cateNm;		// 카테고리명
+		private String cateNo;		// 카테고리번호
 		
 		// 기획전 응모
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
@@ -113,8 +119,8 @@ public class Plan extends TscBaseDomain{
 		private String endSearchDate;		// 진행기간 종료일
 		private String endSearchTime;		// 진행기간 종료시간
 		private String excelFileNm;			// 엑셀 파일 명
-		private int startRow;				// 페이징 시작
-		private int endRow;					// 피이징 종료
+		//private int startRow;				// 페이징 시작
+		//private int endRow;					// 피이징 종료
 		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 		private String[] siteCds;			// 사이트
 

+ 151 - 104
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -97,51 +97,72 @@
 	<!-- 기획전 목록 -->
 	<select id="getPlanList" parameterType="Plan" resultType="Plan">
 		/* TsaMarketing.getPlanList */
-		SELECT PLAN_SQ                
-		     , PLAN_NM                
-		     , PLAN_GB                
-		     <!-- , CUST_GB -->
-		     <!-- , CUST_GRADE -->
-		     <!-- , PLAN_SNM -->
-		     , TEMPLATE_TYPE          
-		     , SITE_CD                
-		     , FRONT_GB               
-		     , DISP_STDT    
-		     , DISP_EDDT   
-		     , MAIN_PIMG              
-		     , MAIN_MIMG              
-		     , DTL_PIMG               
-		     , DTL_MIMG               
-		     , DTL_TITLE1             
-		     <!-- , DTL_TITLE2 -->
-		     <!-- , CATE_CD -->
-		     <!-- , CATE_DISP_YN -->           
-		     , REPLY_YN               
-		     , REPLY_TITLE1           
-		     , REPLY_TITLE2           
-		     , REPLY_LOC              
-		     , REPLY_IMG              
-		     , POLL_SQ                
-		     <!-- , PRIVACY_POLICY -->
-		     , DEV_URL                
-		     , CORNER_NM_DISP_YN      
-		     , GOODS_LIMIT_YN         
-		     , GOODS_LIMIT_QTY        
-		     , DEL_YN                 
-		     , OPEN_YN                
-		     , DISP_ORD               
-		     , READ_CNT               
-		     , BADGE_NM               
-		     , BADGE_FCOLOR           
-		     , BADGE_BCOLOR           
-		     , FN_GET_USER_NM(REG_NO) AS REG_NM               
-		     , REG_DT
-		       AS REG_DT              
-		     , UPD_NO                 
-		     , UPD_DT              
-		FROM   TB_PLAN
-		WHERE  1=1
-		AND    DEL_YN = 'N'
+		 SELECT Z.*
+		 FROM(
+		 	  SELECT @rownum := @rownum + 1 AS RNUM
+		 	         ,A.*
+		 	   FROM (
+					SELECT PLAN_SQ                
+					     , PLAN_NM                
+					     , PLAN_GB                
+					     <!-- , CUST_GB -->
+					     <!-- , CUST_GRADE -->
+					     <!-- , PLAN_SNM -->
+					     , TEMPLATE_TYPE          
+					     , SITE_CD                
+					     , FRONT_GB               
+					     , DISP_STDT    
+					     , DISP_EDDT   
+					     , MAIN_PIMG              
+					     , MAIN_MIMG              
+					     , DTL_PIMG               
+					     , DTL_MIMG               
+					     , DTL_TITLE1             
+					     <!-- , DTL_TITLE2 -->
+					     <!-- , CATE_CD -->
+					     <!-- , CATE_DISP_YN -->           
+					     , REPLY_YN               
+					     , REPLY_TITLE1           
+					     , REPLY_TITLE2           
+					     , REPLY_LOC              
+					     , REPLY_IMG              
+					     , POLL_SQ                
+					     <!-- , PRIVACY_POLICY -->
+					     , DEV_URL                
+					     , CORNER_NM_DISP_YN      
+					     , GOODS_LIMIT_YN         
+					     , GOODS_LIMIT_QTY        
+					     , DEL_YN                 
+					     , OPEN_YN                
+					     , DISP_ORD               
+					     , READ_CNT               
+					     , BADGE_NM               
+					     , BADGE_FCOLOR           
+					     , BADGE_BCOLOR           
+					     , FN_GET_USER_NM(REG_NO) AS REG_NM               
+					     , REG_DT
+					       AS REG_DT              
+					     , UPD_NO                 
+					     , UPD_DT              
+					FROM   TB_PLAN T JOIN ( SELECT @rownum := 0) R
+					WHERE  1=1
+					AND    DEL_YN = 'N'
+					<include refid="getPlanListCondition_sql"/>
+					ORDER  BY PLAN_SQ DESC
+				<include refid="getListPagingCondition_sql"/>
+		
+	</select>
+	
+	<!-- 기획전 리스트 카운트 조회-->
+	<select id="getPlanListCnt" parameterType="Plan" resultType="int">
+		/* TsaMarketing.getPlanListCnt */
+		SELECT COUNT(1)
+		  FROM TB_PlAN
+		 WHERE 1=1
+		 <include refid="getPlanListCondition_sql"/>
+	</select>
+	
+	<sql id="getPlanListCondition_sql">
 		<if test ="siteCd != null and siteCd !=''">
 		AND    SITE_CD = #{siteCd}
 		</if>
@@ -152,7 +173,7 @@
 		AND    PLAN_NM LIKE UPPER('%' || #{planNm} || '%')
 		</if>
 		
-		<!-- <if test="condition != null and condition != ''"> -->
+		<if test="condition != null and condition != ''">
 		<choose>
 			     <when test="search != null and search == 'searchPlanNm'">
 		AND    (
@@ -168,7 +189,7 @@
 		         </foreach>
 			      </when>
 		</choose>
-		<!-- </if> -->
+		</if>
 		<if test="openYn != null and openYn != ''">
 		AND    OPEN_YN = #{openYn}
 		</if>
@@ -196,64 +217,22 @@
 		<if test="popupDispEddt != null and popupDispEddt != ''">
 		AND    DISP_STDT <![CDATA[<=]]> DATE_FORMAT(#{popupDispEddt}, 'YYYY-MM-DD') + 0.99999
 		</if>
-		ORDER  BY PLAN_SQ DESC
-	</select>
+	</sql>
 	
-	<!-- 기획전 리스트 카운트 조회-->
-	<select id="getPlanListCnt" parameterType="Plan" resultType="int">
-		/* TsaMarketing.getPlanListCnt */
-		SELECT COUNT(1)
-		  FROM TB_PlAN
-		 WHERE 1=1
-		<if test ="siteCd != null and siteCd !=''">
-		AND    SITE_CD = #{siteCd}
-		</if>
-        <!-- <if test='condition != null and condition != "" '> -->
+	<sql id="getListPagingCondition_sql">
 		<choose>
-		     <when test='search != null and search == "searchPlanNm"'>
- 		AND (
-		         <foreach collection="conditionList" item="item" index="index" separator="or">
-		           UPPER(PLAN_NM) LIKE CONCAT('%',UPPER(#{item}),'%') 
-		         </foreach>
-		     )
-		     </when>
-		     <when test='search != null and search == "searchPlanSq"'>
- 		AND (		 
-		         <foreach collection="conditionList" item="item" index="index" separator="or">
-	    		   UPPER(PLAN_SQ) LIKE CONCAT('%',UPPER(#{item}),'%') 
-		         </foreach>
-		    )
-		      </when>
+			<when test="pageable != null">
+				) A
+				)Z
+				WHERE RNUM BETWEEN  #{pageable.startRow} AND #{pageable.endRow}
+			</when>
+			<otherwise>
+				) A
+				)Z
+			</otherwise>
 		</choose>
-		<!-- </if> -->
-		<if test="openYn != null and openYn != ''">
-		AND    OPEN_YN = #{openYn}
-		</if>
-		<if test="regNo != null and regNo != ''">
-		AND    REG_NO = #{regNo}
-		</if>
-		<if test="frontGb != null and frontGb != ''">
-		AND    FRONT_GB = #{frontGb}
-		</if>
-		<if test="planGb != null and planGb != ''">
-		AND    PLAN_GB = #{planGb}
-		</if>
-		<if test="templateType != null and templateType != ''">
-		AND    TEMPLATE_TYPE = #{templateType}
-		</if>
-		<if test="dispStdt != null and dispStdt != ''">
-		AND    DISP_EDDT <![CDATA[>=]]> DATE_FORMAT(#{dispStdt}, 'YYYY-MM-DD')
-		</if>
-		<if test="dispEddt != null and dispEddt != ''">
-		AND    DISP_STDT <![CDATA[<=]]> DATE_FORMAT(#{dispEddt}, 'YYYY-MM-DD') + 0.99999
-		</if>
-		<if test="popupDispStdt != null and popupDispStdt != ''">
-		AND    DISP_EDDT <![CDATA[>=]]> DATE_FORMAT(#{popupDispStdt}, 'YYYY-MM-DD')
-		</if>
-		<if test="popupDispEddt != null and popupDispEddt != ''">
-		AND    DISP_STDT <![CDATA[<=]]> DATE_FORMAT(#{popupDispEddt}, 'YYYY-MM-DD') + 0.99999
-		</if>
-	</select>
+	</sql>
+	
 	
 	<!-- 기획전 삭제처리 -->
 	<update id="deletePlan" parameterType="Plan">
@@ -533,14 +512,82 @@
 						  , ${planSq} 
 						  , DISP_YN 
 						  , REG_NO  
-						  , REG_DT  
+						  , CURRENT_TIMESTAMP  
 						  , UPD_NO  
-						  , UPD_DT  
+						  , CURRENT_TIMESTAMP  
 	        	   FROM   TB_PLAN_BRAND
 	        	   WHERE 1=1
 					 AND PLAN_SQ = #{copyPlanSq}
 	        	     AND BRAND_CD = #{brandCd}
 	</insert>
+	
+	<insert id="createPlanCorner" parameterType="Plan">
+		/* TsaMarketing.createPlanCorner */
+		INSERT INTO TB_PLAN_CATE
+		(
+			CATE_NO
+		  , PLAN_SQ
+		  , DISP_YN
+		  , REG_NO
+		  , REG_DT
+		  , UPD_NO
+		  , UPD_DT
+		)
+		VALUES(
+				#{cateNo}
+			  , #{planSq}
+			  , 'Y'
+			  , #{regNo}
+			  , now()
+			  , #{updNo}
+			  , now()
+			)
+	
+	</insert>
+	
+	<select id="getPlanCornerList" parameterType="Plan" resultType="Plan">
+		/* TsaMarketing.getPlanCornerList */
+		 SELECT TP.PLAN_NM AS PLAN_NM
+				     , TP.PLAN_SQ AS PLAN_SQ
+				     , TC.CATE1_NM AS CATE_NM
+				     , TC.CATE1_NO AS CATE_NO
+				     , TC.CATE_GB AS CATE_GB
+				     , TP.SITE_CD AS SITE_CD
+		FROM TB_PLAN TP  LEFT OUTER JOIN TB_PLAN_CATE TPC 
+							   ON TP.PLAN_SQ = TPC.PLAN_SQ 
+		            	 LEFT OUTER JOIN  TB_CATE1 TC
+		   					   ON TPC.CATE_NO = TC.CATE1_NO 
+		WHERE 1=1
+		 	AND TP.PLAN_SQ = TPC.PLAN_SQ 
+		 	AND TP.PLAN_SQ = #{planSq}
+		AND TP.DEL_YN = 'N'
+	</select>
+	
+	<insert id="createPlanCornerCopy" parameterType="Plan">
+		/* TsaMarketing.createPlanCornerCopy */
+			INSERT INTO
+					 TB_PLAN_CATE
+					 (
+			           CATE_NO
+					  ,PLAN_SQ
+					  ,DISP_YN
+					  ,REG_NO 
+					  ,REG_DT 
+					  ,UPD_NO 
+					  ,UPD_DT 
+     			      ) SELECT 	
+     			      		CATE_NO
+						  , ${planSq} 
+						  , DISP_YN 
+						  , REG_NO  
+						  , now()  
+						  , UPD_NO  
+						  , now()  
+	        	   FROM   TB_PLAN_CATE
+	        	   WHERE 1=1
+					 AND PLAN_SQ = #{copyPlanSq}
+	        	     AND CATE_NO = #{cateNo}
+	</insert>
 </mapper>
 
 

+ 4 - 3
src/main/webapp/WEB-INF/views/marketing/PlanListForm.html

@@ -112,9 +112,7 @@
 					<input type="button" value="조회" class="btn btn-base btn-lg" id="btnSearch"/>
 					</li>
 				</ul>
-			</form>
-		</div>
-
+				
 
 	<div class="panelStyle">
 			<!-- 검색결과 영역 -->
@@ -145,6 +143,9 @@
 				</li>
 			</ul>
 		</div>
+			</form>
+		</div>
+
 	</div>
 
 <!-- 컬러 피커 -->

+ 71 - 6
src/main/webapp/WEB-INF/views/marketing/PlanWebDetailPopupForm.html

@@ -334,12 +334,12 @@
 													<span class="buttonSpan">
 														<button type="button"
 															class="btn btnRight btn-success btn-lg"
-															id="btnAddCompany">업체 추가</button>
+															id="btnAddCorner">업체 추가</button>
 														<button type="button"
 															class="btn btnRight btn-success btn-lg"
-															id="btnDeleteCompany">선택삭제</button>
+															id="btnDeleteCorner">선택삭제</button>
 													</span> <br />
-													<div id="gridFGPromotionCompanyList"
+													<div id="gridFGCornerList"
 														style="width: 100%; height: 200px;"
 														class="ag-theme-balham"></div>
 												</div>
@@ -660,12 +660,12 @@
 													<span class="buttonSpan">
 														<button type="button"
 															class="btn btnRight btn-success btn-lg"
-															id="btnAddCompany">업체 추가</button>
+															id="btnAddCorner">코너 추가</button>
 														<button type="button"
 															class="btn btnRight btn-success btn-lg"
-															id="btnDeleteCompany">선택삭제</button>
+															id="btnDeleteCorner">선택삭제</button>
 													</span> <br />
-													<div id="gridFGPromotionCompanyList"
+													<div id="gridFGCornerList"
 														style="width: 100%; height: 200px;"
 														class="ag-theme-balham"></div>
 												</div>
@@ -715,6 +715,7 @@
 	var fsrcPc = [[${fsrcPc}]];
 	var fsrcMobile = [[${fsrcMobile}]];
 	var planBrandList = [[${planBrandList}]];
+	var planCornerList = [[${planCornerList}]];
 	var snOptions;
 
 	// 카테고리 전시 여부
@@ -874,9 +875,18 @@
 			multiBrand.push(item.brandCd);
 		});
 		
+		let allCornerData = gagaAgGrid.getAllRowData(gridOptionsFGCornerList);
+		var multiCorner = [];
+		$.each(allCornerData, function(idx, item) {
+			multiCorner.push(item.cateNo);
+		});
+		
+		
 		let data = {
 				 multiBrand : multiBrand
 				,brandList : allBrandData
+				,multiCorner : multiCorner
+				,CornerList : allCornerData
 			    ,mode : $('#planWebRegisterForm input[name=mode]').val()
 			    ,planSq : $('#planWebRegisterForm input[name=planSq]').val()
 				,planGb	: $('#planWebRegisterForm select[name=planGb]').val()
@@ -1052,6 +1062,59 @@
 		}
 	};
 	
+	// 코너 리스트 설정
+	var columnCornerList = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: "사이트", field: "siteCd", width: 120, cellClass: 'text-center'},
+		{headerName: "코너 구분", field: "cateGb", width: 110, cellClass: 'text-center'},
+		{headerName: "코너", field: "cateNm", width: 120, cellClass: 'text-center'},
+		{headerName: "코너", field: "cateNo", width: 150, cellClass: 'text-center', hide: true},
+		/* {headerName: "시퀀스", field: "tmtbGoodsSq", width: 150, cellClass: 'text-center', hide: true},
+		{headerName: "삭제여부", field: "delYn", width: 150, cellClass: 'text-center', hide: true}  */
+	];
+	
+	// 카테고리 그리드 설정
+	var gridOptionsFGCornerList = gagaAgGrid.getGridOptions(columnCornerList);
+	gridOptionsFGCornerList.rowSelection = "multiple";
+	gridOptionsFGCornerList.suppressRowClickSelection = true;
+	
+	// 브랜드 설정 선택삭제 버튼 클릭시
+    $('#btnDeleteCorner').on('click', function() {
+    	gridOptionsFGCornerList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGCornerList)});
+    });
+	
+	
+	
+	// 코너추가(카테고리 추가)
+	$('#btnAddCorner').on('click' , function () {
+		cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
+	});
+	
+	// 카테고리 추가 콜백 함수
+	var fnSetPopupCategoryInfo = function (result) {
+		// 기존 리스트 데이터 for
+		for(let i = 0 ; i < result.length ; i++) {
+			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(gridOptionsFGCornerList);		// 받아온 모든 데이터
+
+			// 받아온 data for
+			for(let j = 0 ; j < gridListValue.length ; j++) {
+				// 동일한 data는 추가하지 않음
+				if(gridListValue[j].cateNo == result[i].cateNo) {	addChk = false;	}		// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				if(result[i].cate2No!=null)
+				{
+					mcxDialog.alert('카테고리1에서 선택하세요.');
+					return;
+				}
+				gagaAgGrid.addRowData(gridOptionsFGCornerList, {"siteCd":result[i].siteCd , "cateGb":result[i].cateGb, "cateNm":result[i].cateNm, "cateNo":result[i].cateNo});
+			}
+		}
+	}
+	
+	
 
 	$(document).ready(function() {
 		
@@ -1063,6 +1126,7 @@
 		
 		// 그리드 그리기
 		gagaAgGrid.createGrid("gridFGBrandList", gridOptionsFGBrandList);
+		gagaAgGrid.createGrid("gridFGCornerList", gridOptionsFGCornerList);
 		
 		 if (mode =='U') {
 			/* $('#planWebDetailForm input[name=badgeFcolor]').spectrum({
@@ -1078,6 +1142,7 @@
 			}); */
 			
 			gridOptionsFGBrandList.api.setRowData(planBrandList);
+			gridOptionsFGCornerList.api.setRowData(planCornerList);
 
 			if (planInfo.goodsLimitYn == 'N') {
 				$('#planWebDetailForm input[name=goodsLimitQty]').hide();