Explorar el Código

메일 서비스 추가

jsshin hace 5 años
padre
commit
14a41b07e1

+ 2 - 2
src/main/java/com/style24/batch/biz/job/customer/TsbMarketingAgreementNoticeJob.java → src/main/java/com/style24/batch/biz/job/customer/TsbMarketingAgreeNoticeJob.java

@@ -20,10 +20,10 @@ import org.springframework.stereotype.Component;
  */
 @Component
 @Slf4j
-public class TsbMarketingAgreementNoticeJob extends TsbAbstractJob<Collection<Customer>, GagaMap, GagaMap> {
+public class TsbMarketingAgreeNoticeJob extends TsbAbstractJob<Collection<Customer>, GagaMap, GagaMap> {
 
 	@Autowired
-	TsbCustomerService customerService;
+	private TsbCustomerService customerService;
 
 	private int succCnt = 0;
 	private int failCnt = 0;

+ 15 - 2
src/main/java/com/style24/batch/biz/service/TsbCouponService.java

@@ -6,6 +6,7 @@ import com.style24.batch.support.env.TsbConstants;
 import com.style24.core.biz.service.TscCouponService;
 import com.style24.core.biz.service.TscEnvsetService;
 import com.style24.core.biz.service.TscKakaotalkService;
+import com.style24.core.biz.service.TscMailService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.CustCoupon;
@@ -46,12 +47,16 @@ public class TsbCouponService {
 	@Autowired
 	private TscCouponService coreCouponService;
 
+	@Autowired
+	private TscMailService mailService;
+
 
 	@Transactional("shopTxnManager")
 	public GagaMap saveCombackCoupon(CustCoupon custCoupon, int stdt, int edDt) {
 		GagaMap result = new GagaMap();
 		int succCnt = 0;
 		int failCnt = 0;
+		Integer senderNo = TsbConstants.REG_NO;
 		if (stdt > 0 && edDt > 0) {
 			CustomerSearch customerSearch = new CustomerSearch();
 			customerSearch.setStDay(stdt);
@@ -67,11 +72,19 @@ public class TsbCouponService {
 					coreCouponService.saveCouponIssue(custCoupon);
 
 					if (StringUtils.isNotBlank(customer.getCellPhnno()) && "Y".equals(customer.getSmsAgreeYn())) {
-						kakaotalkService.sendCombackCoupon(customer, custCoupon, TsbConstants.REG_NO);
+						try {
+							kakaotalkService.sendCombackCoupon(customer, custCoupon, senderNo);
+						} catch (Exception e) {
+							log.error(e.getMessage());
+						}
 					}
 
 					if (StringUtils.isNotBlank(customer.getEmail()) && "Y".equals(customer.getEmailAgreeYn())) {
-						// TODO: 2021.05.28 메일서비스 붙이기
+						try {
+							mailService.sendCombackCoupon(customer, custCoupon, senderNo);
+						} catch (Exception e) {
+							log.error(e.getMessage());
+						}
 					}
 
 					succCnt++;

+ 12 - 20
src/main/java/com/style24/batch/biz/service/TsbCustomerService.java

@@ -3,6 +3,7 @@ package com.style24.batch.biz.service;
 import java.util.Collection;
 
 import com.style24.core.biz.service.TscKakaotalkService;
+import com.style24.core.biz.service.TscMailService;
 import com.style24.persistence.domain.CustCoupon;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +43,9 @@ public class TsbCustomerService {
 	@Autowired
 	private TscKakaotalkService kakaotalkService;
 
+	@Autowired
+	private TscMailService mailService;
+
 	/**
 	 * 휴면전환예정 메일 발송 대상
 	 *
@@ -67,27 +71,17 @@ public class TsbCustomerService {
 		GagaMap result = new GagaMap();
 		int succCnt = 0;
 		int failCnt = 0;
+		Integer senderNo = TsbConstants.REG_NO;
 		for (Customer customer : customerCollection) {
 			try {
-				// TODO: 이메일 발송 모듈 붙어야 함 2021.03.09 jsshin
 				// 이메일 발송
 				if (StringUtils.isNotBlank(customer.getEmail())) {
-
+					mailService.sendExpectedDormentCustomer(customer, senderNo);
 				}
-				// TODO: 카카오톡 발송 모듈 붙어야 함 2021.03.09 jsshin
 				// 카카오톡 알림톡
 				if (StringUtils.isNotBlank(customer.getCellPhnno())) {
-
+					kakaotalkService.sendExpectedDormentCustomer(customer, senderNo);
 				}
-				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);
-				//접촉 이력 저장
-				coreCustomerService.createCustomerContactHistory(custContactHst);
 
 				succCnt++;
 
@@ -211,10 +205,9 @@ public class TsbCustomerService {
 		for (Customer customer : customerCollection) {
 			try {
 				Integer senderNo = TsbConstants.REG_NO;
-				// TODO: 이메일 발송 모듈 붙어야 함 2021.05.06 jsshin
-				// 이메일 발송
-				if (StringUtils.isNotBlank(customer.getEmail())) {
 
+				if (StringUtils.isNotBlank(customer.getEmail())) {
+					mailService.sendPrivacyPolicyNotice(customer, senderNo);
 				}
 
 				if (StringUtils.isNotBlank(customer.getCellPhnno())) {
@@ -260,10 +253,10 @@ public class TsbCustomerService {
 		for (Customer customer : customerCollection) {
 			try {
 				Integer senderNo = TsbConstants.REG_NO;
-				// TODO: 이메일 발송 모듈 붙어야 함 2021.05.06 jsshin
+
 				// 이메일 발송
 				if (StringUtils.isNotBlank(customer.getEmail())) {
-
+					mailService.sendMarketingAgreeNotice(customer, senderNo);
 				}
 
 				if (StringUtils.isNotBlank(customer.getCellPhnno())) {
@@ -399,11 +392,10 @@ public class TsbCustomerService {
 	 */
 	@Transactional("shopTxnManager")
 	public void sendBirthDayCouponNotice(CustCoupon custCoupon) {
-		// TODO: 이메일 발송 모듈 붙어야 함 2021.05.10 jsshin
 		Integer senderNo = TsbConstants.REG_NO;
 		// 이메일 발송
 		if (StringUtils.isNotBlank(custCoupon.getEmail()) && "Y".equals(custCoupon.getEmailAgreeYn())) {
-
+			mailService.sendBirthDayCouponNotice(custCoupon, senderNo);
 		}
 		// 카카오 알림톡
 		if (StringUtils.isNotBlank(custCoupon.getCellPhnno()) && "Y".equals(custCoupon.getSmsAgreeYn())) {

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

@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
 import com.style24.batch.biz.job.customer.TsbDormantScheduleJob;
 import com.style24.batch.biz.job.customer.TsbDormantTransformJob;
 import com.style24.batch.biz.job.customer.TsbGradeChangeJob;
-import com.style24.batch.biz.job.customer.TsbMarketingAgreementNoticeJob;
+import com.style24.batch.biz.job.customer.TsbMarketingAgreeNoticeJob;
 import com.style24.batch.biz.job.customer.TsbNetpathyMailJob;
 import com.style24.batch.biz.job.customer.TsbPrivacyPolicyNoticeJob;
 import com.style24.batch.biz.job.customer.TsbSecedeProcessJob;
@@ -47,7 +47,7 @@ public class TsbCustomerTask {
 	private TsbPrivacyPolicyNoticeJob privacyPolicyNoticeJob;
 
 	@Autowired
-	private TsbMarketingAgreementNoticeJob marketingAgreementNoticeJob;
+	private TsbMarketingAgreeNoticeJob marketingAgreeNoticeJob;
 
 	@Autowired
 	private TsbGradeChangeJob gradeChangeJob;
@@ -144,7 +144,7 @@ public class TsbCustomerTask {
 	@Scheduled(cron = "${cron.customer.marketing.info.notify}")
 	@Async
 	public void marketingInfoNotifyJob() throws Exception {
-		marketingAgreementNoticeJob.runById("cron.customer.marketing.info.notify");
+		marketingAgreeNoticeJob.runById("cron.customer.marketing.info.notify");
 	}
 
 	/**

+ 2 - 2
src/main/java/com/style24/batch/biz/web/TsbCustomerController.java

@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.style24.batch.biz.job.customer.TsbDormantScheduleJob;
 import com.style24.batch.biz.job.customer.TsbDormantTransformJob;
 import com.style24.batch.biz.job.customer.TsbGradeChangeJob;
-import com.style24.batch.biz.job.customer.TsbMarketingAgreementNoticeJob;
+import com.style24.batch.biz.job.customer.TsbMarketingAgreeNoticeJob;
 import com.style24.batch.biz.job.customer.TsbNetpathyMailJob;
 import com.style24.batch.biz.job.customer.TsbPrivacyPolicyNoticeJob;
 import com.style24.batch.biz.job.customer.TsbSecedeProcessJob;
@@ -49,7 +49,7 @@ public class TsbCustomerController extends TscBaseController {
 	TsbPrivacyPolicyNoticeJob privacyPolicyNoticeJob;
 
 	@Autowired
-	TsbMarketingAgreementNoticeJob marketingAgreementNoticeJob;
+	TsbMarketingAgreeNoticeJob marketingAgreementNoticeJob;
 
 	@Autowired
 	TsbGradeChangeJob gradeChangeJob;

+ 5 - 3
src/main/java/com/style24/persistence/mybatis/shop/TsbCustomer.xml

@@ -12,7 +12,7 @@
 		      , C.EMAIL
 		      , DATE_FORMAT(C.LOGIN_LDT, '%Y-%m-%d') AS LOGIN_LDT
 		      , DATE_FORMAT(DATE_ADD(C.LOGIN_LDT, INTERVAL #{dormantConversionDay} +1 DAY), '%Y.%m.%d') AS DORMANT_DT
-		      , DATE_FORMAT(DATE_ADD(C.LOGIN_LDT, INTERVAL #{dormantConversionDay} DAY), '%Y.%m.%d') AS FEW_DT
+		      , DATE_FORMAT(DATE_ADD(C.LOGIN_LDT, INTERVAL #{dormantConversionDay} DAY), '%Y%m%d') AS FEW_DT
 		FROM    TB_CUSTOMER C
 		WHERE   C.CUST_STAT = 'G104_10' -- 활동회원
 		AND     C.SITE_CD = #{siteCd}
@@ -676,8 +676,10 @@
 		     , C.EMAIL_AGREE_YN
 		     , BB.BIRTH_YMD
 		     , C.CUST_GRADE
-		     , DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH)+ INTERVAL 1 DAY, '%Y%m%d%H%i%S') AS AVAIL_STDT
-		     , DATE_FORMAT(CONCAT(LAST_DAY(NOW()), ' 23:59:59'), '%Y%m%d%H%i%S')               AS AVAIL_EDDT
+		     , DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH)+ INTERVAL 1 DAY, '%Y%m%d%H%i%S')   AS AVAIL_STDT
+		     , DATE_FORMAT(CONCAT(LAST_DAY(NOW()), ' 23:59:59'), '%Y%m%d%H%i%S')                 AS AVAIL_EDDT
+			 , DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH)+ INTERVAL 1 DAY, '%Y.%m.%d %H:%i') AS AVAIL_STDT_TIME
+		     , DATE_FORMAT(CONCAT(LAST_DAY(NOW()), ' 23:59:59'), '%Y.%m.%d %H:%i')               AS AVAIL_EDDT_TIME
 		     , CO.CPN_ID
 		     , CO.END_ALIM_YN
 		     , CO.DC_PVAL                                                                      AS DC_VAL