Quellcode durchsuchen

상품상세 공지

eskim vor 5 Jahren
Ursprung
Commit
cff304b21b

+ 42 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaGoodsDao.java

@@ -14,6 +14,8 @@ import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.Notice;
+import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
 
 import com.gagaframework.web.parameter.GagaMap;
@@ -506,4 +508,44 @@ public interface TsaGoodsDao {
 	 */
 	void deleteGoodEpSkip(GoodsEpSkip goodsEpSkip);
 
+	/**
+	 * 상품 상세공지 목록
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	Collection<Notice> getNoticeList(GoodsSearch goodsSearch);
+
+	/**
+	 * 상품 상세공지 상품 목록
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	Collection<NoticeGoods> getNoticeGoodsList(Notice notice);
+
+	/**
+	 * 상품 상세공지 상품 저장
+	 *
+	 * @param noticeGoods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	void saveNoticeGoods(NoticeGoods noticeGoods);
+
+	/**
+	 * 상품 상세공지 상품 삭제
+	 *
+	 * @param noticeGoods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	void deleteNoticeGoods(NoticeGoods noticeGoods);
+
 }

+ 91 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -27,6 +27,8 @@ import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.Notice;
+import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
 import com.style24.persistence.domain.SearchData;
 
@@ -67,6 +69,11 @@ public class TsaGoodsService {
 	@Autowired
 	private TsaRendererService rendererService;
 
+	@Autowired
+	private TsaNoticeService noticeService;
+
+
+
 	@Autowired
 	private ObjectMapper mapper;
 
@@ -1514,4 +1521,88 @@ public class TsaGoodsService {
 			idx++;
 		}
 	}
+
+	/**
+	 * 상품 상세공지 목록
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	public Collection<Notice> getNoticeList(GoodsSearch goodsSearch) {
+		return goodsDao.getNoticeList(goodsSearch);
+	}
+
+	/**
+	 * 상품 상세공지 상품 목록
+	 *
+	 * @param notice
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	public Collection<NoticeGoods> getNoticeGoodsList(Notice notice) {
+		return goodsDao.getNoticeGoodsList(notice);
+	}
+
+	/**
+	 * 공지사항 저장
+	 * @param notice - 공지사항 정보
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	@Transactional("shopTxnManager")
+	public void saveNotice(Notice notice) {
+		notice.setRegNo(TsaSession.getInfo().getUserNo());
+		notice.setUpdNo(TsaSession.getInfo().getUserNo());
+
+		// 신규 일때
+		if (notice.getNoticeSq() == null) {
+			// 공지사항 저장
+			noticeService.createNotice(notice);
+
+			// 등록된 사용자번호 값 가져오기
+			Integer noticeSq = notice.getNoticeSq();
+
+			notice.setNoticeSq(noticeSq);
+
+		} else {
+			// 공지사항 수정
+			noticeService.updateNotice(notice);
+		}
+
+		if (!StringUtils.isEmpty(notice.getGoodsList())) {
+			Collection<NoticeGoods> noticeGoodsList = null;
+			try {
+				noticeGoodsList = mapper.readValue(notice.getGoodsList(), new TypeReference<Collection<NoticeGoods>>() {
+				});
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException(message.getMessage("상품상세공지 저장 중 오류로 인해 저장되지 않았습니다."));
+			}
+			log.info("noticeGoodsList: {}", noticeGoodsList);
+			for (NoticeGoods noticeGoods : noticeGoodsList) {
+				noticeGoods.setNoticeSq(notice.getNoticeSq());
+				noticeGoods.setRegNo(TsaSession.getInfo().getUserNo());
+				noticeGoods.setUpdNo(TsaSession.getInfo().getUserNo());
+
+				goodsDao.saveNoticeGoods(noticeGoods);
+			}
+
+		}
+	}
+
+	/**
+	 * 공지사항 상품 삭제
+	 * @param noticeGoods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	@Transactional("shopTxnManager")
+	public void deleteNoticeGoods(NoticeGoods noticeGoods) {
+		goodsDao.deleteNoticeGoods(noticeGoods);
+	}
 }

+ 26 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaNoticeService.java

@@ -124,4 +124,30 @@ public class TsaNoticeService {
 		noticeDao.deleteNoticeFile(notice);
 	}
 
+	/**
+	 * 공지사항 등록(상품상세공지에서 사용)
+	 * @param notice - 공지사항 정보
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	@Transactional("shopTxnManager")
+	public void createNotice(Notice notice) {
+		noticeDao.createNotice(notice);
+	}
+
+	/**
+	 * 공지사항 수정(상품상세공지에서 사용)
+	 * @param notice - 공지사항 정보
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	@Transactional("shopTxnManager")
+	public void updateNotice(Notice notice) {
+		noticeDao.updateNotice(notice);
+	}
+
+
+
 }

+ 62 - 0
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -12,6 +12,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,6 +37,8 @@ import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.GoodsTnmRes;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.Notice;
+import com.style24.persistence.domain.NoticeGoods;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -1262,11 +1265,70 @@ public class TsaGoodsController extends TsaBaseController {
 	public ModelAndView detailNoticeForm() {
 		ModelAndView mav = new ModelAndView();
 
+		// 공급업체
+		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList());
+
 		mav.setViewName("goods/GoodsDetailNoticeForm");
 
 		return mav;
 	}
 
+	/**
+	 * 상품 상세공지 목록
+	 * @param notice - 공지사항 정보
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	@PostMapping("/notice/list")
+	@ResponseBody
+	public Collection<Notice> getNoticeList(@RequestBody GoodsSearch goodsSearch) {
+
+		// 입점업체담당자는 업체코드 설정
+		if ("G001_B000".equals(TsaSession.getInfo().getRoleCd())) {
+			goodsSearch.setSupplyCompCd(TsaSession.getInfo().getSupplyCompCd());
+			goodsSearch.setMdNo(TsaSession.getInfo().getUserNo());
+		}
+
+		// multi row 검색관련 처리
+		if (!StringUtils.isEmpty(goodsSearch.getCondition())) {
+			goodsSearch.setConditionList(goodsSearch.getCondition().replaceAll("\r", "").split("\n"));
+		}
+
+		return goodsService.getNoticeList(goodsSearch);
+	}
+
+	/**
+	 * 상품 상세공지 상품목록
+	 * @param notice - 공지사항 정보
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 06
+	 */
+	@GetMapping("/notice/goods/list/{noticeSq}")
+	@ResponseBody
+	public Collection<NoticeGoods> getNoticeGoodsList(@PathVariable Integer noticeSq) {
+		Notice notice = new Notice();
+		notice.setNoticeSq(noticeSq);
+		return goodsService.getNoticeGoodsList(notice);
+	}
+
+	/**
+	 * 상품 상세공지 저장/등록
+	 *
+	 * @param
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 05
+	 */
+	@PostMapping("/notice/save")
+	@ResponseBody
+	public GagaResponse saveNotice(@RequestBody Notice notice) {
+		goodsService.saveNotice(notice);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+
 	/**
 	 * 상품조회 팝업
 	 *

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

@@ -73,6 +73,9 @@ public class GoodsSearch extends TscBaseDomain {
 	private String goodsType;
 	private String selfMallYn;
 
+	private String useYn;
+	private String noticeTitle;
+
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] siteCd;
 

+ 12 - 1
style24.admin/src/main/java/com/style24/persistence/domain/Notice.java

@@ -1,5 +1,7 @@
 package com.style24.persistence.domain;
 
+import java.util.Collection;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
@@ -7,7 +9,7 @@ import lombok.Data;
 
 /**
  * 공지사항 Domain
- * 
+ *
  * @author gagamel
  * @since 2020. 10. 30
  */
@@ -31,6 +33,11 @@ public class Notice extends TscBaseDomain {
 	private String endDt;			// 종료일자
 	private String receiverId;		// 수신자ID
 
+	//private String goodsList;
+	private String crud;
+	private String goodsCd;
+	private String goodsNm;
+
 	// 공지사항 수신자
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] receiverIds;
@@ -44,4 +51,8 @@ public class Notice extends TscBaseDomain {
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] sysFileNms;
 
+
+	private String goodsList;
+	private Collection<NoticeGoods> goodsListNew;
+
 }

+ 22 - 0
style24.admin/src/main/java/com/style24/persistence/domain/NoticeGoods.java

@@ -0,0 +1,22 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 공지사항 상품 Domain
+ *
+ * @author eskim
+ * @since 2020. 11. 06
+ */
+@SuppressWarnings("serial")
+@Data
+public class NoticeGoods extends TscBaseDomain {
+
+	private Integer noticeSq;		// 공지사항일련번호
+	private String goodsCd;
+	private String goodsNm;
+	private String crud;
+
+}

+ 125 - 0
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -1953,4 +1953,129 @@
 		WHERE GOODS_EP_SKIP_SQ = #{goodsEpSkipSq}
 	</delete>
 	
+	<!-- 상품상세 공지사항 목록 -->
+	<select id="getNoticeList" parameterType="GoodsSearch" resultType="Notice">
+		/* TsaGoods.getNoticeList */
+		SELECT A.NOTICE_SQ                                  
+		     , A.NOTICE_TYPE                                
+		     , A.NOTICE_TITLE                               
+		     , A.NOTICE_CONTENT                             
+		     , DATE_FORMAT(A.NOTICE_STDT,'%Y-%m-%d')  AS NOTICE_STDT 
+		     , DATE_FORMAT(A.NOTICE_EDDT,'%Y-%m-%d')  AS NOTICE_EDDT 
+		     , A.USE_YN                                          
+		     , FN_GET_USER_NM(A.REG_NO)             AS REG_NM    
+		     , DATE_FORMAT(A.REG_DT,'%Y-%m-%d %H:%i:%S') AS REG_DT
+		     , FN_GET_USER_NM(A.UPD_NO)             AS UPD_NM    
+		     , DATE_FORMAT(A.UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT    
+		FROM   TB_NOTICE A
+		WHERE  A.NOTICE_TYPE = 'G047_30'
+		<if test="stDate != null and stDate !=''">
+		AND A.NOTICE_EDDT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		</if>
+		<if test="edDate != null and edDate !=''">
+		<![CDATA[
+		AND A.NOTICE_STDT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		]]>
+		</if>
+		<if test='useYn != null and useYn !=""'>
+		AND A.USE_YN = #{useYn}
+		</if>
+		<if test="noticeTitle != null and noticeTitle !=''">
+		AND LOWER(A.NOTICE_TITLE) LIKE CONCAT('%',LOWER(#{noticeTitle}),'%')
+		</if>
+		<if test='conditionList != null and conditionList.length>0'>
+		AND A.NOTICE_SQ IN (
+		                    SELECT NOTICE_SQ
+		                    FROM TB_NOTICE_GOODS
+		                    WHERE GOODS_CD IN (
+		                                       SELECT GOODS_CD 
+		                                       FROM TB_GOODS G
+		                                       WHERE 1 = 1
+		                                       AND (
+		    <choose>
+		      <when test='search != null and search == "searchGoodsCd"'>
+		          <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(G.GOODS_CD) LIKE CONCAT('%',UPPER(#{item}),'%') 
+		          </foreach>
+		      </when>
+		      <when test='search != null and search == "searchGoodsNm"'>
+		          <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(G.GOODS_NM) LIKE CONCAT('%',UPPER(#{item}),'%')
+		          </foreach>
+		      </when>
+		      <when test='search != null and search == "searchGoodsNum"'>
+		          <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(G.GOODS_NUM) LIKE CONCAT('%',UPPER(#{item}),'%')
+		          </foreach>
+		      </when>
+		      <when test='search != null and search == "searchSupplyGoodsCd"'>
+		          <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(G.SUPPLY_GOODS_CD) LIKE CONCAT('%',UPPER(#{item}),'%')
+		          </foreach>
+		      </when>
+		    </choose>
+		                                            )
+		                                      )
+		                   )
+		</if>
+		<if test="supplyCompCd != null and supplyCompCd  != ''">
+		AND A.NOTICE_SQ IN (
+		                    SELECT NOTICE_SQ
+		                    FROM TB_NOTICE_GOODS
+		                    WHERE GOODS_CD IN (
+		                                       SELECT GOODS_CD 
+		                                       FROM TB_GOODS 
+		                                       WHERE SUPPLY_COMP_CD = #{supplyCompCd}
+		                                       <if test="brandCd != null and brandCd  != ''">
+		                                       AND BRAND_CD = #{brandCd} 
+		                                       </if>
+		                                      )
+		                   )
+		</if>
+		ORDER  BY A.NOTICE_SQ DESC
+	</select>
+	
+	<!-- 상품상세 공지사항 상품 목록 -->
+	<select id="getNoticeGoodsList" parameterType="Notice" resultType="NoticeGoods">
+		/* TsaGoods.getNoticeGoodsList */
+		SELECT A.NOTICE_SQ
+		     , A.GOODS_CD
+		     , B.GOODS_NM
+		FROM TB_NOTICE_GOODS A
+		INNER JOIN TB_GOODS B ON A.GOODS_CD = B.GOODS_CD
+		WHERE NOTICE_SQ = #{noticeSq}
+		ORDER BY A.GOODS_CD
+	</select>
+	
+	<!-- 상품상세 공지사항 상품저장 -->
+	<insert id="saveNoticeGoods" parameterType="NoticeGoods">
+		/* TsaGoods.saveNoticeGoods */
+		INSERT INTO TB_NOTICE_GOODS (
+		       NOTICE_SQ
+		     , GOODS_CD
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{noticeSq}
+		     , #{goodsCd}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+		ON DUPLICATE KEY UPDATE
+		       GOODS_CD = #{goodsCd}
+	</insert>
+	
+	<!-- 상품상세 공지사항 상품 삭제 -->
+	<delete id="deleteNoticeGoods" parameterType="NoticeGoods">
+		/* TsaGoods.deleteNoticeGoods */
+		DELETE FROM TB_NOTICE_GOODS 
+		WHERE NOICE_SQ =  #{noiceSq}
+		AND GOODS_CD = #{goodsCd}
+	</delete>
+	
 </mapper>

+ 7 - 5
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsDetailForm.html

@@ -459,7 +459,8 @@
 			</div>	<!--  class=panelContent -->
 		</div>	<!--  class=panelStyle -->
 	</div> <!--  class=modalPopup -->
-<script type="text/javascript" src="/ux/plugins/summernote/summernote.js?v=2020102902"></script>
+<script type="text/javascript" src="/ux/plugins/summernote/summernote.js?v=2020103001"></script>
+<script type="text/javascript" src="/ux/plugins/gaga/gaga.summernote.js?v=2020103001"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
 
@@ -812,10 +813,11 @@
 			$("#goodsDetailForm").find("#goodsTypeNm").html(result.goodsTypeNm);
 			
 			//상품상세
-			$('#goodsDetailForm textarea[name=goodsPcTopDesc]').summernote('code', result.goodsPcTopDesc);
-			$('#goodsDetailForm textarea[name=goodsMobileTopDesc]').summernote('code', result.goodsMobileTopDesc);
-			$('#goodsDetailForm textarea[name=goodsPcDownDesc]').summernote('code', result.goodsPcDownDesc);
-			$('#goodsDetailForm textarea[name=goodsMobileDownDesc]').summernote('code', result.goodsMobileDownDesc);
+			// 공지내용. Summernote에 값 세팅
+			gagaSn.setContents('#goodsPcTopDesc', result.goodsPcTopDesc);
+			gagaSn.setContents('#goodsMobileTopDesc', result.goodsMobileTopDesc);
+			gagaSn.setContents('#goodsPcDownDesc', result.goodsPcDownDesc);
+			gagaSn.setContents('#goodsMobileDownDesc', result.goodsMobileDownDesc);
 
 			if (!gagajf.isNull(result.niClsfNm)){
 				$('#goodsDetailForm').find('#itemkindNoti').html('품목기준 고시분류 : ' + result.niClsfNm);

+ 391 - 0
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsDetailNoticeForm.html

@@ -0,0 +1,391 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : GoodsDetailNoticeForm.html
+ * @desc    : 상품상세공지관리 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.11.05   eskim     최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+		
+		<!-- 검색조건 영역 -->
+		<div class="panelStyle">
+			<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/notice/list'}" >
+				<input type="hidden" name="noticeType" value="G047_30"/>
+				<input type="hidden" id="searchGb" name="searchGb" />
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col width="10%"/>
+						<col width="40%"/>
+						<col width="10%"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>업체/브랜드</th>
+						<td>
+							<select name="supplyCompCd" id="supplyCompCd">
+								<option value="" th:if="${sessionInfo.roleCd} != 'B000'">[전체]</option>
+								<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+							<select name="brandCd" id="brandCd">
+								<option value="">[전체]</option>
+							</select>
+						</td>
+						<th>키워드</th>
+						<td>
+							<select name="search" id="search">
+								<option value="searchGoodsCd">상품코드</option>
+								<option value="searchGoodsNm">상품명</option>
+								<option value="searchGoodsNum">품번</option>
+								<option value="searchSupplyGoodsCd">업체상품코드</option>
+							</select>
+							<input type="text" class="w50p" name="condition" id="condition" maxlength="50"/>
+						</td>
+					</tr>
+					<tr>
+						<th>공지제목</th>
+						<td>
+							<input name="noteicTitle" type="text" maxlength="200"/>
+						</td>
+						<th>사용여부</th>
+						<td>
+							<select name="useYn">
+								<option value="">[전체]</option>
+								<option value="Y">[Y] Yes</option>
+								<option value="N">[N] No</option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>공지기간</th>
+						<td colspan="3" id="sellTerms">
+						</td>
+					</tr>
+				</table>
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-gray btn-lg" onclick="$('#searchForm')[0].reset();">초기화</button>
+						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+		<!-- 검색조건 영역 -->
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<div id="gridNoticeList" style="width: 100%; height: 400px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+		<form id="goodsNoticeForm" name="goodsNoticeForm" action="#" th:action="@{'/goods/notice/save'}">
+		<input type="hidden" name="urgentYn" value="N"/> <!-- 긴급공지여부 -->
+		<input type="hidden" name="noticeType" value="G047_30"/>
+		<input type="hidden" name="goodsList" />
+		<!-- 등록/수정 -->
+		<div class="panelStyle" >
+			<ul>
+				<li>
+					<table class="w100p">
+						<colgroup>
+							<col style="width:65%;"/>
+							<col style="width:1%;"/>
+							<col/>
+						</colgroup>
+						<tr>
+							<td>
+								<table class="frmStyle" aria-describedby="등록/수정 폼">
+									<colgroup>
+										<col style="width:10%;"/>
+										<col style="width:15%;"/>
+										<col style="width:10%;"/>
+										<col style="width:15%;"/>
+										<col style="width:10%;"/>
+										<col/>
+									</colgroup>
+									<tr>
+										<th>공지번호</th>
+										<td>
+											<input type="text" class="w100" name="noticeSq" placeholder="자동부여" readonly="readonly"/>
+										</td>
+										<th>사용여부</th>
+										<td>
+											<input type="hidden" name="useYn"/>
+											<label class="chkBox"><input type="checkbox" name="chkUseYn" checked="checked" value="Y"/>사용</label>
+										</td>
+										<th>공지기간<i class="required" title="필수"></i></th>
+										<td>
+											<input type="text" class="schDate w100" name="noticeStdt" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+											~
+											<input type="text" class="schDate w100" name="noticeEddt" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+										</td>
+									</tr>
+									<tr>
+										<th>제목<i class="required" title="필수"></i></th>
+										<td colspan="5">
+											<input type="text" name="noticeTitle" required="required" data-valid-name="제목"/>
+										</td>
+									</tr>
+									<tr>
+										<th>공지내용<i class="required" title="필수"></i></th>
+										<td colspan="5">
+											<textarea class="textareaR4" name="noticeContent" id="noticeContent"></textarea>
+										</td>
+									</tr>
+								</table>
+							</td>
+							<td>&nbsp;</td>
+							<td>
+							<ul class="panelBar">
+								<li class="left">
+									<button type="button" class="btn btn-danger btn-lg" id="btnDeleteNoticeGoods">삭제</button>
+								</li>
+								<li class="right">
+									<button type="button" class="btn btn-base btn-lg" id="btnSearchExcel">엑셀조회</button>
+									<button type="button" class="btn btn-info btn-lg" id="btnSearchGoods">상품조회</button>
+								</li>
+							</ul>
+							<ul>
+								<li id="gridNoticeGoodsList" style="width: 100%; height: 450px;" class="ag-theme-balham"></li>
+							</ul>
+							</td>
+						</tr>
+					</table>
+				</li>
+			</ul>
+			<!-- 버튼 배치 영역 -->
+			<ul class="panelBar">
+				<li class="right">
+					<button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
+					<button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
+				</li>
+			</ul>
+			<!-- //버튼 배치 영역 -->
+		</div>
+		<!-- 등록/수정 -->
+		</form>
+	</div>
+
+<script type="text/javascript" src="/ux/plugins/summernote/summernote.js?v=2020103001"></script>
+<script type="text/javascript" src="/ux/plugins/gaga/gaga.summernote.js?v=2020103001"></script>
+<script th:inline="javascript">
+/*<![CDATA[*/
+
+	var columnNoticeDefs = [
+		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
+		{headerName: "공지번호", field: "noticeSq", width: 90, cellClass: 'text-center'},
+		{headerName: "공지제목", field: "noticeTitle", width: 500,
+			cellRenderer: function(params) { return '<a href="javascript:void(0);">' + params.value + '</a>'; }
+		},
+		{headerName: "공지시작일", field: "noticeStdt", width:150, cellClass: 'text-center',
+			cellRenderer: function(params) { return gagaAgGrid.toDateFormat(params.value); }
+		},
+		{headerName: "공지종료일", field: "noticeEddt", width:150, cellClass: 'text-center',
+			cellRenderer: function(params) { return gagaAgGrid.toDateFormat(params.value); }
+		},
+		{headerName: "사용여부", field: "useYn", width:90, cellClass: 'text-center'},
+		{headerName: "등록자", field: "regNm", width:90, cellClass: 'text-center'},
+		{headerName: "등록일자", field: "regDt", width:150, cellClass: 'text-center',
+			cellRenderer: function(params) { return gagaAgGrid.toDateFormat(params.value); }
+		}
+	];
+	
+	var columnNoticeGoodsDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
+		{headerName: "CRUD", field: "crud", width: 75, minWidth: 75, hide: true},
+		{headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center'},
+		{headerName: "상품명", field: "goodsNm", width: 250, cellClass: 'text-left'}
+	];
+
+	var gridNoticeOptions = gagaAgGrid.getGridOptions(columnNoticeDefs);
+	var gridNoticeGoodsOptions = gagaAgGrid.getGridOptions(columnNoticeGoodsDefs);
+
+	// Cell click
+	gridNoticeOptions.onCellClicked = function(event) {
+		if (event.colDef.field != 'noticeTitle')
+			return;
+		
+		$('#goodsNoticeForm input[name=noticeSq]').val(event.data.noticeSq);
+		if (event.data.useYn == 'Y') {
+			$('#goodsNoticeForm input:checkbox[name=chkUseYn]').prop('checked', true);
+		} else {
+			$('#goodsNoticeForm input:checkbox[name=chkUseYn]').prop('checked', false);
+		}
+		
+		$('#goodsNoticeForm input[name=noticeStdt]').val(event.data.noticeStdt);
+		$('#goodsNoticeForm input[name=noticeEddt]').val(event.data.noticeEddt);
+		$('#goodsNoticeForm input[name=noticeTitle]').val(event.data.noticeTitle);
+
+		// 공지내용. Summernote에 값 세팅
+		gagaSn.setContents('#noticeContent', event.data.noticeContent);
+
+		// 상품 목록
+		fnGetNoticeGoodsList(event.data.noticeSq);
+	}
+
+	// 검색
+	$('#btnSearch').on('click', function() {
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridNoticeOptions, '#searchForm');
+	});
+	
+	// 상품 목록 조회
+	var fnGetNoticeGoodsList = function(noticeSq) {
+		var actionUrl = '/goods/notice/goods/list/' + noticeSq;
+		gagaAgGrid.fetch(actionUrl, gridNoticeGoodsOptions);
+	}
+	
+	//업체변경시
+	$('#searchForm select[name=supplyCompCd]').on('change', function() {
+		var actionUrl = '/renderer/supplyCompany/brand/list/' + $(this).val();
+
+		if(sessRoleCd == "G001_B000"){
+			actionUrl = '/renderer/brand/AuthBrandlist';
+		}
+		$("#searchForm select[name=brandCd] option:gt(0)").remove();
+
+		cfnCreateCombo(actionUrl, $('#searchForm select[name=brandCd]'), "[전체]", "");
+	});	
+	
+	//엑셀 상품 조회
+	$('#btnSearchExcel').on('click', function() {
+		cfnExcelUploadPopup('goodsNoticeExcelUpload', 'goodsNoticeExcelUpload');
+	});
+
+	var goodsNoticeExcelUpload = function(result){
+		var data = {procJob : result.procJob
+			,excelFileNm : result.excelFileNm
+		};
+		var jsonData = JSON.stringify(data);
+		gagajf.ajaxJsonSubmit('/goods/search/excelupload/save', jsonData, fnGoodsNoticeExcelUploadCallBack);
+	}
+	
+	var fnGoodsNoticeExcelUploadCallBack = function(result){
+		gagajf.ajaxJsonSubmit('/goods/excel/upload/goods/list', '', fnExcelSearchCallBack);
+	}
+	
+	// 상품 조회 클릭 시
+	$('#btnSearchGoods').on('click', function() {
+		cfnOpenGoodsPopup('fnExcelSearchCallBack');
+	});
+
+	// 상품 조회 콜백함수
+	var fnExcelSearchCallBack = function(result) {
+		if (result.goodsExcelList.length < 1) return;
+		var oldData = gagaAgGrid.getAllRowData(gridNoticeGoodsOptions);
+		$.each(result.goodsExcelList, function(idx, item) {
+			var isInvalid = false;
+			if (oldData != null && oldData.length != 0){
+				oldData.forEach(function(oneData){
+					if(oneData.goodsCd == item.goodsCd){
+						isInvalid = true;
+						return true;
+					}
+				});
+				if(isInvalid){
+					return isInvalid;
+				}
+			}
+			gagaAgGrid.addRowData(gridNoticeGoodsOptions, {"goodsCd" : item.goodsCd, "goodsNm" : item.goodsNm, "crud" : "C"});
+		});
+		return;
+	};
+
+	
+	// 신규 버튼 클릭
+	$("#btnNew").on("click", function(){
+		$('#goodsNoticeForm')[0].reset();
+
+		$('#goodsNoticeForm input[name=noticeSq]').val('');
+		$('#goodsNoticeForm input[name=noticeStdt]').val(_today);
+		$('#goodsNoticeForm input[name=noticeEddt]').val(_today);
+	});
+	
+	// 저장
+	$("#btnSave").on("click", function() {
+		// 날짜 체크
+		if (gagajf.isNull($('#goodsNoticeForm input[name=noticeStdt]').val())) {
+			mcxDialog.alertC('공지시작일자를 입력해 주세요.', {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#goodsNoticeForm input[name=noticeStdt]').focus();
+				}
+			});
+			return;
+		}
+
+		if (gagajf.isNull($('#goodsNoticeForm input[name=noticeEddt]').val())) {
+			mcxDialog.alertC('공지종료일자를 입력해 주세요.', {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#goodsNoticeForm input[name=noticeEddt]').focus();
+				}
+			});
+			return;
+		}
+		var stDate = $('#goodsNoticeForm input[name=noticeStdt]').val().toDate('YYYY-MM-DD');
+		var edDate = $('#goodsNoticeForm input[name=noticeEddt]').val().toDate('YYYY-MM-DD');
+
+		if (stDate > edDate) {
+			mcxDialog.alert("공지기간 종료일자는 시작일자 보다 클 수 없습니다.");
+			return;
+		}
+
+		// validation
+		if (!gagajf.validation('#goodsNoticeForm'))
+			return false;
+
+		$('#goodsNoticeForm input[name=useYn]').val($('#goodsNoticeForm input:checkbox[name=chkUseYn]').is(":checked") ? 'Y' : 'N');
+
+		mcxDialog.confirm('저장하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				
+				var goodsAllData = gagaAgGrid.getAllRowData(gridNoticeGoodsOptions);
+				
+				
+				var jsonGoodsData = JSON.stringify(goodsAllData);
+				$('#goodsNoticeForm input[name=goodsList]').val(jsonGoodsData);
+				
+				var jsonData = JSON.stringify($('#goodsNoticeForm').serializeObject());
+				gagajf.ajaxJsonSubmit($('#goodsNoticeForm').prop('action'), jsonData, function() {
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	});
+	
+	$(document).ready(function() {
+		
+		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '공지일', 'X');
+		
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridNoticeList', gridNoticeOptions);
+		gagaAgGrid.createGrid('gridNoticeGoodsList', gridNoticeGoodsOptions);
+		
+		// Create a summernote
+		var snOptions = gagaSn.getToolbarOptions('media');
+		gagaSn.createSummernote(snOptions, '#noticeContent');
+		
+	});
+	
+/*]]>*/
+</script>
+
+</html>