Explorar el Código

2021. 02. 02 메일헤더푸터관련 임시커밋

csh9191 hace 5 años
padre
commit
6127518b0a

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

@@ -0,0 +1,42 @@
+package com.style24.admin.biz.dao;
+
+import java.util.Collection;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.MailTemplate;
+
+/**
+ * 메일템플릿 Dao
+ * 
+ * @author csh9191	 
+ * @since 2021. 01. 29
+ */
+@ShopDs
+public interface TsaMailTemplateDao {
+	
+	/**
+	 * 메일 헤더푸터 관리 목록
+	 * @param mailtemplate - 메일관련 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	Collection<MailTemplate> getmailHFList(MailTemplate mailtemplate);
+	
+	/**
+	 * 메일 헤더푸터 상세
+	 * @param mailtemplate - 메일관련 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	MailTemplate getMailHFDetail(Integer mailtemplate);
+
+	/**
+	 * 메일 헤더푸터 등록/수정
+	 * @param  mailtemplate - 메일관련 정보
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	void saveMailHF(MailTemplate mailtemplate);
+}

+ 68 - 0
src/main/java/com/style24/admin/biz/service/TsaMailTemplateService.java

@@ -0,0 +1,68 @@
+package com.style24.admin.biz.service;
+
+import java.util.Collection;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import com.style24.admin.biz.dao.TsaMailTemplateDao;
+import com.style24.persistence.domain.MailTemplate;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 메일템플릿관리 Service
+ *
+ * @author csh9191
+ * @since 2021. 01. 29
+ */
+
+@Service
+@Slf4j
+public class TsaMailTemplateService {
+
+	@Autowired
+	private TsaMailTemplateDao mailtempletDao;
+
+	/**
+	 * 메일 헤더 푸터 관리 목록
+	 * 
+	 * @param mailtemplate - 메일관련 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	public Collection<MailTemplate> getmailHFList(MailTemplate mailtemplate) {
+		return mailtempletDao.getmailHFList(mailtemplate);
+	}
+	
+	/**
+	 * 메일 헤더 푸터 관리 상세
+	 * @param mailtemplate - 메일관련 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	public MailTemplate getMailHFDetail(Integer mailtemplate) {
+		return mailtempletDao.getMailHFDetail(mailtemplate);
+	}
+	
+
+	/**
+	 * 메일 헤더 푸터 관리
+	 * @param mailtemplate - 메일관련 정보
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	@Transactional("shopTxnManager")
+	public void saveMailHF(MailTemplate mailtemplate) {
+		// 내용 유무 확인
+		if (StringUtils.isNotBlank(mailtemplate.getMailhfContent())) {
+			mailtemplate.setMailhfContent(mailtemplate.getMailhfContent().replaceAll("&lt;", "<").replaceAll("&gt;", ">"));
+		}
+
+		mailtempletDao.saveMailHF(mailtemplate);
+	
+	}
+}

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

@@ -24,6 +24,7 @@ import org.springframework.web.servlet.ModelAndView;
 import com.style24.admin.biz.service.TsaCommonService;
 import com.style24.admin.biz.service.TsaCouponService;
 import com.style24.admin.biz.service.TsaFreegiftPromotionService;
+import com.style24.admin.biz.service.TsaMailTemplateService;
 import com.style24.admin.biz.service.TsaMorebetterService;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.biz.service.TsaReviewService;
@@ -31,11 +32,15 @@ import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.TscPageRequest;
+import com.style24.persistence.domain.AnswerPhase;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.CouponRefval;
 import com.style24.persistence.domain.CustCoupon;
+import com.style24.persistence.domain.Faq;
 import com.style24.persistence.domain.FreeGoodsPromotion;
+import com.style24.persistence.domain.Itemkind;
+import com.style24.persistence.domain.MailTemplate;
 import com.style24.persistence.domain.MoreBetter;
 import com.style24.persistence.domain.MoreBetterBurden;
 import com.style24.persistence.domain.MoreBetterGoods;
@@ -86,7 +91,10 @@ public class TsaMarketingController extends TsaBaseController {
 
 	@Autowired
 	private TscPointService corePointService;
-
+	
+	@Autowired
+	private TsaMailTemplateService mailTemplateService;
+	
 	/**
 	 * 상품평관리 화면
 	 * @return
@@ -843,6 +851,77 @@ public class TsaMarketingController extends TsaBaseController {
 
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
+	/* CSH 진행 */
+	
+	/**
+	 * 메일헤더푸더관리 화면
+	 * @param 메일헤더푸더관리 - 메일헤더푸더 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 1
+	 */
+	@GetMapping("/mailtemplate/form")
+	public ModelAndView mailheaderfooterForm() {
+		ModelAndView mav = new ModelAndView();
+		// 정보고시 목록
+
+		mav.setViewName("marketing/MailHeaderFooterForm");
+		return mav;
+	}
+	
+	/**
+	 * 메일헤더푸더관리 목록
+	 * @param 메일헤더푸더관리 - 메일헤더푸더 정보
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 1
+	 */
+	@GetMapping("/mailtemplate/hf/list")
+	@ResponseBody
+	public Collection<MailTemplate> getMailHFList(@RequestBody MailTemplate mailTemplate) {
+		return mailTemplateService.getmailHFList(mailTemplate);
+	}
+	
+	/**
+	 * 메일헤더푸터 상세 화면
+	 * @param mode - 모드(N:신규, U:상세)
+	 * @return
+	 * @author csh9191
+	 * @since 2021. 02. 01
+	 */
+	@GetMapping("/mailtemplate/detail/form")
+	public ModelAndView faqDetailForm(@RequestParam(value = "mode") String mode, @RequestParam(value = "mailhfSq", required = false) Integer mailhfSq) {
+		ModelAndView mav = new ModelAndView();
+		// 모드 값
+		mav.addObject("mode", mode);
+
+		if ("U".equals(mode)) {
+			mav.addObject("mailhfInfo", mailTemplateService.getMailHFDetail(mailhfSq));
+		}
+
+		mav.setViewName("marketing/MailHeaderFooterDetailForm");
+
+		return mav;
+	}
+	
+	
+	/**
+	 * 메일헤더푸터 상세 등록/수정
+	 * @param 메일헤더푸더관리 - 메일헤더푸더 정보
+	 * @return
+	 * @author csh9191	
+	 * @since 2021. 02. 01
+	 */
+	@PostMapping("/mailtemplate/save")
+	@ResponseBody
+	public GagaResponse saveMailHF(@RequestBody MailTemplate mailTemplate) {
+		mailTemplate.setRegNo(TsaSession.getInfo().getUserNo());
+		mailTemplate.setUpdNo(TsaSession.getInfo().getUserNo());
+		mailTemplateService.saveMailHF(mailTemplate);
+		return super.ok(message.getMessage("SUCC_0001"));
+
+	}
+	
 	/* // CSB 진행 */
 
 	/**

+ 33 - 0
src/main/java/com/style24/persistence/domain/MailTemplate.java

@@ -0,0 +1,33 @@
+package com.style24.persistence.domain;
+
+import java.util.Collection;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 색상 Domain
+ *
+ * @author csh9191
+ * @since 2021. 01. 29.
+ */
+
+@SuppressWarnings("serial")
+@Data
+public class MailTemplate extends TscBaseDomain{
+
+	//메일템플릿
+	private Integer mailhfSq;		// 메일헤더푸터 일련번호
+	private String mailhfNm;		// 메일헤더푸터명
+	private String mailhfGb;		// 메일헤더푸터 구분 H:헤더 F:푸터
+	private String mailhfContent;	// 메일헤더푸터 내용
+	private String useYn;			// 사용여부
+	private String regDt;			// 등록일시
+	private String updDt;			// 수정일시
+
+
+	}
+
+

+ 10 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaMailHF.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.admin.biz.dao.TsaMailTemplateDao">
+
+	<!-- 헤더푸터 목록 -->
+	<select id="getMailList" parameterType="MailTemplate" resultType="MailTemplate">
+
+	</select>
+	
+</mapper>

+ 182 - 0
src/main/webapp/WEB-INF/views/marketing/MailHeaderFooterDetailForm.html

@@ -0,0 +1,182 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : MailHeaderFooterDetailForm.html
+ * @desc    : FAQ 상세 팝업 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.10.29   gagamel     최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="1200" id="popupMailHF">
+	<div class="panelStyle">
+		<!-- TITLE -->
+		<div class="panelTitle">
+			<strong th:text="${'메일 헤더/푸터 ' + (mode == 'N' ? '등록' : '상세')}">메일 헤더/푸터</strong>
+			<button type="button" class="close" onclick="uifnPopupClose('popupMailHF');"><em class="fa fa-times"></em></button>
+		</div>
+		<!-- //TITLE -->
+		
+		<!-- 등록 -->
+		<div class="panelContent" th:if="${mode == 'N'}">
+			<form id="MailHFForm" name="MailHFForm" action="#" th:action="@{'/marketing/mailtemplate/save'}" th:method="post">
+				<input type="hidden" name="mode" th:value="${mode}"/>
+				
+				<table class="frmStyle" aria-describedby="등록폼">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:23%;"/>
+						<col style="width:10%;"/>
+						<col style="width:23%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>번호</th>
+							<td>
+								<input type="text" name="faqSq" maxlength="20" placeholder="자동생성" readonly="readonly"/>
+							</td>							
+						</tr>
+						<tr>
+							<th>구분<em class="required" title="필수"></em></th>
+							<td>
+								<label class="rdoBtn"><input type="radio" name="mailhfGb" value="H" checked="checked"/>Header</label>
+								<label class="rdoBtn"><input type="radio" name="mailhfGb" value="F"/>Footer</label>
+							</td>
+						</tr>
+						<tr>
+							<th>타이틀<em class="required" title="필수"></em></th>
+							<td>
+								<input type="text" name="question" maxlength="200" required="required" data-valid-name="타이틀"/>
+							</td>
+						</tr>
+						<tr>
+							<td colspan="2">
+								<textarea class="textareaR4" id="mailhfContent" name="mailhfContent" data-valid-name="내용"></textarea>
+							</td>
+						</tr>
+					</tbody>
+				</table>
+			</form>
+		</div>
+		
+		<!-- 상세 -->
+		<div class="panelContent" th:if="${mode == 'U'}">
+			<form id="MailHFForm" name="MailHFForm" action="#" th:action="@{'/marketing/mailtemplate/save'}" th:method="post" th:object="${mailhfInfo}">
+				<input type="hidden" name="mode" th:value="${mode}"/>
+				
+				<table class="frmStyle" aria-describedby="상세폼">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:23%;"/>
+						<col style="width:10%;"/>
+						<col style="width:23%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>FAQ번호</th>
+							<td>
+								<input type="text" name="faqSq" maxlength="20" placeholder="자동생성" readonly="readonly" th:field="*{faqSq}"/>
+							</td>
+							<th>사이트<em class="required" title="필수"></em></th>
+							<td>
+								<select name="siteCd" required="required" th:field="*{siteCd}">
+									<option th:if="${siteList}" th:each="oneData, status : ${siteList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|" th:selected="${siteCd == oneData.cd}"></option>
+								</select>
+							</td>
+							<th>FAQ유형<em class="required" title="필수"></em></th>
+							<td>
+								<select name="faqType" required="required" th:field="*{faqType}">
+									<option th:if="${faqTypeList}" th:each="oneData, status : ${faqTypeList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|" th:selected="${faqType == oneData.cd}"></option>
+								</select>
+							</td>
+						</tr>
+						<tr>
+							<th>사용여부<em class="required" title="필수"></em></th>
+							<td>
+								<label class="rdoBtn"><input type="radio" name="useYn" value="Y" th:field="*{useYn}"/>Yes</label>
+								<label class="rdoBtn"><input type="radio" name="useYn" value="N" th:field="*{useYn}"/>No</label>
+							</td>
+							<th>표시순서<i class="required" title="필수" aria-hidden="true"></i></th>
+							<td>
+								<input type="text" class="w100 text-right" name="dispOrd" placeholder="" maxlength="5" required="required" data-valid-type="numeric" data-valid-name="표시순서" th:field="*{dispOrd}"/>
+								<span class="infoTxt cBlue marL10"><i class="fa fa-info-circle" aria-hidden="true"></i>TOP 10 노출 순서</span>
+							</td>
+							<th>조회수</th>
+							<td>
+								<input type="text" name="readCnt" class="w100 aR" readonly="readonly" th:field="*{readCnt}"/>
+							</td>
+						</tr>
+						<tr>
+							<th>질문<em class="required" title="필수"></em></th>
+							<td colspan="5">
+								<input type="text" name="question" placeholder="" maxlength="200" required="required" data-valid-name="질문" th:field="*{question}"/>
+							</td>
+						</tr>
+						<tr>
+							<th>답변<em class="required" title="필수"></em></th>
+							<td colspan="5">
+								<textarea class="textareaR4" id="mailhfContent" name="mailhfContent" data-valid-name="내용" th:field="*{mailhfContent}"></textarea>
+							</td>
+						</tr>
+					</tbody>
+				</table>
+			</form>
+		</div>
+		<!-- //CONTENT -->
+
+		<!-- 버튼 배치 영역 -->
+		<ul class="panelBar">
+			<li class="right">
+				<button type="button" class="btn btn-info btn-lg" id="btnSaveFaq">저장</button>
+			</li>
+		</ul>
+		<!-- //버튼 배치 영역 -->
+	</div>
+</div>
+
+<script type="text/javascript" src="/ux/plugins/summernote/summernote.js?v=2020102902"></script>
+<script type="text/javascript" src="/ux/plugins/gaga/gaga.summernote.js?v=20201030"></script>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	// 저장
+	$('#btnSaveFaq').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation('#MailHFForm'))
+			return false;
+		
+		if (gagajf.isNull($('#mailhfContent').val())) {
+			mcxDialog.alert('답변을 입력해 주세요.');
+			return false;
+		}
+		
+		mcxDialog.confirm("저장하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				gagajf.ajaxFormSubmit($('#MailHFForm').prop('action'), '#MailHFForm', function() {
+					uifnPopupClose('popupMailHF');
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	});
+	
+	$(document).ready(function() {
+		// Create a summernote
+		let snOptions = gagaSn.getToolbarOptions();
+		gagaSn.createSummernote(snOptions, '#mailhfContent');
+	});
+/*]]>*/
+</script>
+
+</html>

+ 133 - 0
src/main/webapp/WEB-INF/views/marketing/MailHeaderFooterForm.html

@@ -0,0 +1,133 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : MailHeaderFooter.html
+ * @desc    : MailHeaderFooter Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021. 02. 01   csh9191     최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+		
+		<!-- 리스트 영역 -->
+	<form id="searchForm" name="searchForm" action="#" th:action="@{'/marketing/mailtemplate/hf/list'}">
+		<div class="panelStyle">
+			<!-- 버튼 배치 영역 -->
+			<ul class="panelBar">
+				<li class="right">
+					<button type="button" class="btn btn-info btn-lg" onclick="fnOpenMailHFPopup('N');">등록</button>
+					<button type="button" class="btn btn-danger btn-lg" id="btnDeleteRow">선택 삭제</button>				
+				</li>
+			</ul>
+			<!-- //버튼 배치 영역 -->
+			<div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
+		</div>
+	</form>
+
+	<!-- //리스트 영역 -->
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	var mailhfGb = { "H":"Header", "F":"Footer" };
+
+	// specify the columns
+	var columnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: "구분", field: "mailhfGb", width: 150, cellClass: 'text-center',
+			editable : function(params){return params.data.crud=='C' ? true : false;},
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { required: true, onblur: '$(this).val($(this).val().toUpperCase())' }
+		},
+		{headerName: "타이틀", field: "mailhfNm", width: 350, cellClass: 'text-left',
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 50, required: true }
+		},
+		{headerName: "등록자", field: "regNo", width: 200, cellClass: 'text-left'
+			,cellRenderer: function(params) {
+				return params.value + "(" + params.data.regDt + ")";
+			}
+		},
+		{headerName: "수정자", field: "updDt", width: 200, cellClass: 'text-left'
+			,cellRenderer: function(params) {
+				return params.value + "(" + params.data.updDt + ")";
+			}
+		}
+	];
+
+	// Get GridOptions
+	var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// Grid editable
+	gridOptions.defaultColDef.editable = true;
+
+	// Add on options
+	gridOptions.suppressRowClickSelection = true;
+	gridOptions.rowSelection = 'multiple';
+
+	gridOptions.stopEditingWhenGridLosesFocus = true;
+
+	// 선택삭제
+	$('#btnDeleteRow').on('click', function() {
+		var selectedData = gridOptions.api.getSelectedRows();
+		var removedData = gagaAgGrid.removeRowData(gridOptions);
+
+		if (selectedData.length == 0) {
+			mcxDialog.alert('선택된 행이 없습니다.');
+			return;
+		}
+
+		if (removedData.length > 0) {
+
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					var deleteData = [];
+
+					$.each(removedData, function(idx, item) {
+						deleteData.push(item);
+					});
+
+					var jsonData = JSON.stringify(deleteData);
+					gagajf.ajaxJsonSubmit('', jsonData, fnSearch);
+				}
+			});
+		}
+	});
+	
+	// 등록/상세 팝업
+	var fnOpenMailHFPopup = function(mode, mailhfSq) {
+		var actionUrl = '/marketing/mailtemplate/detail/form' + '?mode=' + mode;
+		if (!gagajf.isNull(mailhfSq)) actionUrl += '&mailhfSq=' + mailhfSq;
+		cfnOpenModalPopup(actionUrl, 'popupMailHF');
+	}
+	
+	$(document).ready(function() {
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+		
+		
+	});
+	
+/*]]>*/
+</script>
+
+
+</html>