Fix : common
This commit is contained in:
parent
cb7c025405
commit
3d0ed4c268
@ -8,4 +8,8 @@ public class ActionPlanNotFoundException extends AnalyticsException {
|
|||||||
public ActionPlanNotFoundException(Long planId) {
|
public ActionPlanNotFoundException(Long planId) {
|
||||||
super("ACTION_PLAN_NOT_FOUND", "실행 계획을 찾을 수 없습니다: " + planId);
|
super("ACTION_PLAN_NOT_FOUND", "실행 계획을 찾을 수 없습니다: " + planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionPlanNotFoundException(String message) {
|
||||||
|
super("ACTION_PLAN_NOT_FOUND", message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package com.ktds.hi.analytics.infra.exception;
|
package com.ktds.hi.analytics.infra.exception;
|
||||||
|
|
||||||
import com.ktds.hi.common.dto.ErrorResponse;
|
import com.ktds.hi.common.dto.ErrorResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.ConstraintViolation;
|
||||||
|
import jakarta.validation.ConstraintViolationException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -11,14 +14,13 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
|
|
||||||
import jakarta.validation.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 글로벌 예외 처리 핸들러
|
* 글로벌 예외 처리 핸들러 (수정 완료)
|
||||||
* 모든 컨트롤러에서 발생하는 예외를 중앙에서 처리
|
* 모든 컨트롤러에서 발생하는 예외를 중앙에서 처리
|
||||||
|
* 새로운 ErrorResponse 필드 구조에 맞게 수정
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
@ -28,16 +30,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 분석 서비스 커스텀 예외 처리
|
* 분석 서비스 커스텀 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(AnalyticsException.class)
|
@ExceptionHandler(AnalyticsException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleAnalyticsException(AnalyticsException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleAnalyticsException(
|
||||||
|
AnalyticsException ex, HttpServletRequest request) {
|
||||||
log.error("Analytics Exception: {}", ex.getMessage(), ex);
|
log.error("Analytics Exception: {}", ex.getMessage(), ex);
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
ex.getErrorCode(),
|
||||||
.status(HttpStatus.BAD_REQUEST.value())
|
ex.getMessage(),
|
||||||
.error("Analytics Error")
|
request.getRequestURI()
|
||||||
.message(ex.getMessage())
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.badRequest().body(errorResponse);
|
return ResponseEntity.badRequest().body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -46,16 +47,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 매장 정보 없음 예외 처리
|
* 매장 정보 없음 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(StoreNotFoundException.class)
|
@ExceptionHandler(StoreNotFoundException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleStoreNotFoundException(StoreNotFoundException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleStoreNotFoundException(
|
||||||
|
StoreNotFoundException ex, HttpServletRequest request) {
|
||||||
log.error("Store Not Found: {}", ex.getMessage());
|
log.error("Store Not Found: {}", ex.getMessage());
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"STORE_NOT_FOUND",
|
||||||
.status(HttpStatus.NOT_FOUND.value())
|
ex.getMessage(),
|
||||||
.error("Store Not Found")
|
request.getRequestURI()
|
||||||
.message(ex.getMessage())
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -64,16 +64,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 실행 계획 없음 예외 처리
|
* 실행 계획 없음 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(ActionPlanNotFoundException.class)
|
@ExceptionHandler(ActionPlanNotFoundException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleActionPlanNotFoundException(ActionPlanNotFoundException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleActionPlanNotFoundException(
|
||||||
|
ActionPlanNotFoundException ex, HttpServletRequest request) {
|
||||||
log.error("Action Plan Not Found: {}", ex.getMessage());
|
log.error("Action Plan Not Found: {}", ex.getMessage());
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"ACTION_PLAN_NOT_FOUND",
|
||||||
.status(HttpStatus.NOT_FOUND.value())
|
ex.getMessage(),
|
||||||
.error("Action Plan Not Found")
|
request.getRequestURI()
|
||||||
.message(ex.getMessage())
|
);
|
||||||
.path("/api/action-plans")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -82,16 +81,15 @@ public class GlobalExceptionHandler {
|
|||||||
* AI 서비스 예외 처리
|
* AI 서비스 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(AIServiceException.class)
|
@ExceptionHandler(AIServiceException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleAIServiceException(AIServiceException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleAIServiceException(
|
||||||
|
AIServiceException ex, HttpServletRequest request) {
|
||||||
log.error("AI Service Exception: {}", ex.getMessage(), ex);
|
log.error("AI Service Exception: {}", ex.getMessage(), ex);
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"AI_SERVICE_ERROR",
|
||||||
.status(HttpStatus.SERVICE_UNAVAILABLE.value())
|
"AI 서비스 연동 중 오류가 발생했습니다.",
|
||||||
.error("AI Service Error")
|
request.getRequestURI()
|
||||||
.message("AI 서비스 연동 중 오류가 발생했습니다.")
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -100,16 +98,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 외부 서비스 예외 처리
|
* 외부 서비스 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(ExternalServiceException.class)
|
@ExceptionHandler(ExternalServiceException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleExternalServiceException(ExternalServiceException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleExternalServiceException(
|
||||||
|
ExternalServiceException ex, HttpServletRequest request) {
|
||||||
log.error("External Service Exception: {}", ex.getMessage(), ex);
|
log.error("External Service Exception: {}", ex.getMessage(), ex);
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
ex.getErrorCode(),
|
||||||
.status(HttpStatus.SERVICE_UNAVAILABLE.value())
|
"외부 서비스 연동 중 오류가 발생했습니다.",
|
||||||
.error("External Service Error")
|
request.getRequestURI()
|
||||||
.message("외부 서비스 연동 중 오류가 발생했습니다.")
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -118,20 +115,25 @@ public class GlobalExceptionHandler {
|
|||||||
* 입력 값 검증 예외 처리
|
* 입력 값 검증 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleValidationException(MethodArgumentNotValidException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleValidationException(
|
||||||
|
MethodArgumentNotValidException ex, HttpServletRequest request) {
|
||||||
log.error("Validation Exception: {}", ex.getMessage());
|
log.error("Validation Exception: {}", ex.getMessage());
|
||||||
|
|
||||||
String errorMessage = ex.getBindingResult().getFieldErrors().stream()
|
List<ErrorResponse.ValidationError> validationErrors = ex.getBindingResult()
|
||||||
.map(FieldError::getDefaultMessage)
|
.getFieldErrors()
|
||||||
.collect(Collectors.joining(", "));
|
.stream()
|
||||||
|
.map(error -> ErrorResponse.ValidationError.builder()
|
||||||
|
.field(error.getField())
|
||||||
|
.rejectedValue(error.getRejectedValue())
|
||||||
|
.message(error.getDefaultMessage())
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.ofValidation(
|
||||||
.timestamp(LocalDateTime.now())
|
"입력값 검증 실패",
|
||||||
.status(HttpStatus.BAD_REQUEST.value())
|
request.getRequestURI(),
|
||||||
.error("Validation Error")
|
validationErrors
|
||||||
.message(errorMessage)
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.badRequest().body(errorResponse);
|
return ResponseEntity.badRequest().body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -140,20 +142,24 @@ public class GlobalExceptionHandler {
|
|||||||
* 바인딩 예외 처리
|
* 바인딩 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(BindException.class)
|
@ExceptionHandler(BindException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleBindException(BindException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleBindException(
|
||||||
|
BindException ex, HttpServletRequest request) {
|
||||||
log.error("Bind Exception: {}", ex.getMessage());
|
log.error("Bind Exception: {}", ex.getMessage());
|
||||||
|
|
||||||
String errorMessage = ex.getFieldErrors().stream()
|
List<ErrorResponse.ValidationError> validationErrors = ex.getFieldErrors()
|
||||||
.map(FieldError::getDefaultMessage)
|
.stream()
|
||||||
.collect(Collectors.joining(", "));
|
.map(error -> ErrorResponse.ValidationError.builder()
|
||||||
|
.field(error.getField())
|
||||||
|
.rejectedValue(error.getRejectedValue())
|
||||||
|
.message(error.getDefaultMessage())
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.ofValidation(
|
||||||
.timestamp(LocalDateTime.now())
|
"바인딩 실패",
|
||||||
.status(HttpStatus.BAD_REQUEST.value())
|
request.getRequestURI(),
|
||||||
.error("Binding Error")
|
validationErrors
|
||||||
.message(errorMessage)
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.badRequest().body(errorResponse);
|
return ResponseEntity.badRequest().body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -162,20 +168,19 @@ public class GlobalExceptionHandler {
|
|||||||
* 제약 조건 위반 예외 처리
|
* 제약 조건 위반 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(ConstraintViolationException.class)
|
@ExceptionHandler(ConstraintViolationException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleConstraintViolationException(ConstraintViolationException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleConstraintViolationException(
|
||||||
|
ConstraintViolationException ex, HttpServletRequest request) {
|
||||||
log.error("Constraint Violation Exception: {}", ex.getMessage());
|
log.error("Constraint Violation Exception: {}", ex.getMessage());
|
||||||
|
|
||||||
String errorMessage = ex.getConstraintViolations().stream()
|
String errorMessage = ex.getConstraintViolations().stream()
|
||||||
.map(ConstraintViolation::getMessage)
|
.map(ConstraintViolation::getMessage)
|
||||||
.collect(Collectors.joining(", "));
|
.collect(Collectors.joining(", "));
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"CONSTRAINT_VIOLATION",
|
||||||
.status(HttpStatus.BAD_REQUEST.value())
|
errorMessage,
|
||||||
.error("Constraint Violation")
|
request.getRequestURI()
|
||||||
.message(errorMessage)
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.badRequest().body(errorResponse);
|
return ResponseEntity.badRequest().body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -184,16 +189,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 타입 불일치 예외 처리
|
* 타입 불일치 예외 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleTypeMismatchException(MethodArgumentTypeMismatchException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleTypeMismatchException(
|
||||||
|
MethodArgumentTypeMismatchException ex, HttpServletRequest request) {
|
||||||
log.error("Type Mismatch Exception: {}", ex.getMessage());
|
log.error("Type Mismatch Exception: {}", ex.getMessage());
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"TYPE_MISMATCH",
|
||||||
.status(HttpStatus.BAD_REQUEST.value())
|
"잘못된 파라미터 타입입니다: " + ex.getName(),
|
||||||
.error("Type Mismatch")
|
request.getRequestURI()
|
||||||
.message("잘못된 파라미터 타입입니다: " + ex.getName())
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.badRequest().body(errorResponse);
|
return ResponseEntity.badRequest().body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -202,16 +206,15 @@ public class GlobalExceptionHandler {
|
|||||||
* 일반적인 RuntimeException 처리
|
* 일반적인 RuntimeException 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(RuntimeException.class)
|
@ExceptionHandler(RuntimeException.class)
|
||||||
public ResponseEntity<ErrorResponse> handleRuntimeException(RuntimeException ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleRuntimeException(
|
||||||
|
RuntimeException ex, HttpServletRequest request) {
|
||||||
log.error("Runtime Exception: {}", ex.getMessage(), ex);
|
log.error("Runtime Exception: {}", ex.getMessage(), ex);
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.of(
|
||||||
.timestamp(LocalDateTime.now())
|
"RUNTIME_ERROR",
|
||||||
.status(HttpStatus.INTERNAL_SERVER_ERROR.value())
|
"내부 서버 오류가 발생했습니다.",
|
||||||
.error("Internal Server Error")
|
request.getRequestURI()
|
||||||
.message("내부 서버 오류가 발생했습니다.")
|
);
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
||||||
}
|
}
|
||||||
@ -220,16 +223,13 @@ public class GlobalExceptionHandler {
|
|||||||
* 모든 예외의 최종 처리
|
* 모든 예외의 최종 처리
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseEntity<ErrorResponse> handleAllExceptions(Exception ex) {
|
public ResponseEntity<ErrorResponse<Void>> handleAllExceptions(
|
||||||
|
Exception ex, HttpServletRequest request) {
|
||||||
log.error("Unexpected Exception: {}", ex.getMessage(), ex);
|
log.error("Unexpected Exception: {}", ex.getMessage(), ex);
|
||||||
|
|
||||||
ErrorResponse errorResponse = ErrorResponse.builder()
|
ErrorResponse<Void> errorResponse = ErrorResponse.ofInternalError(
|
||||||
.timestamp(LocalDateTime.now())
|
"예상치 못한 오류가 발생했습니다."
|
||||||
.status(HttpStatus.INTERNAL_SERVER_ERROR.value())
|
);
|
||||||
.error("Unexpected Error")
|
|
||||||
.message("예상치 못한 오류가 발생했습니다.")
|
|
||||||
.path("/api/analytics")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,4 +8,8 @@ public class StoreNotFoundException extends AnalyticsException {
|
|||||||
public StoreNotFoundException(Long storeId) {
|
public StoreNotFoundException(Long storeId) {
|
||||||
super("STORE_NOT_FOUND", "매장을 찾을 수 없습니다: " + storeId);
|
super("STORE_NOT_FOUND", "매장을 찾을 수 없습니다: " + storeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StoreNotFoundException(String message) {
|
||||||
|
super("STORE_NOT_FOUND", message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.ktds.hi.analytics.infra.gateway;
|
package com.ktds.hi.analytics.infra.gateway;
|
||||||
|
|
||||||
|
import static com.azure.ai.textanalytics.models.TextSentiment.*;
|
||||||
|
|
||||||
import com.azure.ai.textanalytics.TextAnalyticsClient;
|
import com.azure.ai.textanalytics.TextAnalyticsClient;
|
||||||
import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
|
import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
|
||||||
import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
|
import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
|
||||||
import com.azure.ai.textanalytics.models.DocumentSentiment;
|
import com.azure.ai.textanalytics.models.DocumentSentiment;
|
||||||
|
import com.azure.ai.textanalytics.models.TextSentiment;
|
||||||
import com.azure.core.credential.AzureKeyCredential;
|
import com.azure.core.credential.AzureKeyCredential;
|
||||||
import com.ktds.hi.analytics.biz.domain.AiFeedback;
|
import com.ktds.hi.analytics.biz.domain.AiFeedback;
|
||||||
import com.ktds.hi.analytics.biz.domain.SentimentType;
|
import com.ktds.hi.analytics.biz.domain.SentimentType;
|
||||||
@ -97,16 +100,19 @@ public class AIServiceAdapter implements AIServicePort {
|
|||||||
@Override
|
@Override
|
||||||
public SentimentType analyzeSentiment(String content) {
|
public SentimentType analyzeSentiment(String content) {
|
||||||
try {
|
try {
|
||||||
AnalyzeSentimentResult result = textAnalyticsClient.analyzeSentiment(content);
|
DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment(content);
|
||||||
DocumentSentiment sentiment = result.getDocumentSentiment();
|
TextSentiment sentiment = documentSentiment.getSentiment();
|
||||||
|
|
||||||
switch (sentiment) {
|
if (sentiment == TextSentiment.POSITIVE) {
|
||||||
case POSITIVE:
|
return SentimentType.POSITIVE;
|
||||||
return SentimentType.POSITIVE;
|
} else if (sentiment == TextSentiment.NEGATIVE) {
|
||||||
case NEGATIVE:
|
return SentimentType.NEGATIVE;
|
||||||
return SentimentType.NEGATIVE;
|
} else if (sentiment == TextSentiment.NEUTRAL) {
|
||||||
default:
|
return SentimentType.NEUTRAL;
|
||||||
return SentimentType.NEUTRAL;
|
} else if (sentiment == TextSentiment.MIXED) {
|
||||||
|
return SentimentType.NEUTRAL; // MIXED는 NEUTRAL로 처리
|
||||||
|
} else {
|
||||||
|
return SentimentType.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -31,7 +31,7 @@ import java.util.concurrent.Executors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class EventHubAdapter implements EventPort {
|
public class EventHubAdapter {
|
||||||
|
|
||||||
@Qualifier("reviewEventConsumer")
|
@Qualifier("reviewEventConsumer")
|
||||||
private final EventHubConsumerClient reviewEventConsumer;
|
private final EventHubConsumerClient reviewEventConsumer;
|
||||||
@ -61,7 +61,6 @@ public class EventHubAdapter implements EventPort {
|
|||||||
aiAnalysisEventProducer.close();
|
aiAnalysisEventProducer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void publishAnalysisCompletedEvent(Long storeId, AnalysisType analysisType) {
|
public void publishAnalysisCompletedEvent(Long storeId, AnalysisType analysisType) {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> eventData = new HashMap<>();
|
Map<String, Object> eventData = new HashMap<>();
|
||||||
@ -84,7 +83,7 @@ public class EventHubAdapter implements EventPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void publishActionPlanCreatedEvent(ActionPlan actionPlan) {
|
public void publishActionPlanCreatedEvent(ActionPlan actionPlan) {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> eventData = new HashMap<>();
|
Map<String, Object> eventData = new HashMap<>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user