From 238550f415d1b3f37b92f51dee15fbbc050ccd12 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Wed, 4 Apr 2018 17:36:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E6=B5=81=E7=A8=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=BA=E6=88=91=E7=9A=84=E5=88=97=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E5=BE=85=E5=A4=84=E7=90=86=E3=80=81=E5=B7=B2=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9B=20=E8=B0=83=E6=95=B4=E6=A8=A1=E5=9D=97=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=8C=89=E6=A8=A1=E5=9D=97=E6=A0=87=E8=AF=86=E6=98=A0?= =?UTF-8?q?=E5=B0=84=EF=BC=9B=20=E4=BC=98=E5=8C=96API=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DOC/核心设计.EAP | Bin 1249280 -> 1249280 bytes OpenAuth.App/Flow/FlowNode.cs | 1 + OpenAuth.App/FlowInstanceApp.cs | 96 ++- .../Request/QueryFlowInstanceListReq.cs | 1 - OpenAuth.App/Response/ModuleView.cs | 2 + OpenAuth.App/SSO/SSOController.cs | 13 +- .../Controllers/FlowInstancesController.cs | 16 + .../Controllers/ModuleManagerController.cs | 16 +- OpenAuth.Mvc/OpenAuth.Mvc.csproj | 4 + .../Views/FlowInstances/Disposed.cshtml | 53 ++ OpenAuth.Mvc/Views/FlowInstances/Wait.cshtml | 53 ++ OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml | 3 +- OpenAuth.Mvc/Views/ModuleManager/Index.cshtml | 9 +- OpenAuth.Mvc/js/utils.js | 4 +- OpenAuth.Mvc/userJs/categories.js | 2 +- OpenAuth.Mvc/userJs/flowInstanceDisposed.js | 184 ++++++ OpenAuth.Mvc/userJs/flowInstanceWait.js | 184 ++++++ OpenAuth.Mvc/userJs/flowInstances.js | 4 +- OpenAuth.Mvc/userJs/flowSchemes.js | 2 +- OpenAuth.Mvc/userJs/forms.js | 2 +- OpenAuth.Mvc/userJs/modules.js | 2 +- OpenAuth.Mvc/userJs/orgs.js | 2 +- OpenAuth.Mvc/userJs/roles.js | 2 +- OpenAuth.Mvc/userJs/users.js | 2 +- OpenAuth.Repository/Domain/Module.cs | 7 + OpenAuth.Repository/Mapping/ModuleMap.cs | 4 + OpenAuth.UnitTest/TestWorkflow.cs | 2 +- README.md | 2 +- 建表&初始化数据.sql | Bin 291058 -> 281400 bytes 数据库设计关系图/OpenAuthDB.apm | 600 +++++++++--------- 数据库设计关系图/OpenAuthDB.pdm | 590 ++++++++--------- 31 files changed, 1223 insertions(+), 639 deletions(-) create mode 100644 OpenAuth.Mvc/Views/FlowInstances/Disposed.cshtml create mode 100644 OpenAuth.Mvc/Views/FlowInstances/Wait.cshtml create mode 100644 OpenAuth.Mvc/userJs/flowInstanceDisposed.js create mode 100644 OpenAuth.Mvc/userJs/flowInstanceWait.js diff --git a/DOC/核心设计.EAP b/DOC/核心设计.EAP index 8412a6c6ca214631d5f1a0a1717a3b04834a8e7a..982288d2a5b41f6fca36e1cb810102bbc9417479 100644 GIT binary patch delta 793 zcmc&wO-NKx6u$S(yYD^I*SvQKrvYgkA}uKpCr4v2oOFhQiP25XqQD^07Gg%(&!Vn{ z7Yla-9f$%k3(OYcVs5l3R~bkkE!w#XWEK@ei*V)ZJX%$&Rvq}x_kH)Cb2uD1SCDgs zWy3Od3`|xbiS1Q@|DNm>=e=#pX5L(uv7>iA<#FX1%8Mw^tazf~q=+%b66lx2K0iS+ z4DpLtLid(LB#P}L?hHOn*LMn&AG4OqqI4J!u8K9>9u;ejWUP%Dd8XGciHsHbz2LH# z4!K}lE1-AYE4^qxz9+2wrB zUZNd2duiL~wnI#~gdMJRcNhr!&uDyLi4Aoa)a<1 zZ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 +29,7 @@ { public const string SPECIAL_USER = "SPECIAL_USER"; //指定用户 public const string ALL_USER = "ALL_USER"; //所有用户 + public const string SPECIAL_ROLE = "SPECIAL_ROLE"; /// /// 节点执行权限类型 /// diff --git a/OpenAuth.App/FlowInstanceApp.cs b/OpenAuth.App/FlowInstanceApp.cs index b8896556..44fcf8cf 100644 --- a/OpenAuth.App/FlowInstanceApp.cs +++ b/OpenAuth.App/FlowInstanceApp.cs @@ -53,6 +53,8 @@ namespace OpenAuth.App FlowInstanceOperationHistory processOperationHistoryEntity = new FlowInstanceOperationHistory { InstanceId = flowInstance.Id, + CreateUserId = user.User.Id, + CreateUserName = user.User.Name, Content = "" + user.User.Name + "һ̡̽" @@ -73,9 +75,11 @@ namespace OpenAuth.App ToNodeId = wfruntime.runtimeModel.nextNodeId, ToNodeName = wfruntime.runtimeModel.nextNode.name, ToNodeType = wfruntime.runtimeModel.nextNodeType, - TransitionSate = 0 + IsFinish = wfruntime.runtimeModel.nextNodeType == 4?1:0, + TransitionSate = 0, + CreateUserId = user.User.Id, + CreateUserName = user.User.Name }; - processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); #endregion UnitWork.Add(flowInstance); @@ -93,7 +97,10 @@ namespace OpenAuth.App public bool NodeVerification(string instanceId, bool flag, string description = "") { FlowInstance flowInstance = Get(instanceId); - FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();//¼ + FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory + { + InstanceId = instanceId + };//¼ FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//ת¼ FlowRuntime wfruntime = new FlowRuntime(flowInstance); @@ -166,15 +173,18 @@ namespace OpenAuth.App processTransitionHistoryEntity = new FlowInstanceTransitionHistory { + InstanceId = flowInstance.Id, + CreateUserId = user.Id, + CreateUserName = user.Name, 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, + IsFinish = wfruntime.runtimeModel.nextNodeType ==4?1:0, TransitionSate = 0 }; - processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); #endregion break; @@ -204,19 +214,23 @@ namespace OpenAuth.App processTransitionHistoryEntity = new FlowInstanceTransitionHistory { + InstanceId = flowInstance.Id, + CreateUserId = user.Id, + CreateUserName = user.Name, 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, + IsFinish = wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0, TransitionSate = 0 }; - 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; + flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description; } else { @@ -224,7 +238,9 @@ namespace OpenAuth.App tag.Taged = -1; wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag); - flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description; + flowInstanceOperationHistory.Content = "" + "todo name" + "" + + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + + description; } } #endregion @@ -243,9 +259,15 @@ namespace OpenAuth.App /// public bool NodeReject(VerificationReq reqest) { + var user = AuthUtil.GetCurrentUser().User; + FlowInstance flowInstance = Get(reqest.FlowInstanceId); - FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory(); - FlowInstanceTransitionHistory processTransitionHistoryEntity = null; + FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory + { + InstanceId = reqest.FlowInstanceId, + CreateUserId = user.Id, + CreateUserName = user.Name + }; FlowRuntime wfruntime = new FlowRuntime(flowInstance); @@ -260,7 +282,6 @@ namespace OpenAuth.App resnode = reqest.NodeRejectStep; } - var user = AuthUtil.GetCurrentUser().User; var tag = new Tag { Description = reqest.VerificationOpinion, @@ -280,29 +301,32 @@ namespace OpenAuth.App flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//ǰڵִеϢ #region ת¼ - processTransitionHistoryEntity = new FlowInstanceTransitionHistory + var processTransitionHistoryEntity = new FlowInstanceTransitionHistory { + InstanceId = flowInstance.Id, + CreateUserId = user.Id, + CreateUserName = user.Name, 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, + IsFinish = wfruntime.runtimeModel.nextNodeType ==4?1:0, TransitionSate = 1 }; - // - processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0); + + UnitWork.Add(processTransitionHistoryEntity); + #endregion } - 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(); return true; @@ -361,32 +385,38 @@ namespace OpenAuth.App /// private string GetMakerList(FlowNode node, string processId) { - string makerlsit = ""; + string makerList = ""; if (node.setInfo == null) { - makerlsit = "-1"; + makerList = "-1"; } else { if (node.setInfo.NodeDesignate == Setinfo.ALL_USER)//гԱ { - makerlsit = "1"; + makerList = "1"; } else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_USER)//ָԱ { - // 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); + makerList = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerList); - if (makerlsit == "") + if (makerList == "") { - makerlsit = "-1"; + makerList = "-1"; + } + } + else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_ROLE) + { + makerList = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerList); + + if (makerList == "") + { + makerList = "-1"; } } } - return makerlsit; + return makerList; } /// @@ -419,21 +449,25 @@ namespace OpenAuth.App { //todo:/Ѱ/ҵ var result = new TableData(); + var user = AuthUtil.GetCurrentUser(); - result.count = UnitWork.Find(u => u.CreateUserId == request.userid).Count(); - if (request.type == "inbox") // + if (request.type == "wait") // { - result.data = UnitWork.Find(request.page, request.limit, "CreateDate descending", null).ToList(); + result.count = UnitWork.Find(u => u.MakerList =="1" || u.MakerList.Contains(user.User.Id)).Count(); + + result.data = UnitWork.Find(request.page, request.limit, "CreateDate descending", + u => u.MakerList == "1" || u.MakerList.Contains(user.User.Id)).ToList(); } - else if (request.type == "outbox") //Ѱ + else if (request.type == "disposed") //Ѱ { result.data = UnitWork.Find(request.page, request.limit, "CreateDate descending", null).ToList(); - } else //ҵ { - result.data = UnitWork.Find(request.page, request.limit, "CreateDate descending", null).ToList(); + result.count = UnitWork.Find(u => u.CreateUserId == user.User.Id).Count(); + result.data = UnitWork.Find(request.page, request.limit, + "CreateDate descending", u => u.CreateUserId == user.User.Id).ToList(); } return result; diff --git a/OpenAuth.App/Request/QueryFlowInstanceListReq.cs b/OpenAuth.App/Request/QueryFlowInstanceListReq.cs index df843870..06a57187 100644 --- a/OpenAuth.App/Request/QueryFlowInstanceListReq.cs +++ b/OpenAuth.App/Request/QueryFlowInstanceListReq.cs @@ -3,6 +3,5 @@ public class QueryFlowInstanceListReq : PageReq { public string type { get; set; } - public string userid { get; set; } } } diff --git a/OpenAuth.App/Response/ModuleView.cs b/OpenAuth.App/Response/ModuleView.cs index aafe6f7c..32ba63de 100644 --- a/OpenAuth.App/Response/ModuleView.cs +++ b/OpenAuth.App/Response/ModuleView.cs @@ -55,6 +55,8 @@ namespace OpenAuth.App.Response /// public int SortNo { get; set; } + public string Code { get; set; } + /// /// 模块中的元素 /// diff --git a/OpenAuth.App/SSO/SSOController.cs b/OpenAuth.App/SSO/SSOController.cs index 432b596e..55dee05c 100644 --- a/OpenAuth.App/SSO/SSOController.cs +++ b/OpenAuth.App/SSO/SSOController.cs @@ -43,15 +43,12 @@ namespace OpenAuth.App.SSO filterContext.Result = LoginResult(""); return; } - else + //验证 + if (AuthUtil.CheckLogin(token, request.RawUrl) == false) { - //验证 - if (AuthUtil.CheckLogin(token, request.RawUrl) == false) - { - //会话丢失,跳转到登录页面 - filterContext.Result = LoginResult(""); - return; - } + //会话丢失,跳转到登录页面 + filterContext.Result = LoginResult(""); + return; } base.OnActionExecuting(filterContext); diff --git a/OpenAuth.Mvc/Controllers/FlowInstancesController.cs b/OpenAuth.Mvc/Controllers/FlowInstancesController.cs index d27dc34a..862d1c6c 100644 --- a/OpenAuth.Mvc/Controllers/FlowInstancesController.cs +++ b/OpenAuth.Mvc/Controllers/FlowInstancesController.cs @@ -22,6 +22,22 @@ namespace OpenAuth.Mvc.Controllers return View(); } + /// + /// 待处理的流程 + /// + public ActionResult Wait() + { + return View(); + } + + /// + /// 已完成的流程 + /// + public ActionResult Disposed() + { + return View(); + } + public ActionResult Edit() { return View(); diff --git a/OpenAuth.Mvc/Controllers/ModuleManagerController.cs b/OpenAuth.Mvc/Controllers/ModuleManagerController.cs index 319c7974..bcd97d2f 100644 --- a/OpenAuth.Mvc/Controllers/ModuleManagerController.cs +++ b/OpenAuth.Mvc/Controllers/ModuleManagerController.cs @@ -70,10 +70,20 @@ namespace OpenAuth.Mvc.Controllers return JsonHelper.Instance.Serialize(menus); } - - public string LoadAuthorizedMenus() + /// + /// 获取发起页面的菜单权限 + /// + /// System.String. + public string LoadAuthorizedMenus(string modulecode) { - return JsonHelper.Instance.Serialize(CurrentModule.Elements); + var user = AuthUtil.GetCurrentUser(); + var module = user.Modules.First(u =>u.Code == modulecode); + if (module != null) + { + return JsonHelper.Instance.Serialize(module.Elements); + + } + return ""; } diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj index 53dcb216..138712d3 100644 --- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj +++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj @@ -198,6 +198,8 @@ + + @@ -635,6 +637,8 @@ + + diff --git a/OpenAuth.Mvc/Views/FlowInstances/Disposed.cshtml b/OpenAuth.Mvc/Views/FlowInstances/Disposed.cshtml new file mode 100644 index 00000000..b7dfa20c --- /dev/null +++ b/OpenAuth.Mvc/Views/FlowInstances/Disposed.cshtml @@ -0,0 +1,53 @@ +@section header +{ + +} + + +
+
+
    +
+
+
+ + + + + + + + + + + + + + + +
主键Id是否完成实例名称实例编号当前节点名称创建时间创建用户实例备注
+ + +
+
+ + + + + + + diff --git a/OpenAuth.Mvc/Views/FlowInstances/Wait.cshtml b/OpenAuth.Mvc/Views/FlowInstances/Wait.cshtml new file mode 100644 index 00000000..df8167b9 --- /dev/null +++ b/OpenAuth.Mvc/Views/FlowInstances/Wait.cshtml @@ -0,0 +1,53 @@ +@section header +{ + +} + + +
+
+
    +
+
+
+ + + + + + + + + + + + + + + +
主键Id是否完成实例名称实例编号当前节点名称创建时间创建用户实例备注
+ + +
+
+ + + + + + + diff --git a/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml b/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml index 2012ab63..1bfac404 100644 --- a/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml +++ b/OpenAuth.Mvc/Views/FlowSchemes/Index.cshtml @@ -2,8 +2,7 @@ { } -