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/cal/plan/MesCalPlanController.java |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanController.java
index 5a1a782..73355e2 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanController.java
@@ -6,6 +6,8 @@
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanImportRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanPageReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanSaveReqVO;
@@ -13,6 +15,7 @@
 import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanService;
 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;
@@ -20,8 +23,11 @@
 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.time.LocalDateTime;
+import java.util.Collections;
 import java.util.List;
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
@@ -72,7 +78,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鎺掔彮璁″垝")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')")
     public CommonResult<MesCalPlanRespVO> getPlan(@RequestParam("id") Long id) {
         MesCalPlanDO plan = planService.getPlan(id);
         return success(BeanUtils.toBean(plan, MesCalPlanRespVO.class));
@@ -80,7 +85,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱鎺掔彮璁″垝鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')")
     public CommonResult<PageResult<MesCalPlanRespVO>> getPlanPage(@Valid MesCalPlanPageReqVO pageReqVO) {
         PageResult<MesCalPlanDO> pageResult = planService.getPlanPage(pageReqVO);
         return success(BeanUtils.toBean(pageResult, MesCalPlanRespVO.class));
@@ -99,4 +103,37 @@
                 BeanUtils.toBean(list, MesCalPlanRespVO.class));
     }
 
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱鎺掔彮璁″垝瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+        List<MesCalPlanImportExcelVO> list = Collections.singletonList(
+                MesCalPlanImportExcelVO.builder().code("PLAN-001").name("绀轰緥鎺掔彮璁″垝")
+                        .calendarType(1)
+                        .startDate(LocalDateTime.of(2026, 1, 1, 0, 0))
+                        .endDate(LocalDateTime.of(2026, 12, 31, 0, 0))
+                        .shiftType(2)
+                        .shiftMethod(1)
+                        .shiftCount(7)
+                        .excludeWeekend(true)
+                        .remark("").build()
+        );
+        // 杈撳嚭
+        ExcelUtils.writeTemplate(response, "鎺掔彮璁″垝瀵煎叆妯℃澘.xls", "鎺掔彮璁″垝鍒楄〃", MesCalPlanImportExcelVO.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:cal-plan:import')")
+    public CommonResult<MesCalPlanImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                             @RequestParam(value = "updateSupport", required = false,
+                                                                     defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<MesCalPlanImportExcelVO> list = ExcelUtils.read(file, MesCalPlanImportExcelVO.class);
+        return success(planService.importPlanList(list, updateSupport));
+    }
+
 }

--
Gitblit v1.9.3