|
|
@@ -118,7 +118,7 @@ public class TsfCustomerService {
|
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 15
|
|
|
*/
|
|
|
- public boolean getCustomerFindByCustId(String custId) {
|
|
|
+ public boolean getCustomerFindByCustIdCount(String custId) {
|
|
|
Customer customer = new Customer();
|
|
|
customer.setCustId(custId);
|
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
@@ -136,7 +136,7 @@ public class TsfCustomerService {
|
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 15
|
|
|
*/
|
|
|
- public boolean getCustomerFindByEmail(String email) {
|
|
|
+ public boolean getCustomerFindByEmailCount(String email) {
|
|
|
Customer customer = new Customer();
|
|
|
customer.setEmail(email);
|
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
@@ -160,6 +160,26 @@ public class TsfCustomerService {
|
|
|
customer.setHypenCellPhone(); // 010-0000-0000
|
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
customer.encryptData();
|
|
|
+
|
|
|
+ int result = customerDao.getCustomerInfoCount(customer);
|
|
|
+
|
|
|
+ return result > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 해당 CI로 가입된 이력이 있는지 확인
|
|
|
+ * @param ci - 연계정보
|
|
|
+ * @return boolean - 있으면 TRUE/ 없으면 FALSE
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 02. 15
|
|
|
+ */
|
|
|
+ public boolean getCustomerFindByCiCount(String ci) {
|
|
|
+ TscSession.setAttribute("maskingYn","Y");
|
|
|
+ Customer customer = new Customer();
|
|
|
+ customer.setCi(ci);
|
|
|
+ customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
+ customer.encryptData();
|
|
|
+
|
|
|
int result = customerDao.getCustomerInfoCount(customer);
|
|
|
|
|
|
return result > 0;
|
|
|
@@ -284,11 +304,10 @@ public class TsfCustomerService {
|
|
|
boolean isJoin = true;
|
|
|
customer.setEncodedPasswd(" ");
|
|
|
customer.setCustId(customer.getSnsType()+"_"+customer.getSnsId());
|
|
|
- customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
|
|
|
- customer.encryptData();
|
|
|
-
|
|
|
String gender = "G007_"+customer.getSexGb();
|
|
|
customer.setSexGb(gender);
|
|
|
+ customer.encryptData();
|
|
|
+
|
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
customer.setFrontGb(TsfSession.getFrontGb());
|
|
|
customer.setAfLinkCd(TsfSession.getAttribute("afLinkCd"));
|
|
|
@@ -296,11 +315,13 @@ public class TsfCustomerService {
|
|
|
customer.setCustGb(TscConstants.CustGb.NORMAL.value());
|
|
|
customer.setCustGrade(TscConstants.CustGrade.WELCOME.value());
|
|
|
|
|
|
+
|
|
|
int custCnt = customerDao.createCustomer(customer);
|
|
|
customerDao.createCustomerSns(customer);
|
|
|
|
|
|
if (custCnt > 0) {
|
|
|
saveJoinPostProcessing(customer);
|
|
|
+ TsfSession.setAttribute("custNo", String.valueOf(customer.getCustNo()));
|
|
|
} else {
|
|
|
isJoin = false;
|
|
|
}
|
|
|
@@ -330,7 +351,8 @@ public class TsfCustomerService {
|
|
|
|
|
|
/**
|
|
|
* Sns 정보에대한 상태 처리
|
|
|
- * @param custSnsInfo
|
|
|
+ *
|
|
|
+ * @param custSnsInfo - SNS 고객 정보
|
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 19
|
|
|
*/
|
|
|
@@ -346,21 +368,27 @@ public class TsfCustomerService {
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
- // 2. CI(연계정보)로 가입 되어져 있는 고객이 있는지 ?
|
|
|
+ if (StringUtils.isBlank(custSnsInfo.getCi())) {
|
|
|
+ throw new IllegalStateException("연계정보 값이 없습니다. 고객센터에 문의하시기 바랍니다.");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. CI(연계정보)로 가입 되어져 있는 고객이 확인
|
|
|
custInfo = getCustomerFindByCi(custSnsInfo.getCi());
|
|
|
|
|
|
if (custInfo != null) { // 2-1. 고객정보 있는경우
|
|
|
+
|
|
|
if (TscConstants.CustStat.SECEDE.value().equals(custInfo.getCustStat())) {
|
|
|
resultMap.setString("custStat", "SECEDE_CUST"); // 탈퇴 회원
|
|
|
return resultMap;
|
|
|
}
|
|
|
+
|
|
|
if (TscConstants.CustStat.DORMANT.value().equals(custInfo.getCustStat())) {
|
|
|
resultMap.setString("custStat", "DORMANT_CUST"); // 휴면 회원
|
|
|
return resultMap;
|
|
|
}
|
|
|
- if (TscConstants.CustStat.ACTIVE.value().equals(custInfo.getCustStat())) {
|
|
|
|
|
|
- if (StringUtils.isBlank(custSnsInfo.getCellPhnno())) {
|
|
|
+ if (TscConstants.CustStat.ACTIVE.value().equals(custInfo.getCustStat())) {
|
|
|
+ if (StringUtils.isBlank(custSnsInfo.getCellPhnno())) { // 휴대폰 정보가 없음 - 회원가입 페이지 이동(ID/PW 제외)
|
|
|
resultMap.setString("custStat", "EMPTY_PHONE_CUST");
|
|
|
return resultMap;
|
|
|
}
|
|
|
@@ -370,6 +398,7 @@ public class TsfCustomerService {
|
|
|
resultMap.setString("custStat", "SUCC_CUST");
|
|
|
return resultMap;
|
|
|
}
|
|
|
+
|
|
|
} else { // 2-2. 고객정보 없는 경우
|
|
|
|
|
|
if (StringUtils.isBlank(custSnsInfo.getCellPhnno())) { // 휴대전화번호가 없는 경우
|
|
|
@@ -377,24 +406,24 @@ public class TsfCustomerService {
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
- boolean isFindByPhone =getCustomerFindByCellPhnnoCount(custSnsInfo.getCellPhnno().replace("-",""));
|
|
|
+ boolean isFindByPhone = getCustomerFindByCellPhnnoCount(custSnsInfo.getCellPhnno().replace("-",""));
|
|
|
if (isFindByPhone) {
|
|
|
- resultMap.setString("custStat", "DUP_PHONE_CUST");
|
|
|
+ resultMap.setString("custStat", "DUP_PHONE_CUST"); // 휴대폰 중복
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
- boolean isFindByEmail = getCustomerFindByEmail(custSnsInfo.getEmail());
|
|
|
+ boolean isFindByEmail = getCustomerFindByEmailCount(custSnsInfo.getEmail());
|
|
|
if (isFindByEmail) {
|
|
|
resultMap.setString("custStat", "DUP_EMAIL_CUST"); // 이메일 중복
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
Customer customer = objectMapper.convertValue(custSnsInfo, Customer.class);
|
|
|
-
|
|
|
boolean isJoin = saveJoinCustomerSns(customer);
|
|
|
|
|
|
if (isJoin) {
|
|
|
- resultMap.setString("custStat", "SUCC_CUST");
|
|
|
+ resultMap.setString("custNo", String.valueOf(customer.getCustNo()));
|
|
|
+ resultMap.setString("custStat", "NEW_CUST");
|
|
|
} else {
|
|
|
resultMap.setString("custStat", "FAIL_CUST");
|
|
|
}
|
|
|
@@ -404,21 +433,19 @@ public class TsfCustomerService {
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 로그인 처리
|
|
|
- * @param custId - 고객아이디
|
|
|
+ * @param custNo- 고객번호
|
|
|
* @param request - 요청
|
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 18
|
|
|
*/
|
|
|
- public void getLogin(String custId, HttpServletRequest request) {
|
|
|
- if (StringUtils.isBlank(custId)) {
|
|
|
- throw new IllegalStateException("고객 아이디가 없습니다. 로그인 다시 해보시기 바랍니다.");
|
|
|
+ public void getLogin(Integer custNo, HttpServletRequest request) {
|
|
|
+ if (custNo == null) {
|
|
|
+ throw new IllegalStateException("고객번호가 없습니다.");
|
|
|
}
|
|
|
-
|
|
|
Login loginParam = new Login();
|
|
|
- loginParam.setCustId(custId);
|
|
|
+ loginParam.setCustNo(custNo);
|
|
|
Login loginInfo = loginService.getLoginCheckInfo(loginParam);
|
|
|
|
|
|
// 권한 설정
|
|
|
@@ -439,8 +466,11 @@ public class TsfCustomerService {
|
|
|
|
|
|
/**
|
|
|
* Session 생성
|
|
|
+ *
|
|
|
* @param request - HttpServletRequest
|
|
|
* @param loginDetails - 로그인 상세 정보
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 02. 18
|
|
|
*/
|
|
|
private void createSession(HttpServletRequest request, TsfLoginDetails loginDetails) {
|
|
|
HttpSession session = request.getSession(true);
|
|
|
@@ -448,4 +478,61 @@ public class TsfCustomerService {
|
|
|
session.setAttribute("session", loginDetails);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 일반고객 정보 유효성
|
|
|
+ *
|
|
|
+ * @param customer - 고객정보
|
|
|
+ * @return GagaMap - 유효성 결과 값
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 02. 18
|
|
|
+ */
|
|
|
+ public GagaMap generalCustomerValidation (Customer customer) {
|
|
|
+ GagaMap resultMap = new GagaMap();
|
|
|
+
|
|
|
+ // 1. 아이디 확인
|
|
|
+ boolean boolCustId = getCustomerFindByCustIdCount(customer.getCustId());
|
|
|
+ if (!boolCustId) {
|
|
|
+ resultMap.setString("custStat", "DUP_ID_CUST");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 이메일 확인
|
|
|
+ boolean boolEmail = getCustomerFindByEmailCount(customer.getEmail());
|
|
|
+ if (!boolEmail) {
|
|
|
+ resultMap.setString("custStat", "DUP_EMAIL_CUST");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 휴대전화
|
|
|
+ boolean boolPhone = getCustomerFindByCellPhnnoCount(customer.getCellPhnno());
|
|
|
+ if (!boolPhone) {
|
|
|
+ resultMap.setString("custStat", "DUP_PHONE_CUST");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4. CI
|
|
|
+ boolean boolCi = getCustomerFindByCiCount(customer.getCi());
|
|
|
+ if (!boolCi) {
|
|
|
+ resultMap.setString("custStat", "DUP_CI_CUST");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ resultMap.setString("custStat", "PASS_CUST");
|
|
|
+
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * SNS 정보로 고객 테이블 조회
|
|
|
+ * @param custSnsInfo - 고객정보
|
|
|
+ * @return 고객정보
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 02. 26
|
|
|
+ */
|
|
|
+ Customer getCusomterSnsFind(CustSnsInfo custSnsInfo) {
|
|
|
+ return customerDao.getCusomterSnsFind(custSnsInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|