jsshin 5 tahun lalu
induk
melakukan
f2a9e57105

+ 2 - 1
src/main/java/com/style24/batch/biz/dao/TsbCustomerDao.java

@@ -1,6 +1,7 @@
 package com.style24.batch.biz.dao;
 
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.CustCoupon;
 import com.style24.persistence.domain.CustGrade;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.CustomerSearch;
@@ -224,5 +225,5 @@ public interface TsbCustomerDao {
 	 * @author jsshin
 	 * @since  2021. 05. 10
 	 */
-	Collection<Customer> getBirthDayTargetList(CustomerSearch customerSearch);
+	Collection<CustCoupon> getBirthDayTargetList(CustomerSearch customerSearch);
 }

+ 8 - 7
src/main/java/com/style24/batch/biz/job/marketing/TsbBirthdayCouponNoticeJob.java

@@ -5,6 +5,7 @@ import com.style24.batch.biz.job.TsbAbstractJob;
 import com.style24.batch.biz.service.TsbCustomerService;
 import com.style24.batch.support.env.TsbConstants;
 import com.style24.core.support.env.TscConstants;
+import com.style24.persistence.domain.CustCoupon;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.CustomerSearch;
 import lombok.extern.slf4j.Slf4j;
@@ -21,7 +22,7 @@ import java.util.Collection;
  */
 @Component
 @Slf4j
-public class TsbBirthdayCouponNoticeJob extends TsbAbstractJob<Collection<Customer>, GagaMap, GagaMap> {
+public class TsbBirthdayCouponNoticeJob extends TsbAbstractJob<Collection<CustCoupon>, GagaMap, GagaMap> {
 
 	@Autowired
 	TsbCustomerService customerService;
@@ -30,20 +31,20 @@ public class TsbBirthdayCouponNoticeJob extends TsbAbstractJob<Collection<Custom
 	private int failCnt = 0;
 
 	@Override
-	public Collection<Customer> read() throws Exception {
+	public Collection<CustCoupon> read() throws Exception {
 		CustomerSearch customerSearch = new CustomerSearch();
 		customerSearch.setSiteCd(TscConstants.Site.STYLE24.value());
 		return customerService.getBirthDayTargetList(customerSearch);
 	}
 
 	@Override
-	public GagaMap process(Collection<Customer> readItem) throws Exception {
+	public GagaMap process(Collection<CustCoupon> readItem) throws Exception {
 
-		for (Customer customer: readItem) {
+		for (CustCoupon CustCoupon: readItem) {
 			try {
-				customer.setRegNo(TsbConstants.REG_NO);
-				customer.setUpdNo(TsbConstants.REG_NO);
-				customerService.sendBirthDayCouponNotice(customer);
+				CustCoupon.setRegNo(TsbConstants.REG_NO);
+				CustCoupon.setUpdNo(TsbConstants.REG_NO);
+				customerService.sendBirthDayCouponNotice(CustCoupon);
 				succCnt++;
 			} catch (Exception e) {
 				failCnt++;

+ 6 - 5
src/main/java/com/style24/batch/biz/service/TsbCustomerService.java

@@ -2,6 +2,7 @@ package com.style24.batch.biz.service;
 
 import java.util.Collection;
 
+import com.style24.persistence.domain.CustCoupon;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -377,7 +378,7 @@ public class TsbCustomerService {
 	 * @author jsshin
 	 * @since  2021. 05. 10
 	 */
-	public Collection<Customer> getBirthDayTargetList(CustomerSearch customerSearch) {
+	public Collection<CustCoupon> getBirthDayTargetList(CustomerSearch customerSearch) {
 		return customerDao.getBirthDayTargetList(customerSearch);
 	}
 
@@ -385,15 +386,15 @@ public class TsbCustomerService {
 	/**
 	 * 생일쿠폰 안내
 	 *
-	 * @param customer - 사이트 코드
+	 * @param custCoupon - 사이트 코드
 	 * @author jsshin
 	 * @since  2021. 05. 10
 	 */
 	@Transactional("shopTxnManager")
-	public void sendBirthDayCouponNotice(Customer customer) {
+	public void sendBirthDayCouponNotice(CustCoupon custCoupon) {
 		// TODO: 이메일 발송 모듈 붙어야 함 2021.05.10 jsshin
 		// 이메일 발송
-		if (StringUtils.isNotBlank(customer.getEmail())) {
+		if (StringUtils.isNotBlank(custCoupon.getEmail())) {
 
 		}
 		CustContactHst custContactHst = new CustContactHst();
@@ -401,7 +402,7 @@ public class TsbCustomerService {
 		custContactHst.setContactMethod(TscConstants.ContactMethod.EMAIL.value());
 		custContactHst.setContactContents("생일쿠폰 다운로드 안내");
 		custContactHst.setSenderNo(TsbConstants.REG_NO);
-		custContactHst.setReceiverNo(customer.getCustNo());
+		custContactHst.setReceiverNo(custCoupon.getCustNo());
 		custContactHst.setRegNo(TsbConstants.REG_NO);
 		//접촉 이력 저장
 		coreCustomerService.createCustomerContactHistory(custContactHst);

+ 19 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsbCustomer.xml

@@ -587,16 +587,33 @@
 	</insert>
 
 	<!--생일쿠폰 다운로드 안내 대상자-->
-	<select id="getBirthDayTargetList" parameterType="CustomerSearch" resultType="Customer">
+	<select id="getBirthDayTargetList" parameterType="CustomerSearch" resultType="CustCoupon">
 		/*TsbCustomerDao.getBirthDayTargetList*/
 		SELECT C.CUST_NO
-		     , C.CUST_ID
 		     , C.EMAIL
 		     , 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
+		     , CO.CPN_ID
+		     , CO.END_ALIM_YN
+		     , CO.DC_PVAL                                                                      AS DC_VAL
+		     , CASE WHEN CO.DC_WAY = 'G240_10' THEN '원'
+		            ELSE '%'
+		       END                                                                             AS DC_WAY
+		     , CO.MAX_DC_AMT
 		FROM   TB_CUSTOMER C
 		INNER JOIN
 		       TB_BATCH_BIRTH BB
 		ON     C.CUST_NO = BB.CUST_NO
+		INNER JOIN
+		       TB_CUST_GRADE_POLICY CGP
+		ON     C.CUST_GRADE = CGP.GRADE_CD
+		AND    CGP.USE_YN = 'Y'
+		INNER JOIN
+		       TB_COUPON CO
+		ON     CGP.GRADE_CPN_ID3 = CO.CPN_ID
+		AND    CO.CPN_STAT = 'G232_11'
 		WHERE  C.CUST_STAT = 'G104_10'
 		AND    C.SITE_CD = #{siteCd}
 		AND    SUBSTR(BB.BIRTH_YMD, 5,8) > DATE_FORMAT(DATE_ADD(LAST_DAY(NOW()), INTERVAL -1 MONTH ), '%m%d')