|
|
@@ -3,6 +3,7 @@ package com.remy.graphql.resolvers.query;
|
|
|
import com.remy.common.module.OrderDTO;
|
|
|
import com.remy.graphql.evn.RestAPIEnv;
|
|
|
import graphql.kickstart.tools.GraphQLQueryResolver;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
@@ -14,12 +15,14 @@ import java.util.List;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class OrderQuery implements GraphQLQueryResolver {
|
|
|
|
|
|
@Autowired
|
|
|
RestAPIEnv apiEnv;
|
|
|
|
|
|
public CompletableFuture<List<OrderDTO>> orderList() {
|
|
|
+ log.info("start query orderList");
|
|
|
return CompletableFuture.supplyAsync(() ->
|
|
|
new RestTemplate().exchange(
|
|
|
apiEnv.getOrdersEndpoint(),
|
|
|
@@ -30,6 +33,7 @@ public class OrderQuery implements GraphQLQueryResolver {
|
|
|
}
|
|
|
|
|
|
public CompletableFuture<List<OrderDTO>> orderQuery(String goodsSerialNo) {
|
|
|
+ log.info("start query order by goods serial no");
|
|
|
return CompletableFuture.supplyAsync(() ->
|
|
|
new RestTemplate().exchange(
|
|
|
apiEnv.getOrdersEndpoint() + "query?goodsSerialNo=" + goodsSerialNo,
|
|
|
@@ -40,6 +44,7 @@ public class OrderQuery implements GraphQLQueryResolver {
|
|
|
}
|
|
|
|
|
|
public CompletableFuture<OrderDTO> orderInfo(String orderNo) {
|
|
|
+ log.info("start query order by order no");
|
|
|
return CompletableFuture.supplyAsync(() ->
|
|
|
new RestTemplate().getForObject(apiEnv.getOrdersEndpoint() + orderNo, OrderDTO.class));
|
|
|
}
|