|
@@ -1,12 +1,16 @@
|
|
|
package com.style24.front.biz.service;
|
|
package com.style24.front.biz.service;
|
|
|
|
|
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
import com.gagaframework.web.parameter.GagaMap;
|
|
|
import com.gagaframework.web.security.GagaPasswordEncoder;
|
|
import com.gagaframework.web.security.GagaPasswordEncoder;
|
|
|
import com.style24.core.biz.service.TscCustomerService;
|
|
import com.style24.core.biz.service.TscCustomerService;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
import com.style24.core.support.session.TscSession;
|
|
import com.style24.core.support.session.TscSession;
|
|
|
|
|
+import com.style24.core.support.util.CryptoUtils;
|
|
|
import com.style24.front.support.security.TsfLoginDetails;
|
|
import com.style24.front.support.security.TsfLoginDetails;
|
|
|
|
|
+import com.style24.front.support.security.session.TsfSession;
|
|
|
import com.style24.persistence.domain.Coupon;
|
|
import com.style24.persistence.domain.Coupon;
|
|
|
|
|
+import com.style24.persistence.domain.CustSnsInfo;
|
|
|
import com.style24.persistence.domain.Customer;
|
|
import com.style24.persistence.domain.Customer;
|
|
|
import com.style24.persistence.domain.Login;
|
|
import com.style24.persistence.domain.Login;
|
|
|
import com.style24.persistence.domain.Point;
|
|
import com.style24.persistence.domain.Point;
|
|
@@ -47,6 +51,9 @@ public class TsfCustomerService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TsfLoginService loginService;
|
|
private TsfLoginService loginService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ObjectMapper objectMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 고객아이디 찾기
|
|
* 고객아이디 찾기
|
|
@@ -60,9 +67,27 @@ public class TsfCustomerService {
|
|
|
TscSession.setAttribute("maskingYn","Y");
|
|
TscSession.setAttribute("maskingYn","Y");
|
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
customer.encryptData(); // 데이터 암호하
|
|
customer.encryptData(); // 데이터 암호하
|
|
|
|
|
+ return customerDao.getCusomterActiveAndDormant(customer);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 고객정보찾기 -
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param custNo - 고객번호
|
|
|
|
|
+ * @return Customer 고객정보
|
|
|
|
|
+ * @author jsshin
|
|
|
|
|
+ * @since 2021. 02. 24
|
|
|
|
|
+ */
|
|
|
|
|
+ public Customer getCustomerFindByCustNo(Integer custNo) {
|
|
|
|
|
+ Customer customer = new Customer();
|
|
|
|
|
+ customer.setCustNo(custNo);
|
|
|
|
|
+ customer.setCustStat(TscConstants.CustStat.ACTIVE.value());
|
|
|
|
|
+ customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+ customer.encryptData();
|
|
|
return coreCustomerService.getCustomerInfo(customer);
|
|
return coreCustomerService.getCustomerInfo(customer);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 임시비밀번호 조회
|
|
* 임시비밀번호 조회
|
|
|
* @param length - 비밀번호 자릿수
|
|
* @param length - 비밀번호 자릿수
|
|
@@ -122,9 +147,27 @@ public class TsfCustomerService {
|
|
|
return result > 0;
|
|
return result > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 해당 휴대전화로 가입된 이력이 있는지 확인
|
|
|
|
|
+ * @param cellPhnno - 휴대전화
|
|
|
|
|
+ * @return boolean - 있으면 TRUE/ 없으면 FALSE
|
|
|
|
|
+ * @author jsshin
|
|
|
|
|
+ * @since 2021. 02. 15
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean getCustomerFindByCellPhnnoCount(String cellPhnno) {
|
|
|
|
|
+ Customer customer = new Customer();
|
|
|
|
|
+ customer.setCellPhnno(cellPhnno);
|
|
|
|
|
+ customer.setHypenCellPhone(); // 010-0000-0000
|
|
|
|
|
+ customer.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+ customer.encryptData();
|
|
|
|
|
+ int result = customerDao.getCustomerInfoCount(customer);
|
|
|
|
|
+
|
|
|
|
|
+ return result > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 해당 CI로 가입된 이력이 있는지 확인
|
|
* 해당 CI로 가입된 이력이 있는지 확인
|
|
|
- * @param ci - ci
|
|
|
|
|
|
|
+ * @param ci - 연계정보
|
|
|
* @return boolean - 있으면 TRUE/ 없으면 FALSE
|
|
* @return boolean - 있으면 TRUE/ 없으면 FALSE
|
|
|
* @author jsshin
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 15
|
|
* @since 2021. 02. 15
|
|
@@ -141,7 +184,7 @@ public class TsfCustomerService {
|
|
|
/**
|
|
/**
|
|
|
* 해당 휴대폰 번호로 가입된 이력이 있는지 확인
|
|
* 해당 휴대폰 번호로 가입된 이력이 있는지 확인
|
|
|
* @param cellPhnno - 휴대전화번호
|
|
* @param cellPhnno - 휴대전화번호
|
|
|
- * @return boolean - 있으면 TRUE/ 없으면 FALSE
|
|
|
|
|
|
|
+ * @return Customer - 고객정보
|
|
|
* @author jsshin
|
|
* @author jsshin
|
|
|
* @since 2021. 02. 15
|
|
* @since 2021. 02. 15
|
|
|
*/
|
|
*/
|
|
@@ -201,7 +244,7 @@ public class TsfCustomerService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 회원가입 처리
|
|
|
|
|
|
|
+ * 회원가입 처리 - 일반가입
|
|
|
* @param customer - 일반가입
|
|
* @param customer - 일반가입
|
|
|
* @return boolean - 가입 성공 true / 실패 false
|
|
* @return boolean - 가입 성공 true / 실패 false
|
|
|
* @author jsshin
|
|
* @author jsshin
|
|
@@ -213,17 +256,48 @@ public class TsfCustomerService {
|
|
|
// 1. validation
|
|
// 1. validation
|
|
|
customer.setHypenCellPhone();
|
|
customer.setHypenCellPhone();
|
|
|
customer.encryptData();
|
|
customer.encryptData();
|
|
|
- if (StringUtils.isNotBlank(customer.getSnsId())) {
|
|
|
|
|
- customer.setEncodedPasswd(" ");
|
|
|
|
|
- customer.setCustId(customer.getSnsType()+"_"+customer.getSnsId());
|
|
|
|
|
|
|
+ customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
|
|
|
|
|
+
|
|
|
|
|
+ customer.setCustStat(TscConstants.CustStat.ACTIVE.value());
|
|
|
|
|
+ customer.setCustGb(TscConstants.CustGb.NORMAL.value());
|
|
|
|
|
+ customer.setCustGrade(TscConstants.CustGrade.WELCOME.value());
|
|
|
|
|
+
|
|
|
|
|
+ int custCnt = customerDao.createCustomer(customer);
|
|
|
|
|
+
|
|
|
|
|
+ if (custCnt > 0) {
|
|
|
|
|
+ saveJoinPostProcessing(customer);
|
|
|
} else {
|
|
} else {
|
|
|
- customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
|
|
|
|
|
|
|
+ isJoin = false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ return isJoin;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 회원가입 처리 - SNS 간편가입
|
|
|
|
|
+ * @param customer - SNS 정보
|
|
|
|
|
+ * @return boolean - 가입 성공 true / 실패 false
|
|
|
|
|
+ * @author jsshin
|
|
|
|
|
+ * @since 2021. 02. 19
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean saveJoinCustomerSns (Customer customer) {
|
|
|
|
|
+ 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.setSiteCd(TscConstants.Site.STYLE24.value());
|
|
|
|
|
+ customer.setFrontGb(TsfSession.getFrontGb());
|
|
|
|
|
+ customer.setAfLinkCd(TsfSession.getAttribute("afLinkCd"));
|
|
|
customer.setCustStat(TscConstants.CustStat.ACTIVE.value());
|
|
customer.setCustStat(TscConstants.CustStat.ACTIVE.value());
|
|
|
customer.setCustGb(TscConstants.CustGb.NORMAL.value());
|
|
customer.setCustGb(TscConstants.CustGb.NORMAL.value());
|
|
|
customer.setCustGrade(TscConstants.CustGrade.WELCOME.value());
|
|
customer.setCustGrade(TscConstants.CustGrade.WELCOME.value());
|
|
|
|
|
|
|
|
int custCnt = customerDao.createCustomer(customer);
|
|
int custCnt = customerDao.createCustomer(customer);
|
|
|
|
|
+ customerDao.createCustomerSns(customer);
|
|
|
|
|
|
|
|
if (custCnt > 0) {
|
|
if (custCnt > 0) {
|
|
|
saveJoinPostProcessing(customer);
|
|
saveJoinPostProcessing(customer);
|
|
@@ -232,6 +306,7 @@ public class TsfCustomerService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return isJoin;
|
|
return isJoin;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -252,6 +327,84 @@ public class TsfCustomerService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Sns 정보에대한 상태 처리
|
|
|
|
|
+ * @param custSnsInfo
|
|
|
|
|
+ * @author jsshin
|
|
|
|
|
+ * @since 2021. 02. 19
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
|
|
+ public GagaMap customerSnsProcessing (CustSnsInfo custSnsInfo) {
|
|
|
|
|
+ GagaMap resultMap = new GagaMap();
|
|
|
|
|
+ Customer custInfo;
|
|
|
|
|
+
|
|
|
|
|
+ // 1. snsId, snsType 값으로 연동되어져 있는지 확인
|
|
|
|
|
+ custInfo = customerDao.getCusomterSnsFind(custSnsInfo);
|
|
|
|
|
+ if (custInfo != null) {
|
|
|
|
|
+ resultMap.setString("custStat", "SUCC_CUST");
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 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())) {
|
|
|
|
|
+ resultMap.setString("custStat", "EMPTY_PHONE_CUST");
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+ custInfo.setSnsId(custSnsInfo.getSnsId());
|
|
|
|
|
+ custInfo.setSnsType(custSnsInfo.getSnsType());
|
|
|
|
|
+ customerDao.createCustomerSns(custInfo);
|
|
|
|
|
+ resultMap.setString("custStat", "SUCC_CUST");
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else { // 2-2. 고객정보 없는 경우
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isBlank(custSnsInfo.getCellPhnno())) { // 휴대전화번호가 없는 경우
|
|
|
|
|
+ resultMap.setString("custStat", "EMPTY_PHONE_CUST");
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ boolean isFindByPhone =getCustomerFindByCellPhnnoCount(custSnsInfo.getCellPhnno().replace("-",""));
|
|
|
|
|
+ if (isFindByPhone) {
|
|
|
|
|
+ resultMap.setString("custStat", "DUP_PHONE_CUST");
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ boolean isFindByEmail = getCustomerFindByEmail(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");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resultMap.setString("custStat", "FAIL_CUST");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 로그인 처리
|
|
* 로그인 처리
|
|
|
* @param custId - 고객아이디
|
|
* @param custId - 고객아이디
|