ClientFlowInstanceService的bug修复

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

@ -364,7 +364,7 @@ public class ClientFlowInstanceService : ServiceBase, IClientFlowInstanceService
Content = $"【启动】由{User.UserName}启动该流程。",
UserName = User.UserName
};
Db.Insertable(history).ExecuteCommand();
TenantDb.Insertable(history).ExecuteCommand();
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)
{
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
{
InstanceId = x.Id,
Content = $"【撤销】由{User.UserName}撤销,备注:{note}",
Result = -1,
UserName = User.UserName
}).ToList();
await TenantDb.Updateable(instances).UpdateColumns(x => new
{
x.ActivityId,
x.MakerList,
x.FlowStatus,
x.Note
}).ExecuteCommandAsync();
await TenantDb.Insertable(historys).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
catch (Exception ex)
var historys = instances.Select(x => new FlowInstanceHistory
{
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(MultiLanguageConst.Operation_Failed);
}
InstanceId = x.Id,
Content = $"【撤销】由{User.UserName}撤销,备注:{note}",
Result = -1,
UserName = User.UserName
}).ToList();
await TenantDb.Insertable(historys).ExecuteCommandAsync();
return DataResult.Successed("撤销成功!", MultiLanguageConst.FlowInstanceCancelSuccess);
}
}
Loading…
Cancel
Save