解决导出excel的报错

This commit is contained in:
季圣华
2019-07-30 23:17:28 +08:00
parent 5e1a899f7b
commit 20d932bdd2
2 changed files with 4 additions and 24 deletions

View File

@@ -292,15 +292,12 @@ public class SupplierController {
* @return
*/
@GetMapping(value = "/exportExcel")
public BaseResponseInfo exportExcel(@RequestParam("supplier") String supplier,
public void exportExcel(@RequestParam("supplier") String supplier,
@RequestParam("type") String type,
@RequestParam("phonenum") String phonenum,
@RequestParam("telephone") String telephone,
@RequestParam("description") String description,
HttpServletRequest request, HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String message = "成功";
HttpServletRequest request, HttpServletResponse response) {
try {
List<Supplier> dataList = supplierService.findByAll(supplier, type, phonenum, telephone, description);
String[] names = {"名称", "类型", "联系人", "电话", "电子邮箱", "预收款", "期初应收", "期初应付", "备注", "传真", "手机", "地址", "纳税人识别号", "开户行", "账号", "税率", "状态"};
@@ -331,16 +328,9 @@ public class SupplierController {
}
File file = ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
ExportExecUtil.showExec(file, file.getName(), response);
res.code = 200;
} catch (Exception e) {
e.printStackTrace();
message = "导出失败";
res.code = 500;
} finally {
map.put("message", message);
res.data = map;
}
return res;
}
/**