Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
6ce312b
docs: 핵심 기능 및 구현 기능 목록 정리
Arachneee Nov 9, 2023
2ab22a7
test: 크리스마스 할인 계산 테스트 작성
Arachneee Nov 9, 2023
5148d1c
test: 주문 날짜 생성 테스트 작성
Arachneee Nov 9, 2023
dd073f1
feat: 주문 날짜 생성 기능 구현
Arachneee Nov 9, 2023
e2c41f0
docs: 주문 날짜 생성 기능 구현
Arachneee Nov 9, 2023
0343767
test: 주문 날짜 차이 계산 테스트
Arachneee Nov 9, 2023
7446c16
feat: 주문 날짜 차이 계산 기능
Arachneee Nov 9, 2023
2557ff1
docs: 주문 날짜 차이 계산 기능
Arachneee Nov 9, 2023
fe502fa
test: 주문의 총 금액이 10000원 이상이어야 할인 적용가능
Arachneee Nov 9, 2023
6cc70b8
test: 총 주문 가격 계산 테스트
Arachneee Nov 9, 2023
f7bf2f5
feat: 총 주문 가격 계산 기능 추가
Arachneee Nov 9, 2023
eaf977a
docs: 총 주문 가격 계산 기능 추가
Arachneee Nov 9, 2023
6941daa
feat: 총 금액 10000원 이상 검증 기능 구현
Arachneee Nov 9, 2023
3f34870
test: 주문 날짜가 25일을 넘어가면 할인 적용이 안된다.
Arachneee Nov 9, 2023
679a011
feat: 크리스마스 할인 적용 기능 구현
Arachneee Nov 9, 2023
c7c3bcd
test: 평일에 디저트 메뉴 1개당 2023원 할인 합계를 계산할 수 있다.
Arachneee Nov 9, 2023
724850d
feat: 평일 할인 계산 기능 추가
Arachneee Nov 9, 2023
0e5a39d
docs: 평일 할인 계산 기능 추가
Arachneee Nov 9, 2023
e1dd93d
test: 평일에만 할인이 적용된다.
Arachneee Nov 9, 2023
4ad1a77
test: 주문일자가 주말인지 평일일지 확인할 수 있다.
Arachneee Nov 9, 2023
7ace7f7
feat: 주문일자가 주말인지 확인기능 추가
Arachneee Nov 9, 2023
331faa7
docs: 주문일자가 주말인지 확인기능 추가
Arachneee Nov 9, 2023
9369b1a
feat: 평일에만 할인 적용 기능 추가
Arachneee Nov 9, 2023
03ae550
test: 날짜의 나머지를 계산할 수 있다.
Arachneee Nov 9, 2023
b6aa4b4
test: 주말 계산 기능 위치 이동
Arachneee Nov 9, 2023
46e266c
refactor: WEEK enum으로 평일/주말 계산 기능 분리
Arachneee Nov 9, 2023
a6bed6f
test: display 이름 수정
Arachneee Nov 9, 2023
7363139
style: static import 추가
Arachneee Nov 9, 2023
9f563ca
test: 주말 할인 적용 기능 추가
Arachneee Nov 9, 2023
bdff0dc
feat: 주말 할인 적용 기능 추가
Arachneee Nov 9, 2023
0b0fb5a
docs: 주말 할인 적용 기능 추가
Arachneee Nov 9, 2023
cac8050
test: 특별 할인 테스트 추가
Arachneee Nov 9, 2023
d79d7ae
style: WEEK -> Week 대문자 변경
Arachneee Nov 9, 2023
4a6a5f7
feat: 특별 할인 기능 구현
Arachneee Nov 9, 2023
c72e102
test: rename Special -> Star
Arachneee Nov 9, 2023
14608c5
docs: 특별 할인 기능 구현
Arachneee Nov 9, 2023
af80262
style: rename Discount -> Event
Arachneee Nov 9, 2023
4afb646
refactor: 평일/주말 이벤트 통합
Arachneee Nov 9, 2023
915ed8e
test: 평일/주말 이벤트 통합
Arachneee Nov 9, 2023
1db33fe
feat: 증정 이벤트 구현
Arachneee Nov 9, 2023
ad531b6
test: 증정 이벤트 테스트
Arachneee Nov 9, 2023
96fc0a2
docs: 증정 이벤트 기능 구현
Arachneee Nov 9, 2023
65ee275
feat: 이벤트 제목 get 기능 추가
Arachneee Nov 9, 2023
1140134
refactor: enum 값 재설정
Arachneee Nov 9, 2023
1ab2942
test: rename OrderDay -> Day
Arachneee Nov 9, 2023
dcc86e4
feat: 전체 이벤트 해택 금액 결과 반환 기능 추가
Arachneee Nov 9, 2023
febfab4
docs: 전체 이벤트 해택 금액 결과 반환 기능 추가
Arachneee Nov 9, 2023
1d80e5f
feat: 총 할인 금액 계산
Arachneee Nov 9, 2023
59de3c9
style: title 제거
Arachneee Nov 9, 2023
6065e6d
feat: 최종 결제 금액 계산 기능 구현
Arachneee Nov 9, 2023
ee52cb3
refactor: Events enum으로 변경
Arachneee Nov 9, 2023
fcc1128
docs: 총 해택 금액 계산
Arachneee Nov 9, 2023
980cf07
test: 배지 등급 테스트
Arachneee Nov 9, 2023
52eb133
feat: 배지 등급 계산 기능
Arachneee Nov 9, 2023
aa077d6
style: final 추가
Arachneee Nov 9, 2023
0f2f8e2
docs: 배지 등급 계산 기능 구현
Arachneee Nov 9, 2023
e8955eb
Chore: 패키지 구성 변경
Arachneee Nov 9, 2023
13c8517
style: 변수 명 변경 및 ENUM 타입 변환 위치 변경
Arachneee Nov 10, 2023
98eb8b7
chore: 패키지 구조 변경
Arachneee Nov 10, 2023
e98b479
test: 패키지 구조 변경
Arachneee Nov 10, 2023
8a091b4
feat: Planner 시작 기능 구현
Arachneee Nov 10, 2023
f605a01
rename: Presentation -> Gift 이름 변경
Arachneee Nov 10, 2023
f52a7ef
feat: 중복 메뉴 검증 기능 구현
Arachneee Nov 10, 2023
0f27050
docs: 중복 메뉴 검증 기능 구현
Arachneee Nov 10, 2023
d465eaa
refactor: controller 분리
Arachneee Nov 10, 2023
6e9092c
feat: controller에서 view 전달 Dto 구현
Arachneee Nov 10, 2023
f2934bb
feat: View 출력 기능 구현
Arachneee Nov 10, 2023
d1ccd47
docs: View 출력 기능 구현
Arachneee Nov 10, 2023
33f2f4c
rename: WeekDay -> Weekday
Arachneee Nov 10, 2023
e4d740d
fix: 해택을 받지 않은 내역 출력되는 버그 수정
Arachneee Nov 10, 2023
e967d9a
test: 리펙토링 내역 반영
Arachneee Nov 10, 2023
ad80102
feat: 주문 메뉴 별 숫자 1이상 검증 기능 구현
Arachneee Nov 10, 2023
e342118
docs: 주문 메뉴 별 숫자 1이상 검증 기능 구현
Arachneee Nov 10, 2023
20d301e
style: 불필요 ; 제거
Arachneee Nov 10, 2023
20c90eb
refactor: OrderController 제거 Dto 변환 과정 통합
Arachneee Nov 10, 2023
2efbb8f
rename: result -> discount 이름 변경
Arachneee Nov 10, 2023
c9482cd
style: Dto Builder 패턴 적용
Arachneee Nov 10, 2023
8c167e6
rename: 메소드, 인자 이름 수정
Arachneee Nov 10, 2023
368e026
test: DayOfWeek 테스트 추가
Arachneee Nov 10, 2023
af51be2
test: December 테스트 추가
Arachneee Nov 10, 2023
879bfa7
test: Day, Week 테스트 추가
Arachneee Nov 10, 2023
71c3020
test: Discount 테스트 추가
Arachneee Nov 10, 2023
faf0395
rename: 메소드 명, enum name 변경
Arachneee Nov 10, 2023
0e52ac3
test: 테스트 위치 변경
Arachneee Nov 10, 2023
7c1d6d2
style: Discount equal 메소드 추가
Arachneee Nov 10, 2023
fbe81d8
test: category 테스트 추가
Arachneee Nov 10, 2023
b9767b5
test: 할인 정책 전체 적용 테스트 추가
Arachneee Nov 10, 2023
bb86fd9
test: 메뉴 테스트 추가
Arachneee Nov 10, 2023
86581e3
fix: 중복 메뉴 주문 에러 메시지 버그 수정
Arachneee Nov 10, 2023
80d54eb
test: Map 변환 과정을 수정
Arachneee Nov 10, 2023
8dfe9a1
test: Map 변환 과정을 수정
Arachneee Nov 10, 2023
9fa529c
style: equals hashCode 추가
Arachneee Nov 10, 2023
6db13d9
test: Order 테스트 추가
Arachneee Nov 10, 2023
5f55b68
rename: dto -> response 로 변경
Arachneee Nov 11, 2023
76af671
refactor: Event와 EventType 통합
Arachneee Nov 11, 2023
6ddc0dc
refactor: View의 enum 내부 enum으로 변경
Arachneee Nov 11, 2023
31b02b6
chore: 패키지 구조 변경
Arachneee Nov 11, 2023
0372329
refactor: Service, Repository 구조로 변경
Arachneee Nov 12, 2023
087fcad
fix: 증정 이벤트 적용되지 않은 항목 출력되는 버그 수정
Arachneee Nov 12, 2023
0f7b30f
refactor: 입력 문자 변환 역할 controller로 변경
Arachneee Nov 12, 2023
8088fca
refactor: 중복 메소드 분리
Arachneee Nov 12, 2023
ad5e487
style: 정렬 및 메소드 분리
Arachneee Nov 12, 2023
57b399d
refactor: EventService, EventRepository 추상 클래스 생성
Arachneee Nov 12, 2023
8e47abf
refactor: EventDetailService 생성
Arachneee Nov 12, 2023
7328697
test: 테스트 위치 변경
Arachneee Nov 12, 2023
3c23590
style: 불필요 제네릭 제거
Arachneee Nov 12, 2023
0a1c72b
style: public -> private 변경
Arachneee Nov 12, 2023
c100ff5
test: 입력 컨버터 테스트 작성
Arachneee Nov 12, 2023
8045f2b
test: 불필요 import 제거
Arachneee Nov 12, 2023
c39e581
refactor: 추상메소드 추가
Arachneee Nov 12, 2023
4e7722e
style: 불필요 메소드 제거, 코드 정렬
Arachneee Nov 12, 2023
743c70a
test: 테스트 extracting으로 비교하도록 수정
Arachneee Nov 12, 2023
58ac48a
test: Service 테스트 추가
Arachneee Nov 12, 2023
83592b5
fix: 메뉴 수가 0으로 시작하는 숫자가 통과하는 버그 수정
Arachneee Nov 12, 2023
85b623b
docs: uml 추가
Arachneee Nov 12, 2023
c3947d6
docs: uml 업데이트
Arachneee Nov 12, 2023
0d3c7c9
fix: 12월의 일자 구성이 바뀌는 경우 요일을 찾지 못하는 버그 수정
Arachneee Nov 13, 2023
30cffdf
refactor: Repository를 EnumMap으로 저장하는 방식으로 변경
Arachneee Nov 13, 2023
f98c8f3
test: Repository를 EnumMap으로 저장하는 방식으로 변경
Arachneee Nov 13, 2023
64ab5fa
refactor: Repository 인터페이스 -> 추상클래스로 변경
Arachneee Nov 13, 2023
d11dd5a
style: 인스턴스 변수 상수화
Arachneee Nov 13, 2023
57cc59b
chore: 패키지 변경
Arachneee Nov 13, 2023
d5402f0
refactor: 콘솔 io 분리
Arachneee Nov 13, 2023
efe711c
docs: mvc uml 추가
Arachneee Nov 13, 2023
de27654
style: FunctionalInterface 어노테이션 추가
Arachneee Nov 13, 2023
ec12d45
test: InputView 테스트 추가
Arachneee Nov 13, 2023
af4a309
test: OutputView 테스트 추가
Arachneee Nov 13, 2023
6f71e6b
test: 불필요 테스트 제거
Arachneee Nov 13, 2023
b5b28df
fix: Console close 안되는 버그 수정
Arachneee Nov 13, 2023
4f7e4d1
test: final 추가
Arachneee Nov 13, 2023
fdff529
rename: 메소드명, 클래스명 변경
Arachneee Nov 13, 2023
71cd483
docs: 의존관계도, 클래스 역할 정리
Arachneee Nov 13, 2023
0742c29
test: 불필요 return 제거
Arachneee Nov 13, 2023
76767ed
docs: UML 업데이트
Arachneee Nov 13, 2023
489b2f3
style: final 추가
Arachneee Nov 13, 2023
537fdf3
docs: 핵심 기능 수정
Arachneee Nov 13, 2023
0fabdda
test: 패키지 수정
Arachneee Nov 13, 2023
cab77e2
style: 코드 정렬
Arachneee Nov 13, 2023
f172fed
test: 코드 정렬
Arachneee Nov 13, 2023
ad17865
test: 사용 안하는 import제거
Arachneee Nov 13, 2023
ffbe20f
refactor: 메소드 분리, 메소드명 변경
Arachneee Nov 13, 2023
5c4a7bb
docs: 클래스 역할 설명 수정
Arachneee Nov 13, 2023
9f23ea2
fix: OrderConverter에서 메뉴 영문 입력 불가 버그 수정
Arachneee Nov 13, 2023
f55ebb5
test: Nested 추가
Arachneee Nov 13, 2023
90f640f
fix: 날짜 01, 032 등 0으로 시작하는 입력 받는 버그 수정
Arachneee Nov 13, 2023
8e4ea09
refactor: 문자 -> 숫자 변환 중복 로직 제거
Arachneee Nov 13, 2023
edc51b9
test: OrderController 반복 입력 받기 테스트 추가
Arachneee Nov 13, 2023
930c064
test: final 추가
Arachneee Nov 13, 2023
7bd2adf
chore: 패키지 변경
Arachneee Nov 14, 2023
8255fac
docs: ReadMe 수정
Arachneee Nov 14, 2023
5a93576
refactor: Menu에 static Map 추가
Arachneee Nov 14, 2023
e93de6e
test: Nested 추가
Arachneee Nov 14, 2023
e2904b7
docs: 아이콘 수정
Arachneee Nov 14, 2023
bf4100e
test: 날짜 0으로 시작 문자 입력 예외 테스트 추가
Arachneee Nov 14, 2023
55d15cd
style: static import추가, final 추가
Arachneee Nov 14, 2023
ff7936d
docs: readme 수정
Arachneee Nov 14, 2023
a76f1be
docs: 오타 수정
Arachneee Nov 14, 2023
cec2816
test: 오타 수정
Arachneee Nov 14, 2023
e5ea3f4
rename: 메소드 인자명 수정
Arachneee Nov 14, 2023
48e68f5
docs: UML 수정
Arachneee Nov 14, 2023
2e7aabb
docs: 깨지는 이모티콘 변경
Arachneee Nov 14, 2023
307c23a
docs: 깨지는 이모티콘 변경
Arachneee Nov 14, 2023
47436ea
refactor: DiscountEventType 과 GiftEventType 의 중복 static 메소드 제거
Arachneee Nov 15, 2023
638d9d6
test: DiscountEventType 과 GiftEventType 의 중복 static 메소드 제거
Arachneee Nov 15, 2023
4b589e5
docs: 주요포인트 순서 변경
Arachneee Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
279 changes: 279 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
### 🖥️ 프로그램 소개
주문을 받아서 이벤트 적용 내역을 출력하는 프로그램입니다.

### 💡 핵심 기능
적용 가능한 이벤트 혜택 내역 계산

### 📌 주요 포인트
- 할인 이벤트와 선물 이벤트를 <b>인터페이스</b>와 <b>추상 클래스</b>로 분리와 동시에 공통 로직 통합
- 여러 종류의 이벤트를 <b>Enum</b>과 <b>함수형 인터페이스</b>로 관리
- MVC 패턴에 <b>Service</b>, <b>Repository</b>를 추가하여 역할 분리
- <b>Enum</b>과 <b>EnumMap</b>으로 불필요 클래스 제거 및 통합 관리
- <b>계층형 Dto</b>를 활용한 View와 Domain 의존성 분리

### 📉 런타임 의존관계도
![asso](https://github.com/Arachneee/java-christmas-6-Arachneee/assets/66822642/e94eb329-5991-41f3-9e21-23978a98377e)

### 📊 UML
![promotion_uml](https://github.com/Arachneee/java-christmas-6-Arachneee/assets/66822642/f085deea-f1fc-4475-bf5d-9318d445565e)

### ⚒️ 클래스 역할
<div align="center">
<table>
<tr>
<th align="center">📁 Package</th>
<th align="center">📚 Class</th>
<th align="center">✏️ Description</th>
</tr>
<tr>
<td rowspan="1">🗓️ <b>config</b></td>
<td><b>PlannerConfig</b></td>
<td>의존관계 설정</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="2">⚙️ <b>controller</b></td>
<td><b>OrderController</b></td>
<td>주문 입출력(View), 주문(Service) 연결</td>
</tr>
<tr>
<td><b>OrderConverter</b></td>
<td>View 입력값 Order 인스턴스 변수로 변환</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="2">📐 <b>domain</b><br>&rAarr; order</td>
<td><b>Order</b></td>
<td>주문 일자와 메뉴 수량을 갖는 클래스</td>
</tr>
<tr>
<td><b>Day</b></td>
<td>12월의 일자 원시타입 포장 클래스</td>
</tr>
<tr>
<td rowspan="5"><b>domain</b><br>&rAarr; order<br>&rAarr; constant</td>
<td><b>Category</b></td>
<td>메뉴의 카테고리 Enum</td>
</tr>
<tr>
<td><b>DayOfWeek</b></td>
<td>요일 Enum</td>
</tr>
<tr>
<td><b>December</b></td>
<td>12월 Enum</td>
</tr>
<tr>
<td><b>Menu</b></td>
<td>메뉴 Enum</td>
</tr>
<tr>
<td><b>Week</b></td>
<td>평일/주말 Enum</td>
</tr>
<tr>
<td rowspan="3"><b>domain</b><br>&rAarr; event</td>
<td>📗 <b>Event</b></td>
<td>이벤트 혜택 계산 인터페이스</td>
</tr>
<tr>
<td>📗 <b>EventRepository</b></td>
<td>이벤트 혜택 결과 저장 추상 클래스</td>
</tr>
<tr>
<td><b>Badge</b></td>
<td>배지 Enum</td>
</tr>
<tr>
<td rowspan="2"><b>domain</b><br>&rAarr; event<br>&rAarr; discount</td>
<td>🎁 <b>DiscountEventType</b></td>
<td>Event 인터페이스 구현, 할인 이벤트 통합 관리 Enum</td>
</tr>
<tr>
<td>💾 <b>DiscountRepository</b></td>
<td>EventRepository 구현, 할인 이벤트 결과 EnumMap 저장</td>
</tr>
<tr>
<td rowspan="2"><b>domain</b><br>&rAarr; event<br>&rAarr; gift</td>
<td>🎁 <b>GiftEventType</b></td>
<td>Event 인터페이스 구현, 선물 이벤트 통합 관리 Enum</td>
</tr>
<tr>
<td>💾 <b>GiftRepository</b></td>
<td>EventRepository 구현, 선물 이벤트 결과 EnumMap 저장</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="1">🕹️ <b>service</b><br>&rAarr; order</td>
<td><b>OrderService</b></td>
<td>주문 생성 및 주문 결과 요약</td>
</tr>
<tr>
<td rowspan="4"><b>service</b><br>&rAarr; event</td>
<td><b>EventDetailService</b></td>
<td>이벤트 적용 상세 결과 요약</td>
</tr>
<tr>
<td>📗 <b>EventService</b></td>
<td>이벤트 혜택 결과 계산 추상 클래스</td>
</tr>
<tr>
<td><b>DiscountService</b></td>
<td>EventService 구현, 할인 해택 적용</td>
</tr>
<tr>
<td><b>GiftService</b></td>
<td>EventService 구현, 선물 해택 적용</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="2">⏰ <b>exception</b></td>
<td><b>OrderException</b></td>
<td>주문 생성 예외 발생</td>
</tr>
<tr>
<td><b>ErrorMessage</b></td>
<td>예외 메시지 Enum</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="6">📬 <b>response</b></td>
<td><b>OrderSummaryResponse</b></td>
<td>주문 결과 요약 DTO</td>
</tr>
<tr>
<td><b>OrderResponse</b></td>
<td>주문 항목 DTO</td>
</tr>
<tr>
<td><b>MenuCountResponse</b></td>
<td>주문 메뉴 수량 DTO</td>
</tr>
<tr>
<td><b>EventDetailResponse</b></td>
<td>이벤트 적용 상세 내역 DTO</td>
</tr>
<tr>
<td><b>EventResponse</b></td>
<td>이벤트 적용 내역 DTO</td>
</tr>
<tr>
<td><b>GiftMenuResponse</b></td>
<td>선물 메뉴 수량 DTO</td>
</tr>
<tr><td colspan="3"></td></tr>
<tr>
<td rowspan="4">🖥️ <b>view</b></td>
<td><b>InputView</b></td>
<td>입력 요청 View</td>
</tr>
<tr>
<td><b>OutputView</b></td>
<td>결과 출력 View</td>
</tr>
<tr>
<td>📗 <b>Reader</b></td>
<td>입력 인터페이스</td>
</tr>
<tr>
<td>📗 <b>Writer</b></td>
<td>출력 인터페이스</td>
</tr>
<tr>
<td rowspan="2"><b>view</b><br>&rAarr; io</td>
<td><b>ConsoleReader</b></td>
<td>콘솔 입력</td>
</tr>
<tr>
<td><b>ConsoleWriter</b></td>
<td>콘솔 출력</td>
</tr>


</table>
</div>

<br>

### 🗂️ 구현 기능 목록
#### ⚙️ Controller
- #### OrderController
- [x] 입력 오류시 반복 요청
- #### OrderConverter
- [x] 입력 날짜 숫자 검증
- [x] 입력 날짜 숫자 변환
- [x] 중복 메뉴 검증
- [x] 개수 숫자 검증
- [x] 개수 숫자 변환
- [x] 메뉴 개수 포맷 검증
#### 📐 Domail
- #### Day
- [x] 입력 날짜 범위 검증 (1 ~ 31)
- [x] 날짜 차이 계산
- [x] 날짜 대소비교 기능
- #### Order
- [x] 메뉴 개수 범위 검증 (1이상)
- [x] 총 주문 메뉴 개수 검증 (20이하)
- [x] 음료만 주문 검증
- [x] 카테고리별 수량 계산
- [x] 할인 전 총주문 금액 계산
- #### Menu
- [x] 메뉴 유무 검증
- #### Week
- [x] 평일/주말 구분
- [x] 평일/주말 할인 카테고리 선택
- #### DayOfWeek
- [x] 요일 구분
- #### December
- [x] 크리스마스 확인
- [x] 12월 날짜 확인
- #### DiscountEventType
- [x] 전체 할인 적용 가능 판별
- [x] 전체 할인 이벤트 적용하기
- [x] 총주문 금액 10,000 이상 확인
- [x] 크리스마스 디데이 할인 적용 여부 확인
- [x] 크리스마스 디데이 할인 금액 계산
- [x] 평일/주말 할인 적용 여부 확인
- [x] 평일 할인 적용 금액 계산
- [x] 주말 할인 적용 금액 계산
- [x] 특별 할인 적용 금액 계산
- [x] 특별 할인 적용 여부 확인
- #### GiftEventType
- [x] 전체 선물 이벤트 적용 가능 판별
- [x] 전체 선물 이벤트 적용하기
- [x] 증정 이벤트 적용 여부 확인
- [x] 증정 이벤트 적용 금액 계산
- #### DiscountRepository
- [x] 할인 이벤트 결과 저장
- [x] 할인 이벤트 전체 이익 계산
- #### GiftRepository
- [x] 선물 이벤트 결과 저장
- [x] 선물 이벤트 전체 이익 계산
- [x] 선물 메뉴 항목, 수량 계산
- #### Badge
- [x] 12월 이벤트 배지 등급 계산
#### 🕹️ Service
- #### OrderService
- [x] 주문 내역, 이벤트 적용 내역 요약하기
- #### EventDetailService
- [x] 이벤트 적용 내역 계신
- [x] 총혜택 금액 계산
- [x] 할인 후 예상 결제 금액 계산
- #### DiscountService
- [x] 전체 할인 이벤트 적용하기
- #### GiftService
- [x] 전체 선물 이벤트 적용하기
#### 🖥️ View
- #### InputView
- [x] 방문 날짜 입력 받기
- [x] 메뉴와 개수 입력 받기
- #### OutputView
- [x] Hello 헤더 출력
- [x] 증정 메뉴 출력
- [x] 이벤트 혜택 미리보기 출력
- [x] 주문 메뉴 출력
- [x] 할인 전 총주문 금액 출력
- [x] 혜택 내역 출력
- [x] 총혜택 금액 출력
- [x] 할인 후 예상 결제 금액 출력
- [x] 12월 이벤트 배지 출력
5 changes: 4 additions & 1 deletion src/main/java/christmas/Application.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package christmas;

import static christmas.config.PlannerConfig.orderController;

public class Application {

public static void main(String[] args) {
// TODO: 프로그램 구현
orderController().run();
Comment on lines +3 to +8

Choose a reason for hiding this comment

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

확장성을 고려해서 Config파일로 orderController를 생성하셨군요 이런 방법이 있는 줄 몰랐네요
좋은 지식 배우고갑니다! 👍

}
}
47 changes: 47 additions & 0 deletions src/main/java/christmas/config/PlannerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package christmas.config;

import christmas.controller.OrderController;
import christmas.domain.event.discount.DiscountRepository;
import christmas.domain.event.gift.GiftRepository;
import christmas.service.event.DiscountService;
import christmas.service.event.EventDetailService;
import christmas.service.event.GiftService;
import christmas.service.order.OrderService;
import christmas.view.InputView;
import christmas.view.OutputView;
import christmas.view.io.ConsoleReader;
import christmas.view.io.ConsoleWriter;

public class PlannerConfig {

private PlannerConfig() {
}

public static OrderController orderController() {
return new OrderController(inputView(), outputView(), orderService());
}

Choose a reason for hiding this comment

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

우왓.. Config 파일에서 이런 식으로 객체를 생성하는 방법을 생각지도 못했는데, static 메서드를 사용하니 깔끔하네요..! 👍


private static InputView inputView() {
return new InputView(new ConsoleReader(), new ConsoleWriter());
}

private static OutputView outputView() {
return new OutputView(new ConsoleWriter());
}

private static OrderService orderService() {
return new OrderService(eventDetailService());
}

private static EventDetailService eventDetailService() {
return new EventDetailService(discountService(), giftService());
}

private static DiscountService discountService() {
return new DiscountService(new DiscountRepository());
}

private static GiftService giftService() {
return new GiftService(new GiftRepository());
}
}
55 changes: 55 additions & 0 deletions src/main/java/christmas/controller/OrderController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package christmas.controller;

import christmas.controller.converter.OrderConverter;
import christmas.domain.order.Day;
import christmas.domain.order.Order;
import christmas.response.OrderSummaryResponse;
import christmas.service.order.OrderService;
import christmas.view.InputView;
import christmas.view.OutputView;
import java.util.function.Supplier;

public class OrderController {

private final InputView inputView;
private final OutputView outputView;
private final OrderService orderService;

public OrderController(final InputView inputView, final OutputView outputView, final OrderService orderService) {
this.inputView = inputView;
this.outputView = outputView;
this.orderService = orderService;
}
Copy link

Choose a reason for hiding this comment

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

final을 꼼꼼히 달아주셨네요 👍 이를 통해 예기치 않은 변화로 발생하는 문제를 방지할 수 있겠네요 :)


public void run() {
outputView.printHello();

final Day orderDay = createOrderDay();
final Order order = createOrder(orderDay);

final OrderSummaryResponse orderSummaryResponse = orderService.createOrderSummary(order);

outputView.printOrderSummary(orderSummaryResponse);

inputView.close();
}

private Day createOrderDay() {
return getByRoof(() -> OrderConverter.convertToDay(inputView.readDate()));
}

private Order createOrder(final Day day) {
return getByRoof(() -> Order.of(day, OrderConverter.convertToMenu(inputView.readMenuAndCount())));
}

private <T> T getByRoof(final Supplier<T> method) {
Copy link

Choose a reason for hiding this comment

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

요렇게 함수형 인터페이스 적용하는 것 깔끔합니다!! 👍

Copy link

Choose a reason for hiding this comment

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

이 부분은 재사용성을 고려하여 따로 Util로 빼는 것은 어떨까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

빼는 것도 좋아보입니다.

while (true) {
try {
return method.get();
} catch (IllegalArgumentException illegalArgumentException) {
outputView.printError(illegalArgumentException.getMessage());
}
}
}

}
Loading