Sfoglia il codice sorgente

마이페이지 수정

jsshin 5 anni fa
parent
commit
bfcba54597

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

@@ -837,13 +837,6 @@ public class TsfCustomerService {
 
 		// 2. 계좌정보 수정여부 체크
 		if ("Y".equals(customer.getAccountModifyYn())) {
-			// 계좌 유효성 체크
-			String resultCode = "000";
-			if (!"000".equals(resultCode)) {
-				result.setBoolean("isSuccess", false);
-				result.setString("resultType", "INVALID_ACCOUNT");
-				return result;
-			}
 			CustAccount custAccount = new CustAccount();
 			custAccount.setCustNo(custNo);
 			custAccount.setRegNo(custNo);

+ 14 - 0
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -1904,6 +1904,20 @@ public class TsfMypageController extends TsfBaseController {
 	@PostMapping("/customer/info/save")
 	@ResponseBody
 	public GagaMap updateCustomerInfo(@RequestBody Customer customer) {
+		CustAccount custAccount = new CustAccount();
+		custAccount.setAccountNm(customer.getAccountNm());
+		custAccount.setAccountNo(customer.getAccountNo());
+		custAccount.setBankCd(customer.getBankCd());
+
+		if ("Y".equals(customer.getAccountModifyYn())) {
+			GagaMap result = coreKcpService.checkAccount(custAccount);
+			if (!"0000".equals(result.get("resCd"))) {
+				result.setBoolean("isSuccess", false);
+				result.setString("resultType", "INVALID_ACCOUNT");
+				return result;
+			}
+		}
+
 		return customerService.saveCustomerInfo(customer);
 	}
 

+ 29 - 10
src/main/webapp/WEB-INF/views/mob/mypage/MypageCustModifyFormMob.html

@@ -216,8 +216,9 @@
 	let authMethod = [[${authMethod}]]; //인증 후 해당 페이지로 리다이렉트함
 
 	let orgCustInfo;
-	let orgAccountInfo;
 	let accountCheck = false;
+	let orgBankCd;
+	let orgAccountNo;
 
 	// 고객정보
 	var fnGetCustInfo = function () {
@@ -247,8 +248,6 @@
 		fnDisplayEmailAgree(custInfo.emailAgreeYn);
 		fnDisplaySmsAgree(custInfo.smsAgreeYn);
 
-		// 회원(고객) 계좌 조회
-		fnGetCustAccountInfo();
 	}
 
 	// 이메일 수신동의
@@ -283,8 +282,8 @@
 		orgAccountInfo = {};
 		var $accountNm = $('#custModiFyForm input[name=accountNm]');
 		if (!gagajf.isNull(result)) {
-			orgAccountInfo.accountNo = result.accountNo;
-			orgAccountInfo.bankCd = result.bankCd;
+			orgAccountNo = result.accountNo;
+			orgBankCd = result.bankCd;
 			//1. 고객명과 환불계좌 예금주가 다른 경우 현재 고객명을 적어주고 계좌번호, 은행코드 초기화 처리
 			let $bankCd = '';
 			if ($accountNm.val() === result.accountNm) {
@@ -298,8 +297,8 @@
 			}
 			$($bankCd).trigger('click'); // 셀렉트 박스 트리거
 		} else {
-			orgAccountInfo.accountNo = '';
-			orgAccountInfo.bankCd ='';
+			orgAccountNo = '';
+			orgBankCd ='';
 		}
 	}
 
@@ -371,6 +370,17 @@
 					$('#custModiFyForm input[name=email]').focus();
 				}
 			});
+			return;
+		}
+
+		if (!fnCheckValidationEmail(custModiFy.email)) {
+			mcxDialog.alertC('이메일 형식에 맞게 입력해주세요.',{
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#custModiFyForm input[name=email]').focus();
+				}
+			});
+			return;
 		}
 
 		if (orgCustInfo.email !== custModiFy.email) {
@@ -383,11 +393,11 @@
 
 
 		// 은행코드가 바꼈는지
-		if (orgAccountInfo.bankCd !== $bankCd.val()) {
+		if (orgBankCd !== $bankCd.val()) {
 			accountModifyYn = 'Y';
 		}
 
-		if (orgAccountInfo.accountNo !== $accountNo.val()) {
+		if (orgAccountNo !== $accountNo.val()) {
 			accountModifyYn = 'Y';
 		}
 
@@ -434,12 +444,18 @@
 
 	// 수정 콜백
 	var fnSaveCustomerInfoCallback = function (result) {
+		accountCheck = false;
 		if (result.isSuccess) {
 			mcxDialog.alert("회원정보가 수정되었습니다.");
 			fnGetCustInfo();
+			fnGetCustAccountInfo();
 			return;
 		} else {
-			mcxDialog.alert("실패하였습니다.<br/>고객센터에 문의하시 바랍니다.");
+			let msg = '실패하였습니다.<br/>고객센터에 문의하시 바랍니다.'
+			if (result.resultType === 'INVALID_ACCOUNT') {
+				msg = '환불 계좌정보를 다시 확인하시고 계좌인증을 해주세요.'
+			}
+			mcxDialog.alert(msg);
 			return;
 		}
 	}
@@ -510,6 +526,9 @@
 		// 회원(고객) 조회
 		fnGetCustInfo();
 
+		// 회원(고객) 계좌 조회
+		fnGetCustAccountInfo();
+
 		//버튼 색
 		$(document).on('click','.popup_box .button_list button',function(){
 			$('.popup_box .button_list button').removeClass('on');

+ 18 - 13
src/main/webapp/WEB-INF/views/web/mypage/MypageCustModifyFormWeb.html

@@ -239,8 +239,10 @@
 <script th:inline="javascript">
 	/*<![CDATA[*/
 	let orgCustInfo;
-	let orgAccountInfo;
 	let accountCheck = false;
+	let orgAccountNo;
+	let orgBankCd;
+
 
 	// 고객정보
 	var fnGetCustInfo = function () {
@@ -270,8 +272,6 @@
 		fnDisplayEmailAgree(custInfo.emailAgreeYn);
 		fnDisplaySmsAgree(custInfo.smsAgreeYn);
 
-		// 회원(고객) 계좌 조회
-		fnGetCustAccountInfo();
 	}
 
 	// 이메일 수신동의
@@ -303,11 +303,10 @@
 
 	// 고객계좌 정보 데이터
 	var fnGetCustAccountInfoCallback = function (result) {
-		orgAccountInfo = {};
 		var $accountNm = $('#custModiFyForm input[name=accountNm]');
 		if (!gagajf.isNull(result)) {
-			orgAccountInfo.accountNo = result.accountNo;
-			orgAccountInfo.bankCd = result.bankCd;
+			orgAccountNo = result.accountNo;
+			orgBankCd = result.bankCd;
 			//1. 고객명과 환불계좌 예금주가 다른 경우 현재 고객명을 적어주고 계좌번호, 은행코드 초기화 처리
 			let $bankCd = '';
 			if ($accountNm.val() === result.accountNm) {
@@ -321,8 +320,8 @@
 			}
 			$($bankCd).trigger('click'); // 셀렉트 박스 트리거
 		} else {
-			orgAccountInfo.accountNo = '';
-			orgAccountInfo.bankCd ='';
+			orgAccountNo = '';
+			orgBankCd ='';
 		}
 	}
 
@@ -416,11 +415,11 @@
 		}
 
 		// 은행코드가 바꼈는지
-		if (orgAccountInfo.bankCd !== $bankCd.val()) {
+		if (orgBankCd !== $bankCd.val()) {
 			accountModifyYn = 'Y';
 		}
 
-		if (orgAccountInfo.accountNo !== $accountNo.val()) {
+		if (orgAccountNo !== $accountNo.val()) {
 			accountModifyYn = 'Y';
 		}
 
@@ -467,12 +466,18 @@
 
 	// 수정 콜백
 	var fnSaveCustomerInfoCallback = function (result) {
+		accountCheck = false;
 		if (result.isSuccess) {
 			mcxDialog.alert("회원정보가 수정되었습니다.");
 			fnGetCustInfo();
+			fnGetCustAccountInfo();
 			return;
 		} else {
-			mcxDialog.alert("실패하였습니다.<br/>고객센터에 문의하시 바랍니다.");
+			let msg = '실패하였습니다.<br/>고객센터에 문의하시 바랍니다.'
+			if (result.resultType === 'INVALID_ACCOUNT') {
+				msg = '환불 계좌정보를 다시 확인하시고 계좌인증을 해주세요.'
+			}
+			mcxDialog.alert(msg);
 			return;
 		}
 	}
@@ -531,13 +536,13 @@
 		// 회원(고객) 조회
 		fnGetCustInfo();
 
+		// 회원(고객) 계좌 조회
+		fnGetCustAccountInfo();
 
 
 	});
 
 
-
-
 	/*]]>*/
 </script>
 </th:block>