Skip to content

Refactor: 날짜별 매출 조회 기능 구현 및 주점 랭킹 내 주문 건수 필드 추가#144

Merged
Jjiggu merged 3 commits into
developfrom
refactor/#141-Store-sales
Jul 22, 2025
Merged

Refactor: 날짜별 매출 조회 기능 구현 및 주점 랭킹 내 주문 건수 필드 추가#144
Jjiggu merged 3 commits into
developfrom
refactor/#141-Store-sales

Conversation

@Jjiggu

@Jjiggu Jjiggu commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

작업 요약

날짜별 매출 조회 기능 구현 및 주점 랭킹 내 주문 건수 필드 추가

Issue Link

#141

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 매장별 매출 합계 조회 시 특정 날짜를 지정할 수 있는 기능이 추가되었습니다.
    • 매장 순위 정보에 주문 건수(orderCount) 항목이 추가되었습니다.
  • 버그 수정

    • 매출 데이터가 모두 0인 경우, 해당 날짜에 매출 데이터가 없음을 안내하는 메시지가 표시됩니다.
  • 개선 사항

    • 매장 순위 갱신 스케줄이 30초마다에서 5분마다로 변경되었습니다.
    • 매장별 주문 건수를 한 번에 조회하여 순위 정보에 반영합니다.
  • 문서화

    • 매출 합계 조회 API에 날짜 파라미터 및 동작 방식이 Swagger에 반영되었습니다.

@Jjiggu Jjiggu self-assigned this Jul 22, 2025
@Jjiggu Jjiggu added the refactor 리팩토링 label Jul 22, 2025
@coderabbitai

coderabbitai Bot commented Jul 22, 2025

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

"""

Walkthrough

이번 변경에서는 매장별 매출 합계 조회 기능이 특정 날짜를 기준으로 동작하도록 수정되었으며, 관련 서비스·컨트롤러·레포지토리 계층의 메서드 시그니처가 일괄적으로 변경되었습니다. 또한, 매장 랭킹 DTO에 주문 건수 필드가 추가되고, 랭킹 산출 시 주문 건수 집계 로직이 반영되었습니다. 스케줄러의 실행 주기도 5분마다로 조정되었습니다.

Changes

파일/경로 그룹 변경 요약
.../order/service/OrderService.java getSaleSumByStoreId 메서드가 LocalDate date 파라미터를 추가로 받도록 시그니처 및 내부 호출부 수정
.../statistic/controller/StatisticsController.java /sales 엔드포인트가 date 쿼리 파라미터를 수용, 서비스 호출부 및 Swagger 문서, 0원 데이터 메시지 응답 추가
.../statistic/dto/StoreRankingDto.java orderCount 필드 추가, 생성자 파라미터 및 초기화 코드 수정
.../statistic/scheduler/RankingRefreshScheduler.java 스케줄러 cron 표현식을 30초마다 → 5분마다로 변경
.../statistic/service/impl/RankingServiceImpl.java 랭킹 산출 시 매장별 주문 건수 조회 및 StoreRankingDto에 반영, 관련 주석 수정
.../statistic/dto/OrderSalesSumDetail.java date 필드 추가, 생성자 및 isAllZero() 메서드 추가
.../statistic/repository/StatisticCustomRepository.java findSalesSumByStoreId가 LocalDate 파라미터 추가, findOrderCountByStoreIds 메서드 신규 추가
.../statistic/repository/StatisticCustomRepositoryImpl.java findSalesSumByStoreId가 LocalDate 파라미터 추가 및 쿼리 로직 수정, findOrderCountByStoreIds 신규 구현

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant StatisticsController
    participant OrderService
    participant StatisticCustomRepository

    Client->>StatisticsController: GET /sales?date=YYYY-MM-DD
    StatisticsController->>OrderService: getSaleSumByStoreId(memberDetails, date)
    OrderService->>StatisticCustomRepository: findSalesSumByStoreId(storeId, date)
    StatisticCustomRepository-->>OrderService: OrderSalesSumDetail
    OrderService-->>StatisticsController: OrderSalesSumDetail
    alt 매출 데이터가 모두 0원
        StatisticsController-->>Client: "해당 날짜에 매출 데이터 없음" 메시지
    else
        StatisticsController-->>Client: 매출 데이터 반환
    end
Loading
sequenceDiagram
    participant RankingRefreshScheduler
    participant RankingServiceImpl
    participant StatisticCustomRepository

    RankingRefreshScheduler->>RankingServiceImpl: getStatisticsRankings(memberDetails)
    RankingServiceImpl->>StatisticCustomRepository: findOrderCountByStoreIds(storeIds)
    RankingServiceImpl->>StatisticCustomRepository: (기존) 매장 정보 조회
    RankingServiceImpl-->>RankingRefreshScheduler: StoreRankingDto(orderCount 포함)
Loading

Estimated code review effort

4 (~80분)
"""

Suggested reviewers

  • HyemIin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot requested a review from HyemIin July 22, 2025 10:26
@Jjiggu Jjiggu merged commit e242532 into develop Jul 22, 2025
2 checks passed
@Jjiggu Jjiggu deleted the refactor/#141-Store-sales branch July 23, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant