请求的类型要对应起来
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
log.info("*****************进入方法,入参为:" + gson.toJson(map));
long start = System.currentTimeMillis();
ReturnInfo info = new ReturnInfo();
try {
log.info(">>>>>>>>>>>>>>>>>>>>>>进入方法getList 接口>>>>>>>>>>>>>>>>>>>>>>");
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("token", request.getHeader("token"));
httpHeaders.add("orgId", request.getHeader("orgId"));
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("page", map.get("page").toString());
body.add("size", map.get("size").toString());
body.add("userId", map.get("userId").toString());
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(body, httpHeaders);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ReturnInfo> response = restTemplate.exchange(listUrl, HttpMethod.POST, entity, ReturnInfo.class, Collections.singletonMap("path", "home"));
info = response.getBody();
} catch (HttpClientErrorException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage(), e);
info.setStatus("0");
info.setNote("系统繁忙,请稍后再试!");
}
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>查询接口用时:" + (System.currentTimeMillis() - start) + "ms");
log.info("*****************查询调用返回参数:" + gson.toJson(info) + "\n\n\n");
return info;