发:
List<OrderResListVO> list = optSectMapper.queryOptSect(orderId); RestTemplate restTemplate = new RestTemplate(); String url = "http://localhost:40011/order/queryCompleteOptSect"; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap<String, List<String>> map= new LinkedMultiValueMap<>(); List<String> optSect = new ArrayList<>(); for (OrderResListVO vo : list) { String resId = vo.getResId(); optSect.add(resId); } map.add("optSectId", optSect); HttpEntity<MultiValueMap<String, List<String>>> request = new HttpEntity<>(map, headers); ResponseEntity<OrderResListVO> response = restTemplate.postForEntity( url, request , OrderResListVO.class ); System.out.println(response.getBody());
接:
@PostMapping("/queryCompleteOptSect") public List<OrderResListVO> queryCompleteOptSect(@RequestParam HttpEntity<MultiValueMap<String, List<String>>> optSectIds){ System.out.println("进去了"); return orderService.queryCompleteOptSect(optSectIds); }