From 62e51584e6ca4abfc681bc31d10bcae32d19a84f Mon Sep 17 00:00:00 2001 From: yubaolee Date: Wed, 25 Sep 2024 21:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#I9J6WS=20=E5=A2=9E=E5=8A=A0=E5=8A=A0?= =?UTF-8?q?=E7=AD=BE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FlowApproverApp/FlowApproverApp.cs | 29 +++++++++------ .../Request/AddApproverDtlReq.cs | 37 +++++++++++++++++++ .../FlowApproverApp/Request/AddApproverReq.cs | 20 ++-------- 3 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 OpenAuth.App/FlowApproverApp/Request/AddApproverDtlReq.cs diff --git a/OpenAuth.App/FlowApproverApp/FlowApproverApp.cs b/OpenAuth.App/FlowApproverApp/FlowApproverApp.cs index ed7d8e28..688561b7 100644 --- a/OpenAuth.App/FlowApproverApp/FlowApproverApp.cs +++ b/OpenAuth.App/FlowApproverApp/FlowApproverApp.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Infrastructure; using OpenAuth.App.Interface; @@ -14,25 +15,29 @@ namespace OpenAuth.App { public void Add(AddApproverReq obj) { - if (string.IsNullOrEmpty(obj.Id)) - { - obj.Id = Guid.NewGuid().ToString(); - } - var loginContext = _auth.GetCurrentUser(); if (loginContext == null) { throw new CommonException("登录已过期", Define.INVALID_TOKEN); } - var addObj = obj.MapTo(); - CaculateCascade(addObj); - addObj.CreateDate = DateTime.Now; - addObj.CreateUserId = loginContext.User.Id; - addObj.CreateUserName = loginContext.User.Name; - addObj.Name = addObj.Id; + var objs =new List(); + foreach (var approver in obj.Approvers) + { + var addobj = approver.MapTo(); + if (string.IsNullOrEmpty(addobj.Id)) + { + addobj.Id = Guid.NewGuid().ToString(); + } + + CaculateCascade(addobj); + addobj.CreateDate = DateTime.Now; + addobj.CreateUserId = loginContext.User.Id; + addobj.CreateUserName = loginContext.User.Name; + addobj.Name = addobj.Id; + } - Repository.Insert(addObj); + Repository.InsertRange(objs); } public void Update(AddApproverReq application) diff --git a/OpenAuth.App/FlowApproverApp/Request/AddApproverDtlReq.cs b/OpenAuth.App/FlowApproverApp/Request/AddApproverDtlReq.cs new file mode 100644 index 00000000..1d1ee0cb --- /dev/null +++ b/OpenAuth.App/FlowApproverApp/Request/AddApproverDtlReq.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was generated by a CodeSmith Template. +// +// DO NOT MODIFY contents of this file. Changes to this +// file will be lost if the code is regenerated. +// Author:Yubao Li +//------------------------------------------------------------------------------ + +namespace OpenAuth.App.Request +{ + /// + /// 加签人具体信息 + /// + public class AddApproverDtlReq + { + /// + ///Id + /// + public string Id { get; set; } + + /// + ///加签人姓名 + /// + public string ApproverName { get; set; } + + /// + ///加签人ID + /// + public string ApproverId { get; set; } + + + /// + ///顺序号(当类型为0时) + /// + public int? OrderNo { get; set; } + } +} \ No newline at end of file diff --git a/OpenAuth.App/FlowApproverApp/Request/AddApproverReq.cs b/OpenAuth.App/FlowApproverApp/Request/AddApproverReq.cs index 2f46bd39..41d5c13e 100644 --- a/OpenAuth.App/FlowApproverApp/Request/AddApproverReq.cs +++ b/OpenAuth.App/FlowApproverApp/Request/AddApproverReq.cs @@ -6,6 +6,8 @@ // Author:Yubao Li //------------------------------------------------------------------------------ +using System.Collections.Generic; + namespace OpenAuth.App.Request { /// @@ -13,30 +15,17 @@ namespace OpenAuth.App.Request /// public class AddApproverReq { - /// - ///Id - /// - public string Id { get; set; } - /// ///加签原因 /// public string Reason { get; set; } - /// - ///审批人 - /// - public string ApproverName { get; set; } /// ///工作流实例Id /// public string InstanceId { get; set; } - /// - ///审批人ID - /// - public string ApproverId { get; set; } /// ///类型(0顺序,1并行且,2并行或) @@ -53,9 +42,6 @@ namespace OpenAuth.App.Request /// public string ActivityId { get; set; } - /// - ///顺序号(当类型为0时) - /// - public int? OrderNo { get; set; } + public List Approvers { get; set; } } } \ No newline at end of file