-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
application/src/main/java/com/terte/dto/order/OrderItemDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.terte.dto.order; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class OrderItemDTO { | ||
private Long menuId; | ||
private Integer quantity; | ||
private List<SelectedOptionDTO> selectedOptions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
application/src/main/java/com/terte/dto/order/SelectedOptionDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.terte.dto.order; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class SelectedOptionDTO { | ||
private Long optionId; | ||
private List<Long> selectedChoiceIds; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
application/src/main/java/com/terte/entity/order/Order.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.terte.entity.order; | ||
|
||
import com.terte.common.enums.OrderStatus; | ||
import com.terte.common.enums.OrderType; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class Order { | ||
private Long id; | ||
private Long storeId; | ||
private OrderStatus status; | ||
private List<OrderItem> orderItemList; | ||
private OrderType orderType; | ||
private String phoneNumber; | ||
private Integer tableNumber; | ||
} |
20 changes: 20 additions & 0 deletions
20
application/src/main/java/com/terte/entity/order/OrderItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.terte.entity.order; | ||
|
||
import com.terte.entity.menu.Menu; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class OrderItem { | ||
private Long id; | ||
private Menu menu; | ||
private Integer quantity; | ||
private List<SelectedOption> selectedOptions; | ||
} |
19 changes: 19 additions & 0 deletions
19
application/src/main/java/com/terte/entity/order/SelectedOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.terte.entity.order; | ||
|
||
import com.terte.entity.menu.Choice; | ||
import com.terte.entity.menu.Option; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class SelectedOption { | ||
private Long id; | ||
private Option option; | ||
private List<Choice> selectedChoices; | ||
} |
34 changes: 34 additions & 0 deletions
34
application/src/main/java/com/terte/repository/order/OrderRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.terte.repository.order; | ||
|
||
import com.terte.entity.order.Order; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
@Repository | ||
public class OrderRepository { | ||
private final Map<Long, Order> orderStorage = new ConcurrentHashMap<>(); | ||
|
||
OrderRepository() { | ||
|
||
} | ||
|
||
public Order findById(Long id) { | ||
return orderStorage.get(id); | ||
} | ||
|
||
public Order save(Order order) { | ||
if(order.getId() == null) { | ||
order.setId(orderStorage.size() + 1L); | ||
orderStorage.put(order.getId(), order); | ||
} else { | ||
orderStorage.put(order.getId(), order); | ||
} | ||
return order; | ||
} | ||
|
||
public void deleteById(Long id) { | ||
orderStorage.remove(id); | ||
} | ||
} |