feat(api, core): Workload - статус формирования отчетности. RedisCacheService - получить первую запись из кэш типа Hash.
This commit is contained in:
@@ -303,6 +303,8 @@
|
||||
public const string WorkGroup = BaseStat + "/workload/work-groups";
|
||||
|
||||
public const string ResponseArea = BaseStat + "/workload/response-areas";
|
||||
|
||||
public const string ReportInfo = BaseStat + "/workload/report-info";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using PARR.Domain.DTOs.Workload;
|
||||
|
||||
namespace PARR.API.Contracts.V1.Responses.Statistics
|
||||
{
|
||||
/// <summary>
|
||||
/// Инфо о формирование КЭШ для отчета Workload
|
||||
/// </summary>
|
||||
public record StatWorkloadCacheInfoResponse
|
||||
{
|
||||
public WorkloadCacheInfo.StatusEnum Status { get; set; }
|
||||
|
||||
public DateTimeOffset? Date { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,6 @@ namespace PARR.API.Controllers.V1.Statistics
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Сформировать отчетность
|
||||
/// </summary>
|
||||
@@ -110,6 +108,22 @@ namespace PARR.API.Controllers.V1.Statistics
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о формировании КЭШ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet(ApiRoutes.Workload.ReportInfo)]
|
||||
public async Task<IActionResult> GetReportInfo()
|
||||
{
|
||||
var report = await workloadService.GetReportInfoAsync();
|
||||
|
||||
var response = mapper.Map<StatWorkloadCacheInfoResponse>(report);
|
||||
|
||||
return Ok(new Response<StatWorkloadCacheInfoResponse>(response, true));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Универсальный метод получения отчетности
|
||||
/// </summary>
|
||||
@@ -123,7 +137,8 @@ namespace PARR.API.Controllers.V1.Statistics
|
||||
var report = await workloadService.GetWorkloadReport(reportType, dateStart, durationDays, offset, filter);
|
||||
|
||||
if (report == null)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Необходимо сформировать отчетность." } }));
|
||||
//return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Необходимо сформировать отчетность." } }));
|
||||
return BadRequest(new Response<string?>(null, false, new List<ErrorModel> { new ErrorModel { Message = "Необходимо сформировать отчетность." } }, "empty"));
|
||||
|
||||
var resonse = mapper.Map<StatWorkloadReportResponse>(report);
|
||||
|
||||
|
||||
@@ -444,6 +444,10 @@ namespace PARR.API.MappingProfiles
|
||||
|
||||
CreateMap<WorkloadDailyItem, WorkloadDailyItemResponse>();
|
||||
|
||||
|
||||
|
||||
CreateMap<WorkloadCacheInfo, StatWorkloadCacheInfoResponse>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user