From e7dd8b490661c994c414c0edc2da1854d9bcef82 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 05 十一月 2026 13:33:12 +0800
Subject: [PATCH] feat(excel): 优化Excel列宽与必填标记并支持巡检附件

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/attachment/MesQcAttachmentController.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/attachment/MesQcAttachmentController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/attachment/MesQcAttachmentController.java
index 2489fd3..a00331b 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/attachment/MesQcAttachmentController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/qc/attachment/MesQcAttachmentController.java
@@ -31,13 +31,14 @@
     @Resource private MesQcIpqcService ipqcService;
     @Resource private MesQcOqcService oqcService;
     @Resource private MesQcRqcService rqcService;
+    @Resource private cn.iocoder.yudao.module.mes.controller.admin.qc.patrol.PatrolMapper patrolMapper;
     @Resource private StorageAttachmentApi storageApi;
     @Resource private org.springframework.jdbc.core.JdbcTemplate jdbcTemplate;
 
     @GetMapping("/list")
     @PreAuthorize("@ss.hasPermission('mes:qc-' + #type.toLowerCase() + ':query')")
     public CommonResult<List<StorageBlobRespDTO>> list(
-            @RequestParam @Pattern(regexp = "iqc|ipqc|oqc|rqc") String type,
+            @RequestParam @Pattern(regexp = "iqc|ipqc|oqc|rqc|patrol") String type,
             @RequestParam @NotNull Long id) {
         validateDocument(type, id);
         var files = storageApi.listAttachments(recordType(type), id);
@@ -74,7 +75,7 @@
     @PreAuthorize("@ss.hasPermission('mes:qc-' + #type.toLowerCase() + ':update')")
     @Transactional(rollbackFor = Exception.class)
     public CommonResult<Boolean> remove(
-            @RequestParam @Pattern(regexp = "iqc|ipqc|oqc|rqc") String type,
+            @RequestParam @Pattern(regexp = "iqc|ipqc|oqc|rqc|patrol") String type,
             @RequestParam @NotNull Long id, @RequestParam @NotNull Long blobId) {
         lockDocument(type, id);
         validateDocument(type, id);
@@ -84,7 +85,7 @@
 
     private String recordType(String type) {
         return switch (type) {
-            case "iqc", "ipqc", "oqc", "rqc" -> "mes_qc_" + type + "_attachment";
+            case "iqc", "ipqc", "oqc", "rqc", "patrol" -> "mes_qc_" + type + "_attachment";
             default -> throw new ServiceException(400, "璐ㄦ绫诲瀷鏃犳晥");
         };
     }
@@ -95,6 +96,7 @@
             case "ipqc" -> "mes_qc_ipqc";
             case "oqc" -> "mes_qc_oqc";
             case "rqc" -> "mes_qc_rqc";
+            case "patrol" -> "mes_qc_patrol";
             default -> throw new ServiceException(400, "璐ㄦ绫诲瀷鏃犳晥");
         };
         var ids = jdbcTemplate.queryForList("SELECT id FROM " + table + " WHERE id = ? AND deleted = 0 FOR UPDATE", Long.class, id);
@@ -107,17 +109,18 @@
             case "ipqc" -> ipqcService.validateIpqcExists(id).getStatus();
             case "oqc" -> oqcService.validateOqcExists(id).getStatus();
             case "rqc" -> rqcService.validateRqcExists(id).getStatus();
+            case "patrol" -> { if (patrolMapper.selectById(id) == null) throw new ServiceException(400, "宸℃璁板綍涓嶅瓨鍦�"); yield 0; }
             default -> throw new ServiceException(400, "璐ㄦ绫诲瀷鏃犳晥");
         };
     }
 
     @Data public static class SaveReq {
-        @NotNull @Pattern(regexp = "iqc|ipqc|oqc|rqc") private String type;
+        @NotNull @Pattern(regexp = "iqc|ipqc|oqc|rqc|patrol") private String type;
         @NotNull private Long id;
         @NotEmpty @Size(max = 50) private List<@NotNull Long> blobIds;
     }
     @Data public static class AppendReq {
-        @NotNull @Pattern(regexp = "iqc|ipqc|oqc|rqc") private String type;
+        @NotNull @Pattern(regexp = "iqc|ipqc|oqc|rqc|patrol") private String type;
         @NotNull private Long id;
         @NotNull private Long blobId;
     }

--
Gitblit v1.9.3