mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
fix #IAGT6Z 流程结束后,通知知会的人
This commit is contained in:
parent
d54cebc3ab
commit
b40cf6b43d
@ -37,7 +37,6 @@ namespace OpenAuth.App
|
|||||||
private FlowApproverApp _flowApproverApp;
|
private FlowApproverApp _flowApproverApp;
|
||||||
private RevelanceManagerApp _revelanceManagerApp;
|
private RevelanceManagerApp _revelanceManagerApp;
|
||||||
|
|
||||||
|
|
||||||
#region 流程处理API
|
#region 流程处理API
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -503,6 +502,21 @@ namespace OpenAuth.App
|
|||||||
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
||||||
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||||
AddOperationHis(flowInstance.Id, tag, content);
|
AddOperationHis(flowInstance.Id, tag, content);
|
||||||
|
|
||||||
|
if (flowInstance.IsFinish == 1)
|
||||||
|
{
|
||||||
|
//给知会人员发送通知信息
|
||||||
|
var userids = _userManagerApp.GetNoticeUsers(flowInstance.Id);
|
||||||
|
if (userids.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var userid in userids)
|
||||||
|
{
|
||||||
|
_messageApp.SendMsgTo(userid,
|
||||||
|
$"[{flowInstance.CustomName}]已完成,您可以在我的流程中查看。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
||||||
|
|
||||||
//如果审批通过,且下一个审批人是自己,则自动审批
|
//如果审批通过,且下一个审批人是自己,则自动审批
|
||||||
@ -923,17 +937,19 @@ namespace OpenAuth.App
|
|||||||
from FlowInstance
|
from FlowInstance
|
||||||
where CreateUserId = '{user.User.Id}'
|
where CreateUserId = '{user.User.Id}'
|
||||||
union
|
union
|
||||||
select FirstId as InstanceId
|
select distinct FirstId as InstanceId
|
||||||
from Relevance
|
from Relevance rel
|
||||||
|
inner join FlowInstance flow on rel.FirstId = flow.Id and flow.IsFinish = 1
|
||||||
where `Key` = '{Define.INSTANCE_NOTICE_USER}'
|
where `Key` = '{Define.INSTANCE_NOTICE_USER}'
|
||||||
and SecondId = '{user.User.Id}'
|
and SecondId = '{user.User.Id}'
|
||||||
union
|
union
|
||||||
select a.FirstId as InstanceId
|
select distinct a.FirstId as InstanceId
|
||||||
from Relevance a
|
from Relevance a
|
||||||
inner join (select SecondId as RoleId
|
inner join (select SecondId as RoleId
|
||||||
from Relevance
|
from Relevance
|
||||||
where `Key` = '{Define.USERROLE}'
|
where `Key` = 'UserRole'
|
||||||
and FirstId = '{user.User.Id}') b on a.SecondId = b.RoleId
|
and FirstId = '{user.User.Id}') b on a.SecondId = b.RoleId
|
||||||
|
inner join FlowInstance flow on a.FirstId = flow.Id and flow.IsFinish = 1
|
||||||
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
where a.`Key` = '{Define.INSTANCE_NOTICE_ROLE}') AS UniqueInstanceIds
|
||||||
ON fi.Id = UniqueInstanceIds.InstanceId
|
ON fi.Id = UniqueInstanceIds.InstanceId
|
||||||
";
|
";
|
||||||
@ -941,7 +957,8 @@ namespace OpenAuth.App
|
|||||||
if (SugarClient.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
if (SugarClient.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
{
|
{
|
||||||
sql = sql.Replace("`Key`", "[Key]");
|
sql = sql.Replace("`Key`", "[Key]");
|
||||||
}else if (SugarClient.CurrentConnectionConfig.DbType == DbType.Oracle)
|
}
|
||||||
|
else if (SugarClient.CurrentConnectionConfig.DbType == DbType.Oracle)
|
||||||
{
|
{
|
||||||
sql = sql.Replace("`Key`", "\"Key\"");
|
sql = sql.Replace("`Key`", "\"Key\"");
|
||||||
}
|
}
|
||||||
|
@ -313,5 +313,44 @@ namespace OpenAuth.App
|
|||||||
}
|
}
|
||||||
return Repository.FirstOrDefault(u => u.Id == userid).ParentId;
|
return Repository.FirstOrDefault(u => u.Id == userid).ParentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取流程实例通知的用户
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instanceId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<string> GetNoticeUsers(string instanceId)
|
||||||
|
{
|
||||||
|
var sql = $@"
|
||||||
|
select u.*
|
||||||
|
from `USER` u
|
||||||
|
join (select distinct SecondId as UserId
|
||||||
|
from Relevance
|
||||||
|
where `Key` = '{Define.INSTANCE_NOTICE_USER}'
|
||||||
|
and FirstId = '{instanceId}'
|
||||||
|
union
|
||||||
|
select distinct FirstId as UserId
|
||||||
|
from Relevance a
|
||||||
|
inner join (select SecondId as RoleId
|
||||||
|
from Relevance
|
||||||
|
where `Key` = '{Define.INSTANCE_NOTICE_ROLE}'
|
||||||
|
and FirstId = '{instanceId}') b on a.SecondId = b.RoleId
|
||||||
|
where `Key` = 'UserRole') userids on u.Id = userids.UserId";
|
||||||
|
|
||||||
|
if (UnitWork.GetDbContext().Database.GetDbConnection().GetType().Name == "SqlConnection")
|
||||||
|
{
|
||||||
|
sql = sql.Replace(" `USER` ", " [USER] ");
|
||||||
|
sql = sql.Replace("`Key`", "[Key]");
|
||||||
|
}
|
||||||
|
else if (UnitWork.GetDbContext().Database.GetDbConnection().GetType().Name == "OracleConnection")
|
||||||
|
{
|
||||||
|
sql = sql.Replace(" `USER` ", " \"USER\" ");
|
||||||
|
sql = sql.Replace("`Key`", "\"Key\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
var users = UnitWork.FromSql<User>(sql);
|
||||||
|
return users.Select(u=>u.Id).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user