| | |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.PurchaseItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; |
| | | import com.vincent.rsf.server.manager.entity.excel.PurchaseTemplate; |
| | | import com.vincent.rsf.server.manager.service.PurchaseItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.*; |
| | |
| | | ExcelUtil.build(ExcelUtil.create(purchaseItemService.list(), PurchaseItem.class), response); |
| | | } |
| | | |
| | | /** |
| | | * ASN单据明细导入 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/purchaseItem/import") |
| | | @ApiOperation("PO单导入接口") |
| | | @PreAuthorize("hasAuthority('manager:purchaseItem:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | return R.error("文件不能为空!!"); |
| | | } |
| | | return purchaseItemService.excelImport(file, getLoginUserId()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/purchaseItem/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:purchaseItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | PurchaseTemplate template = ExcelUtil.mockData(PurchaseTemplate.class); |
| | | List<PurchaseTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, PurchaseTemplate.class, true), response); |
| | | } |
| | | |
| | | |
| | | } |