fixed pull request #25
This commit is contained in:
@ -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
Block a user