Fix: review 충돌 에러 해결
This commit is contained in:
parent
7deb2ce39d
commit
0d8b4d177c
@ -185,16 +185,14 @@ public class ExternalReviewEventHubAdapter {
|
|||||||
*/
|
*/
|
||||||
private Review saveExternalReview(Long storeId, String platform, Map<String, Object> reviewData) {
|
private Review saveExternalReview(Long storeId, String platform, Map<String, Object> reviewData) {
|
||||||
try {
|
try {
|
||||||
// ✅ 1. 중복 체크용 고유 식별자 생성
|
|
||||||
String externalNickname = createMemberNickname(platform, reviewData);
|
|
||||||
String content = extractContent(reviewData);
|
String content = extractContent(reviewData);
|
||||||
|
|
||||||
// ✅ 2. 중복 체크 (storeId + 닉네임 + 내용으로 중복 판단)
|
boolean isDuplicate = reviewJpaRepository.existsByStoreIdAndContent(
|
||||||
boolean isDuplicate = reviewJpaRepository.existsByStoreIdAndMemberNicknameAndContent(
|
storeId, content);
|
||||||
storeId, externalNickname, content);
|
|
||||||
|
|
||||||
if (isDuplicate) {
|
if (isDuplicate) {
|
||||||
log.debug("중복 리뷰 스킵: storeId={}, nickname={}", storeId, externalNickname);
|
log.debug("중복 리뷰 스킵: storeId={}, nickname={}", storeId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,12 +35,12 @@ public interface ReviewJpaRepository extends JpaRepository<ReviewEntity, Long> {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 중복 리뷰 체크 (매장ID + 닉네임 + 내용으로 판단)
|
* ✅ 수정: 매장ID + 내용으로 중복 리뷰 체크
|
||||||
*/
|
*/
|
||||||
boolean existsByStoreIdAndMemberNicknameAndContent(Long storeId, String memberNickname, String content);
|
boolean existsByStoreIdAndContent(Long storeId, String content);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 대안: 외부 닉네임으로만 중복 체크 (더 간단한 방법)
|
* 대안: 외부 닉네임으로만 중복 체크 (더 간단한 방법)
|
||||||
*/
|
*/
|
||||||
boolean existsByStoreIdAndExternalNickname(Long storeId, String externalNickname);
|
// boolean existsByStoreIdAndExternalNickname(Long storeId, String externalNickname);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user