Pārlūkot izejas kodu

Merge branch 'develop' of http://112.172.147.34:4936/style24/STYLE24.git into develop

eskim 5 gadi atpakaļ
vecāks
revīzija
72d151b636

+ 2 - 4
style24.scm/src/main/java/com/style24/persistence/domain/Notice.java

@@ -40,10 +40,6 @@ public class Notice extends TscBaseDomain {
 //	@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)
@@ -52,4 +48,6 @@ public class Notice extends TscBaseDomain {
 	private String goodsList;
 	private Collection<NoticeGoods> goodsListNew;
 
+	private Collection<NoticeFileList> fileList;
+
 }

+ 22 - 0
style24.scm/src/main/java/com/style24/persistence/domain/NoticeFileList.java

@@ -0,0 +1,22 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 공지사항파일 Domain
+ *
+ * @author gagamel
+ * @since 2020. 10. 30
+ */
+@SuppressWarnings("serial")
+@Data
+public class NoticeFileList extends TscBaseDomain {
+
+	private Integer noticeSq;
+	private Integer seq;
+	private String orgFileNm;
+	private String sysFileNm;
+
+}

+ 23 - 17
style24.scm/src/main/java/com/style24/persistence/mybatis/shop/TssNotice.xml

@@ -52,6 +52,21 @@
 		WHERE  NOTICE_SQ = #{noticeSq}
 	</update>
 	
+	<!-- 공지사항 팝업 총건수 -->
+	<select id="getNoticePopupTotalCount" resultType="int">
+		/* TssNotice.getNoticePopupTotalCount */
+		SELECT COUNT(*) AS CNT
+		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
+	</select>
+	
 	<!-- 공지사항 팝업 목록 -->
 	<select id="getNoticePopupList" resultType="Notice">
 		/* TssNotice.getNoticePopupList */
@@ -76,24 +91,15 @@
 	</select>
 	
 	<!-- 공지사항 팝업 파일 목록 -->
-	<select id="getNoticePopupFileList" resultType="Notice">
+	<select id="getNoticePopupFileList" parameterType="Integer" resultType="NoticeFileList">
 		/* 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 NOTICE_SQ
+		     , SEQ
+		     , ORG_FILE_NM
+		     , SYS_FILE_NM
+		FROM   TB_NOTICE_FILE
+		WHERE  NOTICE_SQ = #{noticeSq}
+		ORDER  BY SEQ
 	</select>
 
 </mapper>

+ 11 - 1
style24.scm/src/main/java/com/style24/scm/biz/dao/TssNoticeDao.java

@@ -4,6 +4,7 @@ import java.util.Collection;
 
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Notice;
+import com.style24.persistence.domain.NoticeFileList;
 
 /**
  * 공지사항 Dao
@@ -30,6 +31,14 @@ public interface TssNoticeDao {
 	 */
 	void updateNotice(Notice notice);
 
+	/**
+	 * 공지사항 팝업 총건수
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 30
+	 */
+	int getNoticePopupTotalCount();
+
 	/**
 	 * 공지사항 팝업 목록
 	 * @return
@@ -40,10 +49,11 @@ public interface TssNoticeDao {
 
 	/**
 	 * 공지사항 팝업 파일 목록
+	 * @param noticeSq - 공지사항번호
 	 * @return
 	 * @author gagamel
 	 * @since 2020. 12. 29
 	 */
-	Collection<Notice> getNoticePopupFileList();
+	Collection<NoticeFileList> getNoticePopupFileList(Integer noticeSq);
 
 }

+ 15 - 7
style24.scm/src/main/java/com/style24/scm/biz/service/TssNoticeService.java

@@ -49,23 +49,31 @@ public class TssNoticeService {
 	}
 
 	/**
-	 * 공지사항 팝업 목록
+	 * 공지사항 팝업 총건수
 	 * @return
 	 * @author gagamel
-	 * @since 2020. 12. 29
+	 * @since 2020. 12. 30
 	 */
-	public Collection<Notice> getNoticePopupList() {
-		return noticeDao.getNoticePopupList();
+	public int getNoticePopupTotalCount() {
+		return noticeDao.getNoticePopupTotalCount();
 	}
 
 	/**
-	 * 공지사항 팝업 파일 목록
+	 * 공지사항 팝업 목록
 	 * @return
 	 * @author gagamel
 	 * @since 2020. 12. 29
 	 */
-	public Collection<Notice> getNoticePopupFileList() {
-		return noticeDao.getNoticePopupFileList();
+	public Collection<Notice> getNoticePopupList() {
+		Collection<Notice> noticeList = noticeDao.getNoticePopupList();
+
+		if (noticeList != null && !noticeList.isEmpty()) {
+			for (Notice notice : noticeList) {
+				notice.setFileList(noticeDao.getNoticePopupFileList(notice.getNoticeSq()));
+			}
+		}
+
+		return noticeList;
 	}
 
 }

+ 6 - 4
style24.scm/src/main/java/com/style24/scm/biz/web/TssBoardController.java

@@ -1,11 +1,14 @@
 package com.style24.scm.biz.web;
 
+import java.util.Collection;
+
 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.persistence.domain.Notice;
 import com.style24.scm.biz.service.TssNoticeService;
 import com.style24.scm.support.controller.TssBaseController;
 
@@ -37,10 +40,9 @@ public class TssBoardController extends TssBaseController {
 		ModelAndView mav = new ModelAndView();
 
 		// 공지사항 목록
-		mav.addObject("noticeList", noticeService.getNoticePopupList());
-
-		// 공지사항 파일 목록
-		mav.addObject("noticeFileList", noticeService.getNoticePopupFileList());
+		Collection<Notice> noticeList = noticeService.getNoticePopupList();
+		mav.addObject("noticeCnt", noticeList.size());
+		mav.addObject("noticeList", noticeList);
 
 		mav.setViewName("board/NoticePopupForm");
 

+ 7 - 0
style24.scm/src/main/java/com/style24/scm/biz/web/TssIndexController.java

@@ -15,6 +15,7 @@ import org.springframework.web.servlet.ModelAndView;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.User;
 import com.style24.scm.biz.service.TssLoginService;
+import com.style24.scm.biz.service.TssNoticeService;
 import com.style24.scm.support.controller.TssBaseController;
 import com.style24.scm.support.security.session.TssSession;
 
@@ -42,6 +43,9 @@ public class TssIndexController extends TssBaseController {
 	@Autowired
 	private GagaPasswordEncoder passwordEncoder;
 
+	@Autowired
+	private TssNoticeService noticeService;
+
 	/**
 	 * 첫 페이지
 	 * 		로그인 하고
@@ -60,6 +64,9 @@ public class TssIndexController extends TssBaseController {
 
 		if (TssSession.isLogin()) {
 			if (TssSession.isTwoFactorCertify()) { // 2factor인증이 되었으면
+				// 공지사항 팝업 총건수
+				mav.addObject("noticeCnt", noticeService.getNoticePopupTotalCount());
+
 				// 대쉬보드 페이지로
 				mav.setViewName("dashboard");
 			} else {

+ 20 - 16
style24.scm/src/main/webapp/WEB-INF/views/board/NoticePopupForm.html

@@ -33,9 +33,9 @@
 						12월 21일(금) 오후 5시까지 결제완료(입금/결제완료) 주문 건에 한해 명절 연휴 전 발송이 가능하며, 그 이후 주문 건은 12월 26일(수)부터 순차적으로 발송됩니다.<br/><br/>
 						<img src="/image/@notice_popup01.jpg"/>
 					</div>
-					<ul class="download">
-						<li>
-							<i class="fa fa-download" aria-hidden="true"></i><a href="">파일첨부1.pdf</a>
+					<ul class="download" th:if="${oneData.fileList}">
+						<li th:each="oneData2, status2 : ${oneData.fileList}">
+							<i class="fa fa-download" aria-hidden="true"></i><a href="#" th:href="@{@environment.getProperty('upload.default.view') + '/notice' + oneData2.sysFileNm}" th:text="${oneData2.orgFIleNm}"></a>
 						</li>
 					</ul>
 				</div>
@@ -68,19 +68,23 @@
 <script type="text/javascript" src="/ux/plugins/swiper/swiper.min.js"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
-	// 공지팝업 : SWIPE(공지가 한장일 경우 해당 객체 선언 금지)
-	let swiper = new Swiper('#popupNotice .swiper-container', {
-		loop: true,
-		paginationClickable :true,
-		pagination: {
-			el: '.swiper-pagination',
-			type: 'fraction', /* 201125 */
-		},
-		navigation: {
-			nextEl: '.swiper-button-next',
-			prevEl: '.swiper-button-prev',
-		},
-	});
+	let noticeCnt = [[${noticeCnt}]];
+	
+	if (noticeCnt > 1) {
+		// 공지팝업 : SWIPE(공지가 한장일 경우 해당 객체 선언 금지)
+		let swiper = new Swiper('#popupNotice .swiper-container', {
+			loop: true,
+			paginationClickable :true,
+			pagination: {
+				el: '.swiper-pagination',
+				type: 'fraction', /* 201125 */
+			},
+			navigation: {
+				nextEl: '.swiper-button-next',
+				prevEl: '.swiper-button-prev',
+			},
+		});
+	}
 	
 	$('#btnCloseNotice').on('click', function() {
 		gagajf.setCookie("CK_NOTICE_CLOSE", "Y", 1);

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

@@ -341,7 +341,8 @@
 	}
 
 	$(document).ready(function() {
-		if (gagajf.getCookie('CK_NOTICE_CLOSE') != 'Y') {
+		let noticeCnt = [[${noticeCnt}]];
+		if (noticeCnt > 0 && gagajf.getCookie('CK_NOTICE_CLOSE') != 'Y') {
 			// 공지사항 팝업
 			cfnOpenModalPopup('/board/notice/popup/form', 'popupNotice');
 		}