jsshin 5 éve
szülő
commit
4d2e91ec69

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

@@ -29,4 +29,13 @@ public interface TsfCustomerDao {
 	 * @since 2021. 02. 18
 	 */
 	Customer getCustomerInfo(Customer customer);
+
+	/**
+	 * 고객 데이터 생성
+	 * @param customer - 고객정보
+	 * @return 성공여부 - 카운트
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	int createCustomer(Customer customer);
 }

+ 56 - 2
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -1,10 +1,13 @@
 package com.style24.front.biz.service;
 
 import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.security.GagaPasswordEncoder;
 import com.style24.core.biz.service.TscCustomerService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.session.TscSession;
+import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.Customer;
+import com.style24.persistence.domain.Point;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,6 +33,8 @@ public class TsfCustomerService {
 	@Autowired
 	private TscCustomerService coreCustomerService;
 
+	@Autowired
+	private GagaPasswordEncoder passwordEncoder;
 
 	/**
 	 * 고객아이디 찾기
@@ -65,6 +70,7 @@ public class TsfCustomerService {
 	 */
 	@Transactional("shopTxnManager")
 	public void saveCustomerPassword(Customer customer) {
+		customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
 		coreCustomerService.saveCustomerPassword(customer);
 	}
 
@@ -183,14 +189,62 @@ public class TsfCustomerService {
 	}
 
 	/**
-	 * 회원가입
+	 * 회원가입 처리
 	 * @param customer - 일반가입, SNS 가입
 	 * @author jsshin
 	 * @since 2021. 02. 19
 	 */
 	@Transactional("shopTxnManager")
 	public void saveJoinCustomer(Customer customer) {
-		//
+		boolean isSnsJoin = isSnsJoin(customer);
+		if (isSnsJoin) {
+			customer.setEncodedPasswd(" ");
+		} else {
+			customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
+		}
+		customer.encryptData();
+		customerDao.createCustomer(customer);
+		saveJoinPostProcessing(customer);
+	}
+
+	/**
+	 * 가입 후 처리 혜택(쿠폰,포인트)
+	 * @param customer - 일반가입, SNS 가입
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	@Transactional("shopTxnManager")
+	public void saveJoinPostProcessing(Customer customer) {
+		// 1. 쿠폰
+		// 어드민 > 회원등급정책 관리 > 신규회원등급으로 설정된 쿠폰
+
+
+		// 2. 포인트
+		// 어드민 > 포인트 정책설정 > 신규회원 등록된 포인트
+
+
+	}
+	/**
+	 * SNS 가입인지 확인
+	 * @param customer - 일반가입, SNS 가입
+	 * @return boolean - sns 가입이면 true 아니면 false
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	public boolean isSnsJoin(Customer customer) {
+		boolean result = false;
+
+		if (StringUtils.isNotBlank(customer.getKkJoinId())) {
+			result = true;
+		}
+		if (StringUtils.isNotBlank(customer.getNvJoinId())) {
+			result = true;
+		}
+		if (StringUtils.isNotBlank(customer.getYsJoinId())) {
+			result = true;
+		}
+
+		return result;
 	}
 
 }

+ 22 - 9
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -52,9 +52,6 @@ public class TsfCustomerController extends TsfBaseController {
 	@Autowired
 	private NiceCertify niceCertify;
 
-	@Autowired
-	private GagaPasswordEncoder passwordEncoder;
-
 	/**
 	 * 아이디 찾기 화면
 	 *
@@ -195,7 +192,6 @@ public class TsfCustomerController extends TsfBaseController {
 			log.info("tempPasswd  ====> {}", tempPasswd);
 			customer.setTempPasswdYn("Y"); // 임시비밀번호여부
 			customer.setPasswd(tempPasswd);
-			customer.setEncodedPasswd(passwordEncoder.encode(tempPasswd));
 			customer.setRegNo(custInfo.getCustNo());
 			customer.setUpdNo(custInfo.getCustNo());
 			customer.setCustNo(custInfo.getCustNo());
@@ -309,7 +305,6 @@ public class TsfCustomerController extends TsfBaseController {
 		Customer custInfo = customerService.getCustomerFindId(params);
 		if (custInfo != null) {
 			customer.setTempPasswdYn("N"); // 임시비밀번호여부
-			customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
 			customer.setRegNo(custInfo.getCustNo());
 			customer.setUpdNo(custInfo.getCustNo());
 			customer.setCustNo(custInfo.getCustNo());
@@ -570,27 +565,45 @@ public class TsfCustomerController extends TsfBaseController {
 		return result;
 	}
 
-
+	/**
+	 * 가입
+	 *
+	 * @param customer - 고객정보
+	 * @return GagaMap - 결과정보
+	 * @author jsshin
+	 * @since 2021. 02. 18
+	 */
 	@PostMapping("/join/save")
 	@ResponseBody
 	public GagaMap saveJoinCustomer(@RequestBody Customer customer) {
+		GagaMap result = new GagaMap();
 		String encData = TscSession.getAttribute("encData");
 		customer.setEncData(encData);
 		GagaMap authInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
+		customer.setCustNm(authInfo.getString("sName"));
+		customer.setBirthYmd(authInfo.getString("sBirthDate"));
+		customer.setForeignerYn(authInfo.getString("sforeignerYn"));
 		customer.setCi(authInfo.getString("sCi"));
+		String gender = "G007_"+authInfo.getString("sGender");
+		customer.setSexGb(gender);
+		customer.setSiteCd(TscConstants.Site.STYLE24.value());
+		customer.setFrontGb(TsfSession.getFrontGb());
+		customer.setAfLinkCd(TsfSession.getAttribute("afLinkCd"));
 
 		// 1.입력 받은 데이터 검증
 
 		// 2.고객정보 생성 및 혜택 처리
-
+		customerService.saveJoinCustomer(customer);
 		// 3.알림톡 및 메일 발송
-		try {
 
+		try {
+			kakaoService.sendJoinCongrat(customer);
 		} catch (Exception e) {
 			log.error("error", e);
 		}
+		result.setBoolean("isJoin", true);
 
-		return new GagaMap();
+		return result;
 	}
 
 }

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

@@ -147,4 +147,112 @@
 		     ) A
 	</select>
 
+	<insert id="createCustomer" parameterType="Customer" keyProperty="custNo">
+		/* TsfCustomer.createCustomer */
+		INSERT INTO TB_CUSTOMER (
+		       CUST_NO
+		     , CUST_ID
+		     , CUST_NM
+		     , PASSWD
+		     , BIRTH_YMD
+		     , BIRTH_SM
+		     , SEX_GB
+		     , CELL_PHNNO
+		     , APP_AGREE_YN
+		     , APP_AGREE_DT
+		     , SMS_AGREE_YN
+		     , SMS_AGREE_DT
+		     , EMAIL
+		     , EMAIL_AGREE_YN
+		     , EMAIL_AGREE_DT
+		     , HOME_ZIPCODE
+		     , HOME_BASE_ADDR
+		     , HOME_DTL_ADDR
+		     , SITE_CD
+		     , FRONT_GB
+		     , AF_LINK_CD
+		     , CUST_GB
+		     , CUST_GRADE
+		     , JOIN_DT
+		     , FOREIGNER_YN
+		     , CUST_STAT
+		     , PASSWD_CHG_DT
+		     , TEMP_PASSWD_YN
+		     , LOGIN_LDT
+		     , NV_JOIN_ID
+		     , NV_ACCESS_TOKEN
+		     , NV_JOIN_DT
+		     , KK_JOIN_ID
+		     , KK_ACCESS_TOKEN
+		     , KK_JOIN_DT
+		     , YS_JOIN_ID
+		     , YS_ACCESS_TOKEN
+		     , YS_JOIN_DT
+		     , CI
+		     , AUTH_DT
+		     , MANAGED_RSN
+		     , MANAGED_DTL_RSN
+		     , MANAGED_DT
+		     , SECEDE_RSN
+		     , SECEDE_DTL_RSN
+		     , SECEDE_DT
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{custNo}
+		     , #{custId}
+		     , #{encodedCustNm}
+		     , #{encodedPasswd}
+		     , #{encodedBirthYmd}
+		     , #{birthSm}
+		     , #{encodedSexGb}
+		     , #{encodedCellPhnno}
+		     , #{appAgreeYn}
+		     , #{appAgreeDt}
+		     , #{smsAgreeYn}
+		     , #{smsAgreeDt}
+		     , #{encodedEmail}
+		     , #{emailAgreeYn}
+		     , #{emailAgreeDt}
+		     , #{homeZipcode}
+		     , #{encodedHomeBaseAddr}
+		     , #{encodedHomeDtlAddr}
+		     , #{siteCd}
+		     , #{frontGb}
+		     , #{afLinkCd}
+		     , #{custGb}
+		     , #{custGrade}
+		     , NOW()                # JOIN_DT
+		     , #{foreignerYn}
+		     , #{custStat}
+		     , #{passwdChgDt}
+		     , #{tempPasswdYn}      # N
+		     , NOW()                # LOGIN_LDT
+		     , #{nvJoinId}
+		     , #{nvAccessToken}
+		     , #{nvJoinDt}
+		     , #{kkJoinId}
+		     , #{kkAccessToken}
+		     , #{kkJoinDt}
+		     , #{ysJoinId}
+		     , #{ysAccessToken}
+		     , #{ysJoinDt}
+		     , #{ci}
+		     , NOW()                 # AUTH_DT
+		     , #{managedRsn}
+		     , #{managedDtlRsn}
+		     , #{managedDt}
+		     , #{secedeRsn}
+		     , #{secedeDtlRsn}
+		     , #{secedeDt}
+		     , #{custNo}              # REG_NO
+		     , NOW()                  # REG_DT
+		     , #{custNo}              # UPD_NO
+		     , NOW()                  # UPD_DT
+		)
+	</insert>
+
 </mapper>