mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
refactor: 删除FlowinstanceTransitionHistory
This commit is contained in:
parent
cfe60345d2
commit
591ae5a09a
@ -375,7 +375,6 @@ namespace OpenAuth.App.Flow
|
|||||||
flowInstance.ActivityName = Nodes[rejectNode].name;
|
flowInstance.ActivityName = Nodes[rejectNode].name;
|
||||||
flowInstance.MakerList =
|
flowInstance.MakerList =
|
||||||
GetNodeMarkers(Nodes[rejectNode], flowInstance.CreateUserId);
|
GetNodeMarkers(Nodes[rejectNode], flowInstance.CreateUserId);
|
||||||
SaveTransitionHis();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(ToSchemeObj());
|
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(ToSchemeObj());
|
||||||
@ -405,8 +404,6 @@ namespace OpenAuth.App.Flow
|
|||||||
flowInstance.ActivityName = Nodes[startNodeId].name;
|
flowInstance.ActivityName = Nodes[startNodeId].name;
|
||||||
flowInstance.MakerList = GetNodeMarkers(Nodes[startNodeId], flowInstance.CreateUserId);
|
flowInstance.MakerList = GetNodeMarkers(Nodes[startNodeId], flowInstance.CreateUserId);
|
||||||
|
|
||||||
SaveTransitionHis();
|
|
||||||
|
|
||||||
var sugarClient = AutofacContainerModule.GetService<ISqlSugarClient>();
|
var sugarClient = AutofacContainerModule.GetService<ISqlSugarClient>();
|
||||||
sugarClient.Updateable(flowInstance).ExecuteCommand();
|
sugarClient.Updateable(flowInstance).ExecuteCommand();
|
||||||
|
|
||||||
@ -478,32 +475,6 @@ namespace OpenAuth.App.Flow
|
|||||||
SaveOperationHis(user.Id, user.Name, opHis);
|
SaveOperationHis(user.Id, user.Name, opHis);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 保存本次扭转记录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void SaveTransitionHis()
|
|
||||||
{
|
|
||||||
var user = AutofacContainerModule.GetService<IAuth>().GetCurrentUser().User;
|
|
||||||
var SugarClient = AutofacContainerModule.GetService<ISqlSugarClient>();
|
|
||||||
var transitionHistory = new FlowInstanceTransitionHistory
|
|
||||||
{
|
|
||||||
InstanceId = flowInstanceId,
|
|
||||||
CreateUserId = user.Id,
|
|
||||||
CreateUserName = user.Name,
|
|
||||||
FromNodeId = currentNodeId,
|
|
||||||
FromNodeName = currentNode.name,
|
|
||||||
FromNodeType = GetCurrentNodeType(),
|
|
||||||
ToNodeId = nextNodeId,
|
|
||||||
ToNodeName = nextNode?.name,
|
|
||||||
ToNodeType = GetNextNodeType(),
|
|
||||||
IsFinish = IsFinish() ? FlowInstanceStatus.Finished : FlowInstanceStatus.Running,
|
|
||||||
TransitionSate = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
SugarClient.Insertable(transitionHistory).ExecuteCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通知三方系统,节点执行情况
|
/// 通知三方系统,节点执行情况
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -580,12 +551,10 @@ namespace OpenAuth.App.Flow
|
|||||||
currentNode.setInfo.Description = "";
|
currentNode.setInfo.Description = "";
|
||||||
currentNode.setInfo.TagedTime = "";
|
currentNode.setInfo.TagedTime = "";
|
||||||
|
|
||||||
//删除当前节点的扭转记录
|
//删除当前节点的审批记录(只删除最新的一条)
|
||||||
var user = AutofacContainerModule.GetService<IAuth>().GetCurrentUser().User;
|
var user = AutofacContainerModule.GetService<IAuth>().GetCurrentUser().User;
|
||||||
var SugarClient = AutofacContainerModule.GetService<ISqlSugarClient>();
|
var SugarClient = AutofacContainerModule.GetService<ISqlSugarClient>();
|
||||||
SugarClient.Deleteable<FlowInstanceTransitionHistory>().Where(u => u.InstanceId == flowInstanceId && u.CreateUserId == user.Id && u.FromNodeId == currentNodeId).ExecuteCommand();
|
|
||||||
|
|
||||||
//删除当前节点的审批记录(只删除最新的一条)
|
|
||||||
var latestRecord = SugarClient.Queryable<FlowInstanceOperationHistory>()
|
var latestRecord = SugarClient.Queryable<FlowInstanceOperationHistory>()
|
||||||
.Where(u => u.InstanceId == flowInstanceId && u.CreateUserId == user.Id)
|
.Where(u => u.InstanceId == flowInstanceId && u.CreateUserId == user.Id)
|
||||||
.OrderByDescending(u => u.CreateDate)
|
.OrderByDescending(u => u.CreateDate)
|
||||||
|
@ -219,7 +219,6 @@ namespace OpenAuth.App
|
|||||||
|
|
||||||
wfruntime.SaveOperationHis($"【创建】{user.User.Name}创建了流程实例【{addFlowInstanceReq.CustomName}】");
|
wfruntime.SaveOperationHis($"【创建】{user.User.Name}创建了流程实例【{addFlowInstanceReq.CustomName}】");
|
||||||
|
|
||||||
wfruntime.SaveTransitionHis();
|
|
||||||
SugarClient.Ado.CommitTran();
|
SugarClient.Ado.CommitTran();
|
||||||
return flowInstance.Id;
|
return flowInstance.Id;
|
||||||
}
|
}
|
||||||
@ -408,14 +407,11 @@ namespace OpenAuth.App
|
|||||||
: FlowInstanceStatus.Running;
|
: FlowInstanceStatus.Running;
|
||||||
flowInstance.MakerList =
|
flowInstance.MakerList =
|
||||||
wfruntime.IsFinish() ? "" : wfruntime.GetNextMakers();
|
wfruntime.IsFinish() ? "" : wfruntime.GetNextMakers();
|
||||||
|
|
||||||
wfruntime.SaveTransitionHis();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//网关过程中,需要更新用户
|
//网关过程中,需要更新用户
|
||||||
flowInstance.MakerList = wfruntime.GetForkNodeMakers(wfruntime.currentNodeId);
|
flowInstance.MakerList = wfruntime.GetForkNodeMakers(wfruntime.currentNodeId);
|
||||||
wfruntime.SaveTransitionHis();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
||||||
@ -898,7 +894,6 @@ namespace OpenAuth.App
|
|||||||
#endregion 根据运行实例改变当前节点状态
|
#endregion 根据运行实例改变当前节点状态
|
||||||
|
|
||||||
wfruntime.SaveOperationHis($"【启动】由用户{user.User.Name}启动");
|
wfruntime.SaveOperationHis($"【启动】由用户{user.User.Name}启动");
|
||||||
wfruntime.SaveTransitionHis();
|
|
||||||
SugarClient.Ado.CommitTran();
|
SugarClient.Ado.CommitTran();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <autogenerated>
|
|
||||||
// This code was generated by a CodeSmith Template.
|
|
||||||
//
|
|
||||||
// DO NOT MODIFY contents of this file. Changes to this
|
|
||||||
// file will be lost if the code is regenerated.
|
|
||||||
// Author:Yubao Li
|
|
||||||
// </autogenerated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Infrastructure.Const;
|
|
||||||
using OpenAuth.Repository.Core;
|
|
||||||
|
|
||||||
namespace OpenAuth.Repository.Domain
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 流程实例流转记录
|
|
||||||
/// <para>记录某个流程实例所有已审批的从一个活动节点到下一个活动节点的操作人、操作时间</para>
|
|
||||||
/// </summary>
|
|
||||||
[Table("FlowInstanceTransitionHistory")]
|
|
||||||
public partial class FlowInstanceTransitionHistory : StringEntity
|
|
||||||
{
|
|
||||||
public FlowInstanceTransitionHistory()
|
|
||||||
{
|
|
||||||
this.InstanceId = string.Empty;
|
|
||||||
this.FromNodeId = string.Empty;
|
|
||||||
this.FromNodeName = string.Empty;
|
|
||||||
this.ToNodeId = string.Empty;
|
|
||||||
this.ToNodeName = string.Empty;
|
|
||||||
this.TransitionSate = 0;
|
|
||||||
this.IsFinish = FlowInstanceStatus.Running;
|
|
||||||
this.CreateDate = DateTime.Now;
|
|
||||||
this.CreateUserId = string.Empty;
|
|
||||||
this.CreateUserName = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实例Id
|
|
||||||
/// </summary>
|
|
||||||
[Description("实例Id")]
|
|
||||||
public string InstanceId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 开始节点Id
|
|
||||||
/// </summary>
|
|
||||||
[Description("开始节点Id")]
|
|
||||||
public string FromNodeId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 开始节点类型
|
|
||||||
/// </summary>
|
|
||||||
[Description("开始节点类型")]
|
|
||||||
public string FromNodeType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 开始节点名称
|
|
||||||
/// </summary>
|
|
||||||
[Description("开始节点名称")]
|
|
||||||
public string FromNodeName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 结束节点Id
|
|
||||||
/// </summary>
|
|
||||||
[Description("结束节点Id")]
|
|
||||||
public string ToNodeId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 结束节点类型
|
|
||||||
/// </summary>
|
|
||||||
[Description("结束节点类型")]
|
|
||||||
public string ToNodeType { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 结束节点名称
|
|
||||||
/// </summary>
|
|
||||||
[Description("结束节点名称")]
|
|
||||||
public string ToNodeName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 转化状态
|
|
||||||
/// </summary>
|
|
||||||
[Description("转化状态")]
|
|
||||||
public int TransitionSate { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否结束
|
|
||||||
/// </summary>
|
|
||||||
[Description("是否结束")]
|
|
||||||
public int IsFinish { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 转化时间
|
|
||||||
/// </summary>
|
|
||||||
[Description("转化时间")]
|
|
||||||
public System.DateTime CreateDate { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 操作人Id
|
|
||||||
/// </summary>
|
|
||||||
[Description("操作人Id")]
|
|
||||||
public string CreateUserId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 操作人名称
|
|
||||||
/// </summary>
|
|
||||||
[Description("操作人名称")]
|
|
||||||
public string CreateUserName { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -143,7 +143,6 @@ namespace OpenAuth.Repository
|
|||||||
public virtual DbSet<CategoryType> CategoryTypes { get; set; }
|
public virtual DbSet<CategoryType> CategoryTypes { get; set; }
|
||||||
public virtual DbSet<FlowInstance> FlowInstances { get; set; }
|
public virtual DbSet<FlowInstance> FlowInstances { get; set; }
|
||||||
public virtual DbSet<FlowInstanceOperationHistory> FlowInstanceOperationHistorys { get; set; }
|
public virtual DbSet<FlowInstanceOperationHistory> FlowInstanceOperationHistorys { get; set; }
|
||||||
public virtual DbSet<FlowInstanceTransitionHistory> FlowInstanceTransitionHistorys { get; set; }
|
|
||||||
public virtual DbSet<FlowScheme> FlowSchemes { get; set; }
|
public virtual DbSet<FlowScheme> FlowSchemes { get; set; }
|
||||||
public virtual DbSet<Form> Forms { get; set; }
|
public virtual DbSet<Form> Forms { get; set; }
|
||||||
public virtual DbSet<Module> Modules { get; set; }
|
public virtual DbSet<Module> Modules { get; set; }
|
||||||
|
@ -183,10 +183,7 @@ stop
|
|||||||
|
|
||||||
### ActivityId: 当前活动节点,即待审批的节点
|
### ActivityId: 当前活动节点,即待审批的节点
|
||||||
|
|
||||||
与流程实例密切相关的还有两个表:流程实例的操作记录FlowInstanceOperationHistory及流转记录FlowInstanceTransitionHistory。它们有不同的作用:
|
与流程实例密切相关的还有:流程实例的操作记录FlowInstanceOperationHistory。
|
||||||
|
|
||||||
## 操作记录FlowInstanceOperationHistory
|
## 操作记录FlowInstanceOperationHistory
|
||||||
该表记录了流程实例的所有操作记录,包括流程的创建、撤回、驳回、同意、不同意等操作。
|
该表记录了流程实例的所有操作记录,包括流程的创建、撤回、驳回、同意、不同意等操作。
|
||||||
|
|
||||||
## 流转记录FlowInstanceTransitionHistory
|
|
||||||
记录某个流程实例所有已审批的从一个活动节点到下一个活动节点的操作人、操作时间。
|
|
||||||
|
Loading…
Reference in New Issue
Block a user