diff --git a/DOC/核心设计.EAP b/DOC/核心设计.EAP index 25556070..58bda3d4 100644 Binary files a/DOC/核心设计.EAP and b/DOC/核心设计.EAP differ diff --git a/OpenAuth.App/Flow/FlowNode.cs b/OpenAuth.App/Flow/FlowNode.cs index ff41c59d..f86e85ff 100644 --- a/OpenAuth.App/Flow/FlowNode.cs +++ b/OpenAuth.App/Flow/FlowNode.cs @@ -27,9 +27,20 @@ public class Setinfo { + public const string SPECIAL_USER = "SPECIAL_USER"; //指定用户 + public const string ALL_USER = "ALL_USER"; //所有用户 + /// + /// 节点执行权限类型 + /// + public string NodeDesignate { get; set; } public Nodedesignatedata NodeDesignateData { get; set; } public string NodeCode { get; set; } public string NodeName { get; set; } + + /// + /// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理" + /// + public string NodeRejectType { get; set; } } /// @@ -43,6 +54,9 @@ } + /// + /// 节点执行结果标签 + /// public class Tag { public int Taged { get; set; } diff --git a/OpenAuth.App/Flow/FlowRuntime.cs b/OpenAuth.App/Flow/FlowRuntime.cs index c39f9a30..9ad92214 100644 --- a/OpenAuth.App/Flow/FlowRuntime.cs +++ b/OpenAuth.App/Flow/FlowRuntime.cs @@ -23,14 +23,15 @@ namespace OpenAuth.App.Flow dynamic schemeContentJson = instance.SchemeContent.ToJson();//获取工作流模板内容的json对象; _runtimeModel.frmData = instance.FrmData; _runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象 - _runtimeModel.nodes = GetNodeDictionary(schemeContentJson);//节点集合 + _runtimeModel.nodes = GetNodes(schemeContentJson);//节点集合 _runtimeModel.lines = GetLineDictionary(schemeContentJson);//线条集合 _runtimeModel.currentNodeId = (instance.ActivityId == "" ? _runtimeModel.startNodeId : instance.ActivityId); _runtimeModel.currentNodeType = GetNodeType(_runtimeModel.currentNodeId); + //会签开始节点和流程结束节点没有下一步 if (_runtimeModel.currentNodeType == 0 || _runtimeModel.currentNodeType == 4) { - _runtimeModel.nextNodeId = "-1";//下一个节点 + _runtimeModel.nextNodeId = "-1"; _runtimeModel.nextNodeType = -1; } else @@ -50,22 +51,22 @@ namespace OpenAuth.App.Flow /// /// /// - private Dictionary GetNodeDictionary(dynamic schemeContentJson) + private Dictionary GetNodes(dynamic schemeContentJson) { - Dictionary nodeDictionary = new Dictionary(); + Dictionary nodes = new Dictionary(); foreach (JObject item in schemeContentJson.nodes) { var node = item.ToObject(); - if (!nodeDictionary.ContainsKey(node.id)) + if (!nodes.ContainsKey(node.id)) { - nodeDictionary.Add(node.id, node); + nodes.Add(node.id, node); } if (node.type == FlowNode.START) { this._runtimeModel.startNodeId = node.id; } } - return nodeDictionary; + return nodes; } /// /// 获取工作流线段的字典列表:key开始节点id,value线条实体列表 @@ -379,45 +380,27 @@ namespace OpenAuth.App.Flow { return RejectNode(_runtimeModel.currentNodeId); } - /// - /// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理" - /// - /// - /// + public string RejectNode(string nodeId) { - try + dynamic _node = _runtimeModel.nodes[nodeId]; + if (_node.setInfo != null) { - dynamic _node = _runtimeModel.nodes[nodeId]; - if (_node.setInfo != null) - { - if (_node.setInfo.NodeRejectType.Value == "0") - { - return _runtimeModel.previousId; - } - else if (_node.setInfo.NodeRejectType.Value == "1") - { - return GetNextNodeByNodeId(_runtimeModel.startNodeId); - } - else if (_node.setInfo.NodeRejectType.Value == "2") - { - return _node.setInfo.NodeRejectStep.Value; - } - else - { - return ""; - } - - } - else//前一步 + if (_node.setInfo.NodeRejectType.Value == "0") { return _runtimeModel.previousId; } + if (_node.setInfo.NodeRejectType.Value == "1") + { + return GetNextNodeByNodeId(_runtimeModel.startNodeId); + } + if (_node.setInfo.NodeRejectType.Value == "2") + { + return _node.setInfo.NodeRejectStep.Value; + } + return ""; } - catch - { - throw; - } + return _runtimeModel.previousId; } /// /// 标记节点1通过,-1不通过,0驳回 diff --git a/OpenAuth.App/FlowInstanceApp.cs b/OpenAuth.App/FlowInstanceApp.cs index c5a4a86f..b8896556 100644 --- a/OpenAuth.App/FlowInstanceApp.cs +++ b/OpenAuth.App/FlowInstanceApp.cs @@ -16,7 +16,7 @@ namespace OpenAuth.App /// public class FlowInstanceApp : BaseApp { - + #region ̴API /// /// һʵ @@ -146,7 +146,7 @@ namespace OpenAuth.App string confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, tag); - + switch (confluenceres) { case "-1"://ͨ @@ -176,7 +176,7 @@ namespace OpenAuth.App }; processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); #endregion - + break; } } @@ -215,14 +215,14 @@ namespace OpenAuth.App processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); #endregion - + flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description; } else { flowInstance.IsFinish = 3; //ʾýڵ㲻ͬ tag.Taged = -1; - wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId,tag); + wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag); flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description; } @@ -240,13 +240,10 @@ namespace OpenAuth.App /// /// /// - /// - /// - /// /// - public bool NodeReject(string processId, string nodeId, string description = "") + public bool NodeReject(VerificationReq reqest) { - FlowInstance flowInstance = Get(processId); + FlowInstance flowInstance = Get(reqest.FlowInstanceId); FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory(); FlowInstanceTransitionHistory processTransitionHistoryEntity = null; @@ -254,19 +251,19 @@ namespace OpenAuth.App string resnode = ""; - if (nodeId == "") + if (string.IsNullOrEmpty(reqest.NodeRejectStep)) { resnode = wfruntime.RejectNode(); } else { - resnode = nodeId; + resnode = reqest.NodeRejectStep; } var user = AuthUtil.GetCurrentUser().User; var tag = new Tag { - Description = description, + Description = reqest.VerificationOpinion, Taged = 0, UserId = user.Id, UserName = user.Name @@ -278,29 +275,32 @@ namespace OpenAuth.App { flowInstance.PreviousId = flowInstance.ActivityId; flowInstance.ActivityId = resnode; - flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1޷,0ǩʼ,1ǩ,2һڵ,4н + flowInstance.ActivityType = wfruntime.GetNodeType(resnode); flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name; flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//ǰڵִеϢ #region ת¼ - processTransitionHistoryEntity = new FlowInstanceTransitionHistory(); - processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId; - processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name; - processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType; - processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId; - processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name; - processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType; - processTransitionHistoryEntity.TransitionSate = 1;// + + processTransitionHistoryEntity = new FlowInstanceTransitionHistory + { + FromNodeId = wfruntime.runtimeModel.currentNodeId, + FromNodeName = wfruntime.runtimeModel.currentNode.name, + FromNodeType = wfruntime.runtimeModel.currentNodeType, + ToNodeId = wfruntime.runtimeModel.nextNodeId, + ToNodeName = wfruntime.runtimeModel.nextNode.name, + ToNodeType = wfruntime.runtimeModel.nextNodeType, + TransitionSate = 1 + }; + // processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); #endregion } - var data = new - { - SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(), - frmData = (flowInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null) - }; - flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + ",ע" + description; - UnitWork.Add(flowInstance); + + flowInstanceOperationHistory.Content = "" + "todo name" + "" + + wfruntime.runtimeModel.currentNode.name + + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + ",ע" + reqest.VerificationOpinion; + + UnitWork.Update(flowInstance); UnitWork.Add(flowInstanceOperationHistory); UnitWork.Add(processTransitionHistoryEntity); UnitWork.Save(); @@ -361,23 +361,21 @@ namespace OpenAuth.App /// private string GetMakerList(FlowNode node, string processId) { - try - { - string makerlsit = ""; + string makerlsit = ""; - if (node.setInfo == null) + if (node.setInfo == null) + { + makerlsit = "-1"; + } + else + { + if (node.setInfo.NodeDesignate == Setinfo.ALL_USER)//гԱ { - makerlsit = "-1"; + makerlsit = "1"; } - else + else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_USER)//ָԱ { - //if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//гԱ - //{ - // makerlsit = "1"; - //} - //else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//ָԱ - //{ - makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit); + // makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit); // makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.post, makerlsit); // makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.usergroup, makerlsit); makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit); @@ -386,75 +384,11 @@ namespace OpenAuth.App { makerlsit = "-1"; } - // } - //else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType3")//쵼 - //{ - // UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId); - // if (string.IsNullOrEmpty(userEntity.ManagerId)) - // { - // makerlsit = "-1"; - // } - // else - // { - // makerlsit = userEntity.ManagerId; - // } - //} - //else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType4")//ǰһ쵼 - //{ - // FlowInstanceTransitionHistory transitionHistoryEntity = FlowInstanceTransitionHistoryService.GetEntity(flowInstanceId, node.id.Value); - // UserEntity userEntity = userService.GetEntity(transitionHistoryEntity.CreateUserId); - // if (string.IsNullOrEmpty(userEntity.ManagerId)) - // { - // makerlsit = "-1"; - // } - // else - // { - // makerlsit = userEntity.ManagerId; - // } - //} - //else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType5")//߲쵼 - //{ - // UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId); - // DepartmentEntity departmentEntity = departmentService.GetEntity(userEntity.DepartmentId); - - // if (string.IsNullOrEmpty(departmentEntity.ManagerId)) - // { - // makerlsit = "-1"; - // } - // else - // { - // makerlsit = departmentEntity.ManagerId; - // } - //} - //else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType6")//߹˾쵼 - //{ - // UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId); - // OrganizeEntity organizeEntity = organizeService.GetEntity(userEntity.OrganizeId); - - // if (string.IsNullOrEmpty(organizeEntity.ManagerId)) - // { - // makerlsit = "-1"; - // } - // else - // { - // makerlsit = organizeEntity.ManagerId; - // } - //} } - return makerlsit; - } - catch - { - throw; } + return makerlsit; } - /// - /// תɶִ - /// - /// - /// - /// - + /// /// /// 2017-01-20 15:44:45 @@ -464,12 +398,7 @@ namespace OpenAuth.App // if (request.VerificationFinally == "3") { - string _nodeId = ""; - if (!string.IsNullOrEmpty(request.NodeRejectStep)) - { - _nodeId = request.NodeRejectStep; - } - NodeReject(request.FlowInstanceId, _nodeId, request.VerificationOpinion); + NodeReject(request); } else if (request.VerificationFinally == "2")//ʾͬ { @@ -511,3 +440,4 @@ namespace OpenAuth.App } } } + diff --git a/OpenAuth.App/Request/VerificationReq.cs b/OpenAuth.App/Request/VerificationReq.cs index e053b7a0..f8f56d99 100644 --- a/OpenAuth.App/Request/VerificationReq.cs +++ b/OpenAuth.App/Request/VerificationReq.cs @@ -14,7 +14,7 @@ public string VerificationOpinion { get; set; } /// - /// 驳回的步骤 + /// 驳回的步骤,即驳回到的节点ID /// public string NodeRejectStep { get; set; } } diff --git a/OpenAuth.Mvc/Views/FlowSchemes/NodeInfo.cshtml b/OpenAuth.Mvc/Views/FlowSchemes/NodeInfo.cshtml index 2f437670..0750ebd9 100644 --- a/OpenAuth.Mvc/Views/FlowSchemes/NodeInfo.cshtml +++ b/OpenAuth.Mvc/Views/FlowSchemes/NodeInfo.cshtml @@ -27,6 +27,18 @@ placeholder="节点名称" autocomplete="off" class="layui-input"> + +
+ +
+ +
+
@@ -37,9 +49,17 @@
-
    - -
    +
    +
    + + +
    +
    +
    +
      + +
      + diff --git a/OpenAuth.Mvc/userJs/nodeInfo.js b/OpenAuth.Mvc/userJs/nodeInfo.js index 084be08d..fe9ef4b2 100644 --- a/OpenAuth.Mvc/userJs/nodeInfo.js +++ b/OpenAuth.Mvc/userJs/nodeInfo.js @@ -20,7 +20,7 @@ layui.config({ vm.$set('$data', node.setInfo); users = node.setInfo.NodeDesignateData.users; } - + //菜单列表 var menucon = {}; //table的参数,如搜索key,点击tree的id //副树状结构,等lay table没问题了,可以换成table @@ -119,7 +119,7 @@ layui.config({ //提供给上父页面调用 getVal = function () { var result = { - NodeDesignateData: { //节点指定操作人 + NodeDesignateData: { //节点指定操作人 users: users, role: [], org: [] diff --git a/OpenAuth.UnitTest/TestWorkflow.cs b/OpenAuth.UnitTest/TestWorkflow.cs index 4a7d7ee2..271ffd14 100644 --- a/OpenAuth.UnitTest/TestWorkflow.cs +++ b/OpenAuth.UnitTest/TestWorkflow.cs @@ -2,6 +2,7 @@ using Infrastructure; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenAuth.App; +using OpenAuth.App.Request; using OpenAuth.Repository.Domain; namespace OpenAuth.UnitTest @@ -23,9 +24,13 @@ namespace OpenAuth.UnitTest /// 李玉宝于2017-01-20 9:59:11 ///
      [TestMethod] - public void AddProcessInstance() + public void Verify() { - + _runApp.Verification(new VerificationReq + { + FlowInstanceId = "c4aa73f2-d5ea-43c3-8b7e-903e31ba5828", + VerificationFinally = "3" + }); } }