From 883f5e73fbe7458fd760dbe8560dd5d8757e04cd Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期三, 04 十一月 2026 13:56:29 +0800
Subject: [PATCH] refactor: 按需求表收敛范围,撤销非需求模块,补齐售后回访闭环

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java
index 55872f1..6fde67d 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java
@@ -26,6 +26,11 @@
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import org.springframework.web.multipart.MultipartFile;
+import io.swagger.v3.oas.annotations.Parameters;
+import java.util.Collections;
+import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanImportRespVO;
 
 @Tag(name = "绠$悊鍚庡彴 - MES 鐐规淇濆吇鏂规")
 @RestController
@@ -81,7 +86,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鐐规淇濆吇鏂规")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')")
     public CommonResult<MesDvCheckPlanRespVO> getCheckPlan(@RequestParam("id") Long id) {
         MesDvCheckPlanDO checkPlan = checkPlanService.getCheckPlan(id);
         return success(BeanUtils.toBean(checkPlan, MesDvCheckPlanRespVO.class));
@@ -89,7 +93,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱鐐规淇濆吇鏂规鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')")
     public CommonResult<PageResult<MesDvCheckPlanRespVO>> getCheckPlanPage(@Valid MesDvCheckPlanPageReqVO pageReqVO) {
         PageResult<MesDvCheckPlanDO> pageResult = checkPlanService.getCheckPlanPage(pageReqVO);
         return success(BeanUtils.toBean(pageResult, MesDvCheckPlanRespVO.class));
@@ -108,4 +111,35 @@
                 BeanUtils.toBean(list, MesDvCheckPlanRespVO.class));
     }
 
+
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱鐐规淇濆吇鏂规瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+        List<MesDvCheckPlanImportExcelVO> list = Collections.singletonList(
+                MesDvCheckPlanImportExcelVO.builder()
+                        .code("CP-001").name("娉ㄥ鏈烘棩妫�鏂规").type(1)
+                        .startDate(java.time.LocalDateTime.of(2026, 1, 1, 0, 0))
+                        .endDate(java.time.LocalDateTime.of(2026, 12, 31, 0, 0))
+                        .cycleType(1).cycleCount(1).remark("")
+                        .build()
+        );
+        // 杈撳嚭
+        ExcelUtils.writeTemplate(response, "鐐规淇濆吇鏂规瀵煎叆妯℃澘.xls", "鐐规淇濆吇鏂规鍒楄〃", MesDvCheckPlanImportExcelVO.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:dv-check-plan:import')")
+    public CommonResult<MesDvCheckPlanImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                           @RequestParam(value = "updateSupport", required = false,
+                                                                   defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<MesDvCheckPlanImportExcelVO> list = ExcelUtils.read(file, MesDvCheckPlanImportExcelVO.class);
+        return success(checkPlanService.importCheckPlanList(list, updateSupport));
+    }
+
 }

--
Gitblit v1.9.3