From 2d9194764070c154d9c32f4572aa73041e7f50fa Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期二, 22 四月 2025 15:08:14 +0800
Subject: [PATCH] 1.OA测试数据构建

---
 service/QC/OAJyService.cs |   53 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/service/QC/OAJyService.cs b/service/QC/OAJyService.cs
index d04132e..cc9593b 100644
--- a/service/QC/OAJyService.cs
+++ b/service/QC/OAJyService.cs
@@ -199,13 +199,11 @@
             var userId = "FRadmin";
             var encryptedUserId = RsaHelper.Encrypt(userId, SPK);
             string strToken = GetToken();
-    
-            // 鏋勫缓鏈夋晥娴嬭瘯鏁版嵁
-             mainDataDict = new Dictionary<string, object>
-            {
-                ["KQSDATE"] = DateTime.Now.AddDays(-1).ToString("yyyy-MM-ddTHH:mm:sszzz"),
-                ["KQEDATE"] = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz")
-            };
+
+
+            // 鏇挎崲鍘熸湁鐨勬祴璇曟暟鎹瀯寤�
+            mainDataDict = BuildMainDataFromQuery(query);
+
     
             // 璋冪敤鏂规硶澧炲姞userid璇锋眰澶�
             var result = SubmitWorkflowRequest(
@@ -265,8 +263,8 @@
             {
                 //["userId"] = "1268",
                 ["workflowId"] = workflowId,
-                ["mainData"] = mainData,
-                ["detailData"] = detailData ?? new Dictionary<string, object>(),
+                ["mainData"] = new List<Dictionary<string, object>> { mainData }, // 鍖呰鎴愭暟缁�
+                ["detailData"] = null,
                 ["otherParams"] = otherParams ?? new Dictionary<string, object>(),
                 ["remark"] = remark,
                 ["requestLevel"] = requestLevel,
@@ -321,4 +319,41 @@
             throw new Exception($"娴佺▼鎻愪氦寮傚父: {ex.Message}");
         }
     }
+
+
+    // 鏂板鐨勬瀯寤烘柟娉�
+    private Dictionary<string, object> BuildMainDataFromQuery(dynamic query)
+    {
+        var mainData = new Dictionary<string, object>
+        {
+            // 琛ㄧ粨鏋勫畾涔�
+            ["tableDBName"] = "formtable_main_1356_dt1",
+            ["workflowRequestTableRecords"] = new List<Dictionary<string, object>>
+            {
+                new Dictionary<string, object>
+                {
+                    ["recordOrder"] = 0,
+                    ["workflowRequestTableFields"] = new List<Dictionary<string, object>>
+                    {
+                        new Dictionary<string, object> { ["fieldName"] = "wlbm", ["fieldValue"] = "1.01.01.001" },
+                        new Dictionary<string, object> { ["fieldName"] = "khgys", ["fieldValue"] = "闄堥洩骞�" },
+                        new Dictionary<string, object> { ["fieldName"] = "jzmcwlmc", ["fieldValue"] = "椤剁洊" },
+                        new Dictionary<string, object> { ["fieldName"] = "bhgpqxms", ["fieldValue"] = "澶栬涓嶅悎鏍硷紝灏哄涓嶅悎鏍硷紝棰滆壊涓嶇鍚�" },
+                        new Dictionary<string, object> { ["fieldName"] = "dhdhmes", ["fieldValue"] = "MES001" }
+                    }
+                }
+            }
+        };
+
+        return mainData;
+    }
+
+    // 杈呭姪鏂规硶鐢ㄤ簬瀹夊叏娣诲姞灞炴��
+    private void TryAddProperty(Dictionary<string, object> dict, string key, object value)
+    {
+        if (value != null)
+        {
+            dict[key] = value;
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3