DINGYL 3 месяцев назад
Родитель
Сommit
3a3e5919b2

+ 3 - 6
src/main/java/com/uas/eis/controller/SERESController.java

@@ -8,10 +8,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.util.EntityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.IOException;
@@ -63,7 +60,7 @@ public class SERESController {
 
 
     @PostMapping("/erp/ZHJK/test")
     @PostMapping("/erp/ZHJK/test")
     @ResponseBody
     @ResponseBody
-    public Map<String, Object> test(@RequestBody String token) throws Exception {
+    public Map<String, Object> test(@RequestParam String token) throws Exception {
         SpObserver.putSp("AW_ZHJK");
         SpObserver.putSp("AW_ZHJK");
         Map<String, Object> modelMap = seresService.test(token);
         Map<String, Object> modelMap = seresService.test(token);
         return modelMap;
         return modelMap;
@@ -80,7 +77,7 @@ public class SERESController {
 
 
     @PostMapping("/erp/ZHJK/testGetStock")
     @PostMapping("/erp/ZHJK/testGetStock")
     @ResponseBody
     @ResponseBody
-    public Map<String, Object> testGetStock(@RequestBody String token) throws Exception {
+    public Map<String, Object> testGetStock(@RequestParam String token) throws Exception {
         Map<String, Object> modelMap =seresService.testGetStock(token);
         Map<String, Object> modelMap =seresService.testGetStock(token);
         modelMap.put("success", true);
         modelMap.put("success", true);
         return modelMap;
         return modelMap;

+ 6 - 5
src/main/java/com/uas/eis/serviceImpl/SERESServiceImpl.java

@@ -244,7 +244,9 @@ public class SERESServiceImpl implements SERESService {
 
 
     @Override
     @Override
     public Map<String, Object> test(String token) throws Exception {
     public Map<String, Object> test(String token) throws Exception {
-        Map<String, Object> modelMap = new HashMap<String, Object>();
+        logger.info("action :testGetStock");
+        logger.info("token {}",token);
+        Map<String, Object> modelMap =  new HashMap<String, Object>();
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String fullUrl =  seresConfig.getUrl()  + apiPath;
         String fullUrl =  seresConfig.getUrl()  + apiPath;
         logger.info("fullUrl {}",fullUrl);
         logger.info("fullUrl {}",fullUrl);
@@ -273,9 +275,8 @@ public class SERESServiceImpl implements SERESService {
             logger.info("reqBody {}", JSON.toJSONString(reqBody));
             logger.info("reqBody {}", JSON.toJSONString(reqBody));
         }
         }
         try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
         try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
-            logger.info("resp {}", response.getEntity().getContent());
             String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
             String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
-            logger.info("respStr {}", respStr);
+            logger.info("rtest espStr {}", respStr);
             return JSON.parseObject(respStr);
             return JSON.parseObject(respStr);
         }catch (Exception e){
         }catch (Exception e){
             logger.info("Exception {}",e.getMessage());
             logger.info("Exception {}",e.getMessage());
@@ -299,7 +300,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("resp {}", respStr);
+            logger.info("testToken resp {}", respStr);
         } finally {
         } finally {
             httpClient.close();
             httpClient.close();
         }
         }
@@ -308,7 +309,7 @@ public class SERESServiceImpl implements SERESService {
     public Map<String, Object> testGetStock(String token) throws Exception {
     public Map<String, Object> testGetStock(String token) throws Exception {
         logger.info("action :testGetStock");
         logger.info("action :testGetStock");
         Map<String, Object> modelMap =  new HashMap<String, Object>();
         Map<String, Object> modelMap =  new HashMap<String, Object>();
-
+        logger.info("token {}",token);
         CloseableHttpClient httpClient = HttpClients.createDefault();
         CloseableHttpClient httpClient = HttpClients.createDefault();
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String fullUrl =  seresConfig.getUrl()  + apiPath;
         String fullUrl =  seresConfig.getUrl()  + apiPath;