HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("Authorization", "Bearer " + access_token);
JSONObject json = new JSONObject();
json.put("serialNumber", sn);
HttpEntity<Object> entity = new HttpEntity<Object>(json, headers);
// 跨服务调用, 获取治疗数据
String result = restTemplate.postForObject(httpUrl + "/event/data", entity, String.class);
log.info("跨服务获取设备信息结果为:" + result);
JSONObject object = JSONObject.parseObject(result);
// Object resultData = object.get("data");
// Json转String
String resultStr = object.get("data").toString();
// Json string 转 List
List<SummaryInfo> summaryInfoList = JSONObject.parseArray(resultStr, SummaryInfo.class);
for (SummaryInfo summaryInfo : summaryInfoList) {
log.info("=================summaryInfo.getSerial=" + summaryInfo.getSerial());
}