ClientFlowInstanceService的bug修复

dev
嵇文龙 3 weeks ago
parent f7953cf8b2
commit 5594d1492f

@ -364,7 +364,7 @@ public class ClientFlowInstanceService : ServiceBase, IClientFlowInstanceService
Content = $"【启动】由{User.UserName}启动该流程。", Content = $"【启动】由{User.UserName}启动该流程。",
UserName = User.UserName UserName = User.UserName
}; };
Db.Insertable(history).ExecuteCommand(); TenantDb.Insertable(history).ExecuteCommand();
return DataResult.Successed("更新成功!", instance, MultiLanguageConst.FlowInstanceUpdateSuccess); return DataResult.Successed("更新成功!", instance, MultiLanguageConst.FlowInstanceUpdateSuccess);
} }
@ -909,34 +909,24 @@ public class ClientFlowInstanceService : ServiceBase, IClientFlowInstanceService
internal async Task<DataResult> WithdrawCoreAsync(List<FlowInstance> instances, string? note = null) internal async Task<DataResult> WithdrawCoreAsync(List<FlowInstance> instances, string? note = null)
{ {
ArgumentNullException.ThrowIfNull(instances, nameof(instances)); ArgumentNullException.ThrowIfNull(instances, nameof(instances));
await TenantDb.Ado.BeginTranAsync();
try
{
await TenantDb.Updateable(instances).UpdateColumns(x => new
{
x.ActivityId,
x.MakerList,
x.FlowStatus,
x.Note
}).ExecuteCommandAsync();
var historys = instances.Select(x => new FlowInstanceHistory await TenantDb.Updateable(instances).UpdateColumns(x => new
{ {
InstanceId = x.Id, x.ActivityId,
Content = $"【撤销】由{User.UserName}撤销,备注:{note}", x.MakerList,
Result = -1, x.FlowStatus,
UserName = User.UserName x.Note
}).ToList(); }).ExecuteCommandAsync();
await TenantDb.Insertable(historys).ExecuteCommandAsync(); var historys = instances.Select(x => new FlowInstanceHistory
await TenantDb.Ado.CommitTranAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
catch (Exception ex)
{ {
await TenantDb.Ado.RollbackTranAsync(); InstanceId = x.Id,
await ex.LogAsync(Db); Content = $"【撤销】由{User.UserName}撤销,备注:{note}",
return DataResult.FailedWithDesc(MultiLanguageConst.Operation_Failed); Result = -1,
} UserName = User.UserName
}).ToList();
await TenantDb.Insertable(historys).ExecuteCommandAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
} }
} }
Loading…
Cancel
Save