瀏覽代碼

Merge remote-tracking branch 'origin/develop' into xodud1202

xodud lee 5 年之前
父節點
當前提交
2878cf5668

+ 18 - 0
src/main/java/com/style24/batch/biz/dao/TsbCustomerDao.java

@@ -118,4 +118,22 @@ public interface TsbCustomerDao {
 	 * @since  2021. 03. 08
 	 */
 	int deleteSecedeCustomer(Integer custNo);
+
+	/**
+	 * 개인정보 이용내역 안내 대상목록
+	 *
+	 * @return Collection<Customer>
+	 * @author jsshin
+	 * @since  2021. 05. 06
+	 */
+	Collection<Customer> getPrivacyPolicyNoticeTargetList(CustomerSearch customerSearch);
+
+	/**
+	 * 마케팅 정보 수신동의 안내 대상목록
+	 *
+	 * @return Collection<Customer>
+	 * @author jsshin
+	 * @since  2021. 05. 06
+	 */
+	Collection<Customer> getMarketingAgreeNoticeTargetList(CustomerSearch customerSearch);
 }

+ 54 - 0
src/main/java/com/style24/batch/biz/job/customer/TsbMarketingAgreementNoticeJob.java

@@ -0,0 +1,54 @@
+package com.style24.batch.biz.job.customer;
+
+import java.util.Collection;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbCustomerService;
+import com.style24.core.support.env.TscConstants;
+import com.style24.persistence.domain.Customer;
+import com.style24.persistence.domain.CustomerSearch;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 마케팅 정보 수신동의 내역 안내 발송
+ *
+ * @author jsshin
+ * @since 2021.05.06
+ */
+@Component
+@Slf4j
+public class TsbMarketingAgreementNoticeJob extends TsbAbstractJob<Collection<Customer>, GagaMap, GagaMap> {
+
+	@Autowired
+	TsbCustomerService customerService;
+
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	@Override
+	public Collection<Customer> read() throws Exception {
+		CustomerSearch customerSearch = new CustomerSearch();
+		customerSearch.setSiteCd(TscConstants.Site.STYLE24.value());
+		return customerService.getMarketingAgreeNoticeTargetList(customerSearch);
+	}
+
+	@Override
+	public GagaMap process(Collection<Customer> customerCollection) throws Exception {
+		return customerService.sendMarketingAgreeNotice(customerCollection);
+	}
+
+	@Override
+	public GagaMap write(GagaMap result) throws Exception {
+		succCnt = result.getInt("succCnt");
+		failCnt = result.getInt("failCnt");
+		return result;
+	}
+
+	@Override
+	public void notify(GagaMap resultItem) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+}

+ 54 - 0
src/main/java/com/style24/batch/biz/job/customer/TsbPrivacyPolicyNoticeJob.java

@@ -0,0 +1,54 @@
+package com.style24.batch.biz.job.customer;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbCustomerService;
+import com.style24.core.support.env.TscConstants;
+import com.style24.persistence.domain.Customer;
+import com.style24.persistence.domain.CustomerSearch;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+
+/**
+ * 개인정보 이용내역 안내 발송
+ *
+ * @author jsshin
+ * @since 2021.05.06
+ */
+@Component
+@Slf4j
+public class TsbPrivacyPolicyNoticeJob extends TsbAbstractJob<Collection<Customer>, GagaMap, GagaMap> {
+
+	@Autowired
+	TsbCustomerService customerService;
+
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	@Override
+	public Collection<Customer> read() throws Exception {
+		CustomerSearch customerSearch = new CustomerSearch();
+		customerSearch.setSiteCd(TscConstants.Site.STYLE24.value());
+		return customerService.getPrivacyPolicyNoticeTargetList(customerSearch);
+	}
+
+	@Override
+	public GagaMap process(Collection<Customer> customerCollection) throws Exception {
+		return customerService.sendPrivacyPolicyNotice(customerCollection);
+	}
+
+	@Override
+	public GagaMap write(GagaMap result) throws Exception {
+		succCnt = result.getInt("succCnt");
+		failCnt = result.getInt("failCnt");
+		return result;
+	}
+
+	@Override
+	public void notify(GagaMap resultItem) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+}

+ 128 - 15
src/main/java/com/style24/batch/biz/service/TsbCustomerService.java

@@ -38,22 +38,25 @@ public class TsbCustomerService {
 
 	/**
 	 * 휴면전환예정 메일 발송 대상
-	 * @param  customerSearch - 전환예정기간
+	 *
+	 * @param customerSearch - 전환예정기간
 	 * @return Collection<Customer>
 	 * @author jsshin
-	 * @since  2021. 03. 05
+	 * @since 2021. 03. 05
 	 */
 	public Collection<Customer> getDormantCustomerScheduleList(CustomerSearch customerSearch) {
 		return customerDao.getDormantCustomerScheduleList(customerSearch);
 	}
 
 	/**
-	 * 휴면전환예정 메일 발송 대상
-	 * @param  customerCollection - 대상
+	 * 휴면전환예정 안내 메일 발송 대상
+	 *
+	 * @param customerCollection - 대상
 	 * @return int - 성공여부
 	 * @author jsshin
-	 * @since  2021. 03. 08
+	 * @since 2021. 03. 08
 	 */
+	@Transactional("shopTxnManager")
 	public GagaMap sendDormantCustomerSchedule(Collection<Customer> customerCollection) {
 		GagaMap result = new GagaMap();
 		int succCnt = 0;
@@ -73,6 +76,7 @@ public class TsbCustomerService {
 				CustContactHst custContactHst = new CustContactHst();
 				custContactHst.setContactType(TscConstants.ContactType.DORMANT_EXPECTED.value());
 				custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value());
+				custContactHst.setContactContents("휴면전환예정 안내");
 				custContactHst.setSenderNo(TsbConstants.REG_NO);
 				custContactHst.setReceiverNo(customer.getCustNo());
 				custContactHst.setRegNo(TsbConstants.REG_NO);
@@ -94,21 +98,23 @@ public class TsbCustomerService {
 
 	/**
 	 * 휴면회원 전환대상
-	 * @param  customerSearch - 전환기간
+	 *
+	 * @param customerSearch - 전환기간
 	 * @return Collection<Customer>
 	 * @author jsshin
-	 * @since  2021. 03. 05
+	 * @since 2021. 03. 05
 	 */
-	public Collection<Customer> getDormentCustomerList(CustomerSearch customerSearch){
+	public Collection<Customer> getDormentCustomerList(CustomerSearch customerSearch) {
 		return customerDao.getDormentCustomerList(customerSearch);
 	}
 
 	/**
 	 * 휴면회원 전환 처리
-	 * @param  customerSearch - 전환기간
+	 *
+	 * @param customerSearch - 전환기간
 	 * @return GagaMap - 결과
 	 * @author jsshin
-	 * @since  2021. 03. 05
+	 * @since 2021. 03. 05
 	 */
 	@Transactional("shopTxnManager")
 	public GagaMap saveDormantCustomer(CustomerSearch customerSearch) {
@@ -130,22 +136,24 @@ public class TsbCustomerService {
 
 	/**
 	 * 탈퇴회원 삭제대상 목록
-	 * @param  customerSearch - 전환기간
+	 *
+	 * @param customerSearch - 전환기간
 	 * @return Collection<Customer>
 	 * @author jsshin
-	 * @since  2021. 03. 08
+	 * @since 2021. 03. 08
 	 */
-	public Collection<Customer> getExpireSecedeCustomerList(CustomerSearch customerSearch){
+	public Collection<Customer> getExpireSecedeCustomerList(CustomerSearch customerSearch) {
 
 		return customerDao.getExpireSecedeCustomerList(customerSearch);
 	}
 
 	/**
 	 * 탈퇴처리
-	 * @param  customerCollection - 삭제대상 목록
+	 *
+	 * @param customerCollection - 삭제대상 목록
 	 * @return GagaMap - 결과정보
 	 * @author jsshin
-	 * @since  2021. 03. 08
+	 * @since 2021. 03. 08
 	 */
 	@Transactional("shopTxnManager")
 	public GagaMap saveSecedeCustomer(Collection<Customer> customerCollection) {
@@ -170,5 +178,110 @@ public class TsbCustomerService {
 		return result;
 	}
 
+	/**
+	 * 개인정보 이용내역 안내 대상목록
+	 *
+	 * @return Collection<Customer>
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	public Collection<Customer> getPrivacyPolicyNoticeTargetList(CustomerSearch customerSearch) {
+		return customerDao.getPrivacyPolicyNoticeTargetList(customerSearch);
+	}
+
+	/**
+	 * 개인정보 이용내역 안내 발송
+	 *
+	 * @param customerCollection - 대상
+	 * @return GagaMap - 성공/실패 카운트
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	@Transactional("shopTxnManager")
+	public GagaMap sendPrivacyPolicyNotice(Collection<Customer> customerCollection) {
+		GagaMap result = new GagaMap();
+		int succCnt = 0;
+		int failCnt = 0;
+		for (Customer customer : customerCollection) {
+			try {
+				// TODO: 이메일 발송 모듈 붙어야 함 2021.05.06 jsshin
+				// 이메일 발송
+				if (StringUtils.isNotBlank(customer.getEmail())) {
+
+				}
+
+				CustContactHst custContactHst = new CustContactHst();
+				custContactHst.setContactType(TscConstants.ContactType.PRIVACY_POLICY.value());
+				custContactHst.setContactMethod(TscConstants.ContactMethod.EMAIL.value());
+				custContactHst.setContactContents("개인정보 이용내역 안내 발송");
+				custContactHst.setSenderNo(TsbConstants.REG_NO);
+				custContactHst.setReceiverNo(customer.getCustNo());
+				custContactHst.setRegNo(TsbConstants.REG_NO);
+				//접촉 이력 저장
+				coreCustomerService.createCustomerContactHistory(custContactHst);
+
+				succCnt++;
+
+			} catch (Exception e) {
+				log.error(e.getMessage());
+				failCnt++;
+			}
+		}
+		result.setInt("succCnt", succCnt);
+		result.setInt("failCnt", failCnt);
+		return result;
+	}
+
+	/**
+	 * 마케팅 정보 수신동의 내역 안내 대상목록
+	 *
+	 * @return Collection<Customer>
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	public Collection<Customer> getMarketingAgreeNoticeTargetList(CustomerSearch customerSearch) {
+		return customerDao.getMarketingAgreeNoticeTargetList(customerSearch);
+	}
+
+	/**
+	 * 마케팅 정보 수신동의 내역 안내 발송
+	 *
+	 * @param customerCollection - 대상
+	 * @return GagaMap - 성공/실패 카운트
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	@Transactional("shopTxnManager")
+	public GagaMap sendMarketingAgreeNotice(Collection<Customer> customerCollection) {
+		GagaMap result = new GagaMap();
+		int succCnt = 0;
+		int failCnt = 0;
+		for (Customer customer : customerCollection) {
+			try {
+				// TODO: 이메일 발송 모듈 붙어야 함 2021.05.06 jsshin
+				// 이메일 발송
+				if (StringUtils.isNotBlank(customer.getEmail())) {
+
+				}
+
+				CustContactHst custContactHst = new CustContactHst();
+				custContactHst.setContactType(TscConstants.ContactType.MARKETING_AGREE.value());
+				custContactHst.setContactMethod(TscConstants.ContactMethod.EMAIL.value());
+				custContactHst.setContactContents("마케팅 정보 수신동의 내역 안내");
+				custContactHst.setSenderNo(TsbConstants.REG_NO);
+				custContactHst.setReceiverNo(customer.getCustNo());
+				custContactHst.setRegNo(TsbConstants.REG_NO);
+				//접촉 이력 저장
+				coreCustomerService.createCustomerContactHistory(custContactHst);
 
+				succCnt++;
+
+			} catch (Exception e) {
+				failCnt++;
+			}
+		}
+		result.setInt("succCnt", succCnt);
+		result.setInt("failCnt", failCnt);
+		return result;
+	}
 }

+ 38 - 0
src/main/java/com/style24/batch/biz/task/TsbCustomerTask.java

@@ -3,10 +3,13 @@ package com.style24.batch.biz.task;
 
 import com.style24.batch.biz.job.customer.TsbDormantTransformJob;
 import com.style24.batch.biz.job.customer.TsbDormantScheduleJob;
+import com.style24.batch.biz.job.customer.TsbMarketingAgreementNoticeJob;
+import com.style24.batch.biz.job.customer.TsbPrivacyPolicyNoticeJob;
 import com.style24.batch.biz.job.customer.TsbSecedeProcessJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 
@@ -28,8 +31,15 @@ public class TsbCustomerTask {
 	@Autowired
 	TsbSecedeProcessJob secedeProcessJob;
 
+	@Autowired
+	TsbPrivacyPolicyNoticeJob privacyPolicyNoticeJob;
+
+	@Autowired
+	TsbMarketingAgreementNoticeJob marketingAgreementNoticeJob;
+
 	/**
 	 * 휴면전환 예정 대상 메일 발송
+	 *
 	 * @throws Exception - 예외처리
 	 * @author jsshin
 	 * @since 2021. 03. 08
@@ -43,6 +53,7 @@ public class TsbCustomerTask {
 
 	/**
 	 * 휴면전환
+	 *
 	 * @throws Exception - 예외처리
 	 * @author jsshin
 	 * @since 2021. 03. 08
@@ -56,6 +67,7 @@ public class TsbCustomerTask {
 
 	/**
 	 * 탈퇴회원 처리
+	 *
 	 * @throws Exception - 예외처리
 	 * @author jsshin
 	 * @since 2021. 03. 08
@@ -67,5 +79,31 @@ public class TsbCustomerTask {
 		secedeProcessJob.runById("cron.customer.secede.process");
 	}
 
+	/**
+	 * 개인정보 이용내역 안내 발송
+	 *
+	 * @throws Exception - 예외처리
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	//@Scheduled(cron = "${cron.customer.privacy.policy.notice}")
+//	@Scheduled(fixedDelay=360000)
+	@Async
+	public void privacyPolicyNoticeJob() throws Exception {
+		privacyPolicyNoticeJob.runById("cron.customer.privacy.policy.notice");
+	}
 
+	/**
+	 * 마케팅 정보 수신동의 내역 안내 발송
+	 *
+	 * @throws Exception - 예외처리
+	 * @author jsshin
+	 * @since 2021. 05. 06
+	 */
+	//@Scheduled(cron = "${cron.customer.marketing.agreement.notice}")
+//	@Scheduled(fixedDelay=360000)
+	@Async
+	public void marketingAgreementNoticeJob() throws Exception {
+		marketingAgreementNoticeJob.runById("cron.customer.marketing.agreement.notice");
+	}
 }

+ 37 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsbCustomer.xml

@@ -16,7 +16,7 @@
 		WHERE   C.CUST_STAT = 'G104_10' -- 활동회원
 		AND     C.SITE_CD = #{siteCd}
 		AND     C.LOGIN_LDT >= DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL  -#{dormantSelectDays} - 1 DAY), '%Y%m%d%H%i%S')
-		AND     C.LOGIN_LDT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL -#{dormantSelectDays} DAY), '%Y%m%d')
+		AND     C.LOGIN_LDT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL -#{dormantSelectDays} DAY), '%Y%m%d%H%i%S')
 		AND     NOT EXISTS (
 		                    SELECT 1
 		                    FROM  TB_CUST_CONTACT_HST CCH
@@ -267,5 +267,41 @@
 		WHERE CUST_NO = #{custNo}
 	</delete>
 
+	<!--개인정보 이용내역 안내(가입일로부터 1년 시점에 발송) 대상-->
+	<select id="getPrivacyPolicyNoticeTargetList" parameterType="CustomerSearch" resultType="Customer">
+		/*TsbCustomerDao.getPrivacyPolicyNoticeTargetList*/
+		SELECT  C.CUST_NO
+		      , C.CUST_ID
+		      , C.CUST_NM
+		      , C.CELL_PHNNO
+		      , C.EMAIL
+		      , DATEDIFF(NOW(), C.JOIN_DT) AS DIFF_JOIN_DT
+		FROM    TB_CUSTOMER C
+		WHERE   C.CUST_STAT = 'G104_10' -- 활동회원
+		AND     C.JOIN_DT >= DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL -365  DAY), '%Y%m%d%H%i%S')
+		AND     C.JOIN_DT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL -364 DAY), '%Y%m%d%H%i%S')
+		AND     C.SITE_CD = #{siteCd}
+	</select>
+
+	<!--마케팅 정보 수신자 / 가입일로부터 2년 시점에 발송 대상-->
+	<select id="getMarketingAgreeNoticeTargetList" parameterType="CustomerSearch" resultType="Customer">
+		/*TsbCustomerDao.getPrivacyPolicyNoticeTargetList*/
+		SELECT  C.CUST_NO
+		      , C.CUST_ID
+		      , C.CUST_NM
+		      , C.CELL_PHNNO
+		      , C.EMAIL
+		      , DATEDIFF(NOW(), C.JOIN_DT) AS DIFF_JOIN_DT
+		      , C.APP_AGREE_DT
+		      , C.SMS_AGREE_DT
+		      , C.EMAIL_AGREE_DT
+		      , C.MK_AGREE_DT
+		FROM    TB_CUSTOMER C
+		WHERE   C.CUST_STAT = 'G104_10' -- 활동회원
+		AND     C.JOIN_DT >= DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL  -365*2  DAY), '%Y%m%d%H%i%S')
+		AND     C.JOIN_DT <![CDATA[<]]> DATE_FORMAT(DATE_ADD(CURRENT_DATE(), INTERVAL -364*2 DAY), '%Y%m%d%H%i%S')
+		AND    (C.SMS_AGREE_YN = 'Y' OR C.EMAIL_AGREE_YN = 'Y' OR C.APP_AGREE_YN = 'Y' OR C.MK_AGREE_YN = 'Y')
+		AND     C.SITE_CD = #{siteCd}
+	</select>
 
 </mapper>

+ 5 - 4
src/main/resources/config/application-locd.yml

@@ -118,8 +118,9 @@ cron:
         dormant.schedule : 2 22 2 29 2 ?            # 휴면예정 고객 메일발송
         dormant.transform : 2 22 2 29 2 ?           # 휴면처리
         secede.process : 2 22 2 29 2 ?              # 탈퇴처리
-        privacy.policy.notice : 2 22 2 29 2 ?       # 개인정보 이용내역 안내(해야함)
-        marketing.agreement.notice : 2 22 2 29 2 ?  # 마케팅 정보 수신동의 내역 안내(해야함)
+        privacy.policy.notice : 2 22 2 29 2 ?       # 개인정보 이용내역 안내(가입일로부터 1년 시점에 발송)
+        marketing.agreement.notice : 2 22 2 29 2 ?  # 마케팅 정보 수신동의 내역 안내(마케팅 정보 수신자에 한해 발송. 가입일로부터 2년 시점에 발송)
+        grade.change : 2 22 2 29 2                  # 등급변경(매월1일)
 
     #전시
     display:
@@ -130,8 +131,8 @@ cron:
     # 마케팅
     marketing:
         auto.buy.confirm : 2 22 2 29 2 ?        # 자동구매확정 예정포인트 지급
-        birthday.coupon.notice : 2 22 2 29 2 ?  # 생일쿠폰 다운로드 안내 (해야함)
-        comback.coupon.notice : 2 22 2 29 2 ?   # 복귀할인쿠폰발급안내 (해야함)
+        birthday.coupon.notice : 2 22 2 29 2 ?  # 생일쿠폰 다운로드 안내(당월 생일인 회원을 대상으로 해당 월 1일에 발송)(해야함)
+        comback.coupon.notice : 2 22 2 29 2 ?   # 복귀할인쿠폰발급안내(매월 1일)(해야함)
         expire.point : 2 22 2 29 2 ?            # 포인트 소멸
         cart.expiration : 2 22 2 29 2 ?         # 만료기간 지난 장바구니 삭제