diff --git a/prototype/src/main/java/org/hso/ecommerce/action/shop/EnableTrackingAction.java b/prototype/src/main/java/org/hso/ecommerce/action/shop/EnableTrackingAction.java index d608dea..6726ee2 100644 --- a/prototype/src/main/java/org/hso/ecommerce/action/shop/EnableTrackingAction.java +++ b/prototype/src/main/java/org/hso/ecommerce/action/shop/EnableTrackingAction.java @@ -4,10 +4,13 @@ import org.hso.ecommerce.api.RestServiceForDelivery; import org.hso.ecommerce.entities.shop.CustomerOrder; import org.springframework.web.client.ResourceAccessException; +import java.sql.Timestamp; +import java.util.Date; + public class EnableTrackingAction { - public static void addTrackingInfo(CustomerOrder customerOrder) throws ResourceAccessException { - - customerOrder.trackingId = new RestServiceForDelivery().getDeliveryID(customerOrder); + public static void addTrackingInfo(RestServiceForDelivery deliveryService, CustomerOrder customerOrder) throws ResourceAccessException { + customerOrder.inDeliverySince = new Timestamp(new Date().getTime()); + customerOrder.trackingId = deliveryService.getDeliveryID(customerOrder); } } diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java index 45c4d32..b4ffc25 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java @@ -3,6 +3,7 @@ package org.hso.ecommerce.controller; import org.hso.ecommerce.action.user.CreateDeliveryData; import org.hso.ecommerce.action.user.UpdateUserSettingsAction; import org.hso.ecommerce.api.RestServiceForDelivery; +import org.hso.ecommerce.app.config.AppSettings; import org.hso.ecommerce.entities.shop.CustomerOrder; import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.repos.shop.CustomerOrderRepository; @@ -31,6 +32,9 @@ public class UserController { @Autowired private final RestServiceForDelivery restServiceForDelivery = null; + @Autowired + private final AppSettings appSettings = null; + @GetMapping("/") public String user() { return "redirect:/user/settings"; @@ -58,6 +62,7 @@ public class UserController { .collect(Collectors.toList()); model.addAttribute("orderDeliveryDataMap", customerOrderDeliveryDataMap); + model.addAttribute("deliveryService", appSettings.getParcelServiceName()); return "user/orders/index"; } 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 c8fb54f..93ed323 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,6 +1,7 @@ package org.hso.ecommerce.controller.intern.warehouse; import org.hso.ecommerce.action.shop.EnableTrackingAction; +import org.hso.ecommerce.api.RestServiceForDelivery; import org.hso.ecommerce.entities.warehouse.WarehouseBooking; import org.hso.ecommerce.repos.warehouse.WarehouseBookingRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +24,9 @@ public class TodoController { @Autowired private final WarehouseBookingRepository warehouseBookingRepository = null; + @Autowired + private final RestServiceForDelivery deliveryService = null; + @GetMapping("todo") public String accountingWarehouseTodo( Model model @@ -77,7 +81,7 @@ public class TodoController { // Update Delivery Date if (booking.get().reason.customerOrder != null) { try{ - EnableTrackingAction.addTrackingInfo(booking.get().reason.customerOrder); + EnableTrackingAction.addTrackingInfo(deliveryService, booking.get().reason.customerOrder); } catch(ResourceAccessException e) { diff --git a/prototype/src/main/resources/templates/user/orders/index.html b/prototype/src/main/resources/templates/user/orders/index.html index d54074e..354e213 100644 --- a/prototype/src/main/resources/templates/user/orders/index.html +++ b/prototype/src/main/resources/templates/user/orders/index.html @@ -27,6 +27,10 @@
+ + + + - +
Bestelldatum
Lieferstatus @@ -48,7 +52,7 @@
Sendeverfolgungsnummer