List<BankDto> list = new ArrayList<>(); BankDto b = new BankDto(); b.setOrderNo("12313"); BankDto b2 = new BankDto(); b2.setOrderNo("123134343"); list.add(b); list.add(b2);
RestTemplate restTemplate = new RestTemplate(); String url ="http://127.0.0.1:10030/record/updateLogistics"; HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); HttpEntity<List<BankDto>> formEntity = new HttpEntity<List<BankDto>>(list, headers); restTemplate.postForObject(url, formEntity, String.class);