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 | 38 +++++++++++++++++++++++++++++++------- 1 files changed, 31 insertions(+), 7 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 bff26e2..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,15 +2,29 @@ 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 final String getRealmName = "https://imes-test-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration"; + public static void main(String[] args) { + 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 postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface"; +// 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 siteCode = "9786"; + 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"; /** * 鐢熶骇宸ュ崟璇锋眰鎺ュ彛 @@ -37,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; + } + + } /** @@ -77,4 +100,5 @@ .execute(); return response.body(); } + //HttpResponse response = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute(); } -- Gitblit v1.9.3