Explorar el Código

공지사항 팝업 추가

gagamel hace 5 años
padre
commit
7c08ac25b0

+ 7 - 10
style24.scm/src/main/java/com/style24/persistence/domain/Notice.java

@@ -2,7 +2,6 @@ package com.style24.persistence.domain;
 
 import java.util.Collection;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
 import lombok.Data;
@@ -34,23 +33,21 @@ public class Notice extends TscBaseDomain {
 	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;
+//	// 공지사항 수신자
+//	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+//	private String[] receiverIds;
 
 	// 공지사항 첨부파일
 	private Integer seq;
 	private String orgFileNm;
 	private String sysFileNm;
-	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
-	private String[] orgFileNms;
-	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
-	private String[] sysFileNms;
-
+//	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+//	private String[] orgFileNms;
+//	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+//	private String[] sysFileNms;
 
 	private String goodsList;
 	private Collection<NoticeGoods> goodsListNew;

+ 46 - 2
style24.scm/src/main/java/com/style24/persistence/mybatis/shop/TssNotice.xml

@@ -4,7 +4,7 @@
 
 	<!-- 공지사항 저장 -->
 	<insert id="createNotice" parameterType="Notice" keyProperty="noticeSq">
-		/* TsaNotice.createNotice */
+		/* TssNotice.createNotice */
 		INSERT INTO TB_NOTICE (
 		       NOTICE_SQ
 		     , NOTICE_TYPE
@@ -39,7 +39,7 @@
 
 	<!-- 공지사항 수정 -->
 	<update id="updateNotice" parameterType="Notice">
-		/* TsaNotice.updateNotice */
+		/* TssNotice.updateNotice */
 		UPDATE TB_NOTICE
 		SET    NOTICE_TITLE = #{noticeTitle}
 		     , NOTICE_CONTENT = #{noticeContent}
@@ -51,5 +51,49 @@
 		     , UPD_DT = NOW()
 		WHERE  NOTICE_SQ = #{noticeSq}
 	</update>
+	
+	<!-- 공지사항 팝업 목록 -->
+	<select id="getNoticePopupList" resultType="Notice">
+		/* TssNotice.getNoticePopupList */
+		SELECT A.NOTICE_SQ                                           /*공지번호*/
+		     , A.NOTICE_TITLE                                        /*공지제목*/
+		     , A.NOTICE_CONTENT                                      /*공지내용*/
+		     , IFNULL((SELECT COUNT(*)
+		               FROM   TB_NOTICE_FILE
+		               WHERE  NOTICE_SQ = A.NOTICE_SQ
+		              ),0)                               AS FILE_CNT /*파일건수*/
+		     , DATE_FORMAT(A.REG_DT,'%Y-%m-%d %H:%i:%S') AS REG_DT   /*등록일시*/
+		FROM   TB_NOTICE A
+		WHERE  A.NOTICE_TYPE = 'G047_20' /*내부공지*/
+		AND    A.NOTICE_SQ IN (SELECT NOTICE_SQ
+		                       FROM   TB_NOTICE_RECEIVER
+		                       WHERE  RECEIVER_ID = 'G048_60' /*입점업체*/
+		                      )
+		AND    A.USE_YN = 'Y'
+		AND    A.POPUP_YN = 'Y' /*팝업*/
+		AND    CURRENT_DATE() BETWEEN A.POPUP_DISP_STDT AND A.POPUP_DISP_EDDT
+		ORDER  BY A.URGENT_YN DESC, A.NOTICE_SQ DESC
+	</select>
+	
+	<!-- 공지사항 팝업 파일 목록 -->
+	<select id="getNoticePopupFileList" resultType="Notice">
+		/* TsaNotice.getNoticePopupFileList */
+		SELECT A.NOTICE_SQ
+		     , B.SEQ
+		     , B.ORG_FILE_NM
+		     , B.SYS_FILE_NM
+		FROM   TB_NOTICE A
+		     , TB_NOTICE_FILE B
+		WHERE  A.NOTICE_SQ = B.NOTICE_SQ
+		AND    A.NOTICE_TYPE = 'G047_20' /*내부공지*/
+		AND    A.NOTICE_SQ IN (SELECT NOTICE_SQ
+		                       FROM   TB_NOTICE_RECEIVER
+		                       WHERE  RECEIVER_ID = 'G048_60' /*입점업체*/
+		                      )
+		AND    A.USE_YN = 'Y'
+		AND    A.POPUP_YN = 'Y' /*팝업*/
+		AND    CURRENT_DATE() BETWEEN A.POPUP_DISP_STDT AND A.POPUP_DISP_EDDT
+		ORDER  BY A.NOTICE_SQ, B.SEQ
+	</select>
 
 </mapper>

+ 17 - 58
style24.scm/src/main/java/com/style24/scm/biz/dao/TssNoticeDao.java

@@ -1,5 +1,7 @@
 package com.style24.scm.biz.dao;
 
+import java.util.Collection;
+
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Notice;
 
@@ -12,33 +14,6 @@ import com.style24.persistence.domain.Notice;
 @ShopDs
 public interface TssNoticeDao {
 
-//	/**
-//	 * 공지사항 목록
-//	 * @param notice - 공지사항 정보
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	Collection<Notice> getNoticeList(Notice notice);
-//
-//	/**
-//	 * 공지사항 수신자 목록
-//	 * @param noticeSq - 공지사항일련번호
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	Collection<Notice> getNoticeReceiverList(Integer noticeSq);
-//
-//	/**
-//	 * 공지사항 파일 목록
-//	 * @param noticeSq - 공지사항일련번호
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	Collection<Notice> getNoticeFileList(Integer noticeSq);
-
 	/**
 	 * 공지사항 저장
 	 * @param notice - 공지사항 정보
@@ -55,36 +30,20 @@ public interface TssNoticeDao {
 	 */
 	void updateNotice(Notice notice);
 
-//	/**
-//	 * 공지사항 파일 저장
-//	 * @param notice - 공지사항 정보
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	void createNoitceFlie(Notice notice);
-//
-//	/**
-//	 * 공지사항 파일 삭제
-//	 * @param notice - 공지사항 정보
-//	 * @author jaewonHo
-//	 * @since 2020. 01. 15
-//	 */
-//	void deleteNoticeFile(Notice notice);
-//
-//	/**
-//	 * 공지사항 수신자 삭제
-//	 * @param notice - 공지사항 정보
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	void deleteNoticeReceiver(Notice notice);
-//
-//	/**
-//	 * 공지사항 수신자 저장
-//	 * @param notice - 공지사항 정보
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	void createNoticeReceiver(Notice notice);
+	/**
+	 * 공지사항 팝업 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 29
+	 */
+	Collection<Notice> getNoticePopupList();
+
+	/**
+	 * 공지사항 팝업 파일 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 29
+	 */
+	Collection<Notice> getNoticePopupFileList();
 
 }

+ 20 - 98
style24.scm/src/main/java/com/style24/scm/biz/service/TssNoticeService.java

@@ -1,5 +1,7 @@
 package com.style24.scm.biz.service;
 
+import java.util.Collection;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -22,104 +24,6 @@ public class TssNoticeService {
 	@Autowired
 	private TssNoticeDao noticeDao;
 
-//	/**
-//	 * 공지사항 목록
-//	 * @param notice - 공지사항 정보
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	public Collection<Notice> getNoticeList(Notice notice) {
-//		return noticeDao.getNoticeList(notice);
-//	}
-//
-//	/**
-//	 * 공지사항 수신자 목록
-//	 * @param noticeSq - 공지사항일련번호
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	public Collection<Notice> getNoticeReceiverList(Integer noticeSq) {
-//		return noticeDao.getNoticeReceiverList(noticeSq);
-//	}
-//
-//	/**
-//	 * 공지사항 파일 목록
-//	 * @param noticeSq - 공지사항일련번호
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	public Collection<Notice> getNoticeFileList(Integer noticeSq) {
-//		return noticeDao.getNoticeFileList(noticeSq);
-//	}
-//
-//	/**
-//	 * 공지사항 저장
-//	 * @param notice - 공지사항 정보
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	@Transactional("shopTxnManager")
-//	public void saveNotice(Notice notice) {
-//		notice.setRegNo(TsaSession.getInfo().getUserNo());
-//		notice.setUpdNo(TsaSession.getInfo().getUserNo());
-//
-//		// 신규 일때
-//		if (notice.getNoticeSq() == null) {
-//			// 공지사항 저장
-//			noticeDao.createNotice(notice);
-//
-//			// 등록된 사용자번호 값 가져오기
-//			Integer noticeSq = notice.getNoticeSq();
-//			log.info("noticeSq: {}", noticeSq);
-//			notice.setNoticeSq(noticeSq);
-//		} else {
-//			// 공지사항 수정
-//			noticeDao.updateNotice(notice);
-//		}
-//
-//		// 수신자 저장
-//		if (!StringUtils.isAllBlank(notice.getReceiverIds())) {
-//			noticeDao.deleteNoticeReceiver(notice);
-//
-////			for (int i = 0; i < notice.getReceiverIds().length; i++) {
-//			for (String receiverId : notice.getReceiverIds()) {
-//				if (StringUtils.isNotBlank(receiverId)) {
-//					notice.setReceiverId(receiverId);
-//					log.info("noticeReceiver: {}", notice);
-//					noticeDao.createNoticeReceiver(notice);
-//				}
-//			}
-//		}
-//
-//		// 파일이 존재할때
-//		if (!StringUtils.isAllBlank(notice.getSysFileNms())) {
-//			noticeDao.deleteNoticeFile(notice);
-//
-//			for (int i = 0; i < notice.getFileCnt(); i++) {
-//				notice.setOrgFileNm(notice.getOrgFileNms()[i]);
-//				notice.setSysFileNm(notice.getSysFileNms()[i]);
-//				log.info("noticeFile: {}", notice);
-//				noticeDao.createNoitceFlie(notice);
-//			}
-//		}
-//	}
-//
-//	/**
-//	 * 공지사항 첨부파일 삭제
-//	 * @param notice - 공지사항 정보
-//	 * @return
-//	 * @author gagamel
-//	 * @since 2020. 10. 30
-//	 */
-//	@Transactional("shopTxnManager")
-//	public void deleteNoticeFile(Notice notice) {
-//		noticeDao.deleteNoticeFile(notice);
-//	}
-
 	/**
 	 * 공지사항 등록(상품상세공지에서 사용)
 	 * @param notice - 공지사항 정보
@@ -144,6 +48,24 @@ public class TssNoticeService {
 		noticeDao.updateNotice(notice);
 	}
 
+	/**
+	 * 공지사항 팝업 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 29
+	 */
+	public Collection<Notice> getNoticePopupList() {
+		return noticeDao.getNoticePopupList();
+	}
 
+	/**
+	 * 공지사항 팝업 파일 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 29
+	 */
+	public Collection<Notice> getNoticePopupFileList() {
+		return noticeDao.getNoticePopupFileList();
+	}
 
 }

+ 50 - 0
style24.scm/src/main/java/com/style24/scm/biz/web/TssBoardController.java

@@ -0,0 +1,50 @@
+package com.style24.scm.biz.web;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.style24.scm.biz.service.TssNoticeService;
+import com.style24.scm.support.controller.TssBaseController;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 공지사항 Controller
+ *
+ * @author gagamel
+ * @since 2020. 12. 29
+ */
+@Controller
+@RequestMapping("/board")
+@Slf4j
+public class TssBoardController extends TssBaseController {
+
+	@Autowired
+	private TssNoticeService noticeService;
+
+	/**
+	 * 공지사항 팝업 화면
+	 * @param noticeType - 공지유형(10:사이트공지, 20:내부공지)
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 30
+	 */
+	@GetMapping("/notice/popup/form")
+	public ModelAndView noticePopupForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 공지사항 목록
+		mav.addObject("noticeList", noticeService.getNoticePopupList());
+
+		// 공지사항 파일 목록
+		mav.addObject("noticeFileList", noticeService.getNoticePopupFileList());
+
+		mav.setViewName("board/NoticePopupForm");
+
+		return mav;
+	}
+
+}

+ 75 - 0
style24.scm/src/main/webapp/WEB-INF/views/board/NoticePopupForm.html

@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : NoticePopupForm.html
+ * @desc    : 공지사항 팝업 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.12.29   gagamel     최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="500" id="popupNotice">
+	<div class="panelStyle">
+		<!-- TITLE -->
+		<div class="panelTitle">
+			<strong>공지사항</strong>
+			<button type="button" class="close" onclick="uifnPopupClose('popupNotice');"><em class="fa fa-times"></em></button>
+		</div>
+		<!-- //TITLE -->
+		
+		<!-- CONTENT -->
+		<div class="panelContent">
+			<table class="frmStyle" aria-describedby="공지사항">
+				<colgroup>
+					<col style="width:10%;"/>
+					<col/>
+				</colgroup>
+				<tbody th:if="${noticeList}" th:each="oneData, status : ${noticeList}">
+					<tr>
+						<th>제목</th>
+						<td th:text="${oneData.noticeTitle}">
+						</td>
+					</tr>
+					<tr>
+						<th>내용</th>
+						<td th:utext="${#strings.replace(#strings.replace(oneData.noticeContent,'&amplt;','<'),'&ampgt;','>')}">
+						</td>
+					</tr>
+					<tr>
+						<th>첨부파일</th>
+						<td>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+		<!-- //CONTENT -->
+		
+		<!-- 버튼 배치 영역 -->
+		<ul class="panelBar">
+			<li class="right">
+				<button type="button" class="btn btn-info btn-lg" id="btnCloseNotice">1일간 열람하지 않기</button>
+			</li>
+		</ul>
+		<!-- //버튼 배치 영역 -->
+	</div>
+</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	$('#btnCloseNotice').on('click', function() {
+	});
+	
+	$(document).ready(function() {
+
+	});
+/*]]>*/
+</script>
+
+</html>

+ 5 - 2
style24.scm/src/main/webapp/WEB-INF/views/dashboard.html

@@ -341,6 +341,9 @@
 	}
 
 	$(document).ready(function() {
+		// 공지사항 팝업
+		cfnOpenModalPopup('/board/notice/popup/form', 'popupNotice');
+		
 		//fnSearchSummary(1); // 요약-전체
 		//fnSearchSummary(2, 'P'); // 요약-PC
 		//fnSearchSummary(3, 'M'); // 요약-모바일
@@ -502,8 +505,8 @@
 
 	//차트 통계 버튼
 	$(".dbChart .btn-group button").click(function(){
-	    $(".dbChart .btn-group button").removeClass("on");
-	    $(this).addClass("on");
+		$(".dbChart .btn-group button").removeClass("on");
+		$(this).addClass("on");
 	});
 /*]]>*/
 </script>