4.0发布前最后一般脚本;

优化登陆;
优化流程审批;
This commit is contained in:
yubao 2018-04-07 00:36:26 +08:00
parent d5db368a2f
commit e5f911079f
27 changed files with 286 additions and 367 deletions

Binary file not shown.

View File

@ -105,7 +105,7 @@ namespace OpenAuth.App
{ {
var elementIds = UnitWork.Find<Relevance>( var elementIds = UnitWork.Find<Relevance>(
u => u =>
(u.FirstId == _user.Id && u.Key == Define.ROLERESOURCE) || (u.FirstId == _user.Id && u.Key == Define.USERELEMENT) ||
(u.Key == Define.ROLEELEMENT && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId); (u.Key == Define.ROLEELEMENT && _userRoleIds.Contains(u.FirstId))).Select(u => u.SecondId);
return UnitWork.Find<ModuleElement>(u => elementIds.Contains(u.Id)); return UnitWork.Find<ModuleElement>(u => elementIds.Contains(u.Id));
} }

View File

@ -243,28 +243,28 @@ namespace OpenAuth.App.Flow
public string NodeConfluence(string nodeId, Tag tag) public string NodeConfluence(string nodeId, Tag tag)
{ {
string res = "-1"; string res = "-1";
string _nextNodeId = GetNextNodeByNodeId(nodeId);//获取下一个节点 string nextNodeId = GetNextNodeByNodeId(nodeId);//获取下一个节点
if (_nextNodeId != "-1") if (nextNodeId != "-1")
{ {
Dictionary<string, List<FlowLine>> toLines = GetToLineDictionary(_runtimeModel.schemeContentJson); Dictionary<string, List<FlowLine>> toLines = GetToLineDictionary(_runtimeModel.schemeContentJson);
int allnum = toLines[_nextNodeId].Count; int allnum = toLines[nextNodeId].Count;
int i = 0; int i = 0;
foreach (var item in _runtimeModel.schemeContentJson.Flow.nodes) foreach (var item in _runtimeModel.schemeContentJson.nodes)
{ {
if (item.id.Value == _nextNodeId) if (item.id == nextNodeId)
{ {
if (item.setInfo.NodeConfluenceType.Value == "")//0所有步骤通过 todo:先用空格 if (string.IsNullOrEmpty(item.setInfo.NodeConfluenceType))//0所有步骤通过 todo:先用空格
{ {
if (tag.Taged == 1) if (tag.Taged == 1)
{ {
if (item.setInfo.ConfluenceOk == null) if (item.setInfo.ConfluenceOk == null)
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk = 1; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceOk = 1;
res = "1"; res = "1";
} }
else if (item.setInfo.ConfluenceOk.Value == (allnum - 1)) else if (item.setInfo.ConfluenceOk == (allnum - 1))
{ {
res = GetNextNodeByNodeId(_nextNodeId); res = GetNextNodeByNodeId(nextNodeId);
if (res == "-1") if (res == "-1")
{ {
throw (new Exception("会签成功寻找不到下一个节点")); throw (new Exception("会签成功寻找不到下一个节点"));
@ -272,16 +272,16 @@ namespace OpenAuth.App.Flow
} }
else else
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk++; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceOk++;
res = "1"; res = "1";
} }
} }
} }
else if (item.setInfo.NodeConfluenceType.Value == "1")//1一个步骤通过即可 else if (item.setInfo.NodeConfluenceType == "1")//1一个步骤通过即可
{ {
if (tag.Taged ==1) if (tag.Taged ==1)
{ {
res = GetNextNodeByNodeId(_nextNodeId); res = GetNextNodeByNodeId(nextNodeId);
if (res == "-1") if (res == "-1")
{ {
throw (new Exception("会签成功寻找不到下一个节点")); throw (new Exception("会签成功寻找不到下一个节点"));
@ -291,16 +291,16 @@ namespace OpenAuth.App.Flow
{ {
if (item.setInfo.ConfluenceNo == null) if (item.setInfo.ConfluenceNo == null)
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo = 1; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceNo = 1;
res = "1"; res = "1";
} }
else if (item.setInfo.ConfluenceNo.Value == (allnum - 1)) else if (item.setInfo.ConfluenceNo == (allnum - 1))
{ {
res = "-1"; res = "-1";
} }
else else
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo++; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceNo++;
res = "1"; res = "1";
} }
} }
@ -311,33 +311,33 @@ namespace OpenAuth.App.Flow
{ {
if (item.setInfo.ConfluenceOk == null) if (item.setInfo.ConfluenceOk == null)
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk = 1; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceOk = 1;
} }
else else
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk++; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceOk++;
} }
} }
else else
{ {
if (item.setInfo.ConfluenceNo == null) if (item.setInfo.ConfluenceNo == null)
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo = 1; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceNo = 1;
} }
else else
{ {
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo++; _runtimeModel.schemeContentJson.nodes[i].setInfo.ConfluenceNo++;
} }
} }
if ((item.setInfo.ConfluenceNo.Value + item.setInfo.ConfluenceOk.Value) / allnum * 100 > int.Parse(item.setInfo.NodeConfluenceRate.Value)) if ((item.setInfo.ConfluenceNo + item.setInfo.ConfluenceOk) / allnum * 100 > int.Parse(item.setInfo.NodeConfluenceRate))
{ {
res = GetNextNodeByNodeId(_nextNodeId); res = GetNextNodeByNodeId(nextNodeId);
if (res == "-1") if (res == "-1")
{ {
throw (new Exception("会签成功寻找不到下一个节点")); throw (new Exception("会签成功寻找不到下一个节点"));
} }
} }
else if ((item.setInfo.ConfluenceNo.Value + item.setInfo.ConfluenceOk.Value) == allnum) else if ((item.setInfo.ConfluenceNo + item.setInfo.ConfluenceOk) == allnum)
{ {
res = "-1"; res = "-1";
} }
@ -353,19 +353,19 @@ namespace OpenAuth.App.Flow
if (res == "-1") if (res == "-1")
{ {
tag.Taged = -1; tag.Taged = -1;
MakeTagNode(_nextNodeId, tag); MakeTagNode(nextNodeId, tag);
} }
else if (res != "1") //则时res是会签结束节点的ID else if (res != "1") //则时res是会签结束节点的ID
{ {
tag.Taged = 1; tag.Taged = 1;
MakeTagNode(_nextNodeId,tag); MakeTagNode(nextNodeId,tag);
_runtimeModel.nextNodeId = res; _runtimeModel.nextNodeId = res;
_runtimeModel.nextNodeType = GetNodeType(res); _runtimeModel.nextNodeType = GetNodeType(res);
} }
else else
{ {
_runtimeModel.nextNodeId = _nextNodeId; _runtimeModel.nextNodeId = nextNodeId;
_runtimeModel.nextNodeType = GetNodeType(_nextNodeId); _runtimeModel.nextNodeType = GetNodeType(nextNodeId);
} }
return res; return res;
} }
@ -411,7 +411,7 @@ namespace OpenAuth.App.Flow
int i = 0; int i = 0;
foreach (var item in _runtimeModel.schemeContentJson.nodes) foreach (var item in _runtimeModel.schemeContentJson.nodes)
{ {
if (item.id.Value.ToString() == nodeId) if (item.id == nodeId)
{ {
_runtimeModel.schemeContentJson.nodes[i].setInfo.Taged = tag.Taged; _runtimeModel.schemeContentJson.nodes[i].setInfo.Taged = tag.Taged;
_runtimeModel.schemeContentJson.nodes[i].setInfo.UserId = tag.UserId; _runtimeModel.schemeContentJson.nodes[i].setInfo.UserId = tag.UserId;

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Infrastructure; using Infrastructure;
@ -12,21 +12,21 @@ using OpenAuth.Repository.Domain;
namespace OpenAuth.App namespace OpenAuth.App
{ {
/// <summary> /// <summary>
/// 工作流实例表操作 /// 工作流实例表操作
/// </summary> /// </summary>
public class FlowInstanceApp : BaseApp<FlowInstance> public class FlowInstanceApp : BaseApp<FlowInstance>
{ {
#region API #region API
/// <summary> /// <summary>
/// 创建一个实例 /// 创建一个实例
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool CreateInstance(JObject obj) public bool CreateInstance(JObject obj)
{ {
var flowInstance = obj.ToObject<FlowInstance>(); var flowInstance = obj.ToObject<FlowInstance>();
//获取提交的表单数据 //获取提交的表单数据
var frmdata = new JObject(); var frmdata = new JObject();
foreach (var property in obj.Properties().Where(U => U.Name.Contains("data_"))) foreach (var property in obj.Properties().Where(U => U.Name.Contains("data_")))
{ {
@ -34,37 +34,40 @@ namespace OpenAuth.App
} }
flowInstance.FrmData = JsonHelper.Instance.Serialize(frmdata); flowInstance.FrmData = JsonHelper.Instance.Serialize(frmdata);
//创建运行实例 //创建运行实例
var wfruntime = new FlowRuntime(flowInstance); var wfruntime = new FlowRuntime(flowInstance);
var user = AuthUtil.GetCurrentUser(); var user = AuthUtil.GetCurrentUser();
#region #region
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId; flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.GetNextNodeType();//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束 flowInstance.ActivityType = wfruntime.GetNextNodeType();//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name; flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
flowInstance.PreviousId = wfruntime.runtimeModel.currentNodeId; flowInstance.PreviousId = wfruntime.runtimeModel.currentNodeId;
flowInstance.CreateUserId = user.User.Id; flowInstance.CreateUserId = user.User.Id;
flowInstance.CreateUserName = user.User.Account; flowInstance.CreateUserName = user.User.Account;
flowInstance.MakerList = (wfruntime.GetNextNodeType() != 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息 flowInstance.MakerList = (wfruntime.GetNextNodeType() != 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息
flowInstance.IsFinish = (wfruntime.GetNextNodeType() == 4 ? 1 : 0); flowInstance.IsFinish = (wfruntime.GetNextNodeType() == 4 ? 1 : 0);
UnitWork.Add(flowInstance);
#endregion #endregion
#region #region
FlowInstanceOperationHistory processOperationHistoryEntity = new FlowInstanceOperationHistory FlowInstanceOperationHistory processOperationHistoryEntity = new FlowInstanceOperationHistory
{ {
InstanceId = flowInstance.Id, InstanceId = flowInstance.Id,
CreateUserId = user.User.Id, CreateUserId = user.User.Id,
CreateUserName = user.User.Name, CreateUserName = user.User.Name,
Content = "【创建】" CreateDate = DateTime.Now,
Content = "【创建】"
+ user.User.Name + user.User.Name
+ "创建了一个流程进程【" + "创建了一个流程进程【"
+ flowInstance.Code + "/" + flowInstance.Code + "/"
+ flowInstance.CustomName + "】" + flowInstance.CustomName + "】"
}; };
UnitWork.Add(processOperationHistoryEntity);
#endregion #endregion
#region #region
FlowInstanceTransitionHistory processTransitionHistoryEntity = new FlowInstanceTransitionHistory FlowInstanceTransitionHistory processTransitionHistoryEntity = new FlowInstanceTransitionHistory
{ {
@ -82,96 +85,91 @@ namespace OpenAuth.App
}; };
#endregion #endregion
UnitWork.Add(flowInstance);
UnitWork.Add(processOperationHistoryEntity);
UnitWork.Add(processTransitionHistoryEntity); UnitWork.Add(processTransitionHistoryEntity);
UnitWork.Save(); UnitWork.Save();
return true; return true;
} }
/// <summary> /// <summary>
/// 节点审核 /// 节点审核
/// </summary> /// </summary>
/// <param name="instanceId"></param> /// <param name="instanceId"></param>
/// <returns></returns> /// <returns></returns>
public bool NodeVerification(string instanceId, bool flag, string description = "") public bool NodeVerification(string instanceId, bool flag, string description = "")
{ {
var user = AuthUtil.GetCurrentUser().User;
FlowInstance flowInstance = Get(instanceId); FlowInstance flowInstance = Get(instanceId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory
{ {
InstanceId = instanceId InstanceId = instanceId,
};//操作记录 CreateUserId = user.Id,
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//流转记录 CreateUserName = user.Name,
CreateDate = DateTime.Now
};//操作记录
FlowRuntime wfruntime = new FlowRuntime(flowInstance); FlowRuntime wfruntime = new FlowRuntime(flowInstance);
var user = AuthUtil.GetCurrentUser().User;
var tag = new Tag var tag = new Tag
{ {
UserName = user.Name, UserName = user.Name,
UserId = user.Id, UserId = user.Id,
Description = description Description = description
}; };
#region #region
if (flowInstance.ActivityType == 0)//会签 if (flowInstance.ActivityType == 0)//会签
{ {
tag.Taged = 1; tag.Taged = 1;
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag);//标记当前节点通过 wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag);//标记当前节点通过
///寻找需要审核的节点Id
string _VerificationNodeId = ""; string verificationNodeId = ""; //寻找需要审核的节点Id
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId); List<string> nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
string _makerList = ""; foreach (string item in nodelist)
foreach (string item in _nodelist)
{ {
_makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId); var makerList = GetMakerList(wfruntime.runtimeModel.nodes[item]
if (_makerList != "-1") , wfruntime.runtimeModel.flowInstanceId);
if (makerList != "-1")
{ {
var id = AuthUtil.GetCurrentUser().User.Id; foreach (string one in makerList.Split(','))
foreach (string one in _makerList.Split(','))
{ {
if (id == one || id.IndexOf(one) != -1) if (user.Id == one || user.Id.IndexOf(one) != -1)
{ {
_VerificationNodeId = item; verificationNodeId = item;
break; break;
} }
} }
} }
} }
if (_VerificationNodeId != "") if (verificationNodeId != "")
{ {
if (flag) if (flag)
{ {
tag.Taged = 1; tag.Taged = 1;
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description; flowInstanceOperationHistory.Content = "【" + wfruntime.runtimeModel.nodes[verificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
} }
else else
{ {
tag.Taged = -1; tag.Taged = -1;
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description; flowInstanceOperationHistory.Content = "【" + wfruntime.runtimeModel.nodes[verificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
} }
string confluenceres = wfruntime.NodeConfluence(verificationNodeId, tag);
string confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, tag);
switch (confluenceres) switch (confluenceres)
{ {
case "-1"://不通过 case "-1"://不通过
flowInstance.IsFinish = 3; flowInstance.IsFinish = 3;
break; break;
case "1"://等待 case "1"://等待
break; break;
default://通过 default://通过
flowInstance.PreviousId = flowInstance.ActivityId; flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId; flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束 flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name; flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0); flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
flowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//当前节点可执行的人信息 flowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//当前节点可执行的人信息
#region #region
UnitWork.Add(new FlowInstanceTransitionHistory
processTransitionHistoryEntity = new FlowInstanceTransitionHistory
{ {
InstanceId = flowInstance.Id, InstanceId = flowInstance.Id,
CreateUserId = user.Id, CreateUserId = user.Id,
@ -184,7 +182,7 @@ namespace OpenAuth.App
ToNodeType = wfruntime.runtimeModel.nextNodeType, ToNodeType = wfruntime.runtimeModel.nextNodeType,
IsFinish = wfruntime.runtimeModel.nextNodeType ==4?1:0, IsFinish = wfruntime.runtimeModel.nextNodeType ==4?1:0,
TransitionSate = 0 TransitionSate = 0
}; });
#endregion #endregion
break; break;
@ -192,13 +190,13 @@ namespace OpenAuth.App
} }
else else
{ {
throw (new Exception("审核异常,找不到审核节点")); throw (new Exception("审核异常,找不到审核节点"));
} }
} }
#endregion #endregion
#region #region
else//一般审核 else//一般审核
{ {
if (flag) if (flag)
{ {
@ -208,11 +206,11 @@ namespace OpenAuth.App
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId; flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType; flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name; flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
flowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//当前节点可执行的人信息 flowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//当前节点可执行的人信息
flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0); flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
#region #region
processTransitionHistoryEntity = new FlowInstanceTransitionHistory UnitWork.Add(new FlowInstanceTransitionHistory
{ {
InstanceId = flowInstance.Id, InstanceId = flowInstance.Id,
CreateUserId = user.Id, CreateUserId = user.Id,
@ -225,21 +223,21 @@ namespace OpenAuth.App
ToNodeType = wfruntime.runtimeModel.nextNodeType, ToNodeType = wfruntime.runtimeModel.nextNodeType,
IsFinish = wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0, IsFinish = wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0,
TransitionSate = 0 TransitionSate = 0
}; });
#endregion #endregion
flowInstanceOperationHistory.Content = "【" + wfruntime.runtimeModel.currentNode.name
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
} }
else else
{ {
flowInstance.IsFinish = 3; //表示该节点不同意 flowInstance.IsFinish = 3; //表示该节点不同意
tag.Taged = -1; tag.Taged = -1;
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag); wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag);
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" flowInstanceOperationHistory.Content = "【"
+ wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + wfruntime.runtimeModel.currentNode.name + "】【"
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:"
+ description; + description;
} }
} }
@ -249,12 +247,11 @@ namespace OpenAuth.App
UnitWork.Update(flowInstance); UnitWork.Update(flowInstance);
UnitWork.Add(flowInstanceOperationHistory); UnitWork.Add(flowInstanceOperationHistory);
UnitWork.Add(processTransitionHistoryEntity);
UnitWork.Save(); UnitWork.Save();
return true; return true;
} }
/// <summary> /// <summary>
/// 驳回 /// 驳回
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool NodeReject(VerificationReq reqest) public bool NodeReject(VerificationReq reqest)
@ -262,16 +259,9 @@ namespace OpenAuth.App
var user = AuthUtil.GetCurrentUser().User; var user = AuthUtil.GetCurrentUser().User;
FlowInstance flowInstance = Get(reqest.FlowInstanceId); FlowInstance flowInstance = Get(reqest.FlowInstanceId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory
{
InstanceId = reqest.FlowInstanceId,
CreateUserId = user.Id,
CreateUserName = user.Name
};
FlowRuntime wfruntime = new FlowRuntime(flowInstance); FlowRuntime wfruntime = new FlowRuntime(flowInstance);
string resnode = ""; string resnode = "";
if (string.IsNullOrEmpty(reqest.NodeRejectStep)) if (string.IsNullOrEmpty(reqest.NodeRejectStep))
{ {
@ -291,17 +281,17 @@ namespace OpenAuth.App
}; };
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag); wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, tag);
flowInstance.IsFinish = 4;//4表示驳回需要申请者重新提交表单 flowInstance.IsFinish = 4;//4表示驳回需要申请者重新提交表单
if (resnode != "") if (resnode != "")
{ {
flowInstance.PreviousId = flowInstance.ActivityId; flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = resnode; flowInstance.ActivityId = resnode;
flowInstance.ActivityType = wfruntime.GetNodeType(resnode); flowInstance.ActivityType = wfruntime.GetNodeType(resnode);
flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name; flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name;
flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//当前节点可执行的人信息 flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//当前节点可执行的人信息
#region #region
var processTransitionHistoryEntity = new FlowInstanceTransitionHistory UnitWork.Add(new FlowInstanceTransitionHistory
{ {
InstanceId = flowInstance.Id, InstanceId = flowInstance.Id,
CreateUserId = user.Id, CreateUserId = user.Id,
@ -312,21 +302,27 @@ namespace OpenAuth.App
ToNodeId = wfruntime.runtimeModel.nextNodeId, ToNodeId = wfruntime.runtimeModel.nextNodeId,
ToNodeName = wfruntime.runtimeModel.nextNode.name, ToNodeName = wfruntime.runtimeModel.nextNode.name,
ToNodeType = wfruntime.runtimeModel.nextNodeType, ToNodeType = wfruntime.runtimeModel.nextNodeType,
IsFinish = wfruntime.runtimeModel.nextNodeType ==4?1:0, IsFinish = wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0,
TransitionSate = 1 TransitionSate = 1
}; });
UnitWork.Add(processTransitionHistoryEntity);
#endregion #endregion
} }
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【"
+ wfruntime.runtimeModel.currentNode.name
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】驳回,备注:" + reqest.VerificationOpinion;
UnitWork.Update(flowInstance); UnitWork.Update(flowInstance);
UnitWork.Add(flowInstanceOperationHistory);
UnitWork.Add(new FlowInstanceOperationHistory
{
InstanceId = reqest.FlowInstanceId
,CreateUserId = user.Id
,CreateUserName = user.Name
,CreateDate = DateTime.Now
,Content = "【"
+ wfruntime.runtimeModel.currentNode.name
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】驳回,备注:"
+ reqest.VerificationOpinion
});
UnitWork.Save(); UnitWork.Save();
return true; return true;
@ -334,7 +330,7 @@ namespace OpenAuth.App
#endregion #endregion
/// <summary> /// <summary>
/// 寻找该节点执行人 /// 寻找该节点执行人
/// </summary> /// </summary>
/// <param name="wfruntime"></param> /// <param name="wfruntime"></param>
/// <returns></returns> /// <returns></returns>
@ -343,9 +339,9 @@ namespace OpenAuth.App
string makerList = ""; string makerList = "";
if (wfruntime.runtimeModel.nextNodeId == "-1") if (wfruntime.runtimeModel.nextNodeId == "-1")
{ {
throw (new Exception("无法寻找到下一个节点")); throw (new Exception("无法寻找到下一个节点"));
} }
if (wfruntime.runtimeModel.nextNodeType == 0)//如果是会签节点 if (wfruntime.runtimeModel.nextNodeType == 0)//如果是会签节点
{ {
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.nextNodeId); List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.nextNodeId);
string _makerList = ""; string _makerList = "";
@ -354,11 +350,11 @@ namespace OpenAuth.App
_makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId); _makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId);
if (_makerList == "-1") if (_makerList == "-1")
{ {
throw (new Exception("无法寻找到会签节点的审核者,请查看流程设计是否有问题!")); throw (new Exception("无法寻找到会签节点的审核者,请查看流程设计是否有问题!"));
} }
if (_makerList == "1") if (_makerList == "1")
{ {
throw (new Exception("会签节点的审核者不能为所有人,请查看流程设计是否有问题!")); throw (new Exception("会签节点的审核者不能为所有人,请查看流程设计是否有问题!"));
} }
if (makerList != "") if (makerList != "")
{ {
@ -372,14 +368,14 @@ namespace OpenAuth.App
makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.flowInstanceId); makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.flowInstanceId);
if (makerList == "-1") if (makerList == "-1")
{ {
throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!")); throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!"));
} }
} }
return makerList; return makerList;
} }
/// <summary> /// <summary>
/// 寻找该节点执行人 /// 寻找该节点执行人
/// </summary> /// </summary>
/// <param name="node"></param> /// <param name="node"></param>
/// <returns></returns> /// <returns></returns>
@ -393,11 +389,11 @@ namespace OpenAuth.App
} }
else else
{ {
if (node.setInfo.NodeDesignate == Setinfo.ALL_USER)//所有成员 if (node.setInfo.NodeDesignate == Setinfo.ALL_USER)//所有成员
{ {
makerList = "1"; makerList = "1";
} }
else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_USER)//指定成员 else if (node.setInfo.NodeDesignate == Setinfo.SPECIAL_USER)//指定成员
{ {
makerList = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerList); makerList = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerList);
@ -420,21 +416,21 @@ namespace OpenAuth.App
} }
/// <summary> /// <summary>
/// 审核流程 /// 审核流程
/// <para>李玉宝于2017-01-20 15:44:45</para> /// <para>李玉宝于2017-01-20 15:44:45</para>
/// </summary> /// </summary>
public void Verification(VerificationReq request) public void Verification(VerificationReq request)
{ {
//驳回 //驳回
if (request.VerificationFinally == "3") if (request.VerificationFinally == "3")
{ {
NodeReject(request); NodeReject(request);
} }
else if (request.VerificationFinally == "2")//表示不同意 else if (request.VerificationFinally == "2")//表示不同意
{ {
NodeVerification(request.FlowInstanceId, false, request.VerificationOpinion); NodeVerification(request.FlowInstanceId, false, request.VerificationOpinion);
} }
else if (request.VerificationFinally == "1")//表示同意 else if (request.VerificationFinally == "1")//表示同意
{ {
NodeVerification(request.FlowInstanceId, true, request.VerificationOpinion); NodeVerification(request.FlowInstanceId, true, request.VerificationOpinion);
} }
@ -447,11 +443,11 @@ namespace OpenAuth.App
public TableData Load(QueryFlowInstanceListReq request) public TableData Load(QueryFlowInstanceListReq request)
{ {
//todo:待办/已办/我的 //todo:待办/已办/我的
var result = new TableData(); var result = new TableData();
var user = AuthUtil.GetCurrentUser(); var user = AuthUtil.GetCurrentUser();
if (request.type == "wait") //待办事项 if (request.type == "wait") //待办事项
{ {
result.count = UnitWork.Find<FlowInstance>(u => u.MakerList =="1" || u.MakerList.Contains(user.User.Id)).Count(); result.count = UnitWork.Find<FlowInstance>(u => u.MakerList =="1" || u.MakerList.Contains(user.User.Id)).Count();
@ -459,11 +455,22 @@ namespace OpenAuth.App
u => u.MakerList == "1" || u.MakerList.Contains(user.User.Id)).ToList(); u => u.MakerList == "1" || u.MakerList.Contains(user.User.Id)).ToList();
} }
else if (request.type == "disposed") //已办事项 else if (request.type == "disposed") //已办事项(即我参与过的流程)
{ {
result.data = UnitWork.Find<FlowInstance>(request.page, request.limit, "CreateDate descending", null).ToList(); var instances = UnitWork.Find<FlowInstanceTransitionHistory>(u => u.CreateUserId == user.User.Id)
.Select(u => u.InstanceId).Distinct();
var query = from ti in instances
join ct in UnitWork.Find<FlowInstance>(null) on ti equals ct.Id
into tmp
from ct in tmp.DefaultIfEmpty()
select ct;
result.data = query.OrderByDescending(u => u.CreateDate)
.Skip((request.page - 1) * request.limit)
.Take(request.limit).ToList();
result.count = instances.Count();
} }
else //我的流程 else //我的流程
{ {
result.count = UnitWork.Find<FlowInstance>(u => u.CreateUserId == user.User.Id).Count(); result.count = UnitWork.Find<FlowInstance>(u => u.CreateUserId == user.User.Id).Count();
result.data = UnitWork.Find<FlowInstance>(request.page, request.limit, result.data = UnitWork.Find<FlowInstance>(request.page, request.limit,

View File

@ -143,7 +143,7 @@ namespace OpenAuth.App.SSO
var value = _helper.Post(new var value = _helper.Post(new
{ {
AppKey = appKey, AppKey = appKey,
UserName = username, Account = username,
Password = pwd Password = pwd
}, requestUri); }, requestUri);

View File

@ -5,7 +5,7 @@ namespace OpenAuth.App.SSO
public class PassportLoginRequest public class PassportLoginRequest
{ {
public string UserName { get; set; } public string Account { get; set; }
public string Password { get; set; } public string Password { get; set; }
@ -13,7 +13,7 @@ namespace OpenAuth.App.SSO
public void Trim() public void Trim()
{ {
if (string.IsNullOrEmpty(UserName)) if (string.IsNullOrEmpty(Account))
{ {
throw new Exception("用户名不能为空"); throw new Exception("用户名不能为空");
} }
@ -22,7 +22,7 @@ namespace OpenAuth.App.SSO
{ {
throw new Exception("密码不能为空"); throw new Exception("密码不能为空");
} }
UserName = UserName.Trim(); Account = Account.Trim();
Password = Password.Trim(); Password = Password.Trim();
if(!string.IsNullOrEmpty(AppKey)) AppKey = AppKey.Trim(); if(!string.IsNullOrEmpty(AppKey)) AppKey = AppKey.Trim();
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Infrastructure.Cache; using Infrastructure.Cache;
@ -15,49 +15,50 @@ namespace OpenAuth.App.SSO
try try
{ {
model.Trim(); model.Trim();
//获取应用信息 //获取应用信息
var appInfo = new AppInfoService().Get(model.AppKey); var appInfo = new AppInfoService().Get(model.AppKey);
if (appInfo == null) if (appInfo == null)
{ {
throw new Exception("应用不存在"); throw new Exception("应用不存在");
} }
//获取用户信息 //获取用户信息
User userInfo = null; User userInfo = null;
if (model.UserName == "System") if (model.Account == "System")
{ {
userInfo = new User userInfo = new User
{ {
Id = string.Empty, Id = Guid.Empty.ToString(), //TODO:可以根据需要调整
Account = "System", Account = "System",
Name ="超级管理员", Name ="超级管理员",
Password = "123456" Password = "123456"
}; };
} }
else else
{ {
var usermanager = (UserManagerApp)DependencyResolver.Current.GetService(typeof(UserManagerApp)); var usermanager = (UserManagerApp)DependencyResolver.Current.GetService(typeof(UserManagerApp));
userInfo = usermanager.Get(model.UserName); userInfo = usermanager.Get(model.Account);
} }
if (userInfo == null) if (userInfo == null)
{ {
throw new Exception("用户不存在"); throw new Exception("用户不存在");
} }
if (userInfo.Password != model.Password) if (userInfo.Password != model.Password)
{ {
throw new Exception("密码错误"); throw new Exception("密码错误");
} }
var currentSession = new UserAuthSession var currentSession = new UserAuthSession
{ {
UserName = model.UserName, Account = model.Account,
Name = userInfo.Name,
Token = Guid.NewGuid().ToString().GetHashCode().ToString("x"), Token = Guid.NewGuid().ToString().GetHashCode().ToString("x"),
AppKey = model.AppKey, AppKey = model.AppKey,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
IpAddress = HttpContext.Current.Request.UserHostAddress IpAddress = HttpContext.Current.Request.UserHostAddress
}; };
//创建Session //创建Session
new ObjCacheProvider<UserAuthSession>().Create(currentSession.Token, currentSession, DateTime.Now.AddDays(10)); new ObjCacheProvider<UserAuthSession>().Create(currentSession.Token, currentSession, DateTime.Now.AddDays(10));
result.Code = 200; result.Code = 200;

View File

@ -9,7 +9,15 @@ namespace OpenAuth.App.SSO
public string AppKey { get; set; } public string AppKey { get; set; }
public string UserName { get; set; } /// <summary>
/// 用户账号
/// </summary>
public string Account { get; set; }
/// <summary>
/// 用户名
/// </summary>
public string Name { get; set; }
public string IpAddress { get; set; } public string IpAddress { get; set; }

View File

@ -9,6 +9,7 @@
// File: AuthenService.cs // File: AuthenService.cs
// *********************************************************************** // ***********************************************************************
using System;
using System.Linq; using System.Linq;
using OpenAuth.Repository.Domain; using OpenAuth.Repository.Domain;
@ -17,12 +18,18 @@ namespace OpenAuth.App
/// <summary> /// <summary>
/// 领域服务 /// 领域服务
/// <para>超级管理员权限</para> /// <para>超级管理员权限</para>
/// <para>todo:超级管理员使用guid.empty为ID可以根据需要修改</para>
/// </summary> /// </summary>
public class SystemAuthService : AuthoriseService public class SystemAuthService : AuthoriseService
{ {
public SystemAuthService() public SystemAuthService()
{ {
_user = new User { Account = "System", Id = string.Empty }; _user = new User
{
Account = "System",
Name = "超级管理员",
Id = Guid.Empty.ToString()
};
} }

View File

@ -48,15 +48,12 @@ namespace OpenAuth.Mvc.Controllers
return JsonHelper.Instance.Serialize(resp); return JsonHelper.Instance.Serialize(resp);
} }
/// <summary> public string Login(string username, string password)
/// 开发者登录
/// </summary>
public string LoginByDev()
{ {
var resp = new Response(); var resp = new Response();
try try
{ {
var result = AuthUtil.Login(_appKey, "System", "123456"); var result = AuthUtil.Login(_appKey, username, password);
if (result.Code == 200) if (result.Code == 200)
{ {
var cookie = new HttpCookie("Token", result.Token) var cookie = new HttpCookie("Token", result.Token)

View File

@ -196,7 +196,7 @@
<Content Include="js\flow\img\gooflow_icon.png" /> <Content Include="js\flow\img\gooflow_icon.png" />
<Content Include="js\flowlayout.js" /> <Content Include="js\flowlayout.js" />
<Content Include="js\utils.js" /> <Content Include="js\utils.js" />
<Content Include="userJs\flowInstanceOp.js" /> <Content Include="userJs\verification.js" />
<Content Include="userJs\flowInstanceEdit.js" /> <Content Include="userJs\flowInstanceEdit.js" />
<Content Include="userJs\flowInstanceWait.js" /> <Content Include="userJs\flowInstanceWait.js" />
<Content Include="userJs\flowInstanceDisposed.js" /> <Content Include="userJs\flowInstanceDisposed.js" />

View File

@ -6,27 +6,31 @@
<link href="/css/formpreview.css" rel="stylesheet" /> <link href="/css/formpreview.css" rel="stylesheet" />
} }
<form class="layui-form" action="" id="formEdit"> <form class="layui-form " action="" id="formEdit">
<div class="layui-row"> <div class="layui-row ">
<div class="layui-col-xs8">
<div class="layui-tab layui-tab-brief" lay-filter="tab"> <div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title"> <ul class="layui-tab-title">
<li class="layui-this">表单信息</li> <li class="layui-this">流程信息</li>
<li>流程信息</li> <li>表单信息</li>
</ul> </ul>
<div class="layui-tab-content"> <div class="layui-tab-content">
<div class="layui-tab-item layui-show"> <div class="layui-tab-item layui-show">
<div id="frmPreview"></div> <div id="flowPanel"></div>
</div> </div>
<div class="layui-tab-item"> <div class="layui-tab-item">
<div id="flowPanel" ></div> <div id="frmPreview"></div>
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" id="FlowInstanceId" name="FlowInstanceId" /> </div>
<div class="layui-col-xs4" style="background-color: gainsboro; min-height: 600px">
<input type="hidden" id="FlowInstanceId" name="FlowInstanceId"/>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">审核结果</label> <label class="layui-form-label">审核结果</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -39,8 +43,9 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">审核意见</label> <label class="layui-form-label">审核意见</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="VerificationOpinion" <textarea name="VerificationOpinion"
placeholder="" autocomplete="off" class="layui-input"> placeholder="" autocomplete="off" class="layui-textarea" ></textarea>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -48,5 +53,5 @@
<input type="hidden" lay-submit id="btnSubmit" lay-filter="formSubmit"/> <input type="hidden" lay-submit id="btnSubmit" lay-filter="formSubmit"/>
</form> </form>
<script type="text/javascript" src="/layui/layui.js"></script> <script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/userJs/flowInstanceOp.js?v2"></script> <script type="text/javascript" src="/userJs/verification.js?v2"></script>

View File

@ -43,11 +43,11 @@
<form class="layui-form"> <form class="layui-form">
<ul> <ul>
<li> <li>
<input name="username" type="text" class="loginuser" value="admin" <input name="username" type="text" class="loginuser" value="System"
placeholder="请输入用户名/手机号码" lay-verify="required"> placeholder="请输入用户名/手机号码" lay-verify="required">
</li> </li>
<li> <li>
<input name="password" type="password" id="password" value="admin" <input name="password" type="password" id="password" value="123456"
class="loginpwd ipt" placeholder="请输入密码" lay-verify="required"> class="loginpwd ipt" placeholder="请输入密码" lay-verify="required">
</li> </li>
<li> <li>

View File

@ -65,47 +65,6 @@
}(); }();
$("#tree").height($("div.layui-table-view").height()); $("#tree").height($("div.layui-table-view").height());
//添加(编辑)对话框
var editDlg = function () {
var update = false; //是否为更新
var show = function (data) {
var title = update ? "编辑信息" : "添加";
layer.open({
type: 2,
area: ['800px', '700px'], //宽高
maxmin: true, //开启最大化最小化按钮
title: title,
content: '/flowInstances/edit?id=' + data.Id,
btn: ['保存', '关闭'],
yes: function (index, layero) {
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
iframeWin.submit();
},
btn2: function (index) {
layer.close(index);
mainList();
},
cancel: function (index) {
layer.close(index);
mainList();
}
});
}
return {
add: function () { //弹出添加
update = false;
show({
Id: ''
});
},
update: function (data) { //弹出编辑框
update = true;
show(data);
}
};
}();
//监听表格内部按钮 //监听表格内部按钮
table.on('tool(list)', function (obj) { table.on('tool(list)', function (obj) {
@ -117,27 +76,7 @@
//监听页面主按钮操作 //监听页面主按钮操作
var active = { var active = {
btnDel: function () { //批量删除 btnDetail: function () { //处理
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
openauth.del("/FlowInstances/Delete",
data.map(function (e) { return e.Id; }),
mainList);
}
, btnAdd: function () { //添加
editDlg.add();
}
, btnEdit: function () { //编辑
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择编辑的行,且同时只能编辑一行");
return;
}
editDlg.update(data[0]);
}
, btnVerification: function () { //处理
var checkStatus = table.checkStatus('mainList') var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data; , data = checkStatus.data;
if (data.length != 1) { if (data.length != 1) {
@ -147,16 +86,12 @@
layer.open({ layer.open({
type: 2, type: 2,
area: ['750px', '550px'], //宽高 area: ['800px', '600px'], //宽高
maxmin: true, //开启最大化最小化按钮 maxmin: true, //开启最大化最小化按钮
title: '处理流程', title: '处理流程',
content: '/flowInstances/Verification?id=' + data[0].Id, content: ['/flowInstances/Verification?id=' + data[0].Id, 'no'],
btn: ['保存', '关闭'], btn: ['关闭'],
yes: function (index, layero) { yes: function (index) {
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
iframeWin.submit();
},
btn2: function (index) {
layer.close(index); layer.close(index);
mainList(); mainList();
}, },
@ -166,13 +101,6 @@
} }
}); });
} }
, search: function () { //搜索
mainList({ key: $('#key').val() });
}
, btnRefresh: function() {
mainList();
}
}; };
$('.toolList .layui-btn').on('click', function () { $('.toolList .layui-btn').on('click', function () {

View File

@ -65,47 +65,6 @@
}(); }();
$("#tree").height($("div.layui-table-view").height()); $("#tree").height($("div.layui-table-view").height());
//添加(编辑)对话框
var editDlg = function () {
var update = false; //是否为更新
var show = function (data) {
var title = update ? "编辑信息" : "添加";
layer.open({
type: 2,
area: ['800px', '700px'], //宽高
maxmin: true, //开启最大化最小化按钮
title: title,
content: '/flowInstances/edit?id=' + data.Id,
btn: ['保存', '关闭'],
yes: function (index, layero) {
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
iframeWin.submit();
},
btn2: function (index) {
layer.close(index);
mainList();
},
cancel: function (index) {
layer.close(index);
mainList();
}
});
}
return {
add: function () { //弹出添加
update = false;
show({
Id: ''
});
},
update: function (data) { //弹出编辑框
update = true;
show(data);
}
};
}();
//监听表格内部按钮 //监听表格内部按钮
table.on('tool(list)', function (obj) { table.on('tool(list)', function (obj) {
@ -117,27 +76,7 @@
//监听页面主按钮操作 //监听页面主按钮操作
var active = { var active = {
btnDel: function () { //批量删除 btnVerification: function () { //处理
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
openauth.del("/FlowInstances/Delete",
data.map(function (e) { return e.Id; }),
mainList);
}
, btnAdd: function () { //添加
editDlg.add();
}
, btnEdit: function () { //编辑
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择编辑的行,且同时只能编辑一行");
return;
}
editDlg.update(data[0]);
}
, btnVerification: function () { //处理
var checkStatus = table.checkStatus('mainList') var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data; , data = checkStatus.data;
if (data.length != 1) { if (data.length != 1) {
@ -147,10 +86,10 @@
layer.open({ layer.open({
type: 2, type: 2,
area: ['750px', '550px'], //宽高 area: ['800px', '600px'], //宽高
maxmin: true, //开启最大化最小化按钮 maxmin: true, //开启最大化最小化按钮
title: '处理流程', title: '处理流程',
content: '/flowInstances/Verification?id=' + data[0].Id, content: ['/flowInstances/Verification?id=' + data[0].Id,'no'],
btn: ['保存', '关闭'], btn: ['保存', '关闭'],
yes: function (index, layero) { yes: function (index, layero) {
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method(); var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
@ -167,6 +106,31 @@
}); });
} }
, btnDetail: function () { //处理
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择要处理的流程,且同时只能选择一条");
return;
}
layer.open({
type: 2,
area: ['800px', '600px'], //宽高
maxmin: true, //开启最大化最小化按钮
title: '处理流程',
content: ['/flowInstances/Verification?id=' + data[0].Id, 'no'],
btn: ['关闭'],
yes: function (index) {
layer.close(index);
mainList();
},
cancel: function (index) {
layer.close(index);
mainList();
}
});
}
, search: function () { //搜索 , search: function () { //搜索
mainList({ key: $('#key').val() }); mainList({ key: $('#key').val() });
} }

View File

@ -135,7 +135,7 @@
editDlg.update(data[0]); editDlg.update(data[0]);
} }
, btnVerification: function () { //处理 , btnDetail: function () { //处理
var checkStatus = table.checkStatus('mainList') var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data; , data = checkStatus.data;
if (data.length != 1) { if (data.length != 1) {
@ -145,16 +145,12 @@
layer.open({ layer.open({
type: 2, type: 2,
area: ['750px', '550px'], //宽高 area: ['800px', '600px'], //宽高
maxmin: true, //开启最大化最小化按钮 maxmin: true, //开启最大化最小化按钮
title: '处理流程', title: '处理流程',
content: '/flowInstances/Verification?id=' + data[0].Id, content: ['/flowInstances/Verification?id=' + data[0].Id, 'no'],
btn: ['保存', '关闭'], btn: ['关闭'],
yes: function (index, layero) { yes: function (index) {
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
iframeWin.submit();
},
btn2: function (index) {
layer.close(index); layer.close(index);
mainList(); mainList();
}, },

View File

@ -5,7 +5,6 @@ layui.config({
var form = layui.form, element = layui.element, var form = layui.form, element = layui.element,
layer = layui.layer, layer = layui.layer,
$ = layui.jquery; $ = layui.jquery;
var thiswin = (top == undefined) ? window : top.window;
var table = layui.table; var table = layui.table;
var openauth = layui.openauth; var openauth = layui.openauth;
@ -108,7 +107,7 @@ layui.config({
btn: ['确定', '取消'], btn: ['确定', '取消'],
yes: function (index, layero) { yes: function (index, layero) {
var body = layer.getChildFrame('body', index); var body = layer.getChildFrame('body', index);
var iframeWin = thiswin[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method(); var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
var nodedata = iframeWin.getVal(); var nodedata = iframeWin.getVal();
flowDesignPanel.SetNodeEx(object.id, nodedata); flowDesignPanel.SetNodeEx(object.id, nodedata);
layer.close(index); layer.close(index);

View File

@ -3,9 +3,8 @@
}).use(['form', 'vue', 'ztree', 'layer', 'utils', 'jquery', 'table', 'droptree', 'openauth', 'element'], function () { }).use(['form', 'vue', 'ztree', 'layer', 'utils', 'jquery', 'table', 'droptree', 'openauth', 'element'], function () {
var form = layui.form, var form = layui.form,
element = layui.element, element = layui.element,
layer = (top == undefined || top.layer === undefined )? layui.layer : top.layer, layer = layui.layer ,
$ = layui.jquery; $ = layui.jquery;
var thiswin = (top == undefined) ? window : top.window;
var table = layui.table; var table = layui.table;
var openauth = layui.openauth; var openauth = layui.openauth;

View File

@ -92,8 +92,9 @@ layui.config({
//登录按钮事件 //登录按钮事件
form.on("submit(login)", function (data) { form.on("submit(login)", function (data) {
$.getJSON("/Login/LoginByDev", $.getJSON("/Login/Login"
function(data) { , data.field
,function(data) {
if (data.Code == 200) { if (data.Code == 200) {
window.location.href = "/Home/Index"; window.location.href = "/Home/Index";
} else { } else {

View File

@ -10,18 +10,12 @@
var id = $.getUrlParam("id"); //ID var id = $.getUrlParam("id"); //ID
$("#FlowInstanceId").val(id); $("#FlowInstanceId").val(id);
//标签切换
element.on('tab(tab)', function (data) {
layer.iframeAuto(index);
});
$.getJSON('/FlowInstances/get?id=' + id, $.getJSON('/FlowInstances/get?id=' + id,
function (data) { function (data) {
var obj = data.Result; var obj = data.Result;
var schemeContent = JSON.parse(obj.SchemeContent); var schemeContent = JSON.parse(obj.SchemeContent);
var flowDesignPanel = $('#flowPanel').flowdesign({ var flowDesignPanel = $('#flowPanel').flowdesign({
height: 300,
widht: 300,
haveTool: false haveTool: false
, isprocessing: true , isprocessing: true
, activityId: obj.ActivityId , activityId: obj.ActivityId

View File

@ -30,6 +30,16 @@
</root> </root>
</log4net> </log4net>
<appSettings>
<add key="version" value="" />
<!--SSO单点登录主域-->
<!--<add key="SSOPassport" value="http://openauthapi.com" />-->
<add key="SSOPassport" value="http://localhost:52789" />
<!--AppKey唯一标识-->
<add key="SSOAppKey" value="openauth" />
</appSettings>
<autofac defaultAssembly=" OpenAuth.Repository"> <autofac defaultAssembly=" OpenAuth.Repository">
<components> <components>
<component type=" OpenAuth.Repository.UserRepository" service=" OpenAuth.Domain.Interface.IUserRepository,OpenAuth.Domain" /> <component type=" OpenAuth.Repository.UserRepository" service=" OpenAuth.Domain.Interface.IUserRepository,OpenAuth.Domain" />

View File

@ -22,7 +22,7 @@ namespace OpenAuth.UnitTest
[TestMethod] [TestMethod]
public void TestMethod1() public void TestMethod1()
{ {
var service= app.Create("System"); var service= app.Create("admin");
var modules = service.Modules; var modules = service.Modules;

View File

@ -12,11 +12,13 @@ namespace OpenAuth.UnitTest
{ {
private FlowSchemeApp _app; private FlowSchemeApp _app;
private FlowInstanceApp _runApp; private FlowInstanceApp _runApp;
private AuthorizeApp authenApp;
public TestWorkflow() public TestWorkflow()
{ {
_app = AutofacExt.GetFromFac<FlowSchemeApp>(); _app = AutofacExt.GetFromFac<FlowSchemeApp>();
_runApp = AutofacExt.GetFromFac<FlowInstanceApp>(); _runApp = AutofacExt.GetFromFac<FlowInstanceApp>();
authenApp = AutofacExt.GetFromFac<AuthorizeApp>();
} }
/// <summary> /// <summary>
@ -26,9 +28,10 @@ namespace OpenAuth.UnitTest
[TestMethod] [TestMethod]
public void Verify() public void Verify()
{ {
authenApp.Create("System");
_runApp.Verification(new VerificationReq _runApp.Verification(new VerificationReq
{ {
FlowInstanceId = "132333fe-d8db-4373-b101-b0ac574d3b1a", FlowInstanceId = "7335d82f-5c3d-43e5-a53b-7d51a7cb1f59",
VerificationFinally = "3" VerificationFinally = "3"
}); });
} }

View File

@ -65,7 +65,7 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
var user = _objCacheProvider.GetCache(token); var user = _objCacheProvider.GetCache(token);
if (user != null) if (user != null)
{ {
result.Result = _app.GetAccessedControls(user.UserName); result.Result = _app.GetAccessedControls(user.Account);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -92,7 +92,7 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
var user = _objCacheProvider.GetCache(token); var user = _objCacheProvider.GetCache(token);
if (user != null) if (user != null)
{ {
result.Result = user.UserName; result.Result = user.Account;
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -23,7 +23,7 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
var viewModel = new PassportLoginRequest var viewModel = new PassportLoginRequest
{ {
AppKey = appKey, AppKey = appKey,
UserName = username, Account = username,
}; };
return View(viewModel); return View(viewModel);
@ -37,7 +37,7 @@ namespace OpenAuth.WebApi.Areas.SSO.Controllers
if (result.Code ==200) if (result.Code ==200)
{ {
var redirectUrl = string.Format("{0}?token={1}&sessionusername={2}", result.ReturnUrl, result.Token, model.UserName); var redirectUrl = string.Format("{0}?token={1}&sessionusername={2}", result.ReturnUrl, result.Token, model.Account);
//跳转默认回调页面 //跳转默认回调页面
return Redirect(redirectUrl); return Redirect(redirectUrl);

View File

@ -36,7 +36,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label" for="UserName">用户名</label> <label class="col-md-3 control-label" for="UserName">用户名</label>
<div class="col-md-9"> <div class="col-md-9">
@Html.TextBoxFor(model => model.UserName, new { @class = "form-control input-lg", style = "width: 280px" }) @Html.TextBoxFor(model => model.Account, new { @class = "form-control input-lg", style = "width: 280px" })
@Html.HiddenFor(model => model.AppKey) @Html.HiddenFor(model => model.AppKey)
</div> </div>
</div> </div>

Binary file not shown.