fixed pull request #24
This commit is contained in:
parent
caf5430a06
commit
cff9417dc5
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"id" : "bank",
|
||||
"name" : "Bank of Cheese",
|
||||
"discount" : {
|
||||
"minimumDailySalesVolumeNetCent": 100,
|
||||
"percentDiscount": 1
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"title": "Big Mac",
|
||||
"manufacturer": "Mc Donalds",
|
||||
"articleNumber": "0x1 BIGMAC",
|
||||
"vatPercent": 7,
|
||||
"pricePerUnitNet": 700,
|
||||
"shouldBeAdvertised": true
|
||||
},
|
||||
{
|
||||
"title": "500£ Schein",
|
||||
"manufacturer": "Bank",
|
||||
"articleNumber": "500",
|
||||
"vatPercent": 0,
|
||||
"pricePerUnitNet": 50000,
|
||||
"shouldBeAdvertised": false
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"id" : "hans",
|
||||
"name" : "Hans and more",
|
||||
"discount" : {
|
||||
"minimumDailySalesVolumeNetCent": 100000,
|
||||
"percentDiscount": 2
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"title": "Big Mac",
|
||||
"manufacturer": "Mc Donalds",
|
||||
"articleNumber": "0x1 BIGMAC",
|
||||
"vatPercent": 7,
|
||||
"pricePerUnitNet": 700,
|
||||
"shouldBeAdvertised": true
|
||||
},
|
||||
{
|
||||
"title": "Pommes",
|
||||
"manufacturer": "Mc Donalds",
|
||||
"articleNumber": "0x1 POmes",
|
||||
"vatPercent": 7,
|
||||
"pricePerUnitNet": 100,
|
||||
"shouldBeAdvertised": false
|
||||
},
|
||||
{
|
||||
"title": "Milchshake Premium 19%",
|
||||
"manufacturer": "Mc Donalds",
|
||||
"articleNumber": "0x2",
|
||||
"vatPercent": 19,
|
||||
"pricePerUnitNet": 50,
|
||||
"shouldBeAdvertised": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1 +1 @@
|
|||
rootProject.name = 'supplier'
|
||||
rootProject.name = 'delivery'
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package org.hso.ecommerce.supplier;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactoryBuilder;
|
||||
import netscape.javascript.JSObject;
|
||||
|
||||
import org.hso.ecommerce.supplier.data.Delivery;
|
||||
import org.hso.ecommerce.supplier.data.DeliveryManager;
|
||||
import org.json.JSONObject;
|
||||
import org.hso.ecommerce.supplier.data.ReturnStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
|
@ -24,10 +23,10 @@ public class RequestController {
|
|||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
public String searchArticles(@RequestParam(value = "trackingID") String trackingID, HttpServletRequest request, HttpServletResponse response) {
|
||||
public ReturnStatus searchArticles(@RequestParam(value = "trackingID") String trackingID, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
Delivery delivery = DeliveryManager.getInstance().getDeliveryByeID(trackingID);
|
||||
|
||||
return new JSONObject().put("status",delivery.getStatus()).put("estimatedArrival",delivery.getEstimatedArrival()).toString();
|
||||
return new ReturnStatus(delivery.getStatus(),delivery.getEstimatedArrival());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.UUID;
|
|||
public class Delivery {
|
||||
|
||||
private String[] states = {"Bestellung eingegangen","Bestellung auf dem Weg","Lieferung erfolgreich"};
|
||||
private double[] timeBorder = {4,24};
|
||||
private int[] timeBorder = {4,24};
|
||||
|
||||
private String name;
|
||||
private String address;
|
||||
|
@ -35,7 +35,7 @@ public class Delivery {
|
|||
Long creationTime = this.creationTime.getTime();
|
||||
|
||||
Long diff = timeNow - creationTime;
|
||||
double hour = (((diff / 1000) / 3600));
|
||||
double hour = (((diff / 1000.0) / 3600.0));
|
||||
|
||||
for (int i = 0; i < timeBorder.length; i++) {
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.hso.ecommerce.supplier.data;
|
||||
|
||||
public class ReturnStatus {
|
||||
|
||||
private String status;
|
||||
private String estimatedArrival;
|
||||
|
||||
public ReturnStatus(String status, String estimatedArrival) {
|
||||
this.status = status;
|
||||
this.estimatedArrival = estimatedArrival;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getEstimatedArrival() {
|
||||
return estimatedArrival;
|
||||
}
|
||||
}
|
|
@ -1,2 +1,2 @@
|
|||
server.address=::1
|
||||
server.port=8081
|
||||
server.port=8082
|
||||
|
|
Reference in New Issue