From ed01be06d17f1159d32e7fa2133a32f2986d3b9f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 22 九月 2026 14:50:53 +0800
Subject: [PATCH] refactor(mes): 替换物料服务为MDM API并完善质检Word导出功能

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/indicatorresult/MesQcProductReportWordBuilder.java |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/indicatorresult/MesQcProductReportWordBuilder.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/indicatorresult/MesQcProductReportWordBuilder.java
index bee442a..431081f 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/indicatorresult/MesQcProductReportWordBuilder.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/indicatorresult/MesQcProductReportWordBuilder.java
@@ -18,7 +18,8 @@
  * 浜у搧妫�楠屽崟锛堢焊璐�"脳脳浜у搧璐ㄩ噺妫�楠屽崟"鐗堝紡锛塛ord 鏋勫缓鍣�
  *
  * 鐗堝紡锛氭爣棰橈紙鍏徃 + 浜у搧妫�楠屽崟锛夆啋 琛ㄥご淇℃伅 5 琛� 鈫� 妫�楠岄」鐩�/妫�楠岀粨鏋� 涓ゅ垪鐭╅樀 鈫�
- * 鍒ゅ畾缁撹/璐ㄦ涓撶敤绔狅紙鐣欑┖锛屾墦鍗板悗鎵嬪~锛夆啋 澶囨敞 鈫� 妫�楠�/澶嶆牳/鎵瑰噯绛惧瓧琛屻��
+ * 鍒ゅ畾缁撹锛堣嚜鍔ㄥ甫鍑烘楠岀粨鏋滐級/璐ㄦ涓撶敤绔狅紙鐣欑┖鐩栫珷锛夆啋 澶囨敞 鈫�
+ * 妫�楠�/澶嶆牳/鎵瑰噯绛惧瓧琛岋紙鍒嗗埆甯﹀嚭妫�娴嬩汉銆佸鏍镐汉銆佸鏍镐汉濮撳悕锛夈��
  * 涓嶅惈鎶�鏈寚鏍囧垪锛涘垎缁勯」涓嶅睍绀猴紝褰曞叆椤瑰钩閾猴紱骞宠娴嬮噺澶氬�奸】鍙峰悎骞躲��
  */
 public class MesQcProductReportWordBuilder {
@@ -51,9 +52,9 @@
             writeTitle(doc, report);
             writeHeaderTable(doc, report);
             writeItemTable(doc, report);
-            writeConclusionTable(doc);
+            writeConclusionTable(doc, report);
             writeRemarkTable(doc, report);
-            writeSignLine(doc);
+            writeSignLine(doc, report);
             doc.write(out);
             return out.toByteArray();
         }
@@ -150,12 +151,14 @@
                 .orElse(EMPTY);
     }
 
-    // ========== 鍒ゅ畾缁撹 / 璐ㄦ涓撶敤绔狅紙鐣欑┖鍚庡~锛� ==========
+    // ========== 鍒ゅ畾缁撹 / 璐ㄦ涓撶敤绔� ==========
 
-    private static XWPFTable writeConclusionTable(XWPFDocument doc) {
+    /** 鍒ゅ畾缁撹鑷姩甯﹀嚭妫�楠岀粨鏋滄枃妗堬紱璐ㄦ涓撶敤绔犵暀绌猴紝鎵撳嵃鍚庝汉宸ョ洊绔� */
+    private static XWPFTable writeConclusionTable(XWPFDocument doc, MesQcQcReportRespVO report) {
         XWPFTable table = createTable(doc);
-        XWPFTableRow row = addRow(table, valueLeftSpan("鍒ゅ畾缁撹锛�", 2), valueLeftSpan("璐ㄦ涓撶敤绔狅細", 2));
-        // 棰勭暀鎵嬪啓/鐩栫珷楂樺害
+        String conclusion = notBlank(report.getCheckResultText()) ? report.getCheckResultText() : "";
+        XWPFTableRow row = addRow(table, valueLeftSpan("鍒ゅ畾缁撹锛�" + conclusion, 2), valueLeftSpan("璐ㄦ涓撶敤绔狅細", 2));
+        // 棰勭暀鐩栫珷楂樺害
         setRowHeight(row, 2550);
         return table;
     }
@@ -170,12 +173,23 @@
 
     // ========== 绛惧瓧琛� ==========
 
-    /** 绛惧瓧琛屽浐瀹氱暀绌猴紝涓庡垽瀹氱粨璁�/璐ㄦ涓撶敤绔犱竴鑷达紝鎵撳嵃鍚庢墜鍐� */
-    private static void writeSignLine(XWPFDocument doc) {
+    /**
+     * 绛惧瓧琛岋細妫�楠�/澶嶆牳/鎵瑰噯鍒嗗埆甯﹀嚭妫�娴嬩汉锛坕nspectorUserId锛夈�佸鏍镐汉锛坅uditUserId锛夈��
+     * 瀹℃牳浜猴紙approveUserId锛夊鍚嶏紱鏈寚瀹氫汉鍛樻椂璇ユ鐣欑┖锛屾墦鍗板悗鎵嬪啓
+     */
+    private static void writeSignLine(XWPFDocument doc, MesQcQcReportRespVO report) {
         XWPFParagraph paragraph = doc.createParagraph();
         paragraph.setAlignment(ParagraphAlignment.LEFT);
         paragraph.setSpacingBefore(400);
-        addRun(paragraph, "妫�楠岋細銆�銆�銆�銆�銆�銆�銆�銆�銆�澶嶆牳锛氥��銆�銆�銆�銆�銆�銆�銆�銆�鎵瑰噯锛氥��銆�銆�銆�銆�銆�銆�銆�", 12, true);
+        String text = "妫�楠岋細" + signName(report.getInspectorName())
+                + "銆�銆�銆�銆�澶嶆牳锛�" + signName(report.getAuditName())
+                + "銆�銆�銆�銆�鎵瑰噯锛�" + signName(report.getApproveName());
+        addRun(paragraph, text, 12, true);
+    }
+
+    /** 绛惧悕娈碉細鏈夊鍚嶅垯鎵撳嵃濮撳悕骞剁暀绛惧悕浣欓噺锛屾棤濮撳悕鍒欐暣娈电暀绌轰究浜庢墜鍐� */
+    private static String signName(String name) {
+        return notBlank(name) ? name + "銆�銆�銆�" : "銆�銆�銆�銆�銆�";
     }
 
     // ========== 琛ㄦ牸鍩虹 ==========

--
Gitblit v1.9.3