Просмотр исходного кода

SMS수신거부, 메일수신거부 처리 로직 수정

gagamel 5 лет назад
Родитель
Сommit
997dbf2162

+ 4 - 2
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -182,17 +182,19 @@ public interface TsfCustomerDao {
 	/**
 	 * SMS수신거부 처리
 	 * @param custNo - 고객번호
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2021. 5. 11
 	 */
-	void updateSmsReceptionRefuse(Integer custNo);
+	int updateSmsReceptionRefuse(Integer custNo);
 
 	/**
 	 * 메일수신거부 처리
 	 * @param custNo - 고객번호
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2021. 5. 11
 	 */
-	void updateEmailReceptionRefuse(Integer custNo);
+	int updateEmailReceptionRefuse(Integer custNo);
 
 }

+ 28 - 12
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -999,15 +999,23 @@ public class TsfCustomerService {
 	 * @author gagamel
 	 * @since 2021. 5. 11
 	 */
+	@Transactional("shopTxnManager")
 	public void updateSmsReceptionRefuse(Integer custNo) {
 		// 수신거부 처리
-		customerDao.updateSmsReceptionRefuse(custNo);
+		int result = customerDao.updateSmsReceptionRefuse(custNo);
 
-		// 고객이력 생성
-		Customer customer = new Customer();
-		customer.setCustNo(custNo);
-		customer.setRegNo(custNo);
-		coreCustomerService.createCustomerHistory(customer);
+		if (result > 0) {
+			Customer customer = new Customer();
+			customer.setCustNo(custNo);
+			customer.setSmsAgreeYn("N");
+			customer.setRegNo(custNo);
+
+			// 마케팅수신동의이력 생성
+			coreCustomerService.createCustomerMarketHst(customer);
+
+			// 고객이력 생성
+			coreCustomerService.createCustomerHistory(customer);
+		}
 	}
 
 	/**
@@ -1016,15 +1024,23 @@ public class TsfCustomerService {
 	 * @author gagamel
 	 * @since 2021. 5. 11
 	 */
+	@Transactional("shopTxnManager")
 	public void updateEmailReceptionRefuse(Integer custNo) {
 		// 수신거부 처리
-		customerDao.updateEmailReceptionRefuse(custNo);
+		int result = customerDao.updateEmailReceptionRefuse(custNo);
 
-		// 고객이력 생성
-		Customer customer = new Customer();
-		customer.setCustNo(custNo);
-		customer.setRegNo(custNo);
-		coreCustomerService.createCustomerHistory(customer);
+		if (result > 0) {
+			Customer customer = new Customer();
+			customer.setCustNo(custNo);
+			customer.setEmailAgreeYn("N");
+			customer.setRegNo(custNo);
+
+			// 마케팅수신동의이력 생성
+			coreCustomerService.createCustomerMarketHst(customer);
+
+			// 고객이력 생성
+			coreCustomerService.createCustomerHistory(customer);
+		}
 	}
 
 }

+ 2 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -664,6 +664,7 @@
 		     , UPD_NO = #{custNo}
 		     , UPD_DT = NOW()
 		WHERE  CUST_NO = #{custNo}
+		AND    SMS_AGREE_YN = 'Y' /*현재수신동의인경우*/
 	</update>
 	
 	<!-- 메일수신거부 처리 -->
@@ -675,6 +676,7 @@
 		     , UPD_NO = #{custNo}
 		     , UPD_DT = NOW()
 		WHERE  CUST_NO = #{custNo}
+		AND    EMAIL_AGREE_YN = 'Y' /*현재수신동의인경우*/
 	</update>
 
 </mapper>