可以处理流程

This commit is contained in:
yubao 2018-03-26 00:34:49 +08:00
parent 99dd110885
commit 304e465b6b
15 changed files with 407 additions and 323 deletions

BIN
DOC/工作流介绍.docx Normal file

Binary file not shown.

View File

@ -43,5 +43,33 @@ namespace Infrastructure
};
}
}
/// <summary>
/// 把数组转为逗号连接的字符串
/// </summary>
/// <param name="data"></param>
/// <param name="Str"></param>
/// <returns></returns>
public static string ArrayToString(dynamic data, string Str)
{
string resStr = Str;
foreach (var item in data)
{
if (resStr != "")
{
resStr += ",";
}
if (item is string)
{
resStr += item;
}
else
{
resStr += item.Value;
}
}
return resStr;
}
}
}

View File

@ -8,6 +8,8 @@
public const string START = "start round mix";
public const string END = "end round";
public const string NODE = "node";
public const string FORK = "fork"; //会签开始节点
public const string JOIN = "join"; //会签结束节点
public string id { get; set; }
@ -21,11 +23,6 @@
/// </summary>
/// <value>The set information.</value>
public Setinfo setInfo { get; set; }
public FlowNode()
{
setInfo = new Setinfo();
}
}
public class Setinfo
@ -33,11 +30,6 @@
public Nodedesignatedata NodeDesignateData { get; set; }
public string NodeCode { get; set; }
public string NodeName { get; set; }
public Setinfo()
{
NodeDesignateData = new Nodedesignatedata();
}
}
/// <summary>

View File

@ -181,11 +181,11 @@ namespace OpenAuth.App.Flow
/// <returns></returns>
public int GetNodeType(string nodeId)
{
if (_runtimeModel.nodes[nodeId].type == "shuntnode")//会签开始节点
if (_runtimeModel.nodes[nodeId].type == FlowNode.FORK)//会签开始节点
{
return 0;
}
else if (_runtimeModel.nodes[nodeId].type == "confluencenode")//会签结束节点
else if (_runtimeModel.nodes[nodeId].type == FlowNode.JOIN)//会签结束节点
{
return 1;
}
@ -435,6 +435,7 @@ namespace OpenAuth.App.Flow
throw;
}
}
///<summary>
/// 标记节点1通过-1不通过0驳回
/// </summary>
/// <param name="nodeId"></param>
@ -446,7 +447,7 @@ namespace OpenAuth.App.Flow
int i = 0;
foreach (var item in _runtimeModel.schemeContentJson.nodes)
{
if (item.id.Value == nodeId)
if (item.id.Value.ToString() == nodeId)
{
_runtimeModel.schemeContentJson.nodes[i].setInfo.Taged = flag;
_runtimeModel.schemeContentJson.nodes[i].setInfo.UserId = userId;

View File

@ -30,7 +30,7 @@ namespace OpenAuth.App.Flow
/// </summary>
public string nextNodeId { get; set; }
/// <summary>
/// 下一个节点类型
/// 下一个节点类型 -1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
/// </summary>
/// <value>The type of the next node.</value>
public int nextNodeType { get; set; }

View File

@ -16,85 +16,7 @@ namespace OpenAuth.App
/// </summary>
public class FlowInstanceApp : BaseApp<FlowInstance>
{
#region
/// <summary>
/// 存储工作流实例进程(审核驳回重新提交)
/// </summary>
/// <param name="processInstanceEntity"></param>
/// <param name="processSchemeEntity"></param>
/// <param name="processOperationHistoryEntity"></param>
/// <param name="processTransitionHistoryEntity"></param>
/// <returns></returns>
public int SaveProcess(FlowInstance processInstanceEntity,
FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
{
try
{
processInstanceEntity.Id = (processInstanceEntity.Id);
UnitWork.Update(processInstanceEntity);
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processOperationHistoryEntity);
if (processTransitionHistoryEntity != null)
{
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processTransitionHistoryEntity);
}
UnitWork.Save();
return 1;
}
catch
{
throw;
}
}
/// <summary>
/// 更新流程实例 审核节点用
/// </summary>
/// <param name="sql"></param>
/// <param name="dbbaseId"></param>
/// <param name="processInstanceEntity"></param>
/// <param name="processSchemeEntity"></param>
/// <param name="processOperationHistoryEntity"></param>
/// <param name="delegateRecordEntityList"></param>
/// <param name="processTransitionHistoryEntity"></param>
/// <returns></returns>
public int SaveProcess(string sql, string dbbaseId, FlowInstance processInstanceEntity, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
{
try
{
processInstanceEntity.Id = (processInstanceEntity.Id);
UnitWork.Update(processInstanceEntity);
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processOperationHistoryEntity);
if (processTransitionHistoryEntity != null)
{
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processTransitionHistoryEntity);
}
//if (!string.IsNullOrEmpty(dbbaseId) && !string.IsNullOrEmpty(sql))//测试环境不允许执行sql语句
//{
// DataBaseLinkEntity dataBaseLinkEntity = dataBaseLinkService.GetEntity(dbbaseId);//获取
// this.BaseRepository(dataBaseLinkEntity.DbConnection).ExecuteBySql(sql.Replace("{0}", processInstanceEntity.Id));
//}
UnitWork.Save();
return 1;
}
catch
{
throw;
}
}
#endregion
#region API
/// <summary>
/// 创建一个实例
@ -166,153 +88,142 @@ namespace OpenAuth.App
/// <summary>
/// 节点审核
/// </summary>
/// <param name="processId"></param>
/// <param name="instanceId"></param>
/// <returns></returns>
public bool NodeVerification(string processId, bool flag, string description = "")
public bool NodeVerification(string instanceId, bool flag, string description = "")
{
bool _res = false;
try
FlowInstance flowInstance = Get(instanceId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();//操作记录
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//流转记录
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
#region
if (flowInstance.ActivityType == 0)//会签
{
string _sqlstr = "", _dbbaseId = "";
FlowInstance FlowInstance = Get(processId);
FlowInstanceOperationHistory FlowInstanceOperationHistory = new FlowInstanceOperationHistory();//操作记录
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//流转记录
FlowRuntime wfruntime = new FlowRuntime(FlowInstance);
#region
if (FlowInstance.ActivityType == 0)//会签
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, "");//标记当前节点通过
///寻找需要审核的节点Id
string _VerificationNodeId = "";
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
string _makerList = "";
foreach (string item in _nodelist)
{
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, "");//标记当前节点通过
///寻找需要审核的节点Id
string _VerificationNodeId = "";
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
string _makerList = "";
foreach (string item in _nodelist)
_makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId);
if (_makerList != "-1")
{
_makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId);
if (_makerList != "-1")
var id = AuthUtil.GetCurrentUser().User.Id;
foreach (string one in _makerList.Split(','))
{
var id = AuthUtil.GetCurrentUser().User.Id;
foreach (string one in _makerList.Split(','))
if (id == one || id.IndexOf(one) != -1)
{
if (id == one || id.IndexOf(one) != -1)
{
_VerificationNodeId = item;
break;
}
_VerificationNodeId = item;
break;
}
}
}
if (_VerificationNodeId != "")
{
if (flag)
{
FlowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
}
else
{
FlowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
}
string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id, description);
var _data = new
{
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
wfruntime.runtimeModel.frmData
};
switch (_Confluenceres)
{
case "-1"://不通过
FlowInstance.IsFinish = 3;
break;
case "1"://等待
break;
default://通过
FlowInstance.PreviousId = FlowInstance.ActivityId;
FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
FlowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//当前节点可执行的人信息
#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 = 0;
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
#endregion
break;
}
}
else
{
throw (new Exception("审核异常,找不到审核节点"));
}
}
#endregion
#region
else//一般审核
if (_VerificationNodeId != "")
{
if (flag)
{
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, AuthUtil.GetCurrentUser().User.Id, description);
FlowInstance.PreviousId = FlowInstance.ActivityId;
FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
FlowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//当前节点可执行的人信息
FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
#region
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 = 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.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
}
else
{
FlowInstance.IsFinish = 3; //表示该节点不同意
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
FlowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
}
var data = new
string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id, description);
var _data = new
{
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
wfruntime.runtimeModel.frmData
};
}
#endregion
switch (_Confluenceres)
{
case "-1"://不通过
flowInstance.IsFinish = 3;
break;
case "1"://等待
break;
default://通过
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
flowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//当前节点可执行的人信息
_res = true;
SaveProcess(_sqlstr, _dbbaseId, FlowInstance, FlowInstanceOperationHistory, processTransitionHistoryEntity);
return _res;
#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 = 0;
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
#endregion
break;
}
}
else
{
throw (new Exception("审核异常,找不到审核节点"));
}
}
catch
#endregion
#region
else//一般审核
{
throw;
if (flag)
{
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1
, AuthUtil.GetCurrentUser().User.Id, description);
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
flowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//当前节点可执行的人信息
flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
#region
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 = 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;
}
else
{
flowInstance.IsFinish = 3; //表示该节点不同意
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
flowInstanceOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
}
}
#endregion
UnitWork.Update(flowInstance);
UnitWork.Add(flowInstanceOperationHistory);
UnitWork.Add(processTransitionHistoryEntity);
UnitWork.Save();
return true;
}
/// <summary>
/// 驳回
@ -323,59 +234,56 @@ namespace OpenAuth.App
/// <returns></returns>
public bool NodeReject(string processId, string nodeId, string description = "")
{
try
FlowInstance flowInstance = Get(processId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
string resnode = "";
if (nodeId == "")
{
FlowInstance flowInstance = Get(processId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
string resnode = "";
if (nodeId == "")
{
resnode = wfruntime.RejectNode();
}
else
{
resnode = nodeId;
}
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
flowInstance.IsFinish = 4;//4表示驳回需要申请者重新提交表单
if (resnode != "")
{
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = resnode;
flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
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.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;
SaveProcess(flowInstance, flowInstanceOperationHistory, processTransitionHistoryEntity);
return true;
resnode = wfruntime.RejectNode();
}
catch
else
{
throw;
resnode = nodeId;
}
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
flowInstance.IsFinish = 4;//4表示驳回需要申请者重新提交表单
if (resnode != "")
{
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = resnode;
flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
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.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);
UnitWork.Add(flowInstanceOperationHistory);
UnitWork.Add(processTransitionHistoryEntity);
UnitWork.Save();
return true;
}
#endregion
@ -454,10 +362,10 @@ namespace OpenAuth.App
//}
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//指定成员
//{
makerlsit = 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 = ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit);
makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit);
if (makerlsit == "")
{
@ -531,68 +439,33 @@ namespace OpenAuth.App
/// <param name="data"></param>
/// <param name="Str"></param>
/// <returns></returns>
private string ArrayToString(dynamic data, string Str)
{
string resStr = Str;
foreach (var item in data)
{
if (resStr != "")
{
resStr += ",";
}
if (item is string)
{
resStr += item;
}
else
{
resStr += item.Value;
}
}
return resStr;
}
/// <summary>
/// 审核流程
/// <para>李玉宝于2017-01-20 15:44:45</para>
/// </summary>
/// <param name="processId">The process identifier.</param>
/// <param name="verificationData">The verification data.</param>
public void VerificationProcess(string processId, string verificationData)
public void Verification(VerificationReq request)
{
try
//驳回
if (request.VerificationFinally == "3")
{
dynamic verificationDataJson = verificationData.ToJson();
//驳回
if (verificationDataJson.VerificationFinally.Value == "3")
string _nodeId = "";
if (!string.IsNullOrEmpty(request.NodeRejectStep))
{
string _nodeId = "";
if (verificationDataJson.NodeRejectStep != null)
{
_nodeId = verificationDataJson.NodeRejectStep.Value;
}
NodeReject(processId, _nodeId, verificationDataJson.VerificationOpinion.Value);
}
else if (verificationDataJson.VerificationFinally.Value == "2")//表示不同意
{
NodeVerification(processId, false, verificationDataJson.VerificationOpinion.Value);
}
else if (verificationDataJson.VerificationFinally.Value == "1")//表示同意
{
NodeVerification(processId, true, verificationDataJson.VerificationOpinion.Value);
_nodeId = request.NodeRejectStep;
}
NodeReject(request.FlowInstanceId, _nodeId, request.VerificationOpinion);
}
catch
else if (request.VerificationFinally == "2")//表示不同意
{
throw;
NodeVerification(request.FlowInstanceId, false, request.VerificationOpinion);
}
else if (request.VerificationFinally == "1")//表示同意
{
NodeVerification(request.FlowInstanceId, true, request.VerificationOpinion);
}
}
public void Update(FlowInstance flowScheme)
{
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance());

View File

@ -120,6 +120,7 @@
<Compile Include="Request\QueryRoleListReq.cs" />
<Compile Include="Request\QueryFormListReq.cs" />
<Compile Include="Request\QueryUserListReq.cs" />
<Compile Include="Request\VerificationReq.cs" />
<Compile Include="Response\FormResp.cs" />
<Compile Include="Response\TableData.cs" />
<Compile Include="RevelanceManagerApp.cs" />

View File

@ -0,0 +1,21 @@
namespace OpenAuth.App.Request
{
public class VerificationReq
{
public string FlowInstanceId { get; set; }
/// <summary>
/// 1:同意2不同意3驳回
/// </summary>
public string VerificationFinally { get; set; }
/// <summary>
/// 审核意见
/// </summary>
public string VerificationOpinion { get; set; }
/// <summary>
/// 驳回的步骤
/// </summary>
public string NodeRejectStep { get; set; }
}
}

View File

@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc;
using Infrastructure;
using Newtonsoft.Json.Linq;
@ -27,6 +26,26 @@ namespace OpenAuth.Mvc.Controllers
return View();
}
public ActionResult Verification()
{
return View();
}
[HttpPost]
public string Verification(VerificationReq request)
{
try
{
App.Verification(request);
}
catch (Exception ex)
{
Result.Code = 500;
Result.Message = ex.Message;
}
return JsonHelper.Instance.Serialize(Result);
}
public string Get(string id)
{
@ -80,7 +99,7 @@ namespace OpenAuth.Mvc.Controllers
/// <summary>
/// 加载列表
/// </summary>
public string Load([FromUri]QueryFlowInstanceListReq request)
public string Load([System.Web.Http.FromUri]QueryFlowInstanceListReq request)
{
return JsonHelper.Instance.Serialize(App.Load(request));
}

View File

@ -195,6 +195,7 @@
<Content Include="js\flow\img\gooflow_icon.png" />
<Content Include="js\flowlayout.js" />
<Content Include="js\utils.js" />
<Content Include="userJs\flowInstanceOp.js" />
<Content Include="userJs\flowInstanceEdit.js" />
<Content Include="userJs\flowSchemes.js" />
<Content Include="userJs\nodeInfo.js" />
@ -638,6 +639,7 @@
<Content Include="Views\FlowSchemes\NodeInfo.cshtml" />
<Content Include="Views\FlowSchemes\Design.cshtml" />
<Content Include="Views\FlowInstances\Edit.cshtml" />
<Content Include="Views\FlowInstances\Verification.cshtml" />
</ItemGroup>
<ItemGroup />
<ItemGroup>

View File

@ -0,0 +1,52 @@

@section header
{
<link rel="stylesheet" href="/css/treetable.css" />
<link href="/js/flow/GooFlow.css" rel="stylesheet" />
<link href="/css/formpreview.css" rel="stylesheet" />
}
<form class="layui-form" action="" id="formEdit">
<div class="layui-row">
<div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title">
<li class="layui-this">表单信息</li>
<li>流程信息</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div id="frmPreview"></div>
</div>
<div class="layui-tab-item">
<div id="flowPanel" ></div>
</div>
</div>
</div>
<input type="hidden" id="FlowInstanceId" name="FlowInstanceId" v-model="FlowInstanceId" />
<div class="layui-form-item">
<label class="layui-form-label">审核结果</label>
<div class="layui-input-block">
<input type="radio" name="VerificationFinally" v-model="VerificationFinally" value="1" title="同意" checked>
<input type="radio" name="VerificationFinally" v-model="VerificationFinally" value="2" title="不同意">
<input type="radio" name="VerificationFinally" v-model="VerificationFinally" value="3" title="驳回">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核意见</label>
<div class="layui-input-block">
<input type="text" name="VerificationOpinion" v-model="VerificationOpinion"
placeholder="" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<input type="hidden" lay-submit id="btnSubmit" lay-filter="formSubmit"/>
</form>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/userJs/flowInstanceOp.js?v2"></script>

View File

@ -0,0 +1,69 @@
layui.config({
base: "/js/"
}).use(['form', 'vue', 'ztree', 'layer', 'utils', 'element', 'jquery', 'droptree', 'openauth', 'flow/gooflow', 'flowlayout'], function () {
var form = layui.form, element = layui.element,
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
layer = layui.layer,
$ = layui.jquery;
var openauth = layui.openauth;
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var vm = new Vue({
el: "#formEdit"
});
var id = $.getUrlParam("id"); //ID
$("#FlowInstanceId").val(id);
//标签切换
element.on('tab(tab)', function (data) {
parent.layer.iframeAuto(index);
});
/*=========流程设计begin======================*/
var flowDesignPanel = $('#flowPanel').flowdesign({
height: 300,
widht: 300,
haveTool: false
});
/*=========流程设计end=====================*/
$.getJSON('/FlowInstances/get?id=' + id,
function (data) {
var obj = data.Result;
flowDesignPanel.loadData(JSON.parse(obj.SchemeContent));
//取表单的结构数据
$.getJSON("/forms/get?id=" + obj.FrmId, function (data) {
if (data.Code != 500) {
$("#frmPreview").html(data.Result.Html);
}
});
});
//提交数据
form.on('submit(formSubmit)',
function (data) {
$.post("/FlowInstances/Verification",
data.field,
function (result) {
layer.msg(result.Message);
},
"json");
return false; //阻止表单跳转。
});
//$(window).resize(function() {
// flowDesignPanel.reinitSize($(window).width()-30, $(window).height()-100);
//});
//该函数供给父窗口确定时调用
submit = function () {
//只能用隐藏的submit btn才行用form.submit()时data.field里没有数据
$("#btnSubmit").click();
}
//让层自适应iframe
parent.layer.iframeAuto(index);
})

View File

@ -128,6 +128,32 @@
editDlg.update(data[0]);
}
, btnVerification: function () { //处理
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择要处理的流程,且同时只能选择一条");
return;
}
layer.open({
type: 2,
area: ['600px', '500px'], //宽高
maxmin: true, //开启最大化最小化按钮
title: '处理流程',
content: '/flowInstances/Verification?id=' + data[0].Id,
btn: ['保存', '关闭'],
yes: function (index, layero) {
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象执行iframe页的方法iframeWin.method();
iframeWin.submit();
},
cancel: function (index) {
layer.close(index);
mainList();
}
});
}
, search: function () { //搜索
mainList({ key: $('#key').val() });
}

View File

@ -62,7 +62,7 @@ namespace OpenAuth.Repository.Domain
/// </summary>
public string ActivityId { get; set; }
/// <summary>
/// 当前节点类型0会签节点
/// 当前节点类型 -1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
/// </summary>
public int? ActivityType { get; set; }
/// <summary>
@ -130,7 +130,7 @@ namespace OpenAuth.Repository.Domain
/// </summary>
public string Description { get; set; }
/// <summary>
/// 是否完成
/// 是否完成 0未完成1完成并同意2被召回3完成但不同意 4被驳回需要重新提交
/// </summary>
public int IsFinish { get; set; }
/// <summary>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{54F96D9D-A534-4ADF-ADAD-ACFE3C42BC44}" Label="" LastModificationDate="1521692209" Name="OpenAuthDB" Objects="336" Symbols="21" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.6.1.5066"?>
<?PowerDesigner AppLocale="UTF16" ID="{54F96D9D-A534-4ADF-ADAD-ACFE3C42BC44}" Label="" LastModificationDate="1521692209" Name="OpenAuthDB" Objects="320" Symbols="21" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.6.1.5066"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -3967,7 +3967,7 @@ PhysOpts=
[ModelOptions\Default Opts\FRMESOB&lt;&lt;WorkloadGroup&gt;&gt;]
PhysOpts=</a:ModelOptionsText>
<a:RepositoryFilename>F:\MyProject\OpenAuth.Net\数据库设计关系图\OpenAuthDB.pdm</a:RepositoryFilename>
<a:RepositoryFilename>C:\MyProject\OpenAuth.Net\数据库设计关系图\OpenAuthDB.pdm</a:RepositoryFilename>
<c:GenerationOrigins>
<o:Shortcut Id="o3">
<a:ObjectID>9401CEBA-B163-4ADB-AECF-03CE78C0FFF3</a:ObjectID>
@ -9029,9 +9029,9 @@ Drop=No</a:Settings>
<a:Code>ActivityType</a:Code>
<a:CreationDate>1504793917</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1504798127</a:ModificationDate>
<a:ModificationDate>1521866779</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>当前节点类型0会签节点</a:Comment>
<a:Comment>当前节点类型-1无法运行,0会签开始,1会签结束,2一般节点,3开始节点,4流程运行结束</a:Comment>
<a:DataType>int</a:DataType>
</o:Column>
<o:Column Id="o188">
@ -9257,9 +9257,9 @@ Drop=No</a:Settings>
<a:Code>IsFinish</a:Code>
<a:CreationDate>1504793917</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1520667807</a:ModificationDate>
<a:ModificationDate>1521866723</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>是否完成</a:Comment>
<a:Comment>是否完成0运行中1完成并同意2被召回3完成但不同意 4被驳回需要重新提交</a:Comment>
<a:DefaultValue>0</a:DefaultValue>
<a:DataType>int</a:DataType>
<a:Column.Mandatory>1</a:Column.Mandatory>