skyouc
2025-03-07 3f332022ca04a0fa2806f424a1126cb9392a6153
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java
@@ -21,6 +21,8 @@
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@@ -126,12 +128,22 @@
        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 {
        ExcelUtil.build(ExcelUtil.create(matnrService.list(), Matnr.class), response);
    }
    @PreAuthorize("hasAuthority('manager:matnr:save')")
    @ApiOperation(value = "excel表格导入物料信息")
    @PostMapping("/matnr/import")
    public R listImport(@RequestParam MultipartFile file) throws Exception {
        if (Objects.isNull(file)) {
            throw new CoolException("文件不能为空!!");
        }
        matnrService.importExcels(file);
        return R.ok();
    }
}