mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 18:22:11 +08:00
调整流程详情显示效果
添加DataGrid数据格式
This commit is contained in:
32
OpenAuth.Mvc/Models/WorkflowActionProvider.cs
Normal file
32
OpenAuth.Mvc/Models/WorkflowActionProvider.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenAuth.App;
|
||||
using OptimaJet.Workflow.Core.Model;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
|
||||
namespace OpenAuth.Mvc.Models
|
||||
{
|
||||
public class WorkflowActionProvider :IWorkflowActionProvider
|
||||
{
|
||||
private ModuleManagerApp _app;
|
||||
|
||||
public WorkflowActionProvider()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||
}
|
||||
public void ExecuteAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<string> GetActions()
|
||||
{
|
||||
return new List<string>{"ok"};
|
||||
}
|
||||
}
|
||||
}
|
74
OpenAuth.Mvc/Models/WorkflowInit.cs
Normal file
74
OpenAuth.Mvc/Models/WorkflowInit.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Xml.Linq;
|
||||
using OpenAuth.App;
|
||||
using OptimaJet.Workflow.Core.Builder;
|
||||
using OptimaJet.Workflow.Core.Bus;
|
||||
using OptimaJet.Workflow.Core.Persistence;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using OptimaJet.Workflow.DbPersistence;
|
||||
|
||||
namespace OpenAuth.Mvc.Models
|
||||
{
|
||||
public static class WorkflowInit
|
||||
{
|
||||
private static volatile WorkflowRuntime _runtime;
|
||||
private static readonly object _sync = new object();
|
||||
|
||||
public static WorkflowRuntime Runtime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
var connectionString = ConfigurationManager.ConnectionStrings["WorkFlow"].ConnectionString;
|
||||
var builder = new WorkflowBuilder<XElement>(
|
||||
new MSSQLProvider(connectionString),
|
||||
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
|
||||
new MSSQLProvider(connectionString)
|
||||
).WithDefaultCache();
|
||||
|
||||
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
|
||||
.WithBuilder(builder)
|
||||
// .WithRuleProvider(new WorkflowRuleProvider())
|
||||
// .WithActionProvider(new WorkflowActionProvider())
|
||||
.WithPersistenceProvider(new MSSQLProvider(connectionString))
|
||||
.WithTimerManager(new TimerManager())
|
||||
.WithBus(new NullBus())
|
||||
.SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn()
|
||||
.Start();
|
||||
_runtime.ProcessStatusChanged += _runtime_ProcessStatusChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _runtime;
|
||||
}
|
||||
}
|
||||
|
||||
private static void _runtime_ProcessStatusChanged(object sender, ProcessStatusChangedEventArgs e)
|
||||
{
|
||||
if (e.NewStatus != ProcessStatus.Idled && e.NewStatus != ProcessStatus.Finalized)
|
||||
return;
|
||||
|
||||
if (string.IsNullOrEmpty(e.SchemeCode))
|
||||
return;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
var nextState = WorkflowInit.Runtime.GetLocalizedStateName(e.ProcessId, e.ProcessInstance.CurrentState);
|
||||
|
||||
var _app = AutofacExt.GetFromFac<GoodsApplyApp>();
|
||||
var goodsapply = _app.Get(e.ProcessId);
|
||||
if (goodsapply != null)
|
||||
{
|
||||
goodsapply.StateName = nextState;
|
||||
}
|
||||
_app.ChangeState(goodsapply.Id, e.ProcessInstance.CurrentState, nextState);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,19 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenAuth.App;
|
||||
using OptimaJet.Workflow.Core.Model;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
|
||||
namespace OpenAuth.Mvc.Models
|
||||
{
|
||||
public class WorkflowRuleProvider :IWorkflowRuleProvider
|
||||
public class WorkflowRuleProvider : IWorkflowRuleProvider
|
||||
{
|
||||
private RoleManagerApp _app;
|
||||
|
||||
public WorkflowRuleProvider()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<RoleManagerApp>();
|
||||
}
|
||||
|
||||
public List<string> GetRules()
|
||||
{
|
||||
return new List<string>
|
||||
var roles = _app.Load(Guid.Empty, 1, 100).list;
|
||||
var rolestrs = new List<string>();
|
||||
foreach (var role in roles)
|
||||
{
|
||||
"管理员",
|
||||
"普通用户"
|
||||
};
|
||||
rolestrs.Add(role.Name);
|
||||
}
|
||||
return rolestrs;
|
||||
}
|
||||
|
||||
public bool Check(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName,
|
||||
|
Reference in New Issue
Block a user