From 523365960513f297024a419f94b2b42eccd9456f Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 09 四月 2026 11:21:41 +0800
Subject: [PATCH] #

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/PurchaseItemController.java |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/PurchaseItemController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/PurchaseItemController.java
index 8cdfc2d..702317d 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/PurchaseItemController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/PurchaseItemController.java
@@ -10,13 +10,18 @@
 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.manager.utils.buildPageRowsUtils;
 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 jakarta.servlet.http.HttpServletResponse;
 import java.util.*;
 
 @RestController
@@ -30,7 +35,9 @@
     public R page(@RequestBody Map<String, Object> map) {
         BaseParam baseParam = buildParam(map, BaseParam.class);
         PageParam<PurchaseItem, BaseParam> pageParam = new PageParam<>(baseParam, PurchaseItem.class);
-        return R.ok().add(purchaseItemService.page(pageParam, pageParam.buildWrapper(true)));
+        PageParam<PurchaseItem, BaseParam> page = purchaseItemService.page(pageParam, pageParam.buildWrapper(true));
+        buildPageRowsUtils.userNameMap(page.getRecords());
+        return R.ok().add(page);
     }
 
     @PreAuthorize("hasAuthority('manager:purchaseItem:list')")
@@ -107,4 +114,37 @@
         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);
+    }
+
+
 }

--
Gitblit v1.9.1