Conversation
Summary of ChangesHello @hodoon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자의 금융 거래 내역을 통합 관리하는 가계부 기능을 전면적으로 도입합니다. 은행 및 카드 거래 데이터를 자동으로 수집, 분류하고, 중복을 제거하여 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 가계부 API의 배치 처리 로직을 구현하는 것을 목표로 합니다. 전반적으로 JDBC batchUpdate를 사용한 대량 데이터 처리, 중복 데이터 방지를 위한 정교한 매칭 로직 등 좋은 시도들이 보입니다. 코드 리뷰에서는 주로 데이터 처리 로직의 정확성, 성능 최적화, 코드의 일관성 및 가독성 개선에 중점을 두었습니다. 몇 가지 제안 사항은 다음과 같습니다:
- 카드 결제 취소 거래 유형을
INCOME대신REFUND로 명확히 하여 금액 계산 오류를 수정 - 동기화 요청 파라미터 검증 로직의 버그 수정
- 불필요한 데이터베이스 조회 제거를 통한 성능 개선
- 코드 중복 제거 및 캡슐화 강화
이러한 부분들을 개선하면 더 안정적이고 효율적인 시스템이 될 것입니다.
I am having trouble creating individual review comments. Click here to see my feedback.
src/main/java/org/umc/valuedi/domain/ledger/service/command/LedgerSyncService.java (83)
요청 파라미터 검증 로직에 버그가 있습니다. 현재 로직 (A && B) || C는 yearMonth가 제공된 경우에도 toDate가 없으면 예외를 발생시킵니다. yearMonth 또는 fromDate 둘 중 하나는 필수로 제공되어야 한다는 의도를 반영하도록 수정하는 것이 좋습니다.
if (ObjectUtils.isEmpty(request.getYearMonth()) && ObjectUtils.isEmpty(request.getFromDate())) {
src/main/java/org/umc/valuedi/domain/ledger/service/command/LedgerSyncService.java (183)
카드 결제 취소 시 transactionType을 INCOME으로 설정하고 있습니다. 이는 개념적으로 혼란을 줄 수 있으며, LedgerQueryRepository의 getCardAmountExpression 메서드에서 지출 계산 시 해당 내역이 누락되는 버그를 유발합니다. TransactionType.REFUND를 사용하여 취소/환불임을 명확히 하고, 관련 계산 로직이 올바르게 동작하도록 수정해야 합니다.
transactionType = TransactionType.REFUND;
src/main/java/org/umc/valuedi/domain/ledger/controller/LedgerController.java (65)
성공 메시지가 하드코딩되어 있습니다. LedgerSuccessCode에 이미 메시지가 정의되어 있으므로, 이를 활용하여 중복을 제거하고 일관성을 유지하는 것이 좋습니다.
return ApiResponse.onSuccess(LedgerSuccessCode.LEDGER_SYNC_SUCCESS, LedgerSuccessCode.LEDGER_SYNC_SUCCESS.getMessage());
src/main/java/org/umc/valuedi/domain/ledger/converter/LedgerConverter.java (27-33)
이 if-else-if 블록은 불필요해 보입니다. type 변수는 이미 24번째 줄에서 entry.getTransactionType()으로 초기화되었고, 이 블록은 같은 값을 다시 할당하고 있습니다. 이 코드를 제거하여 가독성을 높일 수 있습니다.
src/main/java/org/umc/valuedi/domain/ledger/exception/code/LedgerErrorCode.java (14)
오류 메시지에 오타가 있습니다. 닫는 괄호 )가 빠졌습니다.
INVALID_SYNC_REQUEST(HttpStatus.BAD_REQUEST, "LEDGER400_1","동기화 요청 파라미터가 잘못되었습니다. (yearMonth 또는 fromDate/toDate 필수)"),
src/main/java/org/umc/valuedi/domain/ledger/service/command/LedgerSyncService.java (127)
여기서 syncCardApprovals를 호출하고 있는데, 이 메서드 내부에서 다시 cardApprovalRepository.findByUsedDateBetween(from, to)를 호출하여 데이터베이스 조회를 수행합니다. 이미 121번째 줄에서 필요한 데이터를 버퍼를 포함하여 조회했으므로, 이 데이터를 필터링하여 syncCardApprovals에 전달하면 불필요한 데이터베이스 조회를 줄일 수 있습니다. 성능 향상을 위해 리팩토링을 고려해 보세요.
src/main/java/org/umc/valuedi/domain/ledger/service/command/LedgerSyncService.java (198)
syncBankTransactions 메서드는 이 클래스 내부에서만 사용되므로 private으로 선언하여 캡슐화를 강화하는 것이 좋습니다.
private void syncBankTransactions(
src/main/java/org/umc/valuedi/domain/ledger/service/query/LedgerQueryService.java (50-54)
서비스 레이어에서 응답 DTO 객체의 상태를 변경하는 것은 부작용을 유발할 수 있어 좋은 설계가 아닐 수 있습니다. CategoryStatResponse에 percentage 필드를 설정하기 위해 setter를 사용하고 있는데, DTO를 불변(immutable) 객체로 만들고, 스트림의 map 연산을 사용하여 계산된 percentage를 포함하는 새로운 DTO를 생성하여 반환하는 방식을 고려해 보세요. 이렇게 하면 코드의 예측 가능성과 안정성을 높일 수 있습니다.
src/main/java/org/umc/valuedi/domain/ledger/repository/LedgerEntryJdbcRepository.java
Show resolved
Hide resolved
src/main/java/org/umc/valuedi/domain/ledger/service/command/LedgerSyncService.java
Show resolved
Hide resolved
|
고생하셨습니다!! |
🔗 Related Issue
📝 Summary
🔄 Changes
💬 Questions & Review Points
📸 API Test Results (Swagger)
✅ Checklist