From 584c594d774956f42d5cc4fb096e67d6aee70a48 Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Mon, 25 Dec 2023 10:27:50 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20=D1=81=D1=82=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=20=D1=81=D0=B8=D0=BD=D1=85?= =?UTF-8?q?=D1=80=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=80=D1=8F=D0=B4=D0=BE=D0=B2=20=D0=95=D0=A1=D0=9F=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V1/Responses/Statistics/StatOrderResponse.cs | 8 +++++++- .../V1/Statistics/StatOrderController.cs | 16 +++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/PARR.API/Contracts/V1/Responses/Statistics/StatOrderResponse.cs b/PARR.API/Contracts/V1/Responses/Statistics/StatOrderResponse.cs index 61163b31..244ece0f 100644 --- a/PARR.API/Contracts/V1/Responses/Statistics/StatOrderResponse.cs +++ b/PARR.API/Contracts/V1/Responses/Statistics/StatOrderResponse.cs @@ -14,9 +14,15 @@ public OrderStatusResponse? Status { get; set; } } - public class GetStatusesLastDayResponse + public class StatGetStatusesLastDayResponse { public int Count { get; set; } public OrderStatusResponse? Status { get; set; } } + + public class StatTaskToEsppResponse + { + public int AllCount { get; set; } + public int TaskCount { get; set; } + } } diff --git a/PARR.API/Controllers/V1/Statistics/StatOrderController.cs b/PARR.API/Controllers/V1/Statistics/StatOrderController.cs index f5f97c0c..ed33b830 100644 --- a/PARR.API/Controllers/V1/Statistics/StatOrderController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatOrderController.cs @@ -59,12 +59,14 @@ namespace PARR.API.Controllers.V1.Statistics [HttpGet(ApiRoutes.StatOrder.TaskToEspp)] public async Task TaskToEspp() { - //todo:!!! + var response = new StatTaskToEsppResponse + { + AllCount = await orderService.Get().CountAsync(), + // такая же логика в PARR.Master + TaskCount = await orderService.Get().CountAsync(t => t.NextStatusCode.HasValue && t.NextStatusCode.Value != t.StatusCode) + }; - //todo: updateDateMOdified - - - return Ok(); + return Ok(new Response(response, true)); } @@ -107,13 +109,13 @@ namespace PARR.API.Controllers.V1.Statistics var queryDate = DateTimeOffset.UtcNow.AddDays(-1); - var response = new GetStatusesLastDayResponse + var response = new StatGetStatusesLastDayResponse { Count = await orderService.Get().CountAsync(t => t.DateModified >= queryDate && t.StatusCode == statusCode), Status = mapper.Map(status) }; - return Ok(new Response(response, true)); + return Ok(new Response(response, true)); }