|
8 | 8 | import com.example.Centralthon.domain.order.exception.CodeNotCreatedException; |
9 | 9 | import com.example.Centralthon.domain.order.repository.OrderItemRepository; |
10 | 10 | import com.example.Centralthon.domain.order.repository.OrderRepository; |
11 | | -import com.example.Centralthon.domain.order.web.dto.OrderItemListReq; |
12 | 11 | import com.example.Centralthon.domain.order.web.dto.CreateOrderReq; |
13 | 12 | import com.example.Centralthon.domain.order.web.dto.CreateOrderRes; |
| 13 | +import com.example.Centralthon.domain.order.web.dto.OrderItemListReq; |
14 | 14 | import lombok.RequiredArgsConstructor; |
15 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
16 | 16 | import org.springframework.context.annotation.Lazy; |
@@ -60,13 +60,15 @@ public CreateOrderRes orderMenus(CreateOrderReq orderReq) { |
60 | 60 | Order order = createOrderWithUniqueCode(totalPrice); |
61 | 61 |
|
62 | 62 | List<OrderItem> orderItemList = new ArrayList<>(); |
| 63 | + List<Long> storeIdList = new ArrayList<>(); |
63 | 64 | for(Menu menu : menuList) { |
64 | 65 | OrderItem orderItem = OrderItem.toEntity(order, menu, orderList.get(menu.getId())); |
65 | 66 | orderItemList.add(orderItem); |
| 67 | + if(!storeIdList.contains(menu.getStore().getId())) storeIdList.add(menu.getStore().getId()); |
66 | 68 | } |
67 | 69 | orderItemRepository.saveAll(orderItemList); |
68 | 70 |
|
69 | | - return CreateOrderRes.from(order); |
| 71 | + return CreateOrderRes.of(order, storeIdList); |
70 | 72 | } |
71 | 73 |
|
72 | 74 | private Order createOrderWithUniqueCode(int totalPrice) { |
|
0 commit comments