futian.liu
2023-12-22 fd95223d9703b9c038ed3c782474c885052dda08
consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java
@@ -21,7 +21,7 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelDataConvertException;
@@ -216,7 +216,7 @@
     * 根据id查询详情
     */
    @GetMapping("/detail")
    public ResponseValue getById(Long id) throws IllegalAccessException {
    public ResponseValue getById(Long id) throws Exception {
        if (id == null) {
            return ResponseValue.error("采购单id为空");
        }
@@ -329,7 +329,7 @@
        map.put("totalAmount", totalAmount);
        Workbook workbook = ExcelExportUtil.exportExcel(params, ProcureExcelTemplate.class, exportList, map);
        String filePath = downLoadExcel("采购入库单", response, workbook);
        String filePath = downLoadExcel("采购入库单", workbook);
        return ResponseValue.success("导出成功", filePath);
    }
@@ -338,14 +338,14 @@
    @PostMapping("/import")
    public ResponseValue upload(MultipartFile file) throws IOException {
        String originalFilename = file.getOriginalFilename();
        if (!originalFilename.endsWith(".xls")) {
        if (!".xls".endsWith(originalFilename)) {
            return ResponseValue.error("文件格式有误!");
        }
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            return ResponseValue.error("当前登录用户为空");
        }
        EasyExcel.read(file.getInputStream(), ImportProcureOrderTemplate.class,
        EasyExcelFactory.read(file.getInputStream(), ImportProcureOrderTemplate.class,
            new AnalysisEventListener<ImportProcureOrderTemplate>() {
                List<LWhFormProcureParam> list = Lists.newArrayList();