|
|
@@ -1,5 +1,8 @@
|
|
|
package com.style24.core.biz.service;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -8,8 +11,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.style24.core.biz.thirdparty.NaverShortUrl;
|
|
|
import com.style24.core.biz.thirdparty.SsgKakaoSender;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
+import com.style24.persistence.domain.Coupon;
|
|
|
import com.style24.persistence.domain.CustContactHst;
|
|
|
+import com.style24.persistence.domain.CustCoupon;
|
|
|
import com.style24.persistence.domain.Customer;
|
|
|
+import com.style24.persistence.domain.GiftCard;
|
|
|
+import com.style24.persistence.domain.Point;
|
|
|
import com.style24.persistence.domain.SsgDirectMessage;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -58,12 +65,12 @@ public class TscKakaotalkService {
|
|
|
replaceInfo.setString("custNm", customer.getCustNm());
|
|
|
replaceInfo.setString("passwd", customer.getPasswd());
|
|
|
|
|
|
- kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.TempPasswd.value(), dm, replaceInfo);
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.TEMP_PASSWD.value(), dm, replaceInfo);
|
|
|
|
|
|
try {
|
|
|
// 고객접촉이력 정보
|
|
|
CustContactHst custContactHst = new CustContactHst();
|
|
|
- custContactHst.setContactType(TscConstants.ContactType.PASSWORD_INFO.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.TEMP_PASSWD.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
custContactHst.setContactContents("고객 임시비밀번호 발송");
|
|
|
custContactHst.setReceiverNo(customer.getCustNo());
|
|
|
@@ -84,22 +91,39 @@ public class TscKakaotalkService {
|
|
|
* @since 2020. 4. 9
|
|
|
*/
|
|
|
@Transactional("shopTxnManager")
|
|
|
- public void sendJoinCongrat(Customer customer, Integer senderNo) {
|
|
|
+ public void sendJoinCongrat(Customer customer, Coupon coupon, Integer senderNo) {
|
|
|
SsgDirectMessage dm = new SsgDirectMessage();
|
|
|
dm.setFuserid(String.valueOf(senderNo)); // 발송자NO
|
|
|
dm.setFdestine(customer.getCellPhnno());
|
|
|
dm.setFkkoresendtype("LMS");
|
|
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd");
|
|
|
+ Date currentTime = new Date();
|
|
|
+ String today = formatter.format(currentTime);
|
|
|
+
|
|
|
+ String custId = customer.getCustId();
|
|
|
+ if (TscConstants.SnsType.NAVER.value().equals(customer.getSnsType())) {
|
|
|
+ custId = "네이버 간편가입회원";
|
|
|
+ } else if (TscConstants.SnsType.KAKAO.value().equals(customer.getSnsType())) {
|
|
|
+ custId = "카카오 간편가입회원";
|
|
|
+ } else if (TscConstants.SnsType.YES24.value().equals(customer.getSnsType())) {
|
|
|
+ custId = "YES24 간편가입회원";
|
|
|
+ }
|
|
|
+
|
|
|
GagaMap replaceInfo = new GagaMap();
|
|
|
replaceInfo.setString("siteNm", siteNm);
|
|
|
replaceInfo.setString("custNm", customer.getCustNm());
|
|
|
+ replaceInfo.setString("custId", custId);
|
|
|
+ replaceInfo.setString("cpnNm", coupon.getCpnNm());
|
|
|
+ replaceInfo.setString("joinDt", today);
|
|
|
+
|
|
|
replaceInfo.set("custNo", customer.getCustNo());
|
|
|
- kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.JoinCongrat.value(), dm, replaceInfo);
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.JOIN_CONGRATS.value(), dm, replaceInfo);
|
|
|
|
|
|
try {
|
|
|
// 고객접촉이력 정보
|
|
|
CustContactHst custContactHst = new CustContactHst();
|
|
|
- custContactHst.setContactType(TscConstants.ContactType.CONGRATULATIONS.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.JOIN_CONGRATS.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
custContactHst.setContactContents("회원가입축하");
|
|
|
custContactHst.setReceiverNo(customer.getCustNo());
|
|
|
@@ -112,6 +136,7 @@ public class TscKakaotalkService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 인증번호발송
|
|
|
* @param customer - 고객 정보
|
|
|
@@ -131,8 +156,86 @@ public class TscKakaotalkService {
|
|
|
replaceInfo.setString("certNo", customer.getCertNo());
|
|
|
|
|
|
// SMS로 발송
|
|
|
- kakaoSender.sendSms(SsgKakaoSender.KakaoAnswerSq.CertNoSend.value(), dm, replaceInfo);
|
|
|
+ kakaoSender.sendSms(SsgKakaoSender.KakaoAnswerSq.CERT_NO_SEND.value(), dm, replaceInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 상품권 기간만료 알림톡(30일)
|
|
|
+ * @param giftcard - 상품권 정보
|
|
|
+ * @param senderNo - 발송자번호(고객번호)
|
|
|
+ * @author sowon
|
|
|
+ * @since 2021. 5. 27
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public void sendGiftcardExpectNotify(GiftCard giftcard, Integer senderNo) {
|
|
|
+ SsgDirectMessage dm = new SsgDirectMessage();
|
|
|
+ dm.setFuserid(String.valueOf(senderNo)); // 발송자NO
|
|
|
+ dm.setFdestine(giftcard.getCellPhnno());
|
|
|
+ dm.setFkkoresendtype("LMS");
|
|
|
+
|
|
|
+ GagaMap replaceInfo = new GagaMap();
|
|
|
+ replaceInfo.setString("siteNm", siteNm);
|
|
|
+ replaceInfo.setString("custNm", giftcard.getCustNm());
|
|
|
+ replaceInfo.setString("rmGfcdAmt", Integer.toString(giftcard.getRmGfcdAmt()));
|
|
|
+ replaceInfo.setString("useExpDate", giftcard.getUseExpDate());
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.GIFTCARD_EXTNC_EXPECT.value(), dm, replaceInfo);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객접촉이력 정보
|
|
|
+ CustContactHst custContactHst = new CustContactHst();
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.GIFTCARD_EXTNC_EXPECT.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
+ custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
+ custContactHst.setContactContents("상품권소멸예정");
|
|
|
+ custContactHst.setReceiverNo(giftcard.getCustNo());
|
|
|
+ custContactHst.setSenderNo(senderNo);
|
|
|
+ custContactHst.setRegNo(senderNo);
|
|
|
+ coreCustomerService.createCustomerContactHistory(custContactHst);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 포인트 기간만료 알림톡(30일)
|
|
|
+ * @param point - 상품권 정보
|
|
|
+ * @param senderNo - 발송자번호(고객번호)
|
|
|
+ * @author sowon
|
|
|
+ * @since 2021. 5. 28
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public void sendPointExpectNotify(Point point, Integer senderNo) {
|
|
|
+ SsgDirectMessage dm = new SsgDirectMessage();
|
|
|
+ dm.setFuserid(String.valueOf(senderNo)); // 발송자NO
|
|
|
+ dm.setFdestine(point.getCellPhnno());
|
|
|
+ dm.setFkkoresendtype("LMS");
|
|
|
+
|
|
|
+ GagaMap replaceInfo = new GagaMap();
|
|
|
+ replaceInfo.setString("siteNm", siteNm);
|
|
|
+ replaceInfo.setString("custNm", point.getCustNm());
|
|
|
+ replaceInfo.setString("rmPntAmt", Integer.toString(point.getRmPntAmt()));
|
|
|
+ replaceInfo.setString("expBeDt", point.getExpBeDt());
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.POINT_EXTNC_EXPECT.value(), dm, replaceInfo);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객접촉이력 정보
|
|
|
+ CustContactHst custContactHst = new CustContactHst();
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.POINT_EXTNC_EXPECT.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
+ custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
+ custContactHst.setContactContents("포인트소멸예정");
|
|
|
+ custContactHst.setReceiverNo(point.getCustNo());
|
|
|
+ custContactHst.setSenderNo(senderNo);
|
|
|
+ custContactHst.setRegNo(senderNo);
|
|
|
+ coreCustomerService.createCustomerContactHistory(custContactHst);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// /**
|
|
|
// * 결제완료 알림톡
|
|
|
@@ -303,7 +406,92 @@ public class TscKakaotalkService {
|
|
|
replaceInfo.setString("iosAppDownUrl", shortUrl.getShortUrl(env.getProperty("app.down.url.ios")));
|
|
|
replaceInfo.setString("aosAppDownUrl", shortUrl.getShortUrl(env.getProperty("app.down.url.aos")));
|
|
|
|
|
|
- kakaoSender.sendLms(SsgKakaoSender.KakaoAnswerSq.AppDownload.value(), dm, replaceInfo);
|
|
|
+ kakaoSender.sendLms(SsgKakaoSender.KakaoAnswerSq.APP_DOWNLOAD.value(), dm, replaceInfo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 휴면/미접속자 방어 쿠폰
|
|
|
+ *
|
|
|
+ * @param customer - 휴대전화번호,고객이름
|
|
|
+ * @param custCoupon - 쿠폰정보
|
|
|
+ * @author jssin
|
|
|
+ * @since 2021. 05. 28
|
|
|
+ */
|
|
|
+ public void sendCombackCoupon(Customer customer, CustCoupon custCoupon, Integer senderNo) {
|
|
|
+ SsgDirectMessage dm = new SsgDirectMessage();
|
|
|
+ dm.setFuserid(String.valueOf(senderNo)); // 발송자NO
|
|
|
+ dm.setFdestine(customer.getCellPhnno());
|
|
|
+ dm.setFkkoresendtype("LMS");
|
|
|
+
|
|
|
+ GagaMap replaceInfo = new GagaMap();
|
|
|
+ replaceInfo.setString("siteNm", siteNm);
|
|
|
+ replaceInfo.setString("custNm", customer.getCustNm());
|
|
|
+ replaceInfo.setInt("dcVal", custCoupon.getDcVal());
|
|
|
+ replaceInfo.setString("dcWay", custCoupon.getDcWay());
|
|
|
+
|
|
|
+ replaceInfo.set("custNo", customer.getCustNo());
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.DORMANT_EXPECT_COMBACK.value(), dm, replaceInfo);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객접촉이력 정보
|
|
|
+ CustContactHst custContactHst = new CustContactHst();
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.DORMANT_EXPECT_COMBACK.value());
|
|
|
+ custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value());
|
|
|
+ custContactHst.setContactContents("휴면/미접속 방어쿠폰");
|
|
|
+ custContactHst.setReceiverNo(customer.getCustNo());
|
|
|
+ custContactHst.setSenderNo(senderNo);
|
|
|
+ custContactHst.setRegNo(senderNo);
|
|
|
+ coreCustomerService.createCustomerContactHistory(custContactHst);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //----------------------------
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 재입고 발송
|
|
|
+ * @param customer
|
|
|
+ * @param goods
|
|
|
+ * @param senderNo
|
|
|
+ * @author eskim
|
|
|
+ * @since 2021. 5. 28
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public void goodsRestock(GagaMap goods, Integer senderNo) {
|
|
|
+ SsgDirectMessage dm = new SsgDirectMessage();
|
|
|
+ dm.setFuserid(String.valueOf(senderNo)); // 발송자NO======>
|
|
|
+ dm.setFdestine(goods.getString("cellPhnno"));
|
|
|
+ dm.setFkkoresendtype("LMS");
|
|
|
+
|
|
|
+ GagaMap replaceInfo = new GagaMap();
|
|
|
+ replaceInfo.setString("siteNm", siteNm);
|
|
|
+ replaceInfo.setString("custNm", goods.getString("custNm"));
|
|
|
+ replaceInfo.setString("goodsNm", goods.getString("goodsNm"));
|
|
|
+ replaceInfo.setString("optCd1", goods.getString("optCd1"));
|
|
|
+ replaceInfo.setString("optCd2", goods.getString("optCd2"));
|
|
|
+ replaceInfo.setString("goodsCd", goods.getString("goodsCd"));
|
|
|
+ replaceInfo.setString("colorCd", goods.getString("colorCd"));
|
|
|
+
|
|
|
+ kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.GOODS_RESTOCK.value(), dm, replaceInfo);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객접촉이력 정보
|
|
|
+ CustContactHst custContactHst = new CustContactHst();
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.GOODS_RESTOCK.value()); // 접촉유형:알림톡(공통코드G054)
|
|
|
+ custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
+ custContactHst.setContactContents("재입고안내");
|
|
|
+ custContactHst.setReceiverNo(goods.getInt("custNo"));
|
|
|
+ custContactHst.setSenderNo(senderNo);
|
|
|
+ custContactHst.setRegNo(senderNo);
|
|
|
+ coreCustomerService.createCustomerContactHistory(custContactHst);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //----------------------------
|
|
|
}
|