获取流程运行实例的内容

usertest
嵇文龙 6 months ago
parent dd98c7afca
commit 091cfba529

@ -140,7 +140,7 @@ public class FlowInstanceService : IFlowInstanceService
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
RunCallback(instance);
}
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
@ -269,7 +269,7 @@ public class FlowInstanceService : IFlowInstanceService
//流程==4为结束执行回调URL
if (wfruntime.GetNextNodeType() == 4 && !instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
{
RunCallback(instance, uri);
RunCallback(instance);
}
var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
@ -390,11 +390,10 @@ public class FlowInstanceService : IFlowInstanceService
//流程==4为结束执行回调URL
int nextNodeType = runtime.GetNextNodeType();
if (runtime.NextNodeType != 5 && (nextNodeType == 4 || nextNodeType == -1) &&
!instance.CallbackURL.IsNullOrEmpty() && Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
if (runtime.NextNodeType != 5 && (nextNodeType == 4 || nextNodeType == -1) && !instance.CallbackURL.IsNullOrEmpty())
{
instance.Note = req.AuditNote;
RunCallback(instance, uri);
RunCallback(instance);
}
var history = new FlowInstanceHistory
@ -410,8 +409,15 @@ public class FlowInstanceService : IFlowInstanceService
return DataResult.Successed("审批成功!", MultiLanguageConst.FlowInstanceAuditSuccess);
}
protected virtual void RunCallback(FlowInstance instance, Uri uri)
/// <summary>
/// 对指定的回调URL发起请求
/// </summary>
/// <param name="instance">运行实例</param>
protected virtual void RunCallback(FlowInstance instance)
{
if (!Uri.TryCreate(instance.CallbackURL, UriKind.RelativeOrAbsolute, out Uri? uri))
return;
HttpClient http = new HttpClient();
http.DefaultRequestHeaders.Add("User-Agent", "X-HttpClient");
http.DefaultRequestHeaders.Add("Authorization", "Bearer " + user.GetToken());
@ -422,7 +428,8 @@ public class FlowInstanceService : IFlowInstanceService
InstanceId = instance.Id,
BusinessId = instance.BusinessId,
AuditType = instance.AuditType,
FlowStatus = (FlowStatusEnum)instance.FlowStatus
FlowStatus = (FlowStatusEnum)instance.FlowStatus,
RejectReason = instance.Note
};
var jsonRequest = new StringContent(JsonConvert.SerializeObject(callback), Encoding.UTF8, "application/json");
try
@ -442,7 +449,7 @@ public class FlowInstanceService : IFlowInstanceService
}
catch (Exception ex)
{
ex.Log(db);
ex.Log(db);
}
finally
{

@ -789,3 +789,17 @@
2024-05-29 15:51:07.5827 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-05-29 15:51:07.5827 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 15:51:07.5953 Info Configuration initialized.
2024-05-29 17:42:15.5010 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-29 17:42:15.5010 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-29 17:42:15.5010 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-29 17:42:15.5183 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-05-29 17:42:15.5183 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-05-29 17:42:15.5183 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 17:42:15.5303 Info Configuration initialized.
2024-05-29 17:54:33.7185 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-29 17:54:33.7185 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-29 17:54:33.7185 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-29 17:54:33.7416 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-05-29 17:54:33.7416 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-05-29 17:54:33.7416 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 17:54:33.7527 Info Configuration initialized.

@ -113,16 +113,18 @@ public class ClientFlowInstanceController : ApiController
return res;
}
/// <summary>
/// 获取流程运行实例的内容
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="type">流程类型</param>
/// <returns></returns>
[HttpGet, Route("GetFlowContent")]
public IActionResult GetFlowContent([FromQuery] long businessId, [FromQuery] FeeAuditType type)
{
var res = _invokeService.GetFlowInstance(businessId, type.ToString());
string json = string.Empty;
if (res.Data != null)
{
json = JsonConvert.SerializeObject(res.Data);
}
string? content = res.Data?.Content;
string json = JsonConvert.SerializeObject(DataResult<string>.Success(content ?? string.Empty));
return new ContentResult { Content = json, ContentType = "application/json" };
}
}

@ -1625,3 +1625,17 @@
2024-05-29 15:51:08.3160 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-05-29 15:51:08.3160 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 15:51:08.3302 Info Configuration initialized.
2024-05-29 17:42:16.5165 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-29 17:42:16.5165 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-29 17:42:16.5311 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-29 17:42:16.5311 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-05-29 17:42:16.5311 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-05-29 17:42:16.5464 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 17:42:16.5464 Info Configuration initialized.
2024-05-29 17:54:34.0941 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-29 17:54:34.0941 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-29 17:54:34.1109 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-29 17:54:34.1263 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-05-29 17:54:34.1263 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-05-29 17:54:34.1263 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-29 17:54:34.1263 Info Configuration initialized.

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\Main</_PublishTargetUrl>
<History>True|2024-05-29T09:18:16.4688274Z||;True|2024-05-29T16:33:42.5152962+08:00||;False|2024-05-29T16:33:09.8393409+08:00||;False|2024-05-29T16:31:07.7569208+08:00||;True|2024-05-28T18:00:39.2399003+08:00||;True|2024-05-28T08:47:53.8630073+08:00||;True|2024-05-23T17:51:45.6784172+08:00||;True|2024-05-21T17:32:52.9294009+08:00||;</History>
<History>True|2024-05-30T01:30:24.9756841Z||;True|2024-05-29T17:46:22.9869679+08:00||;True|2024-05-29T17:20:28.9621862+08:00||;True|2024-05-29T17:18:16.4688274+08:00||;True|2024-05-29T16:33:42.5152962+08:00||;False|2024-05-29T16:33:09.8393409+08:00||;False|2024-05-29T16:31:07.7569208+08:00||;True|2024-05-28T18:00:39.2399003+08:00||;True|2024-05-28T08:47:53.8630073+08:00||;True|2024-05-23T17:51:45.6784172+08:00||;True|2024-05-21T17:32:52.9294009+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save