Parcourir la source

Merge branch 'jsshin' into develop

jsshin il y a 5 ans
Parent
commit
d43d735bbb

+ 11 - 0
src/main/java/com/style24/admin/biz/dao/TsaCustomerDao.java

@@ -35,6 +35,14 @@ public interface TsaCustomerDao {
 	 */
 	Customer getCustomerInfo(String custNo);
 
+	/**
+	 * 회원정보 수정
+	 * @param customer - 고객정보
+	 * @author jsshin
+	 * @since 2020. 01. 20
+	 */
+	void updateCustomerInfo(Customer customer);
+
 	/**
 	 * 탈퇴회원 목록
 	 * @param customerSearch - 검색조건
@@ -52,4 +60,7 @@ public interface TsaCustomerDao {
 	 * @since 2020. 01. 14
 	 */
 	Collection<Customer> getCustomerDormantList(CustomerSearch customerSearch);
+
+	void createException();
+
 }

+ 35 - 0
src/main/java/com/style24/admin/biz/service/TsaCustomerService.java

@@ -1,11 +1,15 @@
 package com.style24.admin.biz.service;
 
 import com.style24.admin.biz.dao.TsaCustomerDao;
+import com.style24.admin.support.security.session.TsaSession;
+import com.style24.core.biz.dao.TscCustomerDao;
+import com.style24.core.biz.service.TscCustomerService;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.CustomerSearch;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
 
@@ -22,6 +26,9 @@ public class TsaCustomerService {
 	@Autowired
 	private TsaCustomerDao customerDao;
 
+	@Autowired
+	private TscCustomerService coreCustomerService;
+
 	/**
 	 * 활동회원 목록
 	 * @param customerSearch - 검색조건
@@ -44,6 +51,34 @@ public class TsaCustomerService {
 		return customerDao.getCustomerInfo(custNo);
 	}
 
+	/**
+	 * 회원정보 수정
+	 * @param customer - 고객정보
+	 * @author jsshin
+	 * @since 2020. 01. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void saveCustomerInfo(Customer customer) {
+		Integer userNo = TsaSession.getInfo().getUserNo();
+		customer.setRegNo(userNo);
+		customer.setUpdNo(userNo);
+		// 고객 이력 생성
+		coreCustomerService.createCustomerHistory(customer);
+		// 정보 수정
+		customerDao.updateCustomerInfo(customer);
+	}
+
+	/**
+	 * 회원 비밀번호 수정
+	 * @param customer - 고객정보
+	 * @author jsshin
+	 * @since 2020. 01. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void updateCustomerPassword(Customer customer) {
+		coreCustomerService.updateCustomerPassword(customer);
+	}
+
 	/**
 	 * 탈퇴회원 목록
 	 * @param customerSearch - 검색조건

+ 45 - 32
src/main/java/com/style24/admin/biz/service/TsaKakaoService.java

@@ -1,11 +1,19 @@
 package com.style24.admin.biz.service;
 
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.admin.support.security.session.TsaSession;
+import com.style24.core.biz.service.TscCustomerService;
+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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.style24.core.biz.thirdparty.SsgKakaoSender;
 
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 카카오알림톡 Service. 모든 카카오알림톡 발송은 여기에서 처리한다.
@@ -20,38 +28,43 @@ public class TsaKakaoService {
 	@Autowired
 	private SsgKakaoSender kakaoSender;
 
-//	/**
-//	 * 고객 임시비밀번호 알림톡 발송
-//	 * @param counsel - 상담 정보
-//	 * @author gagamel
-//	 * @since 2020. 11. 9
-//	 */
-//	@Transactional("shopTxnManager")
-//	public void sendCustomerTempPassword(AdmCustomer customer) {
-//		SsgDirectMessage dm = new SsgDirectMessage();
-//		dm.setFuserid(String.valueOf(TsaSession.getInfo().getUserNo())); // 발송자ID
-//		dm.setFdestine(customer.getCellPhnno());
-//		dm.setFkkoresendtype("LMS");
-//
-//		GagaMap replaceInfo = new GagaMap();
-//		replaceInfo.setString("siteNm", customer.getSiteNm());
-//		replaceInfo.setString("custNm", customer.getCustNm());
-//		replaceInfo.setString("passwd", customer.getPasswd());
-//
-//		kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.TempPasswd.value(), dm, replaceInfo);
-//
-//		try {
-//			// 고객접촉이력 정보
-//			customer.setContactType("203"); // 접촉유형:임시비밀번호발급(공통코드G054)
-//			customer.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
-//			customer.setContactContents("고객 임시비밀번호 발송");
-//			customer.setReceiverId(customer.getCustNo());
-//			customerService.createCustomerContactHistory(customer);
-//		} catch (Exception e) {
-//			log.error("error", e);
-//			// Do nothing
-//		}
-//	}
+	@Autowired
+	private TscCustomerService coreCustomerService;
+
+	/**
+	 * 고객 임시비밀번호 알림톡 발송
+	 * @param customer - 고객 정보
+	 * @author jsshin
+	 * @since 2021. 01. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void sendCustomerTempPassword(Customer customer) {
+		Integer userNo = TsaSession.getInfo().getUserNo();
+		SsgDirectMessage dm = new SsgDirectMessage();
+		dm.setFuserid(String.valueOf(userNo)); // 발송자NO
+		dm.setFdestine(customer.getCellPhnno());
+		dm.setFkkoresendtype("LMS");
+
+		GagaMap replaceInfo = new GagaMap();
+		replaceInfo.setString("siteNm", TscConstants.Style24Infomation.SITE_NAME.value());
+		replaceInfo.setString("custNm", customer.getCustNm());
+		replaceInfo.setString("passwd", customer.getPasswd());
+
+		kakaoSender.send(SsgKakaoSender.KakaoAnswerSq.TempPasswd.value(), dm, replaceInfo);
+
+		try {
+			CustContactHst custContactHst = new CustContactHst();
+			custContactHst.setContactType(TscConstants.ContactType.PASSWORD_INFO.value()); // 접촉유형:임시비밀번호발급(공통코드G054)
+			custContactHst.setContactMethod(TscConstants.ContactMethod.KAKAOTALK.value()); // 접촉방법:알림톡+문자(공통코드G055)
+			custContactHst.setContactContents("고객 임시비밀번호 발송");
+			custContactHst.setReceiverNo(customer.getCustNo());
+			custContactHst.setSenderNo(userNo);
+			coreCustomerService.createCustomerContactHistory(custContactHst);
+		} catch (Exception e) {
+			log.error("error", e);
+			// Do nothing
+		}
+	}
 //
 //	/**
 //	 * 일대일문의 답변 알림톡 발송

+ 58 - 1
src/main/java/com/style24/admin/biz/web/TsaCustomerController.java

@@ -2,10 +2,14 @@ package com.style24.admin.biz.web;
 
 import java.util.Collection;
 
+import com.gagaframework.web.security.GagaPasswordEncoder;
 import com.style24.admin.biz.service.TsaCustomerService;
+import com.style24.admin.biz.service.TsaKakaoService;
+import com.style24.admin.biz.service.TsaSystemService;
 import com.style24.core.support.session.TscSession;
 import com.style24.persistence.domain.Customer;
 import com.style24.persistence.domain.CustomerSearch;
+import com.sun.xml.internal.bind.v2.TODO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -55,6 +59,15 @@ public class TsaCustomerController extends TsaBaseController {
 	@Autowired
 	private TsaCustomerService customerService;
 
+	@Autowired
+	private TsaSystemService systemService;
+
+	@Autowired
+	private GagaPasswordEncoder passwordEncoder;
+
+	@Autowired
+	private TsaKakaoService kakaoService;
+
 	/**
 	 * 1:1문의관리 화면
 	 * @return
@@ -363,7 +376,7 @@ public class TsaCustomerController extends TsaBaseController {
 	}
 
 	/**
-	 * 회원 정보
+	 * 회원정보
 	 * @param custNo - 고객번호
 	 * @return Customer
 	 * @author jsshin
@@ -376,6 +389,50 @@ public class TsaCustomerController extends TsaBaseController {
 		return customerService.getCustomerInfo(custNo);
 	}
 
+	/**
+	 * 회원정보 수정
+	 * @param customer - 고객정보
+	 * @return Customer
+	 * @author jsshin
+	 * @since 2020. 01. 20
+	 */
+	@PostMapping("/info/save")
+	@ResponseBody
+	public GagaResponse saveCustomerInfo(@RequestBody Customer customer) {
+		customerService.saveCustomerInfo(customer);
+		return ok(message.getMessage("SUCC_0002"));
+	}
+
+	/**
+	 * 회원비밀번호초기화
+	 *
+	 * @param customer -고객정보
+	 * @return GagaResponse
+	 * @throws Exception
+	 * @author jsshin
+	 * @since 2020. 01. 20
+	 */
+	@PostMapping("/password/reset")
+	@ResponseBody
+	public GagaResponse resetCustomerPassword(@RequestBody Customer customer) throws Exception {
+		String tempPasswd = systemService.getTemporaryPassword(10);
+		log.info("tempPasswd  ====> {}", tempPasswd);
+
+		customer.setPasswd(tempPasswd);
+		customer.setEncodedPasswd(passwordEncoder.encodeSha256(tempPasswd));
+		customer.setRegNo(TsaSession.getInfo().getRegNo());
+
+		// 비밀번호 수정
+		customerService.updateCustomerPassword(customer);
+
+		// 카카오 알림톡
+		kakaoService.sendCustomerTempPassword(customer);
+
+		// TODO: 2021.1.20 메일발송 서비스 붙여야함 - jsshin
+
+		return ok(message.getMessage("SUCC_0005"));
+	}
+
 	/**
 	 * 탈퇴회원
 	 * @return ModelAndView

+ 69 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml

@@ -162,6 +162,69 @@
 		WHERE  CUST_NO = #{custNo}
 	</select>
 
+	<!--회원정보 수정-->
+	<update id="updateCustomerInfo" parameterType="Customer">
+		/* TsaCustomer.updateCustomerInfo */
+		UPDATE TB_CUSTOMER
+		<set>
+		    <if test="custGb != null and custGb != ''">
+		     CUST_GB = #{custGb},
+		    </if>
+		    <if test="custGrade != null and custGrade !=''">
+		     CUST_GRADE = #{custGrade},
+		    </if>
+		    <if test="emailAgreeYn != null and emailAgreeYn != ''">
+		     EMAIL_AGREE_DT = CASE WHEN EMAIL_AGREE_YN = #{emailAgreeYn}
+		                      THEN EMAIL_AGREE_DT
+		                      ELSE NOW()
+		                      END,
+		     EMAIL_AGREE_YN = #{emailAgreeYn},
+		    </if>
+		    <if test="smsAgreeYn != null and smsAgreeYn != ''">
+		     SMS_AGREE_DT = CASE WHEN SMS_AGREE_YN = #{smsAgreeYn}
+		                    THEN SMS_AGREE_DT
+		                    ELSE NOW()
+		                    END,
+		     SMS_AGREE_YN = #{smsAgreeYn},
+		    </if>
+		    <if test="homePostNo != null and homePostNo != ''">
+		     HOME_POST_NO = #{homePostNo},
+		    </if>
+		    <if test="homeBaseAddr != null and homeBaseAddr != ''">
+		     HOME_BASE_ADDR = #{homeBaseAddr},
+		    </if>
+		    <if test="homeDtlAddr != null and homeDtlAddr != ''">
+		     HOME_DTL_ADDR = #{homeDtlAddr},
+		    </if>
+		    <if test="birthYmd != null and birthYmd != ''">
+		     BIRTH_YMD = REPLACE(#{birthYmd}, '-', ''),
+		    </if>
+		    <if test="cellPhnno != null and cellPhnno != ''">
+		     CELL_PHNNO = #{cellPhnno},
+		    </if>
+		    <if test="email != null and email != ''">
+		     EMAIL = #{email},
+		    </if>
+		    <if test="managedRsn != null and managedRsn != ''">
+		     MANAGED_DT = CASE WHEN MANAGED_RSN = #{managedRsn}
+		                       AND  MANAGED_DTL_RSN = #{managedDtlRsn}
+		                  THEN MANAGED_DT
+		                  ELSE NOW()
+		                  END,
+		     MANAGED_RSN = #{managedRsn},
+		     MANAGED_DTL_RSN = #{managedDtlRsn},
+		    </if>
+		    <if test="managedRsn == null or managedRsn == ''">
+		     MANAGED_RSN = NULL,
+		     MANAGED_DTL_RSN =  NULL,
+		     MANAGED_DT = NULL,
+		    </if>
+		     UPD_NO = #{updNo},
+		     UPD_DT = NOW()
+		</set>
+		WHERE CUST_NO = #{custNo}
+	</update>
+
 	<!-- 탈퇴회원목록 -->
 	<select id="getCustomerSecedeList" parameterType="CustomerSearch" resultType="Customer">
 		/* TsaCustomer.getSecedeCustomerList */
@@ -328,4 +391,10 @@
 		</if>
 	</select>
 
+	<insert id="createException">
+		/* TsaCustomer.createException */
+		INSERT INTO TB_CUSTOMER (CUST_NO)
+		VALUES (NULL)
+	</insert>
+
 </mapper>

Fichier diff supprimé car celui-ci est trop grand
+ 434 - 478
src/main/webapp/WEB-INF/views/customer/CustomerDetailForm.html


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff