| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ImportParams; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import cn.afterturn.easypoi.excel.imports.ExcelImportService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | return R.ok(new PageResult().setRecords(matnrPage.getRecords()).setTotal(matnrPage.getTotal())); |
| | | } |
| | | |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @PostMapping("/matnr/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | |
| | | @PreAuthorize("hasAuthority('manager:matnr:save')") |
| | | @ApiOperation(value = "excel表格导入物料信息") |
| | | @PostMapping("/matnr/import") |
| | | public R listImport(MultipartFile file) { |
| | | try { |
| | | ExcelImportResult<Matnr> objectExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), Matnr.class, ExcelUtil.getDefaultImportParams()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | public R listImport(@RequestParam MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | throw new CoolException("文件不能为空!!"); |
| | | } |
| | | matnrService.importExcels(file); |
| | | |
| | | return R.ok(); |
| | | } |