mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-16 16:50:54 +08:00
fix #I9HQWU 已审核过的用户,后面不需要再次审核
This commit is contained in:
parent
01a9b4e803
commit
440ccd50d5
@ -321,13 +321,6 @@ namespace OpenAuth.App
|
||||
throw new Exception("当前用户没有审批该节点权限");
|
||||
}
|
||||
|
||||
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory
|
||||
{
|
||||
InstanceId = instanceId,
|
||||
CreateUserId = tag.UserId,
|
||||
CreateUserName = tag.UserName,
|
||||
CreateDate = DateTime.Now
|
||||
}; //操作记录
|
||||
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
|
||||
|
||||
#region 会签
|
||||
@ -352,9 +345,9 @@ namespace OpenAuth.App
|
||||
throw (new Exception("审核异常,找不到审核节点"));
|
||||
}
|
||||
|
||||
flowInstanceOperationHistory.Content =
|
||||
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.Nodes[canCheckId].name}】" +
|
||||
var content = $"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.Nodes[canCheckId].name}】" +
|
||||
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||
AddOperationHis(instanceId, tag, content);
|
||||
|
||||
wfruntime.MakeTagNode(canCheckId, tag); //标记审核节点状态
|
||||
string res = wfruntime.NodeConfluence(canCheckId, tag);
|
||||
@ -390,6 +383,43 @@ namespace OpenAuth.App
|
||||
|
||||
else
|
||||
{
|
||||
VerifyNode(request, tag, flowInstance);
|
||||
}
|
||||
|
||||
#endregion 一般审核
|
||||
|
||||
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
||||
|
||||
if (!string.IsNullOrEmpty(request.FrmData))
|
||||
{
|
||||
flowInstance.FrmData = request.FrmData;
|
||||
|
||||
if (flowInstance.FrmType == 1) //如果是开发者自定义的表单,更新对应数据库表数据
|
||||
{
|
||||
var t = Type.GetType("OpenAuth.App." + flowInstance.DbName + "App");
|
||||
ICustomerForm icf = (ICustomerForm) _serviceProvider.GetService(t);
|
||||
icf.Update(flowInstance.Id, flowInstance.FrmData);
|
||||
}
|
||||
}
|
||||
|
||||
UnitWork.Update(flowInstance);
|
||||
//给流程创建人发送通知信息
|
||||
_messageApp.SendMsgTo(flowInstance.CreateUserId,
|
||||
$"你的流程[{flowInstance.CustomName}]已被{user.Name}处理。");
|
||||
|
||||
UnitWork.Save();
|
||||
|
||||
wfruntime.NotifyThirdParty(_httpClientFactory.CreateClient(), tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 普通的节点审批
|
||||
/// </summary>
|
||||
private void VerifyNode(VerificationReq request, Tag tag, FlowInstance flowInstance)
|
||||
{
|
||||
var user = _auth.GetCurrentUser().User;
|
||||
FlowRuntime wfruntime = new FlowRuntime(flowInstance);
|
||||
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
|
||||
if (tag.Taged == (int)TagState.Ok)
|
||||
{
|
||||
@ -418,47 +448,27 @@ namespace OpenAuth.App
|
||||
: FlowInstanceStatus.Running);
|
||||
}
|
||||
}
|
||||
else
|
||||
else //审批结果为不同意
|
||||
{
|
||||
flowInstance.IsFinish = FlowInstanceStatus.Disagree; //表示该节点不同意
|
||||
flowInstance.IsFinish = FlowInstanceStatus.Disagree;
|
||||
wfruntime.nextNodeId = "-1";
|
||||
wfruntime.nextNodeType = 4;
|
||||
}
|
||||
|
||||
AddTransHistory(wfruntime);
|
||||
|
||||
flowInstanceOperationHistory.Content =
|
||||
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
||||
var content = $"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
||||
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||
}
|
||||
AddOperationHis(flowInstance.Id, tag, content);
|
||||
|
||||
#endregion 一般审核
|
||||
|
||||
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
|
||||
|
||||
if (!string.IsNullOrEmpty(request.FrmData))
|
||||
//如果审批通过,且下一个审批人是自己,则自动审批
|
||||
if (tag.Taged == (int)TagState.Ok)
|
||||
{
|
||||
flowInstance.FrmData = request.FrmData;
|
||||
|
||||
if (flowInstance.FrmType == 1) //如果是开发者自定义的表单,更新对应数据库表数据
|
||||
if (flowInstance.MakerList != "1" && (!flowInstance.MakerList.Contains(user.Id)))
|
||||
{
|
||||
var t = Type.GetType("OpenAuth.App." + flowInstance.DbName + "App");
|
||||
ICustomerForm icf = (ICustomerForm) _serviceProvider.GetService(t);
|
||||
icf.Update(flowInstance.Id, flowInstance.FrmData);
|
||||
return;
|
||||
}
|
||||
VerifyNode(request, tag, flowInstance);
|
||||
}
|
||||
|
||||
UnitWork.Update(flowInstance);
|
||||
UnitWork.Add(flowInstanceOperationHistory);
|
||||
|
||||
//给流程创建人发送通知信息
|
||||
_messageApp.SendMsgTo(flowInstance.CreateUserId,
|
||||
$"你的流程[{flowInstance.CustomName}]已被{user.Name}处理。处理情况如下:{flowInstanceOperationHistory.Content}");
|
||||
|
||||
UnitWork.Save();
|
||||
|
||||
wfruntime.NotifyThirdParty(_httpClientFactory.CreateClient(), tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
//会签时,获取一条会签分支上面是否有用户可审核的节点
|
||||
@ -882,6 +892,20 @@ namespace OpenAuth.App
|
||||
});
|
||||
}
|
||||
|
||||
private void AddOperationHis(string instanceId, Tag tag, string content)
|
||||
{
|
||||
FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory
|
||||
{
|
||||
InstanceId = instanceId,
|
||||
CreateUserId = tag.UserId,
|
||||
CreateUserName = tag.UserName,
|
||||
CreateDate = DateTime.Now,
|
||||
Content = content
|
||||
}; //操作记录
|
||||
|
||||
UnitWork.Add(flowInstanceOperationHistory);
|
||||
}
|
||||
|
||||
public List<FlowInstanceOperationHistory> QueryHistories(QueryFlowInstanceHistoryReq request)
|
||||
{
|
||||
return UnitWork.Find<FlowInstanceOperationHistory>(u => u.InstanceId == request.FlowInstanceId)
|
||||
|
Loading…
Reference in New Issue
Block a user