| | |
| | | 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; |
| | |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.base.service.impl.LWhFormProcureCoreService; |
| | | import com.consum.base.service.core.LWhFormProcureCoreService; |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormProcure; |
| | |
| | | * 根据id查询详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id) throws IllegalAccessException { |
| | | public ResponseValue getById(Long id) throws Exception { |
| | | if (id == null) { |
| | | return ResponseValue.error("采购单id为空"); |
| | | } |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | formProcureQry.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | // formProcureQry.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | GenericPager genericPager = lWhFormProcureService.queryFormProcureDetailList(formProcureQry); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | @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(); |
| | | |