Sfoglia il codice sorgente

Merge branch 'develop' into eskim

eskim 5 anni fa
parent
commit
56fd29c091

+ 12 - 2
src/main/java/com/style24/batch/biz/dao/TsbGiftcardDao.java

@@ -20,7 +20,7 @@ public interface TsbGiftcardDao {
 	/**
 	 * 상품권 소멸 리스트
 	 *
-	 * @param point
+	 * @param giftcard
 	 * @return Collection<Giftcard>
 	 * @author sowon
 	 * @since  2021. 05. 20
@@ -30,10 +30,20 @@ public interface TsbGiftcardDao {
 	/**
 	 * 상품권 hst insert
 	 *
-	 * @param point
+	 * @param giftcard
 	 * @return 
 	 * @author sowon
 	 * @since  2021. 05. 20
 	 */
 	void saveExpireGiftcardHst(GiftCard giftcard);
+	
+	/**
+	 * 상품권 기간만료 알림톡(30일) 리스트
+	 *
+	 * @param giftcard
+	 * @return Collection<Giftcard>
+	 * @author sowon
+	 * @since  2021. 05. 27
+	 */
+	Collection<GiftCard> getSendGiftcardExpectList(GiftCard giftcard);
 }

+ 1 - 0
src/main/java/com/style24/batch/biz/job/TsbAbstractJob.java

@@ -135,6 +135,7 @@ public abstract class TsbAbstractJob<I, O, R> {
 			this.printEnd();
 
 		} catch (Exception e) {
+			log.error(e.getMessage());
 			if (StringUtils.isNotBlank(batchId)) {
 				// 배치로그 종료 처리
 				batchService.updateBatchLog(batchLogSq, batchId);

+ 61 - 0
src/main/java/com/style24/batch/biz/job/marketing/TsbExpectGiftcardJob.java

@@ -0,0 +1,61 @@
+package com.style24.batch.biz.job.marketing;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbGiftcardService;
+import com.style24.core.biz.service.TscKakaotalkService;
+import com.style24.persistence.domain.GiftCard;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class TsbExpectGiftcardJob  extends TsbAbstractJob<Collection<GiftCard>, GagaMap, GagaMap>{
+	
+	@Autowired
+	TsbGiftcardService giftcardService;
+	
+	@Autowired
+	TscKakaotalkService kakaoService;
+	
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	
+	@Override
+	public Collection<GiftCard> read() throws Exception {
+		GiftCard giftcard = new GiftCard(); 
+		return giftcardService.getSendGiftcardExpectList(giftcard);
+	}
+
+	@Override
+	public GagaMap process(Collection<GiftCard> readItem) throws Exception {
+		for (GiftCard giftcard : readItem) {
+			try {
+				log.info("giftcard ===> {}", giftcard);
+				kakaoService.sendGiftcardExpect(giftcard, giftcard.getCustNo());
+				succCnt++;
+			} catch (Exception e) {
+				failCnt++;
+				log.error(e.getMessage());
+			}
+		}
+		return null;
+	}
+
+	@Override
+	public GagaMap write(GagaMap convertedItem) throws Exception {
+		return null;
+	}
+
+	@Override
+	public void notify(GagaMap resultItem) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+
+}

+ 1 - 1
src/main/java/com/style24/batch/biz/job/marketing/TsbReviewGuideJob.java

@@ -71,7 +71,7 @@ public class TsbReviewGuideJob extends TsbAbstractJob<String, String, String> {
 				replaceInfo.setString("custNm", reviewGuide.getCustNm());
 
 				// 4.알림톡 발송
-				kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.ReviewWrite.value(), dm, replaceInfo);
+				kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.REVIEW_WRITE.value(), dm, replaceInfo);
 
 				// 5.상품평등록안내발송완료 처리
 				reviewService.updateReviewGuideSendComplete(reviewGuide);

+ 33 - 0
src/main/java/com/style24/batch/biz/service/TsbCouponService.java

@@ -0,0 +1,33 @@
+package com.style24.batch.biz.service;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.persistence.domain.CustCoupon;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 쿠폰 Service
+ *
+ * @author jsshin
+ * @since 2021. 05. 27
+ */
+@Service
+@Slf4j
+public class TsbCouponService {
+	@Autowired
+	private TsbCustomerService customerService;
+
+	@Transactional("shopTxnManager")
+	public GagaMap saveCombackCoupon(CustCoupon custCoupon) {
+		GagaMap result = new GagaMap();
+		// [G12] 휴면/미접속자 방어쿠폰 자동발송-1 : -180 ~ -91
+		// [G13] 휴면/미접속자 방어쿠폰 자동발송-2 : -270 ~ -181
+		// [G14] 휴면/미접속자 방어쿠폰 자동발송-3 : -365 ~ -271
+
+
+
+		return result;
+	}
+}

+ 13 - 0
src/main/java/com/style24/batch/biz/service/TsbGiftcardService.java

@@ -48,4 +48,17 @@ public class TsbGiftcardService {
 	public void saveExpireGiftcardHst(GiftCard giftcard) {
 		giftcardDao.saveExpireGiftcardHst(giftcard);
 	}
+	
+	/**
+	 * 상품권 기간만료 알림톡(30일) 리스트
+	 *
+	 * @param giftcard
+	 * @return Collection<Giftcard>
+	 * @author sowon
+	 * @since  2021. 05. 27
+	 */
+	@Transactional("shopTxnManager")
+	public Collection<GiftCard> getSendGiftcardExpectList(GiftCard giftcard){
+		return giftcardDao.getSendGiftcardExpectList(giftcard);
+	}
 }

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

@@ -14,6 +14,7 @@ import com.style24.batch.biz.job.customer.TsbPrivacyPolicyNoticeJob;
 import com.style24.batch.biz.job.customer.TsbSecedeProcessJob;
 import com.style24.batch.biz.job.marketing.TsbAutoBuyConfirmJob;
 import com.style24.batch.biz.job.marketing.TsbBirthdayCouponNoticeJob;
+import com.style24.batch.biz.job.marketing.TsbExpectGiftcardJob;
 import com.style24.batch.biz.job.marketing.TsbExpireGiftcardJob;
 import com.style24.batch.biz.job.marketing.TsbExpirePointJob;
 import com.style24.batch.biz.job.marketing.TsbReviewGuideJob;
@@ -61,6 +62,9 @@ public class TsbCustomerTask {
 
 	@Autowired
 	private TsbExpireGiftcardJob expireGiftcardJob;
+	
+	@Autowired
+	private TsbExpectGiftcardJob expectGiftcardJob;
 
 	@Autowired
 	private TsbReviewGuideJob reviewGuideJob;
@@ -206,6 +210,19 @@ public class TsbCustomerTask {
 	public void giftcardExpireJob() throws Exception {
 		expireGiftcardJob.runById("cron.customer.giftcard.expire");
 	}
+	
+	/**
+	 * 상품권 기간만료 알림톡(30일)
+	 *
+	 * @throws Exception - 예외처리
+	 * @author sowon
+	 * @since 2021. 05. 27
+	 */
+	@Scheduled(cron = "${cron.customer.giftcard.expect}")
+	@Async
+	public void giftcardExpectJob() throws Exception {
+		expectGiftcardJob.runById("cron.customer.giftcard.expect");
+	}
 
 	/**
 	 * 상품평등록안내발송 처리

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

@@ -16,6 +16,7 @@ import com.style24.batch.biz.job.customer.TsbPrivacyPolicyNoticeJob;
 import com.style24.batch.biz.job.customer.TsbSecedeProcessJob;
 import com.style24.batch.biz.job.marketing.TsbAutoBuyConfirmJob;
 import com.style24.batch.biz.job.marketing.TsbBirthdayCouponNoticeJob;
+import com.style24.batch.biz.job.marketing.TsbExpectGiftcardJob;
 import com.style24.batch.biz.job.marketing.TsbExpireGiftcardJob;
 import com.style24.batch.biz.job.marketing.TsbExpirePointJob;
 import com.style24.batch.biz.job.marketing.TsbReviewGuideJob;
@@ -68,6 +69,9 @@ public class TsbCustomerController extends TscBaseController {
 	@Autowired
 	private TsbExpireGiftcardJob expireGiftcardJob;
 
+	@Autowired
+	private TsbExpectGiftcardJob expectGiftcardJob;
+	
 	@Autowired
 	private TsbReviewGuideJob reviewGuideJob;
 
@@ -221,6 +225,20 @@ public class TsbCustomerController extends TscBaseController {
 		expireGiftcardJob.runById("cron.customer.giftcard.expire");
 		return "OK";
 	}
+	
+	/**
+	 * 상품권 소멸예정 알림톡
+	 *
+	 * @throws Exception - 예외처리
+	 * @author sowon
+	 * @since 2021. 05. 27
+	 */
+	@GetMapping("/giftcard/expect")
+	@ResponseBody
+	public String expectGiftcard() throws Exception {
+		expectGiftcardJob.runById("cron.customer.giftcard.expect");
+		return "OK";
+	}
 
 	/**
 	 * 상품평등록안내발송 처리

+ 15 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsbGiftcard.xml

@@ -41,4 +41,19 @@
 		    , CURRENT_TIMESTAMP
 		)
 	</insert>
+	
+	<select id="getSendGiftcardExpectList" parameterType="Giftcard" resultType="Giftcard">
+		/*TsbGiftcardDao.getSendGiftcardExpectList*/
+		SELECT  CG.CUST_NO 
+		      , CG.RM_GFCD_AMT
+		      , DATE_FORMAT(CG.USE_EXP_DATE ,'%Y.%m.%d') AS USE_EXP_DATE 
+		      , C.CUST_STAT   
+		      , C.CUST_NM   
+		      , C.CELL_PHNNO 
+		FROM TB_CUST_GIFTCARD CG INNER JOIN TB_CUSTOMER C 
+		                  ON CG.CUST_NO = C.CUST_NO 
+		WHERE CG.USE_EXP_DATE = DATE_FORMAT(DATE_ADD(NOW(), INTERVAL 30 DAY),'%Y%m%d')
+		AND CG.RM_GFCD_AMT > 0
+		AND C.CUST_STAT = 'G104_10'
+	</select>
 </mapper>

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

@@ -126,6 +126,9 @@ cron:
         marketing.agreement.notice : 2 22 2 29 2 ?  # 마케팅 정보 수신동의 내역 안내(마케팅 정보 수신자에 한해 발송. 가입일로부터 2년 시점에 발송)
         grade.change : 2 22 2 29 2 ?                # 등급변경(매월1일)
         netpathy.sync : 2 22 2 29 2 ?               # 넷퍼시메일솔루션에 회원정보 연동 (매일 1회)
+        expire.point : 2 22 2 29 2 ?                # 포인트 소멸
+        expire.giftcard : 2 22 2 29 2 ?             # 상품권 소멸
+        expect.giftcard : 2 22 2 29 2 ?             # 상품권 소멸예정 알림톡
 
     # 전시
     display:
@@ -138,10 +141,9 @@ cron:
         auto.buy.confirm : 2 22 2 29 2 ?        # 자동구매확정 예정포인트 지급
         birthday.coupon.notice : 2 22 2 29 2 ?  # 생일쿠폰 다운로드 안내(매월 1일)
         comback.coupon.notice : 2 22 2 29 2 ?   # 복귀할인쿠폰발급안내(매월 5일)
-        expire.point : 2 22 2 29 2 ?            # 포인트 소멸
         cart.expiration : 2 22 2 29 2 ?         # 만료기간 지난 장바구니 삭제
         review.guide: 2 22 2 29 2 ?             # 상품평등록안내 발송 (일배치)
-        expire.giftcard : 2 22 2 29 2 ?         # 포인트 소멸
+       
 
     # 주문
     order: