|
@@ -1,10 +1,15 @@
|
|
package com.raycos.raycosdatacenterapi.amzorder.impl;
|
|
package com.raycos.raycosdatacenterapi.amzorder.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbAmzPullOrderTask;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbAmzPullOrderTask;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbAmzToken;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbAmzToken;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbStoreInfo;
|
|
import com.raycos.raycoscommon.Internal.datacenterapi.TbStoreInfo;
|
|
-import com.raycos.raycoscommon.Internal.datacenterapi.vo.Orders0VO;
|
|
|
|
|
|
+import com.raycos.raycoscommon.Internal.datacenterapi.vo.order.Orders0VOReq;
|
|
|
|
+import com.raycos.raycoscommon.Internal.datacenterapi.vo.order.Orders0VOResp;
|
|
|
|
+import com.raycos.raycoscommon.Internal.datacenterapi.vo.order.amazon.AmazonApiResponse;
|
|
|
|
+import com.raycos.raycoscommon.Internal.datacenterapi.vo.order.amazon.AmazonOrderResponse;
|
|
|
|
+import com.raycos.raycoscommon.Internal.datacenterapi.vo.order.amazon.Payload;
|
|
import com.raycos.raycoscommon.utils.HttpClientUtilRacy;
|
|
import com.raycos.raycoscommon.utils.HttpClientUtilRacy;
|
|
import com.raycos.raycosdatacenterapi.amzorder.AmzPullOrderService;
|
|
import com.raycos.raycosdatacenterapi.amzorder.AmzPullOrderService;
|
|
import com.raycos.raycosdatacenterapi.amzorder.util.AmazonUtil;
|
|
import com.raycos.raycosdatacenterapi.amzorder.util.AmazonUtil;
|
|
@@ -31,6 +36,7 @@ import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -67,10 +73,12 @@ public class AmzPullOrderServiceImpl implements AmzPullOrderService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 实时拉去订单
|
|
* 实时拉去订单
|
|
- * @param map
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public String getOrderRealTime(Orders0VO orders0VO)throws Exception{
|
|
|
|
|
|
+ public Orders0VOResp getOrderRealTime(Orders0VOReq orders0VO)throws Exception{
|
|
|
|
+ Orders0VOResp orders0VOResp = new Orders0VOResp();
|
|
|
|
+ //777 是默认请求
|
|
|
|
+ orders0VOResp.setStatus(777);
|
|
try{
|
|
try{
|
|
//公司id
|
|
//公司id
|
|
String companyId = orders0VO.getCompanyId();
|
|
String companyId = orders0VO.getCompanyId();
|
|
@@ -95,8 +103,6 @@ public class AmzPullOrderServiceImpl implements AmzPullOrderService {
|
|
TbAmzToken tbAmzToken = listTbAmzToken.get(0);
|
|
TbAmzToken tbAmzToken = listTbAmzToken.get(0);
|
|
TbStoreInfo tbStoreInfo = listTbStoreInfo.get(0);
|
|
TbStoreInfo tbStoreInfo = listTbStoreInfo.get(0);
|
|
|
|
|
|
-
|
|
|
|
-// String accessToken = "Atza|IwEBIB_6Jfa97EdFW7l7xqJxNesLmTHpUNShv895BiFoTxDlk7iJANR50kIjoRyd4UN7XaY-KCzvQ8N7XUaPOXon0ItDF5CUBKWpo6sUFQo4bgEU5gn8faO_8mBDw2czmDq-mHTCr0Fg5bXpcn9oxsZZAJrA8qy_HtlDYQNvzt5MKfD_BC8Dr43FyKPgX8eBCD3X6T7pxJCbLhGvdcAqOPRzvwXwn6w7celgztswlV_2KJaZUGoy9cSyXG5yDsjoKpEq6TS7A3MLbBhybZwjqXyuPKUlcH5nh309tDouGasVHozEhxbhAoOcmQETZl5nhSrfz4JzmcRrULWhKZMo-yv4rSyU";
|
|
|
|
String accessToken = tbAmzToken.getAccessToken();
|
|
String accessToken = tbAmzToken.getAccessToken();
|
|
String marketplaceId = tbStoreInfo.getState();
|
|
String marketplaceId = tbStoreInfo.getState();
|
|
|
|
|
|
@@ -112,7 +118,7 @@ public class AmzPullOrderServiceImpl implements AmzPullOrderService {
|
|
|
|
|
|
ZonedDateTime createdBefore = ZonedDateTime.now(ZoneOffset.UTC).minusDays(1);
|
|
ZonedDateTime createdBefore = ZonedDateTime.now(ZoneOffset.UTC).minusDays(1);
|
|
String createdBeforeStr = createdBefore.format(DateTimeFormatter.ISO_INSTANT);
|
|
String createdBeforeStr = createdBefore.format(DateTimeFormatter.ISO_INSTANT);
|
|
-
|
|
|
|
|
|
+ //默认数据查询 测试环境
|
|
String queryString = "CreatedAfter=TEST_CASE_200&MarketplaceIds=" + marketplaceId + "&MaxResultsPerPage=2";
|
|
String queryString = "CreatedAfter=TEST_CASE_200&MarketplaceIds=" + marketplaceId + "&MaxResultsPerPage=2";
|
|
|
|
|
|
// String queryString = "CreatedAfter="+createdAfterStr+"&CreatedBefore="+createdBeforeStr+"&MarketplaceIds=" + marketplaceId + "&MaxResultsPerPage=20";
|
|
// String queryString = "CreatedAfter="+createdAfterStr+"&CreatedBefore="+createdBeforeStr+"&MarketplaceIds=" + marketplaceId + "&MaxResultsPerPage=20";
|
|
@@ -142,10 +148,15 @@ public class AmzPullOrderServiceImpl implements AmzPullOrderService {
|
|
entity,
|
|
entity,
|
|
String.class
|
|
String.class
|
|
);
|
|
);
|
|
- log.info(" orders 接口返回 " + JSONObject.toJSONString(resp));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return JSONObject.toJSONString(resp);
|
|
|
|
|
|
+ String jsonString = JSONObject.toJSONString(resp);
|
|
|
|
+ log.info(" orders 接口返回 " + jsonString);
|
|
|
|
+ AmazonApiResponse apiResponse = JSON.parseObject(jsonString, AmazonApiResponse.class);
|
|
|
|
+ AmazonOrderResponse ordersResponse = JSON.parseObject(apiResponse.getBody(), AmazonOrderResponse.class);
|
|
|
|
+ Payload payload = ordersResponse.getPayload();
|
|
|
|
+ if(apiResponse.getStatusCode().equals("OK") && apiResponse.getStatusCodeValue()==200){
|
|
|
|
+ orders0VOResp.setStatus(apiResponse.getStatusCodeValue());
|
|
|
|
+ orders0VOResp.setOrders(payload.getOrders());
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -154,7 +165,7 @@ public class AmzPullOrderServiceImpl implements AmzPullOrderService {
|
|
throw new Exception(e);
|
|
throw new Exception(e);
|
|
}
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
+ return orders0VOResp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|