mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 18:47:55 +08:00
fix issue #I80UEX 流程设计可以选择直接上级和部门负责人
This commit is contained in:
@@ -1,141 +1,141 @@
|
|||||||
namespace OpenAuth.App.Flow
|
namespace OpenAuth.App.Flow
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 流程节点
|
/// 流程节点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FlowNode
|
public class FlowNode
|
||||||
{
|
{
|
||||||
public const string START = "start round mix";
|
public const string START = "start round mix";
|
||||||
public const string END = "end round";
|
public const string END = "end round";
|
||||||
public const string NODE = "node";
|
public const string NODE = "node";
|
||||||
public const string FORK = "fork"; //会签开始节点
|
public const string FORK = "fork"; //会签开始节点
|
||||||
public const string JOIN = "join"; //会签结束节点
|
public const string JOIN = "join"; //会签结束节点
|
||||||
|
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
|
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
|
|
||||||
public int left { get; set; }
|
public int left { get; set; }
|
||||||
public int top { get; set; }
|
public int top { get; set; }
|
||||||
|
|
||||||
public int width { get; set; }
|
public int width { get; set; }
|
||||||
public int height { get; set; }
|
public int height { get; set; }
|
||||||
public bool alt { get; set; }
|
public bool alt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 节点的附加数据项
|
/// 节点的附加数据项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The set information.</value>
|
/// <value>The set information.</value>
|
||||||
public Setinfo setInfo { get; set; }
|
public Setinfo setInfo { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Setinfo
|
public class Setinfo
|
||||||
{
|
{
|
||||||
public const string ALL_USER = "ALL_USER"; //所有用户
|
public const string ALL_USER = "ALL_USER"; //所有用户
|
||||||
public const string SPECIAL_ROLE = "SPECIAL_ROLE"; //指定角色
|
public const string SPECIAL_ROLE = "SPECIAL_ROLE"; //指定角色
|
||||||
public const string SPECIAL_USER = "SPECIAL_USER"; //指定用户
|
public const string SPECIAL_USER = "SPECIAL_USER"; //指定用户
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 连续多级直属上级
|
/// 连续多级直属上级
|
||||||
/// <para>不同于钉钉的各上级部门负责人审批,OpenAuth以用户的各级直属上级审批模式</para>
|
/// <para>不同于钉钉的各上级部门负责人审批,OpenAuth以用户的各级直属上级审批模式</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RUNTIME_MANY_PARENTS = "RUNTIME_MANY_PARENTS";
|
public const string RUNTIME_MANY_PARENTS = "RUNTIME_MANY_PARENTS";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 部门负责人
|
/// 部门负责人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RUNTIME_CHAIRMAN = "RUNTIME_CHAIRMAN";
|
public const string RUNTIME_CHAIRMAN = "RUNTIME_CHAIRMAN";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发起人直属上级
|
/// 上一节点执行人的直属上级
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RUNTIME_PARENT = "RUNTIME_PARENT";
|
public const string RUNTIME_PARENT = "RUNTIME_PARENT";
|
||||||
|
|
||||||
public const string RUNTIME_SPECIAL_ROLE = "RUNTIME_SPECIAL_ROLE"; //运行时指定角色
|
public const string RUNTIME_SPECIAL_ROLE = "RUNTIME_SPECIAL_ROLE"; //运行时指定角色
|
||||||
public const string RUNTIME_SPECIAL_USER = "RUNTIME_SPECIAL_USER"; //运行时指定用户
|
public const string RUNTIME_SPECIAL_USER = "RUNTIME_SPECIAL_USER"; //运行时指定用户
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 节点执行权限类型
|
/// 节点执行权限类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string NodeDesignate { get; set; }
|
public string NodeDesignate { get; set; }
|
||||||
|
|
||||||
public Nodedesignatedata NodeDesignateData { get; set; }
|
public Nodedesignatedata NodeDesignateData { get; set; }
|
||||||
public string NodeCode { get; set; }
|
public string NodeCode { get; set; }
|
||||||
public string NodeName { get; set; }
|
public string NodeName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 流程执行时,三方回调的URL地址
|
/// 流程执行时,三方回调的URL地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ThirdPartyUrl { get; set; }
|
public string ThirdPartyUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string NodeRejectType { get; set; }
|
public string NodeRejectType { get; set; }
|
||||||
|
|
||||||
public int? Taged { get; set; }
|
public int? Taged { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string TagedTime { get; set; }
|
public string TagedTime { get; set; }
|
||||||
|
|
||||||
//节点会签方式,
|
//节点会签方式,
|
||||||
//all/空:默认为全部通过
|
//all/空:默认为全部通过
|
||||||
//one :至少有一个通过
|
//one :至少有一个通过
|
||||||
public string NodeConfluenceType { get; set; }
|
public string NodeConfluenceType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 会签通过的个数
|
/// 会签通过的个数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? ConfluenceOk { get; set; }
|
public int? ConfluenceOk { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 会签拒绝的个数
|
/// 会签拒绝的个数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? ConfluenceNo { get; set; }
|
public int? ConfluenceNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 可写的表单项ID
|
/// 可写的表单项ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] CanWriteFormItemIds { get; set; }
|
public string[] CanWriteFormItemIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 节点执行人
|
/// 节点执行人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Nodedesignatedata
|
public class Nodedesignatedata
|
||||||
{
|
{
|
||||||
public string[] users { get; set; }
|
public string[] users { get; set; }
|
||||||
public string[] roles { get; set; }
|
public string[] roles { get; set; }
|
||||||
public string[] orgs { get; set; }
|
public string[] orgs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 节点执行结果标签
|
/// 节点执行结果标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Tag
|
public class Tag
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 1: 通过
|
/// 1: 通过
|
||||||
/// 2:不通过
|
/// 2:不通过
|
||||||
/// 3:驳回
|
/// 3:驳回
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Taged { get; set; }
|
public int Taged { get; set; }
|
||||||
|
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string TagedTime { get; set; }
|
public string TagedTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 1: 通过
|
/// 1: 通过
|
||||||
/// 2:不通过
|
/// 2:不通过
|
||||||
/// 3:驳回
|
/// 3:驳回
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum TagState
|
public enum TagState
|
||||||
{
|
{
|
||||||
Ok = 1,
|
Ok = 1,
|
||||||
No,
|
No,
|
||||||
Reject
|
Reject
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -351,11 +351,10 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
throw (new Exception("审核异常,找不到审核节点"));
|
throw (new Exception("审核异常,找不到审核节点"));
|
||||||
}
|
}
|
||||||
|
|
||||||
flowInstanceOperationHistory.Content = "【" + wfruntime.Nodes[canCheckId].name
|
flowInstanceOperationHistory.Content =
|
||||||
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
|
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.Nodes[canCheckId].name}】" +
|
||||||
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
|
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||||
+ tag.Description;
|
|
||||||
|
|
||||||
wfruntime.MakeTagNode(canCheckId, tag); //标记审核节点状态
|
wfruntime.MakeTagNode(canCheckId, tag); //标记审核节点状态
|
||||||
string res = wfruntime.NodeConfluence(canCheckId, tag);
|
string res = wfruntime.NodeConfluence(canCheckId, tag);
|
||||||
@@ -386,7 +385,7 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion 会签
|
#endregion 会签
|
||||||
|
|
||||||
#region 一般审核
|
#region 一般审核
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -394,14 +393,30 @@ namespace OpenAuth.App
|
|||||||
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
|
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
|
||||||
if (tag.Taged == (int) TagState.Ok)
|
if (tag.Taged == (int) TagState.Ok)
|
||||||
{
|
{
|
||||||
flowInstance.PreviousId = flowInstance.ActivityId;
|
bool canNext = true;
|
||||||
flowInstance.ActivityId = wfruntime.nextNodeId;
|
if (wfruntime.currentNode.setInfo.NodeDesignate == Setinfo.RUNTIME_MANY_PARENTS)
|
||||||
flowInstance.ActivityType = wfruntime.nextNodeType;
|
{
|
||||||
flowInstance.ActivityName = wfruntime.nextNode.name;
|
var roles = _auth.GetCurrentUser().Roles;
|
||||||
flowInstance.MakerList = wfruntime.nextNodeType == 4 ? "" : GetNextMakers(wfruntime, request);
|
//如果是连续多级直属上级且还没到指定的角色,只改变执行人,不到下一个节点
|
||||||
flowInstance.IsFinish = (wfruntime.nextNodeType == 4
|
if (!wfruntime.currentNode.setInfo.NodeDesignateData.roles.Intersect(roles.Select(u =>u.Id)).Any())
|
||||||
? FlowInstanceStatus.Finished
|
{
|
||||||
: FlowInstanceStatus.Running);
|
canNext = false;
|
||||||
|
var parentId = _userManagerApp.GetParent(user.Id);
|
||||||
|
flowInstance.MakerList = parentId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canNext)
|
||||||
|
{
|
||||||
|
flowInstance.PreviousId = flowInstance.ActivityId;
|
||||||
|
flowInstance.ActivityId = wfruntime.nextNodeId;
|
||||||
|
flowInstance.ActivityType = wfruntime.nextNodeType;
|
||||||
|
flowInstance.ActivityName = wfruntime.nextNode.name;
|
||||||
|
flowInstance.MakerList = wfruntime.nextNodeType == 4 ? "" : GetNextMakers(wfruntime, request);
|
||||||
|
flowInstance.IsFinish = (wfruntime.nextNodeType == 4
|
||||||
|
? FlowInstanceStatus.Finished
|
||||||
|
: FlowInstanceStatus.Running);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -412,10 +427,9 @@ namespace OpenAuth.App
|
|||||||
|
|
||||||
AddTransHistory(wfruntime);
|
AddTransHistory(wfruntime);
|
||||||
|
|
||||||
flowInstanceOperationHistory.Content = "【" + wfruntime.currentNode.name
|
flowInstanceOperationHistory.Content =
|
||||||
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
|
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
||||||
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
|
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||||
+ tag.Description;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 一般审核
|
#endregion 一般审核
|
||||||
@@ -579,27 +593,20 @@ namespace OpenAuth.App
|
|||||||
|
|
||||||
makerList = GenericHelpers.ArrayToString(request.NodeDesignates, makerList);
|
makerList = GenericHelpers.ArrayToString(request.NodeDesignates, makerList);
|
||||||
}
|
}
|
||||||
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_PARENT)
|
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_PARENT
|
||||||
|
|| wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_MANY_PARENTS)
|
||||||
{
|
{
|
||||||
//如果是发起人直属上级
|
//如果是上一节点执行人的直属上级或连续多级直属上级
|
||||||
if (wfruntime.nextNode.setInfo.NodeDesignate != request.NodeDesignateType)
|
if (wfruntime.nextNode.setInfo.NodeDesignate != request.NodeDesignateType)
|
||||||
{
|
{
|
||||||
throw new Exception("前端提交的节点权限类型异常,请检查流程");
|
throw new Exception("前端提交的节点权限类型异常,请检查流程");
|
||||||
}
|
}
|
||||||
|
|
||||||
string createUserId = string.Empty;
|
//当创建流程时,肯定执行的开始节点,登录用户就是创建用户
|
||||||
if (wfruntime.currentNode.type == FlowNode.START) //如果是创建流程
|
//当审批流程时,能进到这里,表明当前登录用户已经有审批当前节点的权限,完全可以直接用登录用户的直接上级
|
||||||
{
|
var user = _auth.GetCurrentUser().User;
|
||||||
var user = _auth.GetCurrentUser().User;
|
var parentId = _userManagerApp.GetParent(user.Id);
|
||||||
createUserId = user.Id;
|
|
||||||
}
|
|
||||||
else //如果是审批
|
|
||||||
{
|
|
||||||
FlowInstance flowInstance = Get(wfruntime.flowInstanceId);
|
|
||||||
createUserId = flowInstance.CreateUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parentId = _userManagerApp.GetParent(createUserId);
|
|
||||||
makerList = GenericHelpers.ArrayToString(new[]{parentId}, makerList);
|
makerList = GenericHelpers.ArrayToString(new[]{parentId}, makerList);
|
||||||
}
|
}
|
||||||
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_CHAIRMAN)
|
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_CHAIRMAN)
|
||||||
|
Reference in New Issue
Block a user