可以正常发起一个流程

This commit is contained in:
yubaolee
2018-03-23 17:47:44 +08:00
parent ce9f67c396
commit 0a42c651aa
8 changed files with 71 additions and 63 deletions

View File

@@ -14,7 +14,7 @@ namespace OpenAuth.App
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public class FlowInstanceApp :BaseApp<FlowInstance>
public class FlowInstanceApp : BaseApp<FlowInstance>
{
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -26,12 +26,12 @@ namespace OpenAuth.App
/// <param name="processOperationHistoryEntity"></param>
/// <param name="processTransitionHistoryEntity"></param>
/// <returns></returns>
public int SaveProcess(FlowInstance processInstanceEntity,
FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
public int SaveProcess(FlowInstance processInstanceEntity,
FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
{
try
{
processInstanceEntity.Id=(processInstanceEntity.Id);
processInstanceEntity.Id = (processInstanceEntity.Id);
UnitWork.Update(processInstanceEntity);
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
@@ -42,7 +42,7 @@ namespace OpenAuth.App
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processTransitionHistoryEntity);
}
UnitWork.Save();
return 1;
}
@@ -62,11 +62,11 @@ namespace OpenAuth.App
/// <param name="delegateRecordEntityList"></param>
/// <param name="processTransitionHistoryEntity"></param>
/// <returns></returns>
public int SaveProcess(string sql,string dbbaseId, FlowInstance processInstanceEntity, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
public int SaveProcess(string sql, string dbbaseId, FlowInstance processInstanceEntity, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
{
try
{
processInstanceEntity.Id=(processInstanceEntity.Id);
processInstanceEntity.Id = (processInstanceEntity.Id);
UnitWork.Update(processInstanceEntity);
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
@@ -77,7 +77,7 @@ namespace OpenAuth.App
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
UnitWork.Add(processTransitionHistoryEntity);
}
//if (!string.IsNullOrEmpty(dbbaseId) && !string.IsNullOrEmpty(sql))//<2F><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>sql<71><6C><EFBFBD><EFBFBD>
//{
// DataBaseLinkEntity dataBaseLinkEntity = dataBaseLinkService.GetEntity(dbbaseId);//<2F><>ȡ
@@ -94,7 +94,7 @@ namespace OpenAuth.App
#endregion
#region <EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD><EFBFBD><EFBFBD>API
/// <summary>
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʵ<EFBFBD><CAB5>
@@ -146,7 +146,7 @@ namespace OpenAuth.App
{
InstanceId = flowInstance.Id,
FromNodeId = wfruntime.runtimeModel.currentNodeId,
FromNodeName = wfruntime.runtimeModel.currentNode.name.Value,
FromNodeName = wfruntime.runtimeModel.currentNode.name,
FromNodeType = wfruntime.runtimeModel.currentNodeType,
ToNodeId = wfruntime.runtimeModel.nextNodeId,
ToNodeName = wfruntime.runtimeModel.nextNode.name,
@@ -155,7 +155,7 @@ namespace OpenAuth.App
};
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
#endregion
UnitWork.Add(flowInstance);
UnitWork.Add(processOperationHistoryEntity);
UnitWork.Add(processTransitionHistoryEntity);
@@ -220,7 +220,8 @@ namespace OpenAuth.App
string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id, description);
var _data = new
{
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(), wfruntime.runtimeModel.frmData
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
wfruntime.runtimeModel.frmData
};
switch (_Confluenceres)
{
@@ -235,12 +236,12 @@ namespace OpenAuth.App
FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1<>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
FlowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ?"": GetMakerList(wfruntime) );//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
FlowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
@@ -248,14 +249,7 @@ namespace OpenAuth.App
processTransitionHistoryEntity.TransitionSate = 0;
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
#endregion
if (wfruntime.runtimeModel.currentNode.setInfo != null && wfruntime.runtimeModel.currentNode.setInfo.NodeSQL != null)
{
_sqlstr = wfruntime.runtimeModel.currentNode.setInfo.NodeSQL.Value;
_dbbaseId = wfruntime.runtimeModel.currentNode.setInfo.NodeDataBaseToSQL.Value;
}
break;
}
}
@@ -283,7 +277,7 @@ namespace OpenAuth.App
processTransitionHistoryEntity = new FlowInstanceTransitionHistory
{
FromNodeId = wfruntime.runtimeModel.currentNodeId,
FromNodeName = wfruntime.runtimeModel.currentNode.name.Value,
FromNodeName = wfruntime.runtimeModel.currentNode.name,
FromNodeType = wfruntime.runtimeModel.currentNodeType,
ToNodeId = wfruntime.runtimeModel.nextNodeId,
ToNodeName = wfruntime.runtimeModel.nextNode.name,
@@ -293,14 +287,7 @@ namespace OpenAuth.App
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
#endregion
if (wfruntime.runtimeModel.currentNode.setInfo != null && wfruntime.runtimeModel.currentNode.setInfo.NodeSQL != null)
{
_sqlstr = wfruntime.runtimeModel.currentNode.setInfo.NodeSQL.Value;
_dbbaseId = wfruntime.runtimeModel.currentNode.setInfo.NodeDataBaseToSQL.Value;
}
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.currentNode.name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><>ͬ<EFBFBD><CDAC>,<2C><>ע<EFBFBD><D7A2>" + description;
}
else
@@ -312,7 +299,8 @@ namespace OpenAuth.App
}
var data = new
{
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(), wfruntime.runtimeModel.frmData
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
wfruntime.runtimeModel.frmData
};
}
#endregion
@@ -340,7 +328,7 @@ namespace OpenAuth.App
FlowInstance flowInstance = Get(processId);
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
@@ -365,7 +353,7 @@ namespace OpenAuth.App
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
@@ -448,7 +436,7 @@ namespace OpenAuth.App
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
private string GetMakerList(dynamic node, string processId)
private string GetMakerList(FlowNode node, string processId)
{
try
{
@@ -460,22 +448,22 @@ namespace OpenAuth.App
}
else
{
if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//<2F><><EFBFBD>г<EFBFBD>Ա
{
makerlsit = "1";
}
else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//ָ<><D6B8><EFBFBD><EFBFBD>Ա
{
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.role, makerlsit);
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.post, makerlsit);
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.usergroup, makerlsit);
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.user, makerlsit);
//if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//<2F><><EFBFBD>г<EFBFBD>Ա
//{
// makerlsit = "1";
//}
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//ָ<><D6B8><EFBFBD><EFBFBD>Ա
//{
makerlsit = 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);
if (makerlsit == "")
{
makerlsit = "-1";
}
if (makerlsit == "")
{
makerlsit = "-1";
}
// }
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType3")//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//{
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
@@ -543,7 +531,7 @@ namespace OpenAuth.App
/// <param name="data"></param>
/// <param name="Str"></param>
/// <returns></returns>
private string ArrwyToString(dynamic data, string Str)
private string ArrayToString(dynamic data, string Str)
{
string resStr = Str;
foreach (var item in data)
@@ -552,7 +540,16 @@ namespace OpenAuth.App
{
resStr += ",";
}
resStr += item.Value;
if (item is string)
{
resStr += item;
}
else
{
resStr += item.Value;
}
}
return resStr;
}
@@ -594,11 +591,11 @@ namespace OpenAuth.App
throw;
}
}
public void Update(FlowInstance flowScheme)
{
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance());
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance());
}
public TableData Load(QueryFlowInstanceListReq request)