From a192f0ac51174bd70a71e4c3fcf04350a1f29d56 Mon Sep 17 00:00:00 2001 From: CodeSteak Date: Wed, 3 Jun 2020 16:55:36 +0200 Subject: [PATCH] Set Tracing Id in Warehouse/finish not in Checkout. This was wrong. --- .../controller/intern/warehouse/TodoController.java | 6 ++++++ .../ecommerce/controller/shop/ShopCheckoutController.java | 2 -- .../java/org/hso/ecommerce/entities/shop/CustomerOrder.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/warehouse/TodoController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/warehouse/TodoController.java index 48d130a..d57916c 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/intern/warehouse/TodoController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/warehouse/TodoController.java @@ -1,5 +1,6 @@ package org.hso.ecommerce.controller.intern.warehouse; +import org.hso.ecommerce.action.shop.EnableTrackingAction; import org.hso.ecommerce.entities.warehouse.WarehouseBooking; import org.hso.ecommerce.repos.warehouse.WarehouseBookingRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -69,6 +70,11 @@ public class TodoController { booking.get().isInProgress = true; booking.get().isDone = true; + // Update Delivery Date + if (booking.get().reason.customerOrder != null) { + EnableTrackingAction.addTrackingInfo(booking.get().reason.customerOrder); + } + warehouseBookingRepository.save(booking.get()); return "redirect:/intern/warehouse/todo"; diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java index c2c1c3a..507b759 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ShopCheckoutController.java @@ -1,7 +1,6 @@ package org.hso.ecommerce.controller.shop; import org.hso.ecommerce.action.shop.CreateOrderAction; -import org.hso.ecommerce.action.shop.EnableTrackingAction; import org.hso.ecommerce.entities.booking.BookingAccountEntry; import org.hso.ecommerce.entities.booking.PaymentMethod; import org.hso.ecommerce.entities.shop.Address; @@ -136,7 +135,6 @@ public class ShopCheckoutController { CreateOrderAction.Result result = null; try { result = action.finish(); - EnableTrackingAction.addTrackingInfo(result.customerOrder); customerOderRepository.save(result.customerOrder); bookingRepository.saveAll(result.bookings); diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java index 1b20bb2..8c80c58 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java @@ -31,7 +31,7 @@ public class CustomerOrder { @NotNull public java.sql.Timestamp created; - @NotNull + @Column(nullable = true) public String trackingId; @Column(nullable = true)