| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | |
| | | // 导出 |
| | | @RequestMapping(value = "/matCode/export/auth") |
| | | @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "物料编码数据导出") |
| | | public void export(@RequestParam(required = false) String fileName, |
| | | @RequestParam(required = false) Integer rowCount, |
| | | HttpServletResponse response) throws Exception { |
| | |
| | | response.setCharacterEncoding("utf-8"); |
| | | fileName = URLEncoder.encode(Cools.isEmpty(fileName)?"物料编码":fileName, "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), MatCodeExcel.class).sheet("表1").doWrite(excels); |
| | | EasyExcel.write(response.getOutputStream(), MatCodeExcel.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .sheet("表1") |
| | | .doWrite(excels); |
| | | } |
| | | |
| | | // 导入 |
| | | @RequestMapping(value = "/matCode/import/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "物料编码数据导入") |
| | | public R matCodeImport(MultipartFile file) throws IOException, InterruptedException { |
| | | Thread.sleep(2000); |
| | | EasyExcel.read(file.getInputStream(), MatCodeExcel.class, new MatCodeExcelListener()).sheet().doRead(); |