Ver Fonte

SMS수신거부, 이메일수신거부 처리 로직 추가

gagamel há 5 anos atrás
pai
commit
be24aaf399

+ 22 - 7
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -1,15 +1,15 @@
 package com.style24.front.biz.dao;
 
+import java.util.Collection;
+
+import org.springframework.stereotype.Repository;
+
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.CustGrade;
 import com.style24.persistence.domain.CustSnsInfo;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.WishList;
 
-import java.util.Collection;
-
-import org.springframework.stereotype.Repository;
-
 /**
  * 고객(회원) Dao
  * 
@@ -82,7 +82,7 @@ public interface TsfCustomerDao {
 	 * @since 2021. 03. 02
 	 */
 	String getCustomerMaxCustId(Customer customer);
-	
+
 	/**
 	 * 위시리스트 등록
 	 *
@@ -101,7 +101,7 @@ public interface TsfCustomerDao {
 	 * @since 2021. 03. 08
 	 */
 	void deleteWishList(WishList wishList);
-	
+
 	/**
 	 * 위시리스트 삭제 상품 조회
 	 *
@@ -109,7 +109,7 @@ public interface TsfCustomerDao {
 	 * @author eskim
 	 * @since 2021. 03. 11
 	 */
-	String  getDeleteGoodsWish(int custNo);
+	String getDeleteGoodsWish(int custNo);
 
 	/**
 	 * 본인인증 처리
@@ -179,5 +179,20 @@ public interface TsfCustomerDao {
 	 */
 	int saveBatchBirth(Customer customer);
 
+	/**
+	 * SMS수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 5. 11
+	 */
+	void updateSmsReceptionRefuse(Integer custNo);
+
+	/**
+	 * 메일수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 5. 11
+	 */
+	void updateEmailReceptionRefuse(Integer custNo);
 
 }

+ 50 - 22
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -7,8 +7,6 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-
-import com.style24.persistence.domain.CustGrade;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
@@ -17,8 +15,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-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;
@@ -29,6 +25,7 @@ import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.CustAccount;
 import com.style24.persistence.domain.CustDeliveryAddr;
+import com.style24.persistence.domain.CustGrade;
 import com.style24.persistence.domain.CustSnsInfo;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.Login;
@@ -36,6 +33,9 @@ import com.style24.persistence.domain.WishList;
 
 import lombok.extern.slf4j.Slf4j;
 
+import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.security.GagaPasswordEncoder;
+
 /**
  * 고객(회원) Service
  *
@@ -76,7 +76,7 @@ public class TsfCustomerService {
 	 * @since 2021. 02. 08
 	 */
 	public Customer getCustomerFindId(Customer customer) {
-		TsfSession.setAttribute("maskingYn","Y");
+		TsfSession.setAttribute("maskingYn", "Y");
 		customer.setSiteCd(TscConstants.Site.STYLE24.value());
 		customer.encryptData(); // 데이터 암호하
 		return customerDao.getCusomterActiveAndDormant(customer);
@@ -116,7 +116,6 @@ public class TsfCustomerService {
 		return coreCustomerService.getCustomerInfo(customer);
 	}
 
-
 	/**
 	 * 임시비밀번호 조회
 	 * @param length - 비밀번호 자릿수
@@ -221,7 +220,7 @@ public class TsfCustomerService {
 	 * @since 2021. 02. 15
 	 */
 	public Customer getCustomerFindByCi(String ci) {
-		TscSession.setAttribute("maskingYn","Y");
+		TscSession.setAttribute("maskingYn", "Y");
 		Customer customer = new Customer();
 		customer.setCi(ci);
 		customer.setSiteCd(TscConstants.Site.STYLE24.value());
@@ -238,7 +237,7 @@ public class TsfCustomerService {
 	 * @since 2021. 02. 15
 	 */
 	public Customer getCustomerFindByCellPhnno(String cellPhnno) {
-		TscSession.setAttribute("maskingYn","Y");
+		TscSession.setAttribute("maskingYn", "Y");
 		Customer customer = new Customer();
 		customer.setCellPhnno(cellPhnno);
 		customer.setHypenCellPhone(); // 010-0000-0000
@@ -286,11 +285,11 @@ public class TsfCustomerService {
 	 * @since 2021. 02. 19
 	 */
 	@Transactional("shopTxnManager")
-	public boolean saveJoinCustomerSns (Customer customer) {
+	public boolean saveJoinCustomerSns(Customer customer) {
 		boolean isJoin = true;
 		String snsId = customer.getSnsType().equals(TscConstants.SnsType.YES24.value()) ? customer.getMemNo() : customer.getSnsId();
 		customer.setEncodedPasswd(" ");
-		customer.setCustId(customer.getSnsType()+"_"+snsId);
+		customer.setCustId(customer.getSnsType() + "_" + snsId);
 		customer.encryptData();
 
 		customer.setSiteCd(TscConstants.Site.STYLE24.value());
@@ -300,7 +299,6 @@ public class TsfCustomerService {
 		customer.setCustGb(TscConstants.CustGb.NORMAL.value());
 		customer.setCustGrade(TscConstants.CustGrade.WELCOME.value());
 
-
 		int custCnt = customerDao.createCustomer(customer);
 		customerDao.createCustomerSns(customer);
 		customerDao.saveBatchBirth(customer);
@@ -334,7 +332,6 @@ public class TsfCustomerService {
 		couponService.saveJoinCoupon(coupon);
 	}
 
-
 	/**
 	 * Sns 정보에대한 상태 처리
 	 *
@@ -343,7 +340,7 @@ public class TsfCustomerService {
 	 * @since 2021. 02. 19
 	 */
 	@Transactional("shopTxnManager")
-	public GagaMap customerSnsProcessing (CustSnsInfo custSnsInfo) {
+	public GagaMap customerSnsProcessing(CustSnsInfo custSnsInfo) {
 		GagaMap resultMap = new GagaMap();
 		Customer custInfo;
 
@@ -392,7 +389,7 @@ 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"); // 휴대폰 중복
 				return resultMap;
@@ -447,7 +444,7 @@ public class TsfCustomerService {
 		loginService.createLoginHistory(loginInfo.getCustNo());
 
 		// 세션 생성
-		this.createSession(request,  loginDetails);
+		this.createSession(request, loginDetails);
 	}
 
 	/**
@@ -464,7 +461,6 @@ public class TsfCustomerService {
 		session.setAttribute("session", loginDetails);
 	}
 
-
 	/**
 	 * 일반고객 정보 유효성
 	 *
@@ -473,7 +469,7 @@ public class TsfCustomerService {
 	 * @author jsshin
 	 * @since 2021. 02. 18
 	 */
-	public GagaMap generalCustomerValidation (Customer customer) {
+	public GagaMap generalCustomerValidation(Customer customer) {
 		GagaMap resultMap = new GagaMap();
 		String maskingCustId;
 
@@ -529,7 +525,6 @@ public class TsfCustomerService {
 		return customerDao.getCusomterSnsFind(custSnsInfo);
 	}
 
-
 	/**
 	 * 가입된 아이디 가져오기
 	 * @param custId - 고객아이디
@@ -625,7 +620,7 @@ public class TsfCustomerService {
 			wishInfo.setRegNo(TsfSession.getInfo().getCustNo());
 			customerDao.createWishList(wishInfo);
 		}
-		
+
 		// 위시상품목록 50개만 남게 처리
 		String goodsCd = customerDao.getDeleteGoodsWish(TsfSession.getInfo().getCustNo());
 		WishList delWishInfo = new WishList();
@@ -634,7 +629,7 @@ public class TsfCustomerService {
 			delWishInfo.setArrGoodsCd(goodsCd.split("\\,"));
 			customerDao.deleteWishList(delWishInfo);
 		}
-		
+
 	}
 
 	/**
@@ -799,7 +794,6 @@ public class TsfCustomerService {
 		return result;
 	}
 
-
 	/**
 	 * 고객계좌 정보
 	 *
@@ -812,7 +806,6 @@ public class TsfCustomerService {
 		return coreCustomerService.getCustomerAccuontInfo(custNo);
 	}
 
-
 	/**
 	 * 고객정보 수정
 	 *
@@ -999,4 +992,39 @@ public class TsfCustomerService {
 	public Collection<CustGrade> getCustGradePolicy(CustGrade custGrade) {
 		return customerDao.getCustGradePolicy(custGrade);
 	}
+
+	/**
+	 * SMS수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 5. 11
+	 */
+	public void updateSmsReceptionRefuse(Integer custNo) {
+		// 수신거부 처리
+		customerDao.updateSmsReceptionRefuse(custNo);
+
+		// 고객이력 생성
+		Customer customer = new Customer();
+		customer.setCustNo(custNo);
+		customer.setRegNo(custNo);
+		coreCustomerService.createCustomerHistory(customer);
+	}
+
+	/**
+	 * 메일수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2021. 5. 11
+	 */
+	public void updateEmailReceptionRefuse(Integer custNo) {
+		// 수신거부 처리
+		customerDao.updateEmailReceptionRefuse(custNo);
+
+		// 고객이력 생성
+		Customer customer = new Customer();
+		customer.setCustNo(custNo);
+		customer.setRegNo(custNo);
+		coreCustomerService.createCustomerHistory(customer);
+	}
+
 }

+ 39 - 26
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -3,12 +3,11 @@ package com.style24.front.biz.web;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import com.style24.front.biz.thirdparty.Yes24Login;
-import com.style24.persistence.domain.CustSnsInfo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,13 +21,16 @@ import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCustomerService;
 import com.style24.front.biz.service.TsfKakaoService;
 import com.style24.front.biz.thirdparty.NiceCertify;
+import com.style24.front.biz.thirdparty.Yes24Login;
 import com.style24.front.support.controller.TsfBaseController;
 import com.style24.front.support.security.session.TsfSession;
+import com.style24.persistence.domain.CustSnsInfo;
 import com.style24.persistence.domain.Customer;
 
 import lombok.extern.slf4j.Slf4j;
 
 import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.rest.server.GagaResponse;
 
 /**
  * 고객(회원) Controller
@@ -67,8 +69,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 05
 	 */
 	@RequestMapping("/id/find/form")
-	public ModelAndView idFindForm(@RequestParam(value = "sEncData", required = false) String sEncData
-			, @RequestParam(value = "authMethod", required = false) String authMethod) {
+	public ModelAndView idFindForm(@RequestParam(value = "sEncData", required = false) String sEncData, @RequestParam(value = "authMethod", required = false) String authMethod) {
 
 		ModelAndView mav = new ModelAndView();
 
@@ -137,8 +138,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 05
 	 */
 	@RequestMapping("/password/find/form")
-	public ModelAndView pwdFindForm(@RequestParam(value = "sEncData", required = false) String sEncData
-			, @RequestParam(value = "authMethod", required = false) String authMethod) {
+	public ModelAndView pwdFindForm(@RequestParam(value = "sEncData", required = false) String sEncData, @RequestParam(value = "authMethod", required = false) String authMethod) {
 
 		ModelAndView mav = new ModelAndView();
 		mav.addObject("sEncData", sEncData);
@@ -338,9 +338,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 05
 	 */
 	@RequestMapping("/join/form")
-	public ModelAndView getJoinForm(@RequestParam(value = "sEncData", required = false) String sEncData
-			, @RequestParam(value = "authMethod", required = false) String authMethod
-			, @RequestParam(value = "custParams", required = false) String custParams) {
+	public ModelAndView getJoinForm(@RequestParam(value = "sEncData", required = false) String sEncData, @RequestParam(value = "authMethod", required = false) String authMethod, @RequestParam(value = "custParams", required = false) String custParams) {
 
 		ModelAndView mav = new ModelAndView();
 
@@ -362,8 +360,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 09
 	 */
 	@GetMapping("/nice/cellphone/form")
-	public ModelAndView niceCellphoneForm(@RequestParam(value = "redirectUrl", required = false) String redirectUrl
-										, @RequestParam(value = "custParams", required = false) String custParams) {
+	public ModelAndView niceCellphoneForm(@RequestParam(value = "redirectUrl", required = false) String redirectUrl, @RequestParam(value = "custParams", required = false) String custParams) {
 		ModelAndView mav = new ModelAndView();
 		GagaMap result = niceCertify.certifyCellPhone();
 
@@ -386,8 +383,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 09
 	 */
 	@GetMapping("/nice/ipin/form")
-	public ModelAndView getCertifyNiceIpin(@RequestParam(value = "redirectUrl", required = false) String redirectUrl
-										 , @RequestParam(value = "custParams", required = false) String custParams) {
+	public ModelAndView getCertifyNiceIpin(@RequestParam(value = "redirectUrl", required = false) String redirectUrl, @RequestParam(value = "custParams", required = false) String custParams) {
 		ModelAndView mav = new ModelAndView();
 		GagaMap result = niceCertify.certifyIpin();
 
@@ -411,10 +407,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 02. 09
 	 */
 	@RequestMapping("/nice/certify/callback")
-	public ModelAndView niceCertifyCallback(@RequestParam(value = "EncodeData", required = false) String encodeData
-			, @RequestParam(value = "enc_data", required = false) String encData
-			, @RequestParam(value = "param_r1", required = false) String redirectUrl
-			, @RequestParam(value = "param_r2", required = false) String custParams) {
+	public ModelAndView niceCertifyCallback(@RequestParam(value = "EncodeData", required = false) String encodeData, @RequestParam(value = "enc_data", required = false) String encData, @RequestParam(value = "param_r1", required = false) String redirectUrl, @RequestParam(value = "param_r2", required = false) String custParams) {
 
 		ModelAndView mav = new ModelAndView();
 		String sEncData = "";
@@ -667,9 +660,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 03. 08
 	 */
 	@RequestMapping("/dormant/certify/form")
-	public ModelAndView getDormantCeirtyForm(@RequestParam(value = "sEncData", required = false) String sEncData
-										 	, @RequestParam(value = "authMethod", required = false) String authMethod
-											, @RequestParam(value = "custParams", required = false) String custParams) {
+	public ModelAndView getDormantCeirtyForm(@RequestParam(value = "sEncData", required = false) String sEncData, @RequestParam(value = "authMethod", required = false) String authMethod, @RequestParam(value = "custParams", required = false) String custParams) {
 
 		ModelAndView mav = new ModelAndView();
 
@@ -706,7 +697,7 @@ public class TsfCustomerController extends TsfBaseController {
 		}
 
 		GagaMap resultInfo;
-		if (TscConstants.AuthMethod.MOBILE.value().equals(customer.getAuthMethod())){
+		if (TscConstants.AuthMethod.MOBILE.value().equals(customer.getAuthMethod())) {
 			resultInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
 			customer.setCi(resultInfo.getString("sCi"));
 		} else {
@@ -743,9 +734,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @since 2021. 03. 10
 	 */
 	@RequestMapping("/certification/form")
-	public ModelAndView getCertificationForm(@RequestParam(value = "sEncData", required = false) String sEncData
-			, @RequestParam(value = "authMethod", required = false) String authMethod
-			, @RequestParam(value = "custParams", required = false) String custParams) {
+	public ModelAndView getCertificationForm(@RequestParam(value = "sEncData", required = false) String sEncData, @RequestParam(value = "authMethod", required = false) String authMethod, @RequestParam(value = "custParams", required = false) String custParams) {
 
 		ModelAndView mav = new ModelAndView();
 
@@ -761,7 +750,6 @@ public class TsfCustomerController extends TsfBaseController {
 		mav.addObject("sEncData", sEncData);
 		mav.addObject("authMethod", authMethod);
 
-
 		mav.setViewName(super.getDeviceViewName("customer/CertificationForm"));
 		return mav;
 	}
@@ -887,7 +875,7 @@ public class TsfCustomerController extends TsfBaseController {
 	@PostMapping("/peristalsis/yes24")
 	@ResponseBody
 	public GagaMap peristalsisYes24(HttpSession session, HttpServletRequest request) {
-		CustSnsInfo custSnsInfo = (CustSnsInfo) session.getAttribute("custSnsInfo");
+		CustSnsInfo custSnsInfo = (CustSnsInfo)session.getAttribute("custSnsInfo");
 		session.removeAttribute("custSnsInfo"); // YES24 세션 지움
 
 		// 1. SNS처리
@@ -964,5 +952,30 @@ public class TsfCustomerController extends TsfBaseController {
 		return mav;
 	}
 
+	/**
+	 * SMS수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2020. 5. 11
+	 */
+	@GetMapping("/sms/refuse/{custNo}")
+	@ResponseBody
+	public GagaResponse updateSmsReceptionRefuse(@PathVariable Integer custNo) {
+		customerService.updateSmsReceptionRefuse(custNo);
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
+
+	/**
+	 * 이메일수신거부 처리
+	 * @param custNo - 고객번호
+	 * @author gagamel
+	 * @since 2020. 5. 11
+	 */
+	@GetMapping("/email/refuse/{custNo}")
+	@ResponseBody
+	public GagaResponse updateEmailReceptionRefuse(@PathVariable Integer custNo) {
+		customerService.updateSmsReceptionRefuse(custNo);
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
 
 }

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

@@ -654,5 +654,27 @@
 		    ,  UPD_DT = NOW()
 		    ,  UPD_NO = #{updNo}
 	</insert>
+	
+	<!-- SMS수신거부 처리 -->
+	<update id="updateSmsReceptionRefuse" parameterType="Integer">
+		/* TsfCustomer.updateSmsReceptionRefuse */
+		UPDATE TB_CUSTOMER
+		SET    SMS_AGREE_YN = 'N'
+		     , SMS_AGREE_DT = NOW()
+		     , UPD_NO = #{custNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
+	
+	<!-- 메일수신거부 처리 -->
+	<update id="updateEmailReceptionRefuse" parameterType="Integer">
+		/* TsfCustomer.updateEmailReceptionRefuse */
+		UPDATE TB_CUSTOMER
+		SET    EMAIL_AGREE_YN = 'N'
+		     , EMAIL_AGREE_DT = NOW()
+		     , UPD_NO = #{custNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
 
 </mapper>