mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 01:58:01 +08:00
routine update
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.App.Flow
|
||||
@@ -19,8 +21,8 @@ namespace OpenAuth.App.Flow
|
||||
{
|
||||
_runtimeModel = new FlowRuntimeModel();
|
||||
dynamic schemeContentJson = instance.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
|
||||
_runtimeModel.frmData = instance.FrmData;
|
||||
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
|
||||
_runtimeModel.nodes = GetNodeDictionary(schemeContentJson);//节点集合
|
||||
_runtimeModel.lines = GetLineDictionary(schemeContentJson);//线条集合
|
||||
_runtimeModel.currentNodeId = (instance.ActivityId == "" ? _runtimeModel.startNodeId : instance.ActivityId);
|
||||
@@ -51,15 +53,16 @@ namespace OpenAuth.App.Flow
|
||||
private Dictionary<string, FlowNode> GetNodeDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, FlowNode> nodeDictionary = new Dictionary<string, FlowNode>();
|
||||
foreach (var item in schemeContentJson.Flow.nodes)
|
||||
foreach (JObject item in schemeContentJson.nodes)
|
||||
{
|
||||
if (!nodeDictionary.ContainsKey(item.id.Value))
|
||||
var node = item.ToObject<FlowNode>();
|
||||
if (!nodeDictionary.ContainsKey(node.id))
|
||||
{
|
||||
nodeDictionary.Add(item.id.Value, item);
|
||||
nodeDictionary.Add(node.id, node);
|
||||
}
|
||||
if (item.type == FlowNode.START)
|
||||
if (node.type == FlowNode.START)
|
||||
{
|
||||
this._runtimeModel.startNodeId = item.id.Value;
|
||||
this._runtimeModel.startNodeId = node.id;
|
||||
}
|
||||
}
|
||||
return nodeDictionary;
|
||||
@@ -72,16 +75,17 @@ namespace OpenAuth.App.Flow
|
||||
private Dictionary<string, List<FlowLine>> GetLineDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, List<FlowLine>> lineDictionary = new Dictionary<string, List<FlowLine>>();
|
||||
foreach (var item in schemeContentJson.Flow.lines)
|
||||
foreach (JObject item in schemeContentJson.lines)
|
||||
{
|
||||
if (!lineDictionary.ContainsKey(item.from.Value))
|
||||
var line = item.ToObject<FlowLine>();
|
||||
if (!lineDictionary.ContainsKey(line.from))
|
||||
{
|
||||
List<FlowLine> d = new List<FlowLine> { item };
|
||||
lineDictionary.Add(item.from.Value, d);
|
||||
List<FlowLine> d = new List<FlowLine> { line };
|
||||
lineDictionary.Add(line.from, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineDictionary[item.from.Value].Add(item);
|
||||
lineDictionary[line.from].Add(line);
|
||||
}
|
||||
}
|
||||
return lineDictionary;
|
||||
@@ -94,16 +98,17 @@ namespace OpenAuth.App.Flow
|
||||
private Dictionary<string, List<FlowLine>> GetToLineDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, List<FlowLine>> lineDictionary = new Dictionary<string, List<FlowLine>>();
|
||||
foreach (var item in schemeContentJson.Flow.lines)
|
||||
foreach (JObject item in schemeContentJson.lines)
|
||||
{
|
||||
if (!lineDictionary.ContainsKey(item.to.Value))
|
||||
var line = item.ToObject<FlowLine>();
|
||||
if (!lineDictionary.ContainsKey(line.to))
|
||||
{
|
||||
List<FlowLine> d = new List<FlowLine> { item };
|
||||
lineDictionary.Add(item.to.Value, d);
|
||||
List<FlowLine> d = new List<FlowLine> { line };
|
||||
lineDictionary.Add(line.to, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineDictionary[item.to.Value].Add(item);
|
||||
lineDictionary[line.to].Add(line);
|
||||
}
|
||||
}
|
||||
return lineDictionary;
|
||||
|
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.App.Flow;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
@@ -98,21 +99,24 @@ namespace OpenAuth.App
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʵ<EFBFBD><CAB5>
|
||||
/// </summary>
|
||||
/// <param name="processId"><3E><><EFBFBD><EFBFBD>GUID</param>
|
||||
/// <param name="schemeInfoId">ģ<><C4A3><EFBFBD><EFBFBD>ϢID</param>
|
||||
/// <param name="wfLevel"></param>
|
||||
/// <param name="code"><3E><><EFBFBD>̱<EFBFBD><CCB1><EFBFBD></param>
|
||||
/// <param name="customName"><3E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
||||
/// <param name="description"><3E><>ע</param>
|
||||
/// <param name="frmData"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ</param>
|
||||
/// <returns></returns>
|
||||
public bool CreateInstance(FlowInstance flowInstance)
|
||||
public bool CreateInstance(JObject obj)
|
||||
{
|
||||
var flowInstance = obj.ToObject<FlowInstance>();
|
||||
|
||||
//<2F><>ȡ<EFBFBD>ύ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
var frmdata = new JObject();
|
||||
foreach (var property in obj.Properties().Where(U => U.Name.Contains("data_")))
|
||||
{
|
||||
frmdata[property.Name] = property.Value;
|
||||
}
|
||||
flowInstance.FrmData = JsonHelper.Instance.Serialize(frmdata);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
||||
var wfruntime = new FlowRuntime(flowInstance);
|
||||
|
||||
|
||||
var user = AuthUtil.GetCurrentUser();
|
||||
#region ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD>ı䵱ǰ<EFBFBD>ڵ<EFBFBD>״̬
|
||||
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
||||
flowInstance.ActivityType = wfruntime.GetNextNodeType();//-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;
|
||||
|
Reference in New Issue
Block a user