mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
fix #I9J6WS 加签流程增加加签节点是否审批判断
This commit is contained in:
parent
dbe5a04b9b
commit
55f3ee5b0a
@ -87,6 +87,11 @@ namespace OpenAuth.App
|
||||
return approvers.Select(u => u.ApproverId).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前可以审批的加签人列表
|
||||
/// <para>如果是顺序执行,取第一个人</para>
|
||||
/// <para>否则并行且/并行或都是返回所有加签人</para>
|
||||
/// </summary>
|
||||
public FlowApprover[] GetApprovers(QueryApproverReq req)
|
||||
{
|
||||
var query= Repository.AsQueryable()
|
||||
|
@ -1,24 +1,19 @@
|
||||
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.Flow;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Castle.Core.Internal;
|
||||
using Infrastructure.Const;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.Repository;
|
||||
using SqlSugar;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
@ -39,6 +34,7 @@ namespace OpenAuth.App
|
||||
private UserManagerApp _userManagerApp;
|
||||
private OrgManagerApp _orgManagerApp;
|
||||
private FlowApproverApp _flowApproverApp;
|
||||
private RevelanceManagerApp _revelanceManagerApp;
|
||||
|
||||
|
||||
#region 流程处理API
|
||||
@ -429,23 +425,41 @@ namespace OpenAuth.App
|
||||
bool isfinish = _flowApproverApp.Verify(new VerifyApproverReq()
|
||||
{
|
||||
Id = approverInfo.Id,
|
||||
Status = (int)TagState.Ok,
|
||||
Status = (int)TagState.Ok,
|
||||
VerifyComment = tag.Description
|
||||
});
|
||||
if (!isfinish) //如果没有完成,不能到下一步
|
||||
{
|
||||
canNext = false;
|
||||
}
|
||||
else if (approverInfo.ReturnToSignNode == null || !approverInfo.ReturnToSignNode.Value)
|
||||
{
|
||||
//加签完成后,不需要返回原节点,则直接审批加签的节点
|
||||
tag.UserId = approverInfo.CreateUserId;
|
||||
tag.UserName = approverInfo.CreateUserName;
|
||||
//把当前审批人变成加签人,从而可以自动审批
|
||||
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (wfruntime.currentNode.setInfo.NodeDesignate == Setinfo.RUNTIME_MANY_PARENTS)
|
||||
{
|
||||
var roles = _auth.GetCurrentUser().Roles;
|
||||
List<string> roles;
|
||||
if (user.Id != tag.UserId)
|
||||
{
|
||||
//最后一个执行加签的用户,tag.UserId就是加签人id,需要找他的角色
|
||||
roles = _revelanceManagerApp.Get(Define.USERROLE, true, tag.UserId);
|
||||
}
|
||||
else
|
||||
{
|
||||
roles = _auth.GetCurrentUser().Roles.Select(u => u.Id).ToList();
|
||||
}
|
||||
|
||||
//如果是连续多级直属上级且还没到指定的角色,只改变执行人,不到下一个节点
|
||||
if (!wfruntime.currentNode.setInfo.NodeDesignateData.roles.Intersect(roles.Select(u => u.Id)).Any())
|
||||
if (!wfruntime.currentNode.setInfo.NodeDesignateData.roles.Intersect(roles).Any())
|
||||
{
|
||||
canNext = false;
|
||||
var parentId = _userManagerApp.GetParent(user.Id);
|
||||
var parentId = _userManagerApp.GetParent(tag.UserId);
|
||||
flowInstance.MakerList = parentId;
|
||||
}
|
||||
}
|
||||
@ -1036,7 +1050,8 @@ namespace OpenAuth.App
|
||||
public FlowInstanceApp(ISqlSugarClient client, IAuth auth, RevelanceManagerApp revelanceApp,
|
||||
FlowSchemeApp flowSchemeApp, FormApp formApp, IHttpClientFactory httpClientFactory,
|
||||
SysMessageApp messageApp, UserManagerApp userManagerApp, OrgManagerApp orgManagerApp,
|
||||
IServiceProvider serviceProvider, FlowApproverApp flowApproverApp) : base(client, auth)
|
||||
IServiceProvider serviceProvider, FlowApproverApp flowApproverApp,
|
||||
RevelanceManagerApp revelanceManagerApp) : base(client, auth)
|
||||
{
|
||||
_revelanceApp = revelanceApp;
|
||||
_flowSchemeApp = flowSchemeApp;
|
||||
@ -1047,6 +1062,7 @@ namespace OpenAuth.App
|
||||
_orgManagerApp = orgManagerApp;
|
||||
_serviceProvider = serviceProvider;
|
||||
_flowApproverApp = flowApproverApp;
|
||||
_revelanceManagerApp = revelanceManagerApp;
|
||||
}
|
||||
}
|
||||
}
|
@ -116,5 +116,12 @@ namespace OpenAuth.Repository.Domain
|
||||
/// </summary>
|
||||
[Description("加签人Id")]
|
||||
public string CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///是否回到加签节点
|
||||
/// <para>如果不需要,则加签完成后自动审批完成,否则还需要当前节点审批</para>
|
||||
/// </summary>
|
||||
[Description("是否回到加签节点")]
|
||||
public bool? ReturnToSignNode { get; set; }
|
||||
}
|
||||
}
|
@ -386,6 +386,7 @@ CREATE TABLE flowapprover(
|
||||
`ParentId` VARCHAR(50) COMMENT '父节点ID,应对多次加签' ,
|
||||
`ParentName` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '父节点名称,应对多次加签结构' ,
|
||||
`Name` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '加签节点名称,应对多次加签结构' ,
|
||||
`ReturnToSignNode` tinyint(4) COMMENT '是否回到加签节点',
|
||||
PRIMARY KEY (Id)
|
||||
) COMMENT = '工作流加签';
|
||||
|
||||
|
@ -62,6 +62,7 @@ CREATE TABLE FlowApprover(
|
||||
ParentId VARCHAR2(50),
|
||||
ParentName VARCHAR2(100),
|
||||
Name VARCHAR2(100),
|
||||
ReturnToSignNode NUMBER(4,0)
|
||||
PRIMARY KEY (Id)
|
||||
);
|
||||
|
||||
@ -84,6 +85,7 @@ COMMENT ON COLUMN FlowApprover.CascadeId IS '层级ID,应对多次加签';
|
||||
COMMENT ON COLUMN FlowApprover.ParentId IS '父节点ID,应对多次加签';
|
||||
COMMENT ON COLUMN FlowApprover.ParentName IS '父节点名称,应对多次加签结构';
|
||||
COMMENT ON COLUMN FlowApprover.Name IS '加签节点名称,应对多次加签结构';
|
||||
COMMENT ON COLUMN FlowApprover.ReturnToSignNode IS '是否回到加签节点';
|
||||
|
||||
|
||||
|
||||
|
@ -117,6 +117,7 @@ CREATE TABLE [dbo].[FlowApprover](
|
||||
CascadeId VARCHAR(100) NOT NULL,
|
||||
ParentId VARCHAR(50),
|
||||
ParentName VARCHAR(100),
|
||||
ReturnToSignNode bit DEFAULT 1 NOT NULL,
|
||||
Name VARCHAR(100),
|
||||
PRIMARY KEY (Id)
|
||||
);
|
||||
@ -140,6 +141,7 @@ EXEC sp_addextendedproperty 'MS_Description', '层级ID,应对多次加签', '
|
||||
EXEC sp_addextendedproperty 'MS_Description', '父节点ID,应对多次加签', 'SCHEMA', dbo, 'table', FlowApprover, 'column', ParentId;
|
||||
EXEC sp_addextendedproperty 'MS_Description', '父节点名称,应对多次加签结构', 'SCHEMA', dbo, 'table', FlowApprover, 'column', ParentName;
|
||||
EXEC sp_addextendedproperty 'MS_Description', '加签节点名称,应对多次加签结构', 'SCHEMA', dbo, 'table', FlowApprover, 'column', Name;
|
||||
EXEC sp_addextendedproperty 'MS_Description', '是否回到加签节点', 'SCHEMA', dbo, 'table', FlowApprover, 'column', ReturnToSignNode;
|
||||
|
||||
|
||||
|
||||
|
@ -51,6 +51,7 @@ CREATE TABLE FlowApprover(
|
||||
ParentId VARCHAR(50),
|
||||
ParentName VARCHAR(100),
|
||||
Name VARCHAR(100),
|
||||
ReturnToSignNode int2,
|
||||
PRIMARY KEY (Id)
|
||||
);
|
||||
|
||||
@ -73,6 +74,7 @@ COMMENT ON COLUMN FlowApprover.CascadeId IS '层级ID,应对多次加签';
|
||||
COMMENT ON COLUMN FlowApprover.ParentId IS '父节点ID,应对多次加签';
|
||||
COMMENT ON COLUMN FlowApprover.ParentName IS '父节点名称,应对多次加签结构';
|
||||
COMMENT ON COLUMN FlowApprover.Name IS '加签节点名称,应对多次加签结构';
|
||||
COMMENT ON COLUMN FlowApprover.ReturnToSignNode IS '是否回到加签节点';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user