From 9075785a9e14f6220783d052d231f915c6930b87 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期三, 04 十一月 2026 10:21:45 +0800
Subject: [PATCH] revert(collect): 撤销 collect 数采模块(新高设备管理已有自己的采集方式)

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
index 21ed7b7..6222b81 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
@@ -10,6 +10,8 @@
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi;
 import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO;
+import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesImportRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesPageReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesSaveReqVO;
@@ -20,6 +22,7 @@
 import cn.iocoder.yudao.module.mes.service.wm.salesnotice.MesWmSalesNoticeService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
@@ -27,6 +30,7 @@
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.util.*;
@@ -75,7 +79,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱閿�鍞嚭搴撳崟")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:query')")
     public CommonResult<MesWmProductSalesRespVO> getProductSales(@RequestParam("id") Long id) {
         MesWmProductSalesDO sales = productSalesService.getProductSales(id);
         if (sales == null) {
@@ -86,7 +89,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱閿�鍞嚭搴撳崟鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:query')")
     public CommonResult<PageResult<MesWmProductSalesRespVO>> getProductSalesPage(
             @Valid MesWmProductSalesPageReqVO pageReqVO) {
         PageResult<MesWmProductSalesDO> pageResult = productSalesService.getProductSalesPage(pageReqVO);
@@ -117,7 +119,6 @@
     @GetMapping("/check-quantity")
     @Operation(summary = "鏍¢獙閿�鍞嚭搴撳崟鏁伴噺")
     @Parameter(name = "id", description = "缂栧彿", required = true)
-    @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:query')")
     public CommonResult<Boolean> checkProductSalesQuantity(@RequestParam("id") Long id) {
         return success(productSalesService.checkProductSalesQuantity(id));
     }
@@ -157,6 +158,34 @@
         return success(true);
     }
 
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱閿�鍞嚭搴撳崟瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+        List<MesWmProductSalesImportExcelVO> list = Collections.singletonList(
+                MesWmProductSalesImportExcelVO.builder()
+                        .code("XS001").name("绀轰緥閿�鍞嚭搴撳崟")
+                        .salesDate(java.time.LocalDateTime.now()).salesOrderCode("SO001")
+                        .contactName("寮犱笁").remark("").build()
+        );
+        // 杈撳嚭
+        ExcelUtils.writeTemplate(response, "閿�鍞嚭搴撳崟瀵煎叆妯℃澘.xls", "閿�鍞嚭搴撳崟鍒楄〃", MesWmProductSalesImportExcelVO.class, list);
+    }
+
+    @PostMapping("/import")
+    @Operation(summary = "瀵煎叆閿�鍞嚭搴撳崟")
+    @Parameters({
+            @Parameter(name = "file", description = "Excel 鏂囦欢", required = true),
+            @Parameter(name = "updateSupport", description = "鏄惁鏀寔鏇存柊锛岄粯璁や负 false", example = "true")
+    })
+    @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:import')")
+    public CommonResult<MesWmProductSalesImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                                   @RequestParam(value = "updateSupport", required = false,
+                                                                           defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<MesWmProductSalesImportExcelVO> list = ExcelUtils.read(file, MesWmProductSalesImportExcelVO.class);
+        return success(productSalesService.importProductSalesList(list, updateSupport));
+    }
+
     // ==================== 鎷兼帴 VO ====================
 
     private List<MesWmProductSalesRespVO> buildRespVOList(List<MesWmProductSalesDO> list) {
@@ -177,4 +206,4 @@
         });
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3