DINGYL 3 недель назад
Родитель
Сommit
51a2d2b3db
1 измененных файлов с 10 добавлено и 7 удалено
  1. 10 7
      src/main/java/com/uas/eis/serviceImpl/SERESServiceImpl.java

+ 10 - 7
src/main/java/com/uas/eis/serviceImpl/SERESServiceImpl.java

@@ -238,34 +238,37 @@ public class SERESServiceImpl implements SERESService {
     @Override
     public Map<String, Object> test() throws Exception {
         Map<String, Object> modelMap = new HashMap<String, Object>();
-        String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3ODM5OTcxODUsImlhdCI6MTc4Mzk5NzE4NiwiaXNzIjoiMDAwMDAwMjQ0Ni1KVFRLSE9ONCIsImV4cCI6MTc4NDAwMDc4NC4xNX0.psofo-i31lnsM9d9mHIpEG4atJv1uY6lZmZr8jBtzJE";
+        String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3ODQwMTIzOTAsImlhdCI6MTc4NDAxMjM5MSwiaXNzIjoiMDAwMDAwMjQ0Ni1KVFRLSE9ONCIsImV4cCI6MTc4NDAxNTk4OS45NjN9.7hYCWCM22BJU6aNQfE2klllaTRwVnanBX-Tozt49WVg";
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String fullUrl =  seresConfig.getUrl()  + apiPath;
-
+        System.out.println(fullUrl);
         CloseableHttpClient httpClient = HttpClients.createDefault();
         HttpPost httpPost = new HttpPost(fullUrl);
         // 鉴权头
         httpPost.setHeader("Authorization", "Bearer " + token);
         httpPost.setHeader("Content-Type", "application/json");
+        httpPost.setHeader("SupplierCode",  seresConfig.getClientCode());
         JSONObject reqBody = new JSONObject();
         //供应商编码
         reqBody.put("SupplierCode", seresConfig.getClientCode());
         //工厂编码
-        //reqBody.put("FactoryCode", seresConfig.getClient_code());
+        reqBody.put("FactoryCode", "");
         //物料编码
-        //reqBody.put("MaterialCode", seresConfig.getClient_code());
+        reqBody.put("MaterialCode", "");
         //页码
-        //reqBody.put("Skip", seresConfig.getClient_code());
+        reqBody.put("Skip", 1);
         //分页大小
-        //reqBody.put("Take", seresConfig.getClient_code());
+        reqBody.put("Take", 500);
         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);
+            logger.info("respStr {}", respStr);
             return JSON.parseObject(respStr);
+        }catch (Exception e){
+             e.printStackTrace();
         } finally {
             httpClient.close();
             return modelMap;