feat(FinishEnvelopeJob): enhance FinishEnvelopeJob to fetch signed envelopes
- Added MediatR dependency to query envelopes - Injected GdPictureOptions via IOptions - Updated Execute method to fetch envelopes with status 'EnvelopeCompletelySigned' - Preserved logging with job details - Prepared loop for further processing of envelopes
This commit is contained in:
parent
1713a65014
commit
a62a035ec6
@ -1,18 +1,24 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using EnvelopeGenerator.Domain.Constants;
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
using EnvelopeGenerator.Application.Common.Query;
|
using EnvelopeGenerator.Application.Common.Query;
|
||||||
|
using EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Envelopes.Queries;
|
namespace EnvelopeGenerator.Application.Envelopes.Queries;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Repräsentiert eine Abfrage für Umschläge.
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record ReadEnvelopeQuery : EnvelopeQueryBase, IRequest
|
public record ReadEnvelopeQuery : EnvelopeQueryBase, IRequest<IEnumerable<EnvelopeDto>>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abfrage des Include des Umschlags
|
/// Abfrage des Include des Umschlags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EnvelopeStatusQuery? Status { get; init; }
|
public EnvelopeStatusQuery? Status { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool? HasDocResult { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace EnvelopeGenerator.Finalizer.Job
|
|||||||
{
|
{
|
||||||
if (_logger.IsEnabled(LogLevel.Information))
|
if (_logger.IsEnabled(LogLevel.Information))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("{jobName} running at: {time}", GetType().FullName, DateTimeOffset.Now);
|
_logger.LogInformation("{jobName} running at: {time}", context.JobDetail.Key, DateTimeOffset.Now);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
using EnvelopeGenerator.Application.Envelopes.Queries;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using EnvelopeGenerator.Finalizer.Models;
|
||||||
|
using MediatR;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Finalizer.Job
|
namespace EnvelopeGenerator.Finalizer.Job
|
||||||
@ -6,19 +11,34 @@ namespace EnvelopeGenerator.Finalizer.Job
|
|||||||
{
|
{
|
||||||
private readonly ILogger<FinishEnvelopeJob> _logger;
|
private readonly ILogger<FinishEnvelopeJob> _logger;
|
||||||
|
|
||||||
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger)
|
private readonly GdPictureOptions _gdPictureOptions;
|
||||||
|
|
||||||
|
private readonly IMediator _mediator;
|
||||||
|
|
||||||
|
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger, IOptions<GdPictureOptions> gdPictureOptions, IMediator mediator)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_gdPictureOptions = gdPictureOptions.Value;
|
||||||
|
_mediator = mediator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Execute(IJobExecutionContext context)
|
public async Task Execute(IJobExecutionContext context)
|
||||||
{
|
{
|
||||||
if (_logger.IsEnabled(LogLevel.Information))
|
if (_logger.IsEnabled(LogLevel.Information))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("{jobName} running at: {time}", GetType().FullName, DateTimeOffset.Now);
|
_logger.LogInformation("{jobName} running at: {time}", context.JobDetail.Key, DateTimeOffset.Now);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
var envelopes = await _mediator.Send(new ReadEnvelopeQuery()
|
||||||
|
{
|
||||||
|
Status = new() { Include = [EnvelopeStatus.EnvelopeCompletelySigned] },
|
||||||
|
HasDocResult = false
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var envelope in envelopes)
|
||||||
|
{
|
||||||
|
// add sub-steps
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user