From c2e92c3bd4fc134b27ba6a6271f63b032b2b9d99 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期三, 28 八月 2024 15:46:32 +0800 Subject: [PATCH] -打印bug修改 --- jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java | 35 ++++++++++++++++++++++++++--------- 1 files changed, 26 insertions(+), 9 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java b/jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java index 0c63fdf..9b982fd 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java +++ b/jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java @@ -2,19 +2,27 @@ import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import cn.hutool.json.JSONObject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; public class RestfulService { public static void main(String[] args) { - String str = "uuuuuu11uuuuuuuuuuuuuuu"; - System.out.println(str.length()); -// getWorkReportResultFeedback() + String json = "{\"code\":\"success\",\"data\":{\"productNum\":\"LCV123456P0600036\",\"stationCode\":\"1HZ01\",\"resultCode\":\"S\",\"resultText\":\"鎶ュ伐鎴愬姛\"},\"message\":\"API 璋冪敤鎴愬姛\"}"; + JSONObject jsonObject = new JSONObject(json); + String code = jsonObject.getStr("code"); + String resultCode = jsonObject.getJSONObject("data").getStr("resultCode"); + System.out.println("code: " + code); + System.out.println("resultCode: " + resultCode); } - public static final String getRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration"; +// public static final String getRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration"; +//// +// public static final String postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface"; - public static final String postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface"; + public static final String getRealmName = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration"; + + public static final String postRealmName = "https://imes-group.geelycv.com/api/mom-open/restful/interface"; public static final String siteCode = "3983"; @@ -43,10 +51,19 @@ //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"鎶ュ伐鎴愬姛"},"message":"API璋冪敤鎴愬姛"} public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) { - String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; - HttpResponse response = HttpRequest.get(url).execute(); - HttpRequest httpRequest = HttpRequest.get(url); - return response.body(); + String result = ""; + try { + String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; + HttpResponse response = HttpRequest.get(url).execute(); + HttpRequest httpRequest = HttpRequest.get(url); + result = response.body(); + }catch (Exception e){ + e.printStackTrace(); + }finally { + return result; + } + + } /** -- Gitblit v1.9.3