Selaa lähdekoodia

Merge remote-tracking branch 'origin/ST24PRJ-476' into develop

card007 4 vuotta sitten
vanhempi
commit
f75cfea8e4

+ 11 - 7
src/main/java/com/style24/admin/biz/dao/TsaCustomerDao.java

@@ -1,5 +1,9 @@
 package com.style24.admin.biz.dao;
 
+import java.util.Collection;
+
+import org.springframework.stereotype.Repository;
+
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Counsel;
 import com.style24.persistence.domain.Coupon;
@@ -7,17 +11,11 @@ import com.style24.persistence.domain.CustContactHst;
 import com.style24.persistence.domain.CustGrade;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.CustomerSearch;
-import com.style24.persistence.domain.Delivery;
 import com.style24.persistence.domain.GiftCard;
 import com.style24.persistence.domain.Order;
 import com.style24.persistence.domain.Point;
 import com.style24.persistence.domain.Review;
 
-import org.springframework.stereotype.Repository;
-
-import java.util.Collection;
-
-
 /**
  * 회원 Dao
  * 
@@ -62,7 +60,6 @@ public interface TsaCustomerDao {
 	 */
 	void updateCustomerCellPhnno(Customer customer);
 
-
 	/**
 	 * 회원 주문내역
 	 * @param customerSearch - 고객번호
@@ -216,5 +213,12 @@ public interface TsaCustomerDao {
 	 */
 	int getCustomerFindByCellPhone(CustomerSearch customerSearch);
 
+	/**
+	 * 휴대전화번호와 CI 삭제
+	 * @param customer - 고객 정보
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	void deleteCellPhnno(Customer customer);
 
 }

+ 22 - 10
src/main/java/com/style24/admin/biz/service/TsaCustomerService.java

@@ -1,7 +1,12 @@
 package com.style24.admin.biz.service;
 
-import com.gagaframework.web.parameter.GagaMap;
-import com.gagaframework.web.security.GagaPasswordEncoder;
+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.TsaCustomerDao;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.biz.service.TscCustomerService;
@@ -19,13 +24,11 @@ import com.style24.persistence.domain.GiftCard;
 import com.style24.persistence.domain.Order;
 import com.style24.persistence.domain.Point;
 import com.style24.persistence.domain.Review;
+
 import lombok.extern.slf4j.Slf4j;
-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 java.util.Collection;
+import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.security.GagaPasswordEncoder;
 
 /**
  * 회원 Service
@@ -60,7 +63,7 @@ public class TsaCustomerService {
 	 * @since 2021. 2. 01
 	 */
 	public int getCustomerActiveListCount(CustomerSearch customerSearch) {
-		return  customerDao.getCustomerActiveListCount(customerSearch);
+		return customerDao.getCustomerActiveListCount(customerSearch);
 	}
 
 	/**
@@ -276,7 +279,7 @@ public class TsaCustomerService {
 	 * @author jsshin
 	 * @since 2021. 1. 25
 	 */
-	public Point getCustomerPoint(Integer custNo){
+	public Point getCustomerPoint(Integer custNo) {
 		return customerDao.getCustomerPoint(custNo);
 	}
 
@@ -496,6 +499,15 @@ public class TsaCustomerService {
 		return coreCustomerService.deleteSecedeCustomer(custNo);
 	}
 
-
+	/**
+	 * 휴대전화번호와 CI 삭제
+	 * @param customer - 고객 정보
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@Transactional("shopTxnManager")
+	public void deleteCellPhnno(Customer customer) {
+		customerDao.deleteCellPhnno(customer);
+	}
 
 }

+ 115 - 0
src/main/java/com/style24/admin/biz/web/TsaCustomerController.java

@@ -20,8 +20,11 @@ import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.biz.service.TscAnswerPhaseService;
+import com.style24.core.biz.service.TscCustomerService;
 import com.style24.core.biz.service.TscKakaotalkService;
+import com.style24.core.biz.service.TscKcpService;
 import com.style24.core.biz.service.TscMailService;
+import com.style24.core.biz.service.TscOrderChangeService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.core.support.session.TscSession;
@@ -30,6 +33,7 @@ import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.AnswerPhase;
 import com.style24.persistence.domain.Counsel;
 import com.style24.persistence.domain.Coupon;
+import com.style24.persistence.domain.CustAccount;
 import com.style24.persistence.domain.CustContactHst;
 import com.style24.persistence.domain.CustDeliveryAddr;
 import com.style24.persistence.domain.CustGrade;
@@ -78,6 +82,15 @@ public class TsaCustomerController extends TsaBaseController {
 	@Autowired
 	private TscMailService mailService;
 
+	@Autowired
+	private TscCustomerService coreCustomerService;
+
+	@Autowired
+	private TscOrderChangeService coreOrderChangeService;
+
+	@Autowired
+	private TscKcpService coreKcpService;
+
 	/**
 	 * 1:1문의관리 화면
 	 * @return
@@ -546,6 +559,9 @@ public class TsaCustomerController extends TsaBaseController {
 		// 상품권유형
 		mav.addObject("giftCardOccurGbList", rendererService.getCommonCodeList("G074"));
 
+		// 은행
+		mav.addObject("bankList", rendererService.getCommonCodeList("G940"));
+
 		mav.addObject("custNo", custNo);
 
 		mav.setViewName("customer/CustomerDetailForm");
@@ -1353,4 +1369,103 @@ public class TsaCustomerController extends TsaBaseController {
 		return mav;
 	}
 
+	/**
+	 * 계좌정보 조회
+	 * @return custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@GetMapping("/account/info/{custNo}")
+	@ResponseBody
+	public CustAccount getCustomerAccuontInfo(@PathVariable Integer custNo) {
+		return coreCustomerService.getCustomerAccuontInfo(custNo);
+	}
+
+	/**
+	 * 계좌정보 삭제
+	 * @return custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@PostMapping("/account/delete/{custNo}")
+	@ResponseBody
+	public GagaResponse deleteCustomerAccuont(@PathVariable Integer custNo) {
+		// 환불계좌 삭제
+		coreOrderChangeService.deleteRefundAccount(custNo);
+
+		// 고객이력 생성
+		Customer customer = new Customer();
+		customer.setCustNo(custNo);
+		customer.setRegNo(TsaSession.getInfo().getUserNo());
+		coreCustomerService.createCustomerHistory(customer);
+
+		return super.ok(message.getMessage("SUCC_0003"));
+	}
+
+	/**
+	 * 계좌인증
+	 * @return GagaMap - 결과
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@PostMapping("/account/check")
+	@ResponseBody
+	public GagaMap getAccountCheck(@RequestBody CustAccount custAccount) {
+		boolean isValid = false;
+		GagaMap result = coreKcpService.checkAccount(custAccount);
+		if ("0000".equals(result.get("resCd"))) {
+			isValid = true;
+		}
+		result.setBoolean("isValid", isValid);
+		return result;
+	}
+
+	/**
+	 * 계좌등록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@PostMapping("/account/create")
+	@ResponseBody
+	public GagaResponse createAccount(@RequestBody CustAccount custAccount) {
+		// 계좌등록
+		Order refundAccount = new Order();
+		refundAccount.setCustNo(custAccount.getCustNo());
+		refundAccount.setBankCd(custAccount.getBankCd());
+		refundAccount.setAccountNo(custAccount.getAccountNo());
+		refundAccount.setAccountNm(custAccount.getAccountNm());
+		refundAccount.setRegNo(TsaSession.getInfo().getUserNo());
+		refundAccount.setUpdNo(TsaSession.getInfo().getUserNo());
+		refundAccount.encryptData();
+		coreOrderChangeService.saveRefundAccount(refundAccount);
+
+		// 고객이력 생성
+		Customer customer = new Customer();
+		customer.setCustNo(custAccount.getCustNo());
+		customer.setRegNo(TsaSession.getInfo().getUserNo());
+		coreCustomerService.createCustomerHistory(customer);
+
+		return super.ok("계좌가 등록되었습니다.");
+	}
+
+	/**
+	 * 휴대전화번호와 CI 삭제
+	 * @return GagaMap - 결과
+	 * @author gagamel
+	 * @since 2021. 11. 22
+	 */
+	@PostMapping("/cellphnno/delete")
+	@ResponseBody
+	public GagaResponse deleteCellPhnno(@RequestBody Customer customer) {
+		customer.setUpdNo(TsaSession.getInfo().getUserNo());
+		customerService.deleteCellPhnno(customer);
+
+		// 고객이력 생성
+		customer.setRegNo(TsaSession.getInfo().getUserNo());
+		coreCustomerService.createCustomerHistory(customer);
+
+		return super.ok(message.getMessage("SUCC_0003"));
+	}
+
 }

+ 11 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml

@@ -907,5 +907,16 @@
 		) B
 		WHERE NUMB = 1
 	</select>
+	
+	<!-- 휴대전화번호와 CI 삭제 -->
+	<update id="deleteCellPhnno" parameterType="Customer">
+		/* TsaCustomer."deleteCellPhnno" */
+		UPDATE TB_CUSTOMER
+		SET    CELL_PHNNO = NULL
+		     , CI = NULL
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
 
 </mapper>

+ 176 - 4
src/main/webapp/WEB-INF/views/customer/CustomerDetailForm.html

@@ -164,6 +164,7 @@
 											<input type="text" name="maskingCellPhnno" class="w130" readonly="readonly"/>
 											<button type="button" id="btnCustSendLms" class="btn btn-info btn-lg">LMS전송</button>
 											<button type="button" id="btnCustCrtfd" class="btn btn-info btn-lg">번호변경</button>
+											<button type="button" class="btn btn-info btn-lg" id="btnInitializeCI">CI초기화</button>
 										</td>
 										<th class="dashR">SMS수신여부<em class="required" title="필수"></em></th>
 										<td class="dashR">
@@ -194,6 +195,25 @@
 											<label class="rdoBtn"><input type="radio" name="emailAgreeYn" value="N"/>미수신</label>
 										</td>
 									</tr>
+									<tr>
+										<th class="dashR">환불계좌</th>
+										<td class="dashR" colspan="3">
+											<div id="divRefundAccountTxt" style="display: none;">
+												<span id="refundAccount"></span>
+												<button type="button" class="btn btn-info btn-lg" id="btnDeleteRefundAccount">등록계좌삭제</button>
+											</div>
+											<div id="divRefundAccountInput" style="display: none;">
+												<select name="bankCd">
+													<option value="">[은행 선택]</option>
+													<option th:if="${bankList}" th:each="oneData, status : ${bankList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] '+oneData.cdNm}"></option>
+												</select>
+												<input type="text" name="accountNo" class="w200" placeholder="계좌번호" maxlength="20" data-valid-type="numeric"/>
+												<input type="text" name="accountNm" class="w100" placeholder="예금주" maxlength="10"/>
+												<button type="button" class="btn btn-info btn-lg" id="btnCertifyRefundAccount">계좌인증</button>
+												<button type="button" class="btn btn-info btn-lg" id="btnRegisterRefundAccount">계좌등록</button>
+											</div>
+										</td>
+									</tr>
 									<tr>
 										<th class="dashR">가입일시</th>
 										<td class="dashR" id="joinDt" name="joinDt"></td>
@@ -1270,13 +1290,165 @@
 					fnDisplayCellPhnno(data.cellPhnno, data.maskingCellPhnno);
 					fnDisplayManaged(data.managedRsn);
 
-					orgData = data;									// 기존 데이터
-
+					orgData = data; // 기존 데이터
+					
+					// 고객계좌정보 조회
+					fnGetCustAccountInfo();
 				}
 			});
 	};
 
-
+	// 고객계좌정보 조회
+	var accountCertify = false;
+	var fnGetCustAccountInfo = function() {
+		accountCertify = false;
+		
+		$.get('/customer/account/info/' + custNo, function(result) {
+			if (!gagajf.isNull(result)) {
+				let refundAccount = result.bankNm + ' / ' + result.accountNo + ' / ' + result.accountNm
+						+ ' (' + result.regNm + ', ' + result.regDt + ')';
+				$('#refundAccount').text(refundAccount);
+				
+				$('#divRefundAccountTxt').show();
+				$('#divRefundAccountInput').hide();
+			} else {
+				$('#custInfoForm select[name=bankCd]').val('');
+				$('#custInfoForm input[name=accountNo]').val('');
+				$('#custInfoForm input[name=accountNm]').val('');
+				$('#custInfoForm select[name=bankCd]').attr('disabled', false);
+				$('#custInfoForm input[name=accountNo]').attr('readonly', false);
+				$('#custInfoForm input[name=accountNm]').attr('readonly', false);
+				$('#divRefundAccountTxt').hide();
+				$('#divRefundAccountInput').show();
+			}
+		});
+	}
+	
+	// 등록계좌삭제
+	$('#btnDeleteRefundAccount').on('click', function () {
+		mcxDialog.confirm("등록한 계좌를 삭제하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				gagajf.ajaxJsonSubmit('/customer/account/delete/' + custNo, null, function() {
+					// 고객계좌정보 조회
+					fnGetCustAccountInfo();
+				});
+			}
+		});
+	});
+	
+	// 은행계좌 유효성체크
+	var fnIsRefundAccountValidation = function () {
+		let bankCd = $('#custInfoForm select[name=bankCd]').val();
+		let accountNo = $('#custInfoForm input[name=accountNo]').val();
+		let accountNm = $('#custInfoForm input[name=accountNm]').val();
+		
+		if (gagajf.isNull(bankCd)) {
+			mcxDialog.alertC('은행을 선택해 주세요.',{
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#custInfoForm select[name=bankCd]').focus();
+				}
+			});
+			return false;
+		}
+		
+		if (gagajf.isNull(accountNo)) {
+			mcxDialog.alertC('계좌번호를 입력해 주세요.',{
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#custInfoForm input[name=accountNo]').focus();
+				}
+			});
+			return false;
+		}
+		
+		if (gagajf.isNull(accountNm)) {
+			mcxDialog.alertC('예금주를 입력해 주세요.',{
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#custInfoForm input[name=accountNm]').focus();
+				}
+			});
+			return false;
+		}
+		return true;
+	}
+	
+	// 계좌인증
+	$('#btnCertifyRefundAccount').on('click', function () {
+		if (!fnIsRefundAccountValidation()) {
+			return;
+		}
+		
+		let custInfo = {};
+		custInfo.custNo = custNo;
+		custInfo.bankCd = $('#custInfoForm select[name=bankCd]').val();
+		custInfo.accountNo = $('#custInfoForm input[name=accountNo]').val();
+		custInfo.accountNm = $('#custInfoForm input[name=accountNm]').val();
+		let jsonData = JSON.stringify(custInfo);
+		gagajf.ajaxJsonSubmit('/customer/account/check', jsonData, function(result) {
+			let msg = '계좌가 인증되었습니다.';
+			if (result.isValid) { // 유효하면
+				$('#custInfoForm select[name=bankCd]').attr('disabled', true);
+				$('#custInfoForm input[name=accountNo]').attr('readonly', true);
+				$('#custInfoForm input[name=accountNm]').attr('readonly', true);
+				accountCertify = true;
+			} else {
+				accountCertify = false;
+				msg = '인증에 실패했습니다. 은행/계좌번호/예금주를 다시 확인해 주세요.';
+			}
+			mcxDialog.alert(msg);
+		});
+	});
+	
+	// 계좌등록
+	$('#btnRegisterRefundAccount').on('click', function () {
+		if (!fnIsRefundAccountValidation()) {
+			return;
+		}
+		
+		if (!accountCertify) {
+			mcxDialog.alert("계좌인증 후 등록해 주세요.");
+			return;
+		}
+		
+		mcxDialog.confirm("계좌를 등록하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				let custInfo = {};
+				custInfo.custNo = custNo;
+				custInfo.bankCd = $('#custInfoForm select[name=bankCd]').val();
+				custInfo.accountNm = $('#custInfoForm input[name=accountNm]').val();
+				custInfo.accountNo = $('#custInfoForm input[name=accountNo]').val();
+				let jsonData = JSON.stringify(custInfo);
+				gagajf.ajaxJsonSubmit('/customer/account/create', jsonData, function() {
+					// 고객계좌정보 조회
+					fnGetCustAccountInfo();
+				});
+			}
+		});
+	});
+	
+	// CI초기화
+	$('#btnInitializeCI').on('click', function () {
+		mcxDialog.confirm("휴대전화번호와 CI 값이 삭제됩니다. 계속하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				let custInfo = {};
+				custInfo.custNo = custNo;
+				let jsonData = JSON.stringify(custInfo);
+				gagajf.ajaxJsonSubmit('/customer/cellphnno/delete', jsonData, function() {
+					$('#custInfoForm input[name=cellPhnno]').val('');
+					$('#custInfoForm input[name=maskingCellPhnno]').val('');
+				});
+			}
+		});
+	});
+	
 	$('#custOrderListFrom select[name=pageSize]').on('click', function () {
 		fnSearchOrder();
 	});
@@ -1576,7 +1748,7 @@
 		let popupWidth = window.screen.width;
 		let popupHeight = window.screen.height;
 		window.open(actionUrl);
-	})
+	});
 
 	$(document).ready(function () {