-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Step3 pull request #82
base: umanking
Are you sure you want to change the base?
Changes from all commits
d6ed4da
e993690
c85780e
d90d43b
3b4ab4f
7a401cb
a76c968
f641567
b650506
e5bb6a9
1b18873
ba515e2
c427f24
d430573
f0802f7
0d5f61a
1066496
dddfc08
cee64c3
7a372fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ build/ | |
*.iml | ||
*.ipr | ||
out/ | ||
bin/ | ||
|
||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,51 +4,52 @@ | |
- 오프라인 매장인 키친 포스를 구현한다. | ||
|
||
- 상품 (Products) | ||
- [ ] 상품을 등록 한다. | ||
- [ ] 상품은 이름(name)과 가격(price)를 가진다. | ||
- [ ] 상품의 가격이 올바르지 않으면 등록할 수 없다. | ||
- [ ] 상품을 조회 한다. | ||
- [ ] 상품을 등록 할 수 있다. | ||
- [ ] 상품은 이름과 가격으로 구성 된다. | ||
- [ ] 상품의 가격이 올바르지 않으면 등록할 수 없다. | ||
- [ ] 상품 목록을 조회 할 수 있다. | ||
|
||
- 메뉴 그룹 (MenuGroups) | ||
- [ ] 메뉴 그룹을 등록 한다. | ||
- [ ] 메뉴 그룹은 이름(name)를 가진다. | ||
- [ ] 메뉴 그룹들을 조회 한다. | ||
- [ ] 메뉴 그룹을 등록 할 수 있다. | ||
- [ ] 메뉴 그룹은 이름으로 구성 된다. | ||
- [ ] 메뉴 그룹 목록을 조회 할 수 있다. | ||
|
||
- 메뉴 (Menu) | ||
- [ ] 메뉴를 등록 한다. | ||
- [ ] 메뉴는 이름, 가격, 메뉴그룹Id, 메뉴상품들로 구성된다. | ||
- [ ] 메뉴의 가격이 올바르지 않으면 등록할 수 없다. | ||
- [ ] 메뉴에 속한 상품 금액의 합은 메뉴의 가격보다 크거나 같아야 한다 | ||
- [ ] 메뉴 상품은 상품Id, 수량으로 배열 형태로 구성된다. | ||
- [ ] 메뉴를 조회 한다. | ||
- [ ] 메뉴를 등록 할 수 있다. | ||
- [ ] 메뉴의 가격이 올바르지 않으면 등록할 수 없다. | ||
- [ ] 메뉴 그룹이 존재 하지 않으면 등록할 수 없다. | ||
- [ ] 메뉴의 가격이, 메뉴에 속한 상품 금액의 합 보다 크면 안된다. | ||
- [ ] 메뉴를 조회 할 수 있다. | ||
|
||
- 테이블 (Table) | ||
- [ ] 전체 테이블들을 조회한다. | ||
- [ ] 특정 테이블을 비움(empty)로 업데이트 할 수 있다. | ||
- [ ] 비움(empty)로 업데이트할 때는 반드시 주문 상태(OrderStatus)가 COMPLETION 인 경우에 가능하다. | ||
- [ ] 주문 테이블을 등록할 수 있다. | ||
- [ ] 주문 테이블 목록을 조회 할 수 있다. | ||
- [ ] 주문 테이블의 상태를 비움으로 업데이트 할 수 있다. | ||
- [ ] 주문 테이블이 정상값 이어야 한다. | ||
- [ ] 반드시 식사가 끝난 경우에 상태를 비움으로 업데이트 할 수 있다. | ||
- [ ] 특정 테이블의 인원수를 업데이트 한다. | ||
- [ ] 인원수를 업데이트 가능한 조건은 GUEST 숫자값이 정상(0보다 큰)값 이어야 한다. | ||
- [ ] 인원수를 업데이트 가능한 조건은 주문테이블이 빈 상태(empty)가 아니어야 한다. | ||
|
||
|
||
- [ ] 인원수는 정상값만 입력 받는다. | ||
- [ ] 주문 테이블이 반드시 존재해야 인원수 업데이트가 가능하다. | ||
- [ ] 주문 테이블이 비어있는 상태에서는 인원수 업데이트가 불가능 하다. | ||
- 테이블 그룹 (Table Groups) | ||
- [ ] 주문한 테이블을 등록한다. | ||
- [ ] 테이블 등록이 안되는 경우: 주문 테이블이 비어있거나, 2보다 작은 경우 | ||
- [ ] 테이블 등록이 안되는 경우: 파라미터로 넘기는 주문테이블의 사이즈와 DB에서 찾은 사이즈와 같지 않은 경우 | ||
- [ ] 테이블 그룹을 삭제한다. | ||
- [ ] 테이블 그룹을 삭제할때는 반드시 OrderStatus가 COMPLETION 이어야 한다. | ||
- [ ] 테이블 그룹을 만들 수 있다. | ||
- [ ] 주문테이블이 2개 이상인 경우에 만들 수 있다. | ||
- [ ] 주문테이블의 사이즈와 동일해야 만들 수 있다. | ||
- [ ] 테이블 그룹을 삭제 할 수 있다. | ||
- [ ] 주문 상태가 요리중이거나 먹고있으면 삭제 할 수 없다. | ||
|
||
- 주문 (Order) | ||
- [ ] 주문을 등록할 수 있다. | ||
- [ ] 등록할 수 없는 경우: orderLineItems 비어있는 경우 | ||
- [ ] 등록할 수 없는 경우: orderLineItems의 size와 menu의 개수가 일치하지 않는 경우 | ||
- [ ] 등록할 수 없는 경우: 주문테이블 id로 조회했을 때 값이 존재하지 않는 경우 | ||
- [ ] 등록할 수 없는 경우: OrderStatus 값이 COMPLETION 인 경우 | ||
- [ ] 주문은 주문테이블Id, 주문Item들로 구성 된다. | ||
- [ ] 주문Item은 메뉴Id, 수량으로 배열 형태로 구성 된다. | ||
- [ ] 전체 주문을 조회 한다. | ||
- [ ] 주문 상태를 업데이트 한다. | ||
- [ ] 주문 상태는 MEAL, COOKING, COMPLETION 으로 구성된다. | ||
- [ ] 주문을 할 수 있다. | ||
- [ ] 아이템이 존재해야 주문을 할 수 있다. | ||
- [ ] 주문한 아이템의 메뉴 개수와 메뉴DB에서 개수와 동일해야 한다. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래 코멘트에 대해 고민해 봐요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 코드 중심으로 나열했었네요! 수정하겠습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아직 반영되지 않았어요. 확인 부탁드려요. |
||
- [ ] 주문 테이블이 존재해야 한다. | ||
- [ ] 주문을 할때는 주문상태를 COOKING 으로 설정한다. | ||
- [ ] 전체 주문 목록을 조회 할 수 있다. | ||
- [ ] 주문 상태를 업데이트 할 수 있다. | ||
- [ ] 주문 상태는 식사중, 요리중, 식사 완료로 구성 된다. | ||
- [ ] 주문 번호가 반드시 존재해야지 업데이트 가능하다. | ||
- [ ] 주문의 상태가 완료되면 업데이트 할 수 없다. | ||
|
||
## 용어 사전 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
package calculator; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
/** | ||
* @author Geonguk Han | ||
* @since 2020-02-08 | ||
*/ | ||
public class Numbers { | ||
|
||
private List<Number> numbers; | ||
private final List<Number> numbers; | ||
|
||
public Numbers(List<Number> numbers) { | ||
this.numbers = numbers; | ||
public Numbers(final List<Number> numbers) { | ||
this.numbers = new ArrayList<>(numbers); | ||
} | ||
|
||
public int sum() { | ||
return numbers.stream() | ||
.map(number -> number.getValue()) | ||
.reduce(0, Integer::sum); | ||
.reduce(new Number(0), Number::sum) | ||
.getValue(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package kitchenpos.bo; | ||
|
||
import kitchenpos.model.*; | ||
import org.junit.jupiter.api.BeforeAll; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Geonguk Han | ||
* @since 2020-02-15 | ||
*/ | ||
public class Fixtures { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 테스트 픽스처(test fixture) 👍 |
||
|
||
private static final int QUANTITY_ONE = 1; | ||
private static final long PRODUCT_ID = 1L; | ||
private static final long PRODUCT_ID2 = 2L; | ||
private static final long MENU_ID = 1L; | ||
private static final long MENU_GROUP_ID = 1L; | ||
private static final long MENU_GROUP_ID2 = 2L; | ||
private static final long TABLE_GROUP_ID = 1L; | ||
private static final long ORDER_TABLE_ID = 1L; | ||
private static final long ORDER_TABLE_ID2 = 2L; | ||
private static final long ORDER_TABLE_ID3 = 3L; | ||
private static final long SEQ_ID = 1L; | ||
private static final long SEQ_ID2 = 2L; | ||
|
||
public static List<Product> products = Collections.emptyList(); | ||
public static List<MenuGroup> menuGroups = Collections.emptyList(); | ||
public static Menu menu; | ||
public static List<MenuProduct> menuProducts = Collections.emptyList(); | ||
public static List<OrderTable> orderTables = Collections.emptyList(); | ||
public static OrderTable orderTable; | ||
|
||
@BeforeAll | ||
public static void setUp() { | ||
makeProduct(); | ||
makeMenuGroup(); | ||
makeMenu(); | ||
makeMenuProduct(); | ||
makeOrderTable(); | ||
} | ||
|
||
private static void makeProduct() { | ||
final Product product1 = new Product(); | ||
product1.setId(PRODUCT_ID); | ||
product1.setName("짜장면"); | ||
product1.setPrice(BigDecimal.valueOf(6000)); | ||
|
||
final Product product2 = new Product(); | ||
product2.setId(PRODUCT_ID2); | ||
product2.setName("짬봉"); | ||
product2.setPrice(BigDecimal.valueOf(7000)); | ||
|
||
products = Arrays.asList(product1, product2); | ||
} | ||
|
||
private static void makeMenuGroup() { | ||
final MenuGroup menuGroup1 = new MenuGroup(); | ||
menuGroup1.setId(MENU_GROUP_ID); | ||
menuGroup1.setName("면 요리 세트"); | ||
|
||
final MenuGroup menuGroup2 = new MenuGroup(); | ||
menuGroup2.setId(MENU_GROUP_ID2); | ||
menuGroup2.setName("밥 요리 세트"); | ||
|
||
menuGroups = Arrays.asList(menuGroup1, menuGroup2); | ||
} | ||
|
||
private static void makeMenu() { | ||
final Menu newMenu = new Menu(); | ||
newMenu.setId(MENU_ID); | ||
newMenu.setName("메뉴"); | ||
newMenu.setPrice(products.get(0).getPrice().add(products.get(1).getPrice())); | ||
newMenu.setMenuGroupId(menuGroups.get(0).getId()); | ||
|
||
menu = newMenu; | ||
} | ||
|
||
private static void makeMenuProduct() { | ||
final MenuProduct menuProduct1 = new MenuProduct(); | ||
menuProduct1.setSeq(SEQ_ID); | ||
menuProduct1.setMenuId(MENU_ID); | ||
menuProduct1.setProductId(PRODUCT_ID); | ||
menuProduct1.setQuantity(QUANTITY_ONE); | ||
|
||
final MenuProduct menuProduct2 = new MenuProduct(); | ||
menuProduct2.setSeq(SEQ_ID2); | ||
menuProduct2.setMenuId(MENU_ID); | ||
menuProduct2.setProductId(PRODUCT_ID2); | ||
menuProduct2.setQuantity(QUANTITY_ONE); | ||
|
||
menuProducts = Arrays.asList(menuProduct1, menuProduct2); | ||
} | ||
|
||
private static void makeOrderTable() { | ||
final OrderTable newOrderTable1 = new OrderTable(); | ||
newOrderTable1.setId(ORDER_TABLE_ID); | ||
newOrderTable1.setTableGroupId(TABLE_GROUP_ID); | ||
newOrderTable1.setNumberOfGuests(2); | ||
newOrderTable1.setEmpty(false); | ||
|
||
orderTable = newOrderTable1; | ||
|
||
final OrderTable newOrderTable2 = new OrderTable(); | ||
newOrderTable2.setId(ORDER_TABLE_ID2); | ||
newOrderTable2.setTableGroupId(TABLE_GROUP_ID); | ||
newOrderTable2.setNumberOfGuests(4); | ||
newOrderTable2.setEmpty(false); | ||
|
||
final OrderTable newOrderTable3 = new OrderTable(); | ||
newOrderTable3.setId(ORDER_TABLE_ID3); | ||
newOrderTable3.setTableGroupId(TABLE_GROUP_ID); | ||
newOrderTable3.setNumberOfGuests(4); | ||
newOrderTable3.setEmpty(false); | ||
|
||
orderTables = Arrays.asList(newOrderTable1, newOrderTable2, newOrderTable3); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"빈 테이블은 방문한 손님 수를 입력할 수 없다."라는 요구 사항이 필요해 보여요. 아래의 코드를 참고해 주세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 수정했습니다.