String restUrl = "https://www.sd.sgcc.com.cn/ppm/xhjy/api/nusp-business/electricity/selling/getSelectOptions";
MultiValueMap<String, String> postParameters = new LinkedMultiValueMap<String, String>();
postParameters.add("dataID", "24A9A8D65C7FDCC43D201A2BFAFCC9D0");
postParameters.add("status", "0");
String uacResponse = restTemplate.postForObject(restUrl, postParameters, String.class);
JSONObject jsonObject = JSON.parseObject(uacResponse);
int code = jsonObject.getIntValue("code");
String msg = jsonObject.getString("msg");
String requestId = jsonObject.getString("requestId");
System.out.println("code===="+code);
System.out.println("msg======"+msg);
System.out.println("jsonObject==="+jsonObject);
RestTemplate模拟get、post请求
最新推荐文章于 2023-03-30 17:56:24 发布