|
|
@@ -0,0 +1,77 @@
|
|
|
+package com.style24.core.biz.service;
|
|
|
+
|
|
|
+import com.gagaframework.web.parameter.GagaMap;
|
|
|
+import com.style24.core.biz.thirdparty.NaverShortUrl;
|
|
|
+import com.style24.core.biz.thirdparty.NetpathyMailSender;
|
|
|
+import com.style24.core.biz.thirdparty.SsgKakaoSender;
|
|
|
+import com.style24.core.support.env.TscConstants;
|
|
|
+import com.style24.persistence.domain.CustContactHst;
|
|
|
+import com.style24.persistence.domain.Customer;
|
|
|
+import com.style24.persistence.domain.SsgDirectMessage;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 메일 서비스
|
|
|
+ *
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 6. 2
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class TscMailService {
|
|
|
+ private static final String siteNm = "STYLE24";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Environment env;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private NetpathyMailSender netpathyMailSender;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private NaverShortUrl shortUrl;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscCustomerService coreCustomerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TscMailTemplateService mailTemplateService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 고객 임시비밀번호 이메일 발송
|
|
|
+ * @param customer - 고객 정보
|
|
|
+ * @author jsshin
|
|
|
+ * @since 2021. 06. 02
|
|
|
+ */
|
|
|
+ @Transactional("shopTxnManager")
|
|
|
+ public void sendCustomerTempPassword(Customer customer, Integer senderNo) {
|
|
|
+ GagaMap replaceInfo = new GagaMap();
|
|
|
+ replaceInfo.setString("siteNm", siteNm);
|
|
|
+ replaceInfo.setString("custNm", customer.getCustNm());
|
|
|
+ replaceInfo.setString("passwd", customer.getPasswd());
|
|
|
+
|
|
|
+ netpathyMailSender.send(SsgKakaoSender.KakaoAnswerSq.TEMP_PASSWD.value(), customer.getEmail(), replaceInfo);
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 고객접촉이력 정보
|
|
|
+ CustContactHst custContactHst = new CustContactHst();
|
|
|
+ custContactHst.setContactType(TscConstants.ContactType.TEMP_PASSWD.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
|
|
|
+ custContactHst.setContactMethod(TscConstants.ContactMethod.EMAIL.value()); // 접촉방법:알림톡+문자(공통코드G055)
|
|
|
+ custContactHst.setContactContents("고객 임시비밀번호 발송");
|
|
|
+ custContactHst.setReceiverNo(customer.getCustNo());
|
|
|
+ custContactHst.setSenderNo(senderNo);
|
|
|
+ custContactHst.setRegNo(senderNo);
|
|
|
+ coreCustomerService.createCustomerContactHistory(custContactHst);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("error", e);
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|