소스 검색

Merge branch 'jsshin' into develop

jsshin 5 년 전
부모
커밋
70ba1ae1de

+ 19 - 0
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -207,4 +207,23 @@ public interface TsfCustomerDao {
 	 */
 	int updateEmailReceptionRefuse(Integer custNo);
 
+	/**
+	 * 앱수신동의
+	 *
+	 * @param custInfo - 앱수신여부, 고객번호
+	 * @return 처리건수
+	 * @author jsshin
+	 * @since 2021. 05. 22
+	 */
+	int updateAppAgreeYn(Customer custInfo);
+
+	/**
+	 * 앱마케팅 수신동의
+	 *
+	 * @param custInfo - 앱 마케팅 수신동의, 고객번호
+	 * @return 처리건수
+	 * @author jsshin
+	 * @since 2021. 05. 22
+	 */
+	int updateMkAgreeYn(Customer custInfo);
 }

+ 104 - 0
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -1070,4 +1070,108 @@ public class TsfCustomerService {
 		result.set("nextCustGradePolicy", nextCustGradePolicy);
 		return result;
 	}
+
+	/*
+	 * 앱푸시수신여부
+	 *
+	 * @return String - 앱수신여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	public String getAppAgreeYn() {
+		if (!TsfSession.isLogin()) {
+			return  "N";
+		}
+
+		Customer customer = getCustomerFindByCustNo(TsfSession.getInfo().getCustNo());
+		if (customer != null) {
+			return  customer.getAppAgreeYn();
+		}
+
+		return "N";
+	}
+
+	/*
+	 * 앱마케팅수신여부
+	 *
+	 * @return String - 앱수신여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	public String getAppMkAgreeYn() {
+		if (!TsfSession.isLogin()) {
+			return  "N";
+		}
+		Customer customer = getCustomerFindByCustNo(TsfSession.getInfo().getCustNo());
+		if (customer != null) {
+			return customer.getMkAgreeYn();
+		}
+		return "N";
+	}
+
+	/*
+	 * 앱푸시수신동의여부 변경
+	 *
+	 * @return String - 앱수신여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void updateAppAgreeYn(String appAppAgreeYn) {
+		if (!TsfSession.isLogin()) {
+			throw new IllegalStateException("로그인 후 다시 시도하시기 바랍니다.");
+		}
+
+		Integer custNo = TsfSession.getInfo().getCustNo();
+		Customer customer = getCustomerFindByCustNo(custNo);
+
+		if (customer != null) {
+			if (!customer.getAppAgreeYn().equals(appAppAgreeYn)) {
+				Customer custInfo = new Customer();
+				custInfo.setCustNo(custNo);
+				custInfo.setAppAgreeYn(appAppAgreeYn);
+				custInfo.setRegNo(custNo);
+				custInfo.setUpdNo(custNo);
+				coreCustomerService.createCustomerMarketHst(custInfo);
+
+				coreCustomerService.createCustomerHistory(custInfo);
+
+				customerDao.updateAppAgreeYn(custInfo);
+			}
+		}
+	}
+
+	/*
+	 * 앱마케팅수신여부 변경
+	 *
+	 * @return String - 앱수신여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void updateMkAgreeYn(String mkAgreeYn) {
+		if (!TsfSession.isLogin()) {
+			throw new IllegalStateException("로그인 후 다시 시도하시기 바랍니다.");
+		}
+
+		Integer custNo = TsfSession.getInfo().getCustNo();
+		Customer customer = getCustomerFindByCustNo(custNo);
+
+		if (customer != null) {
+			if (!customer.getMkAgreeYn().equals(mkAgreeYn)) {
+				Customer custInfo = new Customer();
+				custInfo.setCustNo(custNo);
+				custInfo.setMkAgreeYn(mkAgreeYn);
+				custInfo.setRegNo(custNo);
+				custInfo.setUpdNo(custNo);
+				coreCustomerService.createCustomerMarketHst(custInfo);
+
+				coreCustomerService.createCustomerHistory(custInfo);
+
+				customerDao.updateMkAgreeYn(custInfo);
+			}
+		}
+	}
+
+
 }

+ 52 - 0
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -984,4 +984,56 @@ public class TsfCustomerController extends TsfBaseController {
 		return super.ok(message.getMessage("SUCC_0004"));
 	}
 
+	/**
+	 * 모바일 설정 화면
+	 *
+	 * @author jsshin
+	 * @since 2020. 5. 11
+	 */
+	@GetMapping("/setting/form")
+	public ModelAndView getSettingForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 정책에 등록된 앱버전
+		if (TsfSession.getAttribute("osType").equals("I")) {
+			mav.addObject("regAppVersion","1.0");
+		} else if (TsfSession.getAttribute("osType").equals("A")) {
+			mav.addObject("regAppVersion","1.0");
+		}
+
+		// 앱푸시수신동의 가져오기
+		mav.addObject("appAgreeYn", customerService.getAppAgreeYn());
+		mav.addObject("appMkAgreeYn", customerService.getAppMkAgreeYn());
+
+		mav.setViewName("mob/customer/SettingFormMob");
+		return mav;
+	}
+
+	/**
+	 * 앱푸시 수신동의
+	 *
+	 * @param  customer - 수신동의 여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	@PostMapping("/appagree/update")
+	@ResponseBody
+	public GagaResponse updateAppAgreeYn(@RequestBody Customer customer) {
+		customerService.updateAppAgreeYn(customer.getAppAgreeYn());
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
+
+	/**
+	 * 앱마케팅 수신동의
+	 *
+	 * @param  customer - 수신동의 여부
+	 * @author jsshin
+	 * @since 2021. 05. 20
+	 */
+	@PostMapping("/mkagree/update")
+	@ResponseBody
+	public GagaResponse updateMkAgreeYn(@RequestBody Customer customer) {
+		customerService.updateMkAgreeYn(customer.getMkAgreeYn());
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
 }

+ 22 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -703,4 +703,26 @@
 		AND    EMAIL_AGREE_YN = 'Y' /*현재수신동의인경우*/
 	</update>
 
+	<!--앱수신여부-->
+	<update id="updateAppAgreeYn" parameterType="Customer">
+		/* TsfCustomer.updateAppAgreeYn */
+		UPDATE TB_CUSTOMER
+		SET    APP_AGREE_YN = #{appAgreeYn}
+		     , APP_AGREE_DT = NOW()
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
+
+	<!--앱마케팅 수신여부-->
+	<update id="updateMkAgreeYn" parameterType="Customer">
+		/* TsfCustomer.updateMkAgreeYn */
+		UPDATE TB_CUSTOMER
+		SET    MK_AGREE_YN = #{mkAgreeYn}
+		     , MK_AGREE_DT = NOW()
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
+
 </mapper>

+ 5 - 1
src/main/webapp/WEB-INF/views/mob/SigninFormMob.html

@@ -153,7 +153,11 @@
 	// 로그인 후 처리
 	var fnReloadAfterLogin = function(result) {
 		if (result.status === 'OK') {
-			document.location.href = result.returnUrl;
+			if (_isApp === 'true') {
+				document.location.href = "idsend://?id=" + result.custNo + "^link=" + result.returnUrl;
+			} else {
+				document.location.href = result.returnUrl;
+			}
 		} else {
 			fnFailLoginProcess(result);
 		}

+ 5 - 1
src/main/webapp/WEB-INF/views/mob/SnsCallBackFormMob.html

@@ -84,7 +84,11 @@
 	// 로그인 후 처리
 	var fnReloadAfterLogin = function(result) {
 		if (result.status === 'OK') {
-			document.location.href = result.returnUrl;
+			if (_isApp === 'true') {
+				document.location.href = "idsend://?id=" + result.custNo + "^link=" + result.returnUrl;
+			} else {
+				document.location.href = result.returnUrl;
+			}
 		} else {
 			fnFailLoginProcess(result);
 		}

+ 36 - 0
src/main/webapp/WEB-INF/views/mob/common/fragments/GnbSubAppMob.html

@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : GnbSubMob.html
+ * @desc    : GNB Sub (모바일용)
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.03.08   gagamel     최초 작성
+ *******************************************************************************
+ -->
+<th:block th:fragment="gnb">
+	<a href="#mainCon" class="skipNav">본문바로가기</a>
+	<header class=""> <!-- 서브페이지에서는 <header>의 클래스.main 제거 -->
+		<section class="htop" id="htopSub">
+			<button class="btn_back" title="이전페이지로">
+				<span><i class="gl1"></i><i class="gl2"></i><i class="gl3"></i></span>
+			</button>
+			<h1 id="htopTitle"></h1>
+		</section>
+	</header>
+	
+<script th:inline="javascript">
+/*<![CDATA[*/
+	
+/*]]>*/
+</script>
+
+</th:block>
+
+</html>

+ 35 - 0
src/main/webapp/WEB-INF/views/mob/common/layout/AppLayoutMob.html

@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
+
+<head th:replace="~{mob/common/fragments/HeadMob :: head}"></head>
+
+<body>
+
+	<th:block th:replace="~{web/common/fragments/VariablesWeb :: variables}"></th:block>
+	
+	<div class="app">
+
+		<th:block th:replace="~{mob/common/fragments/GnbSubAppMob :: gnb}"></th:block>
+
+		<!-- CONTENT AREA -->
+		<th:block layout:fragment="content"></th:block>
+		<!-- // CONTENT AREA -->
+
+		<th:block th:replace="~{mob/common/fragments/FooterMob :: footer}"></th:block>
+
+		<th:block th:replace="~{mob/common/fragments/ScriptsMob :: scripts}"></th:block>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	$(document).ready(function() {
+		
+	});
+/*]]>*/
+</script>
+
+	</div>
+	
+</body>
+</html>

+ 201 - 0
src/main/webapp/WEB-INF/views/mob/customer/SettingFormMob.html

@@ -0,0 +1,201 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+	layout:decorator="mob/common/layout/AppLayoutMob">
+
+<!--
+ *******************************************************************************
+ * @source  : JoinTypeFormMob.html
+ * @desc    : 회원정보 입력 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.04.16   jsshin     최초 작성
+ *******************************************************************************
+ -->
+<body>
+<th:block layout:fragment="content">
+<main class="container app-only">
+	<!-- APP Setting -->
+	<!-- ★ 컨텐츠 시작 -->
+	<section class="sett">
+		<form action="" class="form_wrap">
+			<div class="inner">
+				<div class="form_field">
+					<dl>
+						<dd>
+							<div class="setItems">
+								<span class="set_opt">정보성 PUSH 알림</span>
+								<div class="switch">
+									<input id="btnPushSetting" type="checkbox" th:checked="${appAgreeYn == 'Y'}"/>
+									<label for="btnPushSetting"></label>
+								</div>
+							</div>
+							<p>재입고 알림, 주문, 배송정보 등 내 상품 정보 및 공지를 안내 받으실 수 있습니다.</p>
+							<p class="pot">기기 알림에 관한 설정은 '휴대폰 설정>알림>스타일24'에서 변경할 수 있습니다.</p>
+						</dd>
+						<dd>
+							<div class="setItems">
+								<span class="set_opt">마케팅 PUSH 수신동의</span>
+								<div class="switch">
+									<input id="btnMkSetting" type="checkbox" th:checked="${appMkAgreeYn == 'Y'}" />
+									<label for="btnMkSetting"></label>
+								</div>
+							</div>
+							<p>PUSH 알림 수신에 동의하시면 이벤트, 쿠폰, 할인 안내 등 다양한 소식을 받으실 수 있습니다.</p>
+						</dd>
+						<dd>
+							<div class="setItems">
+								<span class="set_opt">알림함</span>
+								<div class="alink">
+									<a href="javascript:void(0);"></a>
+								</div>
+							</div>
+						</dd>
+					</dl>
+				</div>
+			</div>
+			<div class="inner">
+				<div class="form_field">
+					<dl>
+						<dd>
+							<div class="setItems">
+								<span class="set_opt">현재버전 <em th:text="${appVersion}">1.0</em></span>
+								<span class="alink">
+									<th:block th:if="${appVersion != regAppVersion}">
+										<th:block th:if="${osType == 'A'}">
+											<input id="chk-2" type="button">
+											<label for="chk-2">
+												<span></span>
+											</label>
+										</th:block>
+										<th:block th:if="${osType == 'I'}">
+											<input id="chk-3" type="button">
+											<label for="chk-3">
+												<span></span>
+											</label>
+										</th:block>
+									</th:block>
+									<th:block th:unless="${appVersion != regAppVersion}">
+										<input id="chk-4" type="button" disabled>
+										<label for="chk-4">
+											<span></span>
+										</label>
+									</th:block>
+								</span>
+							</div>
+						</dd>
+					</dl>
+				</div>
+			</div>
+		</form>
+	</section>
+	<!-- ★ 컨텐츠 종료 -->
+</main>
+
+
+<script th:inline="javascript">
+	$(document).ready(function(){
+		$('#htopTitle').text('설정');
+
+		// 앱으로 푸시 상태값 조회. 앱에서 settingsSwtichPush 함수를 호출함.
+		if (_isApp === 'true') {
+			if (_osType === 'A') {
+			window.style24.isAdEnable();
+			} else if (_osType === 'I') {
+				// 아래와 같이 호출 시 settingsSwtichPush 함수가 앱에서 호출됨
+				window.webkit.messageHandlers.isAdEnable.postMessage({"dummy":"dummy"});
+			}
+		}
+
+	});
+
+
+	// 앱에서 호출되는 함수(앱푸시)
+	var settingsAppPush = function(onOff) {
+		if (onOff == 'ON') {
+			$('#btnPushSetting').prop('checked', true);
+		} else if (onOff == 'OFF') {
+			$('#btnPushSetting').prop('checked', false);
+		}
+	}
+
+	// 앱에서 호출되는 함수(마케팅동의)
+	var settingsMkPush = function (onOff) {
+		if (onOff == 'ON') {
+			$('#btnMkSetting').prop('checked', true);
+		} else if (onOff == 'OFF') {
+			$('#btnMkSetting').prop('checked', false);
+		}
+	}
+
+	$('#btnPushSetting').on('click', function() {
+		let appAgreeYn;
+		if (_isApp === 'true') {
+			if ($(this).is(":checked")) {
+				if (_osType == 'A') {
+					window.style24.adEnable('ON');
+				} else if (_osType == 'I') {
+					window.webkit.messageHandlers.adEnable.postMessage({"status":"ON"});
+				}
+				appAgreeYn = 'Y';
+			} else {
+				if (_osType == 'A') {
+					window.style24.adEnable('OFF');
+				} else if(_osType == 'I') {
+					window.webkit.messageHandlers.adEnable.postMessage({"status":"OFF"});
+				}
+				appAgreeYn = 'N';
+			}
+			let params = {}
+			params.appAgreeYn = appAgreeYn;
+			let jsonData = JSON.stringify(params);
+			gagajf.ajaxJsonSubmit('/customer/appagree/update', jsonData);
+		}
+	});
+
+	$('#btnMkSetting').on('click', function() {
+		let mkAgreeYn;
+		if (_isApp === 'true') {
+			if ($(this).is(":checked")) {
+				if (_osType == 'A') {
+					window.style24.adEnable('ON');
+				} else if (_osType == 'I') {
+					window.webkit.messageHandlers.adEnable.postMessage({"status":"ON"});
+				}
+				mkAgreeYn = 'Y';
+			} else {
+				if (_osType == 'A') {
+					window.style24.adEnable('OFF');
+				} else if(_osType == 'I') {
+					window.webkit.messageHandlers.adEnable.postMessage({"status":"OFF"});
+				}
+				mkAgreeYn = 'N';
+			}
+			let params = {}
+			params.mkAgreeYn = mkAgreeYn;
+			let jsonData = JSON.stringify(params);
+			gagajf.ajaxJsonSubmit('/customer/mkagree/update', jsonData);
+		}
+	});
+
+
+	// 안드로이드 앱
+	$('#chk-2').on('click', function () {
+		document.location.href='update://?link=https://play.google.com/store/apps/details?id=';
+	});
+
+	// 아이폰앱
+	$('#chk-3').on('click', function () {
+		document.location.href='update://?link=https://apps.apple.com/kr/app/';
+	});
+
+</script>
+</th:block>
+</body>
+
+</html>

+ 1 - 0
src/main/webapp/ux/style24_link.js

@@ -36,6 +36,7 @@ const _PAGE_USE_TERMS_LAYER = _frontUrl + "/customer/use/terms/layer";								//
 const _PAGE_PRIVACY_POLICY_LAYER = _frontUrl + "/customer/privacy/policy/layer";					// 회원가입 > 개인정보취급방침
 const _PAGE_PRIVACY_TRUST_LAYER = _frontUrl + "/customer/privacy/trust/layer";						// 회원가입 > 개인정보취급위탁
 const _PAGE_NON_CUSTOMER_ORDER_CONFIRM = _frontUrl + "/customer/noncust/order/confirm/form";		// 고객 > 비회원주문확인
+const _PAGE_CUSTOMER_SETTING = _frontUrl + "/customer/setting/form";								// 앱 > 설정
 
 //== 상품상세 ==/
 const _PAGE_GOODS_DETAIL = _frontUrl + "/goods/detail/form?goodsCd=";								// 상품 상세