Skip to content

[BE] 매출 지표 response dto 필드 추가#298

Merged
22DT merged 11 commits intodevelopfrom
feature/#282-be-add-metrics-dto-field
Feb 18, 2026
Merged

[BE] 매출 지표 response dto 필드 추가#298
22DT merged 11 commits intodevelopfrom
feature/#282-be-add-metrics-dto-field

Conversation

@22DT
Copy link
Collaborator

@22DT 22DT commented Feb 17, 2026

#️⃣ 변경 사항

이번 PR에서는 분석 대시보드 및 상세 페이지의 데이터 정확도를 높이고, 사용자에게 더 풍부한 분석 지표를 제공하기 위해 피크타임 분석 로직 고도화, 식자재 등록 상태 확인 필드 추가, 그리고 주문 수단 도메인 확장을 진행했습니다.

#️⃣ 작업 상세 내용

1. 피크타임 분석 기능 고도화 및 DTO 개선

  • 평균 데이터 산출 로직 수정: 비교 기간(최근 4주 등)의 피크타임을 단순히 합계가 아닌 운영 주차(operatingWeeks)로 나눈 평균값으로 계산하도록 로직을 변경했습니다.
  • 데이터 타입 변경: 평균 주문 건수 및 실매출을 정확하게 표현하기 위해 long 타입을 Double 타입으로 변경했습니다. (PeakTimeItem, DashboardPeakTimeResponse)
  • 상세 분석 지표 추가: DetailPeakTimeResponse에 오늘 데이터뿐만 아니라 비교 기간 데이터(week4Items), 피크 시간대 이동 방향(shiftDirection), 피크 시간 차이(diff) 등의 필드를 추가하여 상세한 비교 분석이 가능하도록 했습니다.
  • Projection 및 쿼리 수정: PeakTimeAvgProjection에 실매출 합계와 운영 주차 카운트 로직을 추가하고, SalesAnalysisRepository의 쿼리를 이에 맞춰 업데이트했습니다.

2. 식자재 소진량 분석 편의성 개선

  • 식자재 등록 유무 필드 추가: IngredientUsageResponsehasIngredient 필드를 추가하여, 매장에 등록된 식재료가 없는 경우 프론트엔드에서 적절한 안내 문구를 노출할 수 있도록 개선했습니다.
  • 존재 여부 확인 로직: IngredientRepositoryexistsIngredientsByStoreId 쿼리를 추가하여 효율적으로 등록 여부를 확인합니다.

3. 주문 채널 도메인 확장

  • 기타(ETC) 채널 추가: OrderChannel Enum에 ETC("기타") 타입을 추가하여 기존 채널(POS, KIOSK, 배달앱) 외의 유입 경로에 대응할 수 있도록 했습니다.

4. 코드 안정성 및 예외 처리

  • 빈 데이터 슬롯 처리: 특정 시간대에 데이터가 없는 경우 0으로 강제 할당하던 방식에서, 데이터 존재 여부를 명확히 하기 위해 null 처리가 가능하도록 로직을 보완했습니다.
  • 피크 타임 비교 로직 최적화: 현재 시간이 비교 대상 피크 시간보다 이전인지 여부(beforeComparisonPeak)를 판단하는 유틸리티 로직을 PeakTimeProcessor에 구현했습니다.

#️⃣ 관련 이슈

📸 스크린샷 (선택)

변경 전

변경 후

📎 참고할만한 자료 (선택)

@22DT 22DT linked an issue Feb 17, 2026 that may be closed by this pull request
1 task
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@22DT 22DT self-assigned this Feb 17, 2026
@22DT 22DT requested a review from jho7535 February 17, 2026 07:15
@22DT 22DT added ✨ feat 새로운 기능이나 서비스 로직을 추가합니다. ♻️ refactor 기능 변화 없이 내부 코드 구조를 개선합니다. labels Feb 17, 2026
Copy link
Collaborator

@jho7535 jho7535 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

Comment on lines +9 to +10
double orderCount, // 주문 건수
double netAmount, // 실매출
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4: long에서 double로 변경한 이유가 있을까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

평균을 보내줘야 해서 double로 수정했습니다!

@22DT 22DT merged commit 42ec17f into develop Feb 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat 새로운 기능이나 서비스 로직을 추가합니다. ♻️ refactor 기능 변화 없이 내부 코드 구조를 개선합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BE] 4-2-5. 매출 지표 response dto 필드 추가

2 participants