feature/delivery_api #25
@ -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;
 | 
			
		||||
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						CodeSteak
						commented  
			
		Hier wurde JSON Lib1 importiert. Hier wurde JSON Lib1 importiert. 
			
			
		 | 
			||||
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.*;
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						CodeSteak
						commented  
			
		Hier wird die andere JSON Lib importiert Hier wird die andere JSON Lib importiert 
			
			
		 | 
			||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						CodeSteak
						commented  
			
		Port bereits vergeben für Supplier API Port bereits vergeben für Supplier API 
			
			
		 | 
			||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user
	
Meep