feature/customer_orders #77
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/customer_orders"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ich übernehme Review
@ -0,0 +14,4 @@
import java.util.*;
@Service
public class RestServiceForDelivery {
Name vlcht etwas zu ausführlich, aber OK :D
@ -0,0 +22,4 @@
public String getDeliveryID(CustomerOrder customerOrder) throws ResourceAccessException
{
String url = "http://[::1]:8082/newDelivery";
Besser hier Klassen-Konstate mit http://[::1]:8082
@ -0,0 +68,4 @@
{
return response.getBody();
} else {
return new DeliveryData("DHL-Server ist gerade nicht erreichbar","--:--:----");
Server ist in diesem Fall aber erreichbar.
Error Handling über Strings sollte hier nicht passieren, sondern erst in Templates
@ -0,0 +73,4 @@
}
catch (ResourceAccessException e)
{
return new DeliveryData("DHL-Server gerade nicht erreichbar","--:--:----");
Same
@ -3,9 +3,12 @@ package org.hso.ecommerce.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
Imports wurden hinzygefügt, aber die Klasse nicht verändert?
@ -51,1 +58,3 @@
model.addAttribute("orders", orders);
List<CustomerOrder> orders = customerOrderRepository.getAllOrders();
Map<CustomerOrder, DeliveryData> customerOrderDeliveryDataMap = orders.stream().collect
Formatierung komisch
@ -0,0 +1,75 @@
package org.hso.ecommerce.uiModel;
packetnamen sollten klein sein
@ -0,0 +28,4 @@
isDelivered = status.equals("Lieferung erfolgreich");
}
public static DeliveryData getDeliveryDataFromCustomerOrder(CustomerOrder customerOrder, CustomerOrderRepository customerOrderRepository, RestServiceForDelivery restServiceForDelivery)
Logic sollte in Action oder Controller stattfinden. UiModels sollten einfache Datenklassen sein
@ -0,0 +31,4 @@
public static DeliveryData getDeliveryDataFromCustomerOrder(CustomerOrder customerOrder, CustomerOrderRepository customerOrderRepository, RestServiceForDelivery restServiceForDelivery)
{
if(customerOrder.trackingId == null)
return new DeliveryData("Bestellung wurde elektronisch angekündigt","");
Strings im Idealfall eher im Template. Hier besser mit ENUMs oder booleans etc. arbeiten
@ -16,3 +16,3 @@
<nav></nav>
<div>
<h1>Bestellung 1010</h1>
<h1 th:text="|Bestellung ${order.id}|"></h1>
Wozu die "|" ?
Das hat Hannes so gemacht, es ging darum das man so Text reinschreiben kann wenn ich mich richtig erinnere.
Ahh okay
Also entweder ist ein schließendes "|" zu viel oder überall anders fehlts
@ -7,3 +8,4 @@
import java.util.Optional;
import static jdk.nashorn.internal.runtime.regexp.joni.Syntax.Java;
Bitte Imports checken
@ -26,3 +26,3 @@
<div class="content-width">
<div>
<h2 id="20202701"> Bestellung vom 27.01.2020 </h2>
<h2 th:text="| Bestellung vom ${order.created.toString().substring(0,10)}"></h2>
Schließendes "|" fehlt.
Nur Formatiert, passt.
@ -24,2 +24,2 @@
<div th:each="order: ${orders}">
<h2 id="20202701" th:text="|Bestellung vom ${order.formatCreated()}" />
<div th:each="order: ${orderDeliveryDataMap}">
<h2 id="20202701" th:text="|Bestellung vom ${order.getKey().formatCreated()}" />
Schließendes "|" fehlt
Nur Formatiert, passt.