| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.PurchaseTemplate; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.PurchaseItem; |
| | | import com.vincent.rsf.server.manager.service.PurchaseItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | |
| | | @Service("purchaseItemService") |
| | | public class PurchaseItemServiceImpl extends ServiceImpl<PurchaseItemMapper, PurchaseItem> implements PurchaseItemService { |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/5/6 |
| | | * @description: PO单导入功能 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public R excelImport(MultipartFile file, Long loginUserId) throws Exception { |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), PurchaseTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | } |