From a76e1d17d67641993dea6335cb8e1465a94df58d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 21 五月 2026 15:39:05 +0800
Subject: [PATCH] feat(stock): 优化库存管理和成品树结构功能 1- 为ApproveProcessMapper.xml和ProductBomMapper.xml添加排序功能 2- 在ProductionProductMainDto中新增bomInputQty字段用于产品结构投入数量 3- 修改ProductionProductMainServiceImpl中投入数量计算逻辑,使用前端传入的bomInputQty值 4- 在ProductWorkOrderDto中添加bomInputQty字段并在服务实现中计算标准投入数量 5- 更新SalesLedgerMapper.xml查询逻辑,从product_summary获取电压信息 6- 为SalesLedgerProduct添加stockId字段并修改库存扣减逻辑使用具体库存ID 7- 重构StockInventoryController中的成品库存树查询接口和导入导出功能 8- 新增成品和非成品库存导入导出的数据模型和Excel工具类 9- 优化StockInventoryServiceImpl中的库存扣减逻辑,支持按特定库存ID操作 10- 更新库存导入导出功能,区分成品和非成品类型并提供相应模板

---
 src/main/java/com/ruoyi/basic/controller/CustomerController.java |  104 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 1c27557..e89e203 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -1,107 +1,119 @@
 package com.ruoyi.basic.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.pojo.Customer;
 import com.ruoyi.basic.service.ICustomerService;
-import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.page.TableDataInfo;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 瀹㈡埛妗fController
- * 
+ *
  * @author ruoyi
  * @date 2025-05-07
  */
 @RestController
-@RequestMapping("/system/customer")
+@RequestMapping("/basic/customer")
 @AllArgsConstructor
-public class CustomerController extends BaseController
-{
-    @Autowired
+public class CustomerController extends BaseController {
     private ICustomerService customerService;
 
     /**
      * 鏌ヨ瀹㈡埛妗f鍒楄〃
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:list')")
     @GetMapping("/list")
-    public TableDataInfo list(Customer customer)
-    {
-        startPage();
-        List<Customer> list = customerService.selectCustomerList(customer);
-        return getDataTable(list);
+    public IPage<Customer> list(Page page, Customer customer) {
+        return customerService.selectCustomerList(page, customer);
     }
 
     /**
      * 瀵煎嚭瀹㈡埛妗f鍒楄〃
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:export')")
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, Customer customer)
-    {
-        List<Customer> list = customerService.selectCustomerList(customer);
+    public void export(HttpServletResponse response, Customer customer) {
+        Long[] ids = customer.getIds();
+        List<Customer> list;
+        if (ids != null && ids.length > 0) {
+            list = customerService.selectCustomerListByIds(ids);
+        } else {
+            list = customerService.selectCustomerLists(customer);
+        }
         ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
         util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+    }
+
+    @PostMapping("/downloadTemplate")
+    @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
+    public void downloadTemplate(HttpServletResponse response) {
+        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
+        util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
+    }
+
+
+    /**
+     * 瀵煎叆瀹㈡埛妗f
+     */
+    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file) throws Exception {
+
+        return customerService.importData(file);
     }
 
     /**
      * 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(customerService.selectCustomerById(id));
     }
 
     /**
      * 鏂板瀹㈡埛妗f
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:add')")
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody Customer customer)
-    {
+    @PostMapping("/addCustomer")
+    public AjaxResult add(@RequestBody Customer customer) {
         return toAjax(customerService.insertCustomer(customer));
     }
 
     /**
      * 淇敼瀹㈡埛妗f
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:edit')")
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody Customer customer)
-    {
+    @PostMapping("/updateCustomer")
+    public AjaxResult edit(@RequestBody Customer customer) {
         return toAjax(customerService.updateCustomer(customer));
     }
 
     /**
      * 鍒犻櫎瀹㈡埛妗f
      */
-    @PreAuthorize("@ss.hasPermi('system:customer:remove')")
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/delCustomer")
+    public AjaxResult remove(@RequestBody Long[] ids) {
+        if (ids == null || ids.length == 0) {
+            return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+        }
         return toAjax(customerService.deleteCustomerByIds(ids));
     }
+
+    /**
+     * 鏌ヨ瀹㈡埛
+     */
+    @GetMapping("/customerList")
+    public List customerList(Customer customer) {
+        return customerService.customerList(customer);
+    }
 }

--
Gitblit v1.9.3