|
@@ -125,6 +125,7 @@ public class SERESServiceImpl implements SERESService {
|
|
|
}
|
|
}
|
|
|
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
|
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
|
|
String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
|
|
String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
|
|
|
|
|
+ logger.info("respStr {}",respStr);
|
|
|
return JSON.parseObject(respStr);
|
|
return JSON.parseObject(respStr);
|
|
|
} finally {
|
|
} finally {
|
|
|
httpClient.close();
|
|
httpClient.close();
|
|
@@ -233,4 +234,41 @@ public class SERESServiceImpl implements SERESService {
|
|
|
|
|
|
|
|
return modelMap;
|
|
return modelMap;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, Object> test() throws Exception {
|
|
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
|
|
+ String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3ODM5OTcxODUsImlhdCI6MTc4Mzk5NzE4NiwiaXNzIjoiMDAwMDAwMjQ0Ni1KVFRLSE9ONCIsImV4cCI6MTc4NDAwMDc4NC4xNX0.psofo-i31lnsM9d9mHIpEG4atJv1uY6lZmZr8jBtzJE";
|
|
|
|
|
+ String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
|
|
|
|
|
+ String fullUrl = seresConfig.getUrl() + apiPath;
|
|
|
|
|
+
|
|
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
|
|
+ HttpPost httpPost = new HttpPost(fullUrl);
|
|
|
|
|
+ // 鉴权头
|
|
|
|
|
+ httpPost.setHeader("Authorization", "Bearer " + token);
|
|
|
|
|
+ httpPost.setHeader("Content-Type", "application/json");
|
|
|
|
|
+ JSONObject reqBody = new JSONObject();
|
|
|
|
|
+ //供应商编码
|
|
|
|
|
+ reqBody.put("SupplierCode", seresConfig.getClientCode());
|
|
|
|
|
+ //工厂编码
|
|
|
|
|
+ //reqBody.put("FactoryCode", seresConfig.getClient_code());
|
|
|
|
|
+ //物料编码
|
|
|
|
|
+ //reqBody.put("MaterialCode", seresConfig.getClient_code());
|
|
|
|
|
+ //页码
|
|
|
|
|
+ //reqBody.put("Skip", seresConfig.getClient_code());
|
|
|
|
|
+ //分页大小
|
|
|
|
|
+ //reqBody.put("Take", seresConfig.getClient_code());
|
|
|
|
|
+ if (reqBody != null) {
|
|
|
|
|
+ StringEntity entity = new StringEntity(JSON.toJSONString(reqBody), "UTF-8");
|
|
|
|
|
+ httpPost.setEntity(entity);
|
|
|
|
|
+ }
|
|
|
|
|
+ try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
|
|
|
|
+ String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
|
|
|
|
|
+ logger.info("respStr {}",respStr);
|
|
|
|
|
+ return JSON.parseObject(respStr);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ httpClient.close();
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|