Explorar el Código

임시저장, 답변완료 시 "답변완료" 상태가 아닐 때만 처리되도록 로직 추가

gagamel hace 4 años
padre
commit
88623fbaa8

+ 4 - 2
src/main/java/com/style24/admin/biz/dao/TsaCounselDao.java

@@ -55,18 +55,20 @@ public interface TsaCounselDao {
 	/**
 	 * 문의 답변 임시 저장
 	 * @param counsel - 상담정보
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2021. 9. 24
 	 */
-	void updateQnaAnswerTemp(Counsel counsel);
+	int updateQnaAnswerTemp(Counsel counsel);
 
 	/**
 	 * 문의 답변 저장
 	 * @param counsel - 상담정보
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2020. 12. 24
 	 */
-	void updateQnaAnswer(Counsel counsel);
+	int updateQnaAnswer(Counsel counsel);
 
 	/**
 	 * 상품문의 목록

+ 6 - 4
src/main/java/com/style24/admin/biz/service/TsaCounselService.java

@@ -89,23 +89,25 @@ public class TsaCounselService {
 	/**
 	 * 문의 답변 임시 저장
 	 * @param counsel - 상담정보
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2021. 9. 24
 	 */
 	@Transactional("shopTxnManager")
-	public void updateQnaAnswerTemp(Counsel counsel) {
-		counselDao.updateQnaAnswerTemp(counsel);
+	public int updateQnaAnswerTemp(Counsel counsel) {
+		return counselDao.updateQnaAnswerTemp(counsel);
 	}
 
 	/**
 	 * 문의 답변 저장
 	 * @param counsel - 상담정보
+	 * @return 처리건수
 	 * @author gagamel
 	 * @since 2020. 12. 24
 	 */
 	@Transactional("shopTxnManager")
-	public void updateQnaAnswer(Counsel counsel) {
-		counselDao.updateQnaAnswer(counsel);
+	public int updateQnaAnswer(Counsel counsel) {
+		return counselDao.updateQnaAnswer(counsel);
 	}
 
 	/**

+ 13 - 6
src/main/java/com/style24/admin/biz/web/TsaCustomerController.java

@@ -221,7 +221,10 @@ public class TsaCustomerController extends TsaBaseController {
 		counsel.setAnsNo(TsaSession.getInfo().getUserNo());
 		counsel.setUpdNo(TsaSession.getInfo().getUserNo());
 
-		counselService.updateQnaAnswerTemp(counsel);
+		int result = counselService.updateQnaAnswerTemp(counsel);
+		if (result == 0) {
+			throw new IllegalStateException("이미 답변저장 처리를 하셨습니다. 다시 확인해 주세요.");
+		}
 
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
@@ -239,7 +242,10 @@ public class TsaCustomerController extends TsaBaseController {
 		counsel.setAnsNo(TsaSession.getInfo().getUserNo());
 		counsel.setUpdNo(TsaSession.getInfo().getUserNo());
 
-		counselService.updateQnaAnswer(counsel);
+		int result = counselService.updateQnaAnswer(counsel);
+		if (result == 0) {
+			throw new IllegalStateException("이미 답변저장 처리를 하셨습니다. 다시 확인해 주세요.");
+		}
 
 		// 고객이 알림톡답변수신을 요청했을 때
 		if (counsel.getSmsReqYn().equals("Y")) {
@@ -260,6 +266,7 @@ public class TsaCustomerController extends TsaBaseController {
 				// Do nothing
 			}
 		}
+
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
 
@@ -910,13 +917,13 @@ public class TsaCustomerController extends TsaBaseController {
 		customerSearch.setRegNo(TsaSession.getInfo().getUserNo());
 		customerSearch.setPageable(new TscPageRequest(customerSearch.getPageNo() - 1, customerSearch.getPageSize()));
 		customerSearch.getPageable().setTotalCount(customerService.getCustomerOrderListCount(customerSearch));
-		
+
 		result.set("pageing", customerSearch);
-		
+
 		Collection<Order> customerOrderList = customerService.getCustomerOrderList(customerSearch);
-		
+
 		result.set("custOrderList", customerOrderList);
-		
+
 		return result;
 	}
 

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

@@ -204,6 +204,7 @@
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()
 		WHERE  COUNSEL_SQ = #{counselSq}
+		AND    ANS_STAT != 'G060_20' /*답변완료가 아닐때*/
 	</update>
 	
 	<!--문의 답변 저장 -->
@@ -220,6 +221,7 @@
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()
 		WHERE  COUNSEL_SQ = #{counselSq}
+		AND    ANS_STAT != 'G060_20' /*답변완료가 아닐때*/
 	</update>
 	
 	<!-- 상품문의 목록 -->