From 104db2c4423867a7fa4f41343213f45985ae3110 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 19 八月 2026 18:00:35 +0800
Subject: [PATCH] 补充上传资料上传人上传时间文件附件

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/document/MesPdDocumentController.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/document/MesPdDocumentController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/document/MesPdDocumentController.java
index 3c84e72..26d88c8 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/document/MesPdDocumentController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/document/MesPdDocumentController.java
@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.mes.controller.admin.pd.document;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
@@ -13,6 +14,8 @@
 import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentSaveReqVO;
 import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO;
 import cn.iocoder.yudao.module.mes.service.pd.document.MesPdDocumentService;
+import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
+import cn.iocoder.yudao.module.system.api.storage.dto.StorageBlobRespDTO;
 import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
@@ -45,6 +48,8 @@
 
     @Resource
     private AdminUserApi adminUserApi;
+    @Resource
+    private StorageAttachmentApi storageAttachmentApi;
 
     @PostMapping("/create")
     @Operation(summary = "鍒涘缓璁捐璧勬枡")
@@ -79,7 +84,9 @@
         if (document == null) {
             return success(null);
         }
-        return success(buildDocumentRespVOList(Collections.singletonList(document)).get(0));
+        MesPdDocumentRespVO respVO = buildDocumentRespVOList(Collections.singletonList(document)).get(0);
+        respVO.setAttachmentList(storageAttachmentApi.listAttachments("mes_pd_document", id));
+        return success(respVO);
     }
 
     @GetMapping("/page")
@@ -112,10 +119,22 @@
         // 1.1 鎵归噺鑾峰彇鍏宠仈鏁版嵁锛堜笂浼犱汉锛�
         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(list, MesPdDocumentDO::getUploadUserId));
         // 2. 鎷兼帴 VO
-        return BeanUtils.toBean(list, MesPdDocumentRespVO.class, vo -> {
+        List<MesPdDocumentRespVO> voList = BeanUtils.toBean(list, MesPdDocumentRespVO.class, vo -> {
             MapUtils.findAndThen(userMap, vo.getUploadUserId(),
                     user -> vo.setUploadUserNickname(user.getNickname()));
         });
+        // 3. 鎷兼帴鏂囦欢淇℃伅锛氫紭鍏堝彇绗竴涓檮浠剁殑鍦板潃浣滀负 fileUrl锛屽苟鍦ㄦ湭濉枃浠跺悕鏃惰嚜鍔ㄨˉ鍏�
+        for (MesPdDocumentRespVO vo : voList) {
+            List<StorageBlobRespDTO> attachments = storageAttachmentApi.listAttachments("mes_pd_document", vo.getId());
+            if (CollUtil.isNotEmpty(attachments)) {
+                StorageBlobRespDTO first = attachments.get(0);
+                vo.setFileUrl(first.getUrl());
+                if (StrUtil.isEmpty(vo.getFileName())) {
+                    vo.setFileName(first.getName());
+                }
+            }
+        }
+        return voList;
     }
 
 }

--
Gitblit v1.9.3