mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-06-30 21:03:42 +02:00
64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
package catering.order;
|
|
|
|
import org.salespointframework.core.DataInitializer;
|
|
import org.salespointframework.quantity.Quantity;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
@Component
|
|
public class CustomOrderDataInitializer implements DataInitializer {
|
|
private CustomOrderRepository orderRepository;
|
|
|
|
public CustomOrderDataInitializer(CustomOrderRepository orderRepository) {
|
|
this.orderRepository = orderRepository;
|
|
}
|
|
|
|
@Override
|
|
public void initialize() {
|
|
System.out.println("Initialize OrderRepository");
|
|
|
|
Map<String, Quantity> products = new HashMap<>();
|
|
products.put("Sake Maki", Quantity.of(100));
|
|
products.put("Sake Nigiri", Quantity.of(101));
|
|
orderRepository.addOrder(new CustomOrder(
|
|
CustomOrder.OrderType.SUSHI_NIGHT,
|
|
LocalDateTime.of(2023, 12, 5, 18, 0),
|
|
LocalDateTime.of(2023, 12, 5, 23, 0),
|
|
products,
|
|
false,
|
|
2000.0
|
|
));
|
|
|
|
products = new HashMap<>();
|
|
products.put("Koch", Quantity.of(3));
|
|
products.put("Wasser (still)", Quantity.of(101));
|
|
products.put("Käseplatte", Quantity.of(1000));
|
|
products.put("Wiener Würstchen", Quantity.of(150));
|
|
orderRepository.addOrder(new CustomOrder(
|
|
CustomOrder.OrderType.EVENT_CATERING,
|
|
LocalDateTime.of(2023, 10, 2, 11, 0),
|
|
LocalDateTime.of(2023, 10, 3, 8, 0),
|
|
products,
|
|
true,
|
|
10000.0
|
|
));
|
|
|
|
products = new HashMap<>();
|
|
products.put("Koch", Quantity.of(2));
|
|
products.put("Wiener Schnitzel (vegan)", Quantity.of(1000));
|
|
products.put("Wiener Würstchen", Quantity.of(150));
|
|
products.put("Weißwurst (vegan)", Quantity.of(300));
|
|
orderRepository.addOrder(new CustomOrder(
|
|
CustomOrder.OrderType.RENT_A_COOK,
|
|
LocalDateTime.of(2023, 12, 24, 11, 0),
|
|
LocalDateTime.of(2023, 12, 25, 14, 0),
|
|
products,
|
|
true,
|
|
4000.0
|
|
));
|
|
}
|
|
}
|