Fix String -> UUIDs -> String in method causing crash

This commit is contained in:
CodeSteak 2020-06-20 22:25:52 +02:00
parent c3eaf5ac11
commit e5332a3348
2 changed files with 5 additions and 6 deletions

View File

@ -10,7 +10,6 @@ import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.UUID;
public class CreateDeliveryData {
@ -21,7 +20,7 @@ public class CreateDeliveryData {
if(customerOrder.deliveredAt == null)
{
DeliveryData deliveryData = restServiceForDelivery.getDeliveryData(UUID.fromString(customerOrder.trackingId));
DeliveryData deliveryData = restServiceForDelivery.getDeliveryData(customerOrder.trackingId);
if(deliveryData.isDelivered())

View File

@ -6,13 +6,13 @@ import org.hso.ecommerce.uimodel.DeliveryDataEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
@Service
public class RestServiceForDelivery {
@ -49,7 +49,7 @@ public class RestServiceForDelivery {
}
}
public DeliveryData getDeliveryData(UUID trackingID) {
public DeliveryData getDeliveryData(String trackingID) {
String url = DELIVERY_IP_ADDRESS + "/status";
@ -58,7 +58,7 @@ public class RestServiceForDelivery {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url).queryParam("trackingID",trackingID.toString());
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url).queryParam("trackingID", trackingID);
HttpEntity<?> entity = new HttpEntity<>(headers);