tangjiang 10 місяців тому
батько
коміт
0bef034a14
1 змінених файлів з 75 додано та 59 видалено
  1. 75 59
      src/Hotline.Api/Controllers/Bi/BiOrderController.cs

+ 75 - 59
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -2,7 +2,6 @@
 using Hotline.Application.StatisticalReport;
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
-using Hotline.FlowEngine.WorkflowModules;
 using Hotline.FlowEngine.Workflows;
 using Hotline.Orders;
 using Hotline.Repository.SqlSugar.Extensions;
@@ -14,8 +13,6 @@ using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Bi;
 using Hotline.Share.Dtos.Bigscreen;
 using Hotline.Share.Dtos.CallCenter;
-using Hotline.Share.Dtos.DataSharing.PusherHotlineDto;
-using Hotline.Share.Dtos.FlowEngine.Workflow;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Enums.FlowEngine;
@@ -25,16 +22,10 @@ using Hotline.Tools;
 using MapsterMapper;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
-using NPOI.SS.Formula.Functions;
-using Org.BouncyCastle.Utilities;
 using SqlSugar;
-using System.Dynamic;
 using XF.Domain.Authentications;
-using XF.Domain.Constants;
 using XF.Domain.Exceptions;
 using XF.Domain.Repository;
-using XF.Utility.EnumExtensions;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
 
 namespace Hotline.Api.Controllers.Bi
 {
@@ -63,6 +54,7 @@ namespace Hotline.Api.Controllers.Bi
         private readonly IOrderApplication _orderApplication;
         private readonly ITimeLimitDomainService _timeLimitDomainService;
         private readonly IOrderReportApplication _orderReportApplication;
+        private readonly IRepository<SystemArea> _systemAreaRepository;
 
         public BiOrderController(
             IOrderRepository orderRepository,
@@ -87,7 +79,8 @@ namespace Hotline.Api.Controllers.Bi
             IOrderSecondaryHandlingApplication orderSecondaryHandlingApplication,
             IOrderApplication orderApplication,
             ITimeLimitDomainService timeLimitDomainService,
-            IOrderReportApplication orderReportApplication
+            IOrderReportApplication orderReportApplication,
+            IRepository<SystemArea> systemAreaRepository
             )
         {
             _orderRepository = orderRepository;
@@ -113,6 +106,7 @@ namespace Hotline.Api.Controllers.Bi
             _orderApplication = orderApplication;
             _timeLimitDomainService = timeLimitDomainService;
             _orderReportApplication = orderReportApplication;
+            _systemAreaRepository = systemAreaRepository;
         }
 
         /// <summary>
@@ -2673,65 +2667,87 @@ namespace Hotline.Api.Controllers.Bi
             return ExcelStreamResult(stream, "信件来源统计明细数据");
         }
 
-		/// <summary>
-		/// 信件来源分时统计列表
-		/// </summary>
-		/// <param name="dto"></param>
-		/// <returns></returns>
-		[HttpGet("order_source_hours_report_list")]
+        /// <summary>
+        /// 信件来源分时统计列表
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpGet("order_source_hours_report_list")]
         public async Task<List<OrderSourceHeaderVo>> QueryOrderSourceHoursReportList([FromQuery] QueryOrderSourceRequest dto)
         {
-	        var data = await _orderApplication.QueryOrderSourceHoursList(dto);
-	        return data;
+            var data = await _orderApplication.QueryOrderSourceHoursList(dto);
+            return data;
         }
 
-		/// <summary>
-		/// 信件来源分时统计表头
-		/// </summary>
-		/// <param name="dto"></param>
-		/// <returns></returns>
-		[HttpGet("order_source_hours_report_header")]
-		public async Task<List<Kv>> QueryOrderSourceHoursReportHeader()
-		{
+        /// <summary>
+        /// 信件来源分时统计表头
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpGet("order_source_hours_report_header")]
+        public async Task<List<Kv>> QueryOrderSourceHoursReportHeader()
+        {
             List<Kv> res = new List<Kv>
             {
-	            new Kv { Key = "宜宾110平台", Value = "Platform110" },
-	            new Kv { Key = "电话", Value = "Phone" },
-	            new Kv { Key = "因特网", Value = "Web" },
-	            new Kv { Key = "其他", Value = "Rests" },
-	            new Kv { Key = "自建", Value = "Created" },
-	            new Kv { Key = "微信", Value = "WeChat" },
-	            new Kv { Key = "APP", Value = "App" },
-	            new Kv { Key = "智慧宜宾", Value = "WisdomYB" },
-	            new Kv { Key = "综治平台", Value = "Platform" },
-	            new Kv { Key = "省12328平台", Value = "Platform12328" },
-	            new Kv { Key = "市州与网民", Value = "MayorAndNetizens" },
-	            new Kv { Key = "宜宾融媒体", Value = "MediaYB" },
-	            new Kv { Key = "省12345平台", Value = "Platform12345" },
-	            new Kv { Key = "省政民互动", Value = "Interaction" },
-	            new Kv { Key = "宜办事", Value = "ServiceYB" },
-	            new Kv { Key = "市州互转", Value = "CityTransfer" },
-	            new Kv { Key = "办不成事反映窗口", Value = "NoService" },
-	            new Kv { Key = "I宜宾", Value = "Iyb" }
+                new Kv { Key = "宜宾110平台", Value = "Platform110" },
+                new Kv { Key = "电话", Value = "Phone" },
+                new Kv { Key = "因特网", Value = "Web" },
+                new Kv { Key = "其他", Value = "Rests" },
+                new Kv { Key = "自建", Value = "Created" },
+                new Kv { Key = "微信", Value = "WeChat" },
+                new Kv { Key = "APP", Value = "App" },
+                new Kv { Key = "智慧宜宾", Value = "WisdomYB" },
+                new Kv { Key = "综治平台", Value = "Platform" },
+                new Kv { Key = "省12328平台", Value = "Platform12328" },
+                new Kv { Key = "市州与网民", Value = "MayorAndNetizens" },
+                new Kv { Key = "宜宾融媒体", Value = "MediaYB" },
+                new Kv { Key = "省12345平台", Value = "Platform12345" },
+                new Kv { Key = "省政民互动", Value = "Interaction" },
+                new Kv { Key = "宜办事", Value = "ServiceYB" },
+                new Kv { Key = "市州互转", Value = "CityTransfer" },
+                new Kv { Key = "办不成事反映窗口", Value = "NoService" },
+                new Kv { Key = "I宜宾", Value = "Iyb" }
             };
             return res;
-		}
+        }
 
-		/// <summary>
-		/// 信件来源分时统计导出
-		/// </summary>
-		/// <returns></returns>
-		[HttpPost("order_source_hours_list/_export")]
+        /// <summary>
+        /// 信件来源分时统计导出
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("order_source_hours_list/_export")]
         public async Task<FileStreamResult> QueryOrderSourceHoursReportList([FromBody] ExportExcelDto<QueryOrderSourceRequest> dto)
         {
-	        var data = await _orderApplication.QueryOrderSourceHoursList(dto.QueryDto);
-	        dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
-	        var dtos = data
-		        .Select(stu => _mapper.Map(stu, typeof(OrderSourceHeaderVo), dynamicClass))
-		        .Cast<object>()
-		        .ToList();
-	        var stream = ExcelHelper.CreateStream(dtos);
-	        return ExcelStreamResult(stream, "信件来源分时统计列表数据");
+            var data = await _orderApplication.QueryOrderSourceHoursList(dto.QueryDto);
+            dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
+            var dtos = data
+                .Select(stu => _mapper.Map(stu, typeof(OrderSourceHeaderVo), dynamicClass))
+                .Cast<object>()
+                .ToList();
+            var stream = ExcelHelper.CreateStream(dtos);
+            return ExcelStreamResult(stream, "信件来源分时统计列表数据");
+        }
+
+        /// <summary>
+        /// 区域分时统计
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost("order_area_time")]
+        [AllowAnonymous]
+        public async Task<object> OrderAreaTime([FromQuery] PagedKeywordRequest dto)
+        {
+            var item = await _orderRepository.OrderAreaTime(dto.StartTime, dto.EndTime);
+
+            var titleData = await _systemAreaRepository.Queryable()
+                .Where(p => p.Id.Length == 6 && p.Id != "510000")
+                .Select(p => new
+                {
+                    Key = p.Id,
+                    Value = p.AreaName
+                }).ToListAsync();
+
+            return new { Item = item, TitleData = titleData };
         }
-	}
+    }
 }