@RequestMapping(value = "gettransporters", method = RequestMethod.GET)
public @ResponseBody CustomTransporterResponse fetchTransporters(@RequestParam("postId") int postId,
@RequestParam("page") int page, @RequestParam("rows") int rows) {
CustomTransporterResponse response = new CustomTransporterResponse();
StringBuilder sb = new StringBuilder();
List<Transporter> transporters = healthPostService.getTransportersForHealthPost(postId, rows, page, sb);
List<TransporterDTO> transporterDTOs = new ArrayList<TransporterDTO>();
for (Transporter transporter : transporters) {
TransporterDTO tDTO = new TransporterDTO();
tDTO.setTransporterId(transporter.getTransporterId());
tDTO.setFullName(transporter.getFullName());
tDTO.setPhoneNumber(transporter.getPhoneNumber());
tDTO.setPostId(postId);
transporterDTOs.add(tDTO);
}
response.setPage(String.valueOf(page));
response.setRows(transporterDTOs);
response.setTotal(sb.toString());
response.setRecords(String.valueOf(transporterDTOs.size()));
return response;
}