From 481d8165f26fc7e37f0e87f6444ac0340bb563a3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期二, 03 十一月 2026 18:53:22 +0800
Subject: [PATCH] fix: 移植长辉已验证的四类接口 500/体验问题(不含物料颜色字段)

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

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordController.java
index 39761d1..55598d6 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordController.java
@@ -37,6 +37,10 @@
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
+import org.springframework.web.multipart.MultipartFile;
+import io.swagger.v3.oas.annotations.Parameters;
+import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.MesDvCheckRecordImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.MesDvCheckRecordImportRespVO;
 
 @Tag(name = "绠$悊鍚庡彴 - MES 璁惧鐐规璁板綍")
 @RestController
@@ -90,7 +94,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱璁惧鐐规璁板綍")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:dv-check-record:query')")
     public CommonResult<MesDvCheckRecordRespVO> getCheckRecord(@RequestParam("id") Long id) {
         MesDvCheckRecordDO checkRecord = checkRecordService.getCheckRecord(id);
         if (checkRecord == null) {
@@ -101,7 +104,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱璁惧鐐规璁板綍鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:dv-check-record:query')")
     public CommonResult<PageResult<MesDvCheckRecordRespVO>> getCheckRecordPage(@Valid MesDvCheckRecordPageReqVO pageReqVO) {
         PageResult<MesDvCheckRecordDO> pageResult = checkRecordService.getCheckRecordPage(pageReqVO);
         return success(new PageResult<>(buildCheckRecordRespVOList(pageResult.getList()), pageResult.getTotal()));
@@ -147,4 +149,34 @@
         });
     }
 
+
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱璁惧鐐规璁板綍瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+        List<MesDvCheckRecordImportExcelVO> list = Collections.singletonList(
+                MesDvCheckRecordImportExcelVO.builder()
+                        .machineryCode("MC-001").planCode("CP-001")
+                        .checkTime(java.time.LocalDateTime.of(2026, 12, 31, 8, 0))
+                        .userId(1L).remark("")
+                        .build()
+        );
+        // 杈撳嚭
+        ExcelUtils.writeTemplate(response, "璁惧鐐规璁板綍瀵煎叆妯℃澘.xls", "璁惧鐐规璁板綍鍒楄〃", MesDvCheckRecordImportExcelVO.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-record:import')")
+    public CommonResult<MesDvCheckRecordImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                           @RequestParam(value = "updateSupport", required = false,
+                                                                   defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<MesDvCheckRecordImportExcelVO> list = ExcelUtils.read(file, MesDvCheckRecordImportExcelVO.class);
+        return success(checkRecordService.importCheckRecordList(list, updateSupport));
+    }
+
 }

--
Gitblit v1.9.3