导出excel @RequestMapping(value = "/bill/list/download/{store}/{from}/{to}/{type}/{menthod}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public void downloadBillList(@PathVariable("store") String store,
@RequestMapping(value = "/bill/list/download/{store}/{from}/{to}/{type}/{menthod}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadBillList(@PathVariable("store") String store,
@PathVariable("from") String from,
@PathVariable("to") String to,
@PathVariable("type") String type,
@PathVariable("menthod") String menthod,
HttpServletResponse response) throws Exception {
String fileName = "bill.xls";// 文件名
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename="+ URLEncoder.encode(fileName, "UTF-8"));
ExcelBulider excelBulider = new ExcelBulider();
excelBulider.billList = billService.adminFindByStoreId(store, from, to, type,menthod);
//System.out.println("billList:"+billService.adminFindByStoreId(page,storeId));
HSSFWorkbook workbook = excelBulider.build();
workbook.write(response.getOutputStream());
}
