Fix String -> UUIDs -> String in method causing crash
This commit is contained in:
parent
c3eaf5ac11
commit
e5332a3348
|
@ -10,7 +10,6 @@ import java.sql.Timestamp;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class CreateDeliveryData {
|
public class CreateDeliveryData {
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ public class CreateDeliveryData {
|
||||||
|
|
||||||
if(customerOrder.deliveredAt == null)
|
if(customerOrder.deliveredAt == null)
|
||||||
{
|
{
|
||||||
DeliveryData deliveryData = restServiceForDelivery.getDeliveryData(UUID.fromString(customerOrder.trackingId));
|
DeliveryData deliveryData = restServiceForDelivery.getDeliveryData(customerOrder.trackingId);
|
||||||
|
|
||||||
|
|
||||||
if(deliveryData.isDelivered())
|
if(deliveryData.isDelivered())
|
||||||
|
|
|
@ -6,13 +6,13 @@ import org.hso.ecommerce.uimodel.DeliveryDataEnum;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.ResourceAccessException;
|
import org.springframework.web.client.ResourceAccessException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RestServiceForDelivery {
|
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";
|
String url = DELIVERY_IP_ADDRESS + "/status";
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class RestServiceForDelivery {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
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);
|
HttpEntity<?> entity = new HttpEntity<>(headers);
|
||||||
|
|
||||||
|
|
Reference in New Issue