DINGYL пре 2 недеља
родитељ
комит
5c6856ee44

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

@@ -68,9 +68,9 @@ public class SERESController {
 
     @PostMapping("/erp/ZHJK/testToken")
     @ResponseBody
-    public Map<String, Object> testToken() throws Exception {
+    public Map<String, Object> testToken(@RequestParam String token) throws Exception {
         Map<String, Object> modelMap =  new HashMap<String, Object>();
-                seresService.testToken();
+                seresService.testToken(token);
         modelMap.put("success", true);
         return modelMap;
     }

+ 2 - 1
src/main/java/com/uas/eis/service/SERESService.java

@@ -10,6 +10,7 @@ public interface SERESService {
     String  getToken() throws IOException;
     Map<String,Object> saveAlert(String data) ;
     Map<String,Object> test(String token) throws Exception;
-    void testToken() throws IOException;
+    void testToken(String token) throws IOException;
     Map<String,Object> testGetStock(String token) throws Exception;
+
 }

+ 4 - 3
src/main/java/com/uas/eis/serviceImpl/SERESServiceImpl.java

@@ -250,6 +250,7 @@ public class SERESServiceImpl implements SERESService {
         String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
         String fullUrl =  seresConfig.getUrl()  + apiPath;
         logger.info("fullUrl {}",fullUrl);
+        logger.info("Authorization {}","Bearer " + token);
         CloseableHttpClient httpClient = HttpClients.createDefault();
         HttpPost httpPost = new HttpPost(fullUrl);
         // 鉴权头
@@ -276,7 +277,7 @@ public class SERESServiceImpl implements SERESService {
         }
         try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
             String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
-            logger.info("rtest espStr {}", respStr);
+            logger.info("test respStr {}", respStr);
             return JSON.parseObject(respStr);
         }catch (Exception e){
             logger.info("Exception {}",e.getMessage());
@@ -288,8 +289,8 @@ public class SERESServiceImpl implements SERESService {
     }
 
     @Override
-    public void testToken() throws IOException {
-        String token = getValidToken();
+    public void testToken(String token) throws IOException {
+        logger.info("testToken token {}", token);
         String fullUrl = "https://dis-api-test.seres.cn/aito/public/API_zsgsw/1.0.0";
 
         CloseableHttpClient httpClient = HttpClients.createDefault();