fix #I9TF4L 表单值已经发生变化,但寻找下一个节点时还是按照初始值找

This commit is contained in:
yubaolee 2024-07-04 09:33:49 +08:00
parent c54fff5c34
commit d49ed28b13

View File

@ -55,7 +55,8 @@ namespace OpenAuth.App
IRepository<FlowInstance, OpenAuthDBContext> repository IRepository<FlowInstance, OpenAuthDBContext> repository
, RevelanceManagerApp app, FlowSchemeApp flowSchemeApp, FormApp formApp, , RevelanceManagerApp app, FlowSchemeApp flowSchemeApp, FormApp formApp,
IHttpClientFactory httpClientFactory, IAuth auth, IServiceProvider serviceProvider, IHttpClientFactory httpClientFactory, IAuth auth, IServiceProvider serviceProvider,
SysMessageApp messageApp, DbExtension dbExtension, UserManagerApp userManagerApp, OrgManagerApp orgManagerApp) SysMessageApp messageApp, DbExtension dbExtension, UserManagerApp userManagerApp,
OrgManagerApp orgManagerApp)
: base(unitWork, repository, auth) : base(unitWork, repository, auth)
{ {
_revelanceApp = app; _revelanceApp = app;
@ -145,7 +146,6 @@ namespace OpenAuth.App
{ {
throw new Exception("流程表单数据解析失败,请检查表单是否填写完整"); throw new Exception("流程表单数据解析失败,请检查表单是否填写完整");
} }
} }
//如果工作流配置的表单配置有对应的数据库 //如果工作流配置的表单配置有对应的数据库
@ -283,6 +283,7 @@ namespace OpenAuth.App
{ {
continue; continue;
} }
updatestr += $"{column.ColumnName} = '{val}',"; updatestr += $"{column.ColumnName} = '{val}',";
} }
@ -354,7 +355,8 @@ namespace OpenAuth.App
throw (new Exception("审核异常,找不到审核节点")); throw (new Exception("审核异常,找不到审核节点"));
} }
var 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}"; $"结果:{(tag.Taged == 1 ? "" : "")},备注:{tag.Description}";
AddOperationHis(instanceId, tag, content); AddOperationHis(instanceId, tag, content);
@ -399,17 +401,13 @@ namespace OpenAuth.App
#endregion #endregion
if (!string.IsNullOrEmpty(request.FrmData)) //自定义开发表单,需要更新对应的数据库
{ if (!string.IsNullOrEmpty(request.FrmData) && flowInstance.FrmType == 1)
flowInstance.FrmData = request.FrmData;
if (flowInstance.FrmType == 1) //如果是开发者自定义的表单,更新对应数据库表数据
{ {
var t = Type.GetType("OpenAuth.App." + flowInstance.DbName + "App"); var t = Type.GetType("OpenAuth.App." + flowInstance.DbName + "App");
ICustomerForm icf = (ICustomerForm)_serviceProvider.GetService(t); ICustomerForm icf = (ICustomerForm)_serviceProvider.GetService(t);
icf.Update(flowInstance.Id, flowInstance.FrmData); icf.Update(flowInstance.Id, flowInstance.FrmData);
} }
}
UnitWork.Update(flowInstance); UnitWork.Update(flowInstance);
//给流程创建人发送通知信息 //给流程创建人发送通知信息
@ -428,6 +426,12 @@ namespace OpenAuth.App
private void VerifyNode(VerificationReq request, Tag tag, FlowInstance flowInstance) private void VerifyNode(VerificationReq request, Tag tag, FlowInstance flowInstance)
{ {
var user = _auth.GetCurrentUser().User; var user = _auth.GetCurrentUser().User;
if (!string.IsNullOrEmpty(request.FrmData))
{
flowInstance.FrmData = request.FrmData;
}
FlowRuntime wfruntime = new FlowRuntime(flowInstance); FlowRuntime wfruntime = new FlowRuntime(flowInstance);
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag); wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
if (tag.Taged == (int)TagState.Ok) if (tag.Taged == (int)TagState.Ok)
@ -464,7 +468,8 @@ namespace OpenAuth.App
wfruntime.nextNodeType = 4; wfruntime.nextNodeType = 4;
} }
var 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}"; $"结果:{(tag.Taged == 1 ? "" : "")},备注:{tag.Description}";
AddOperationHis(flowInstance.Id, tag, content); AddOperationHis(flowInstance.Id, tag, content);
flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj()); flowInstance.SchemeContent = JsonHelper.Instance.Serialize(wfruntime.ToSchemeObj());
@ -476,9 +481,9 @@ namespace OpenAuth.App
{ {
return; return;
} }
VerifyNode(request, tag, flowInstance); VerifyNode(request, tag, flowInstance);
} }
} }
//会签时,获取一条会签分支上面是否有用户可审核的节点 //会签时,获取一条会签分支上面是否有用户可审核的节点
@ -630,6 +635,7 @@ namespace OpenAuth.App
{ {
throw new Exception("无法找到当前用户的直属上级"); throw new Exception("无法找到当前用户的直属上级");
} }
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)
@ -733,7 +739,8 @@ namespace OpenAuth.App
} }
else if (node.setInfo != null) else if (node.setInfo != null)
{ {
if (string.IsNullOrEmpty(node.setInfo.NodeDesignate) ||node.setInfo.NodeDesignate == Setinfo.ALL_USER) //所有成员 if (string.IsNullOrEmpty(node.setInfo.NodeDesignate) ||
node.setInfo.NodeDesignate == Setinfo.ALL_USER) //所有成员
{ {
makerList = "1"; makerList = "1";
} }