浏览代码

导出增加合计

tangjiang 10 月之前
父节点
当前提交
78064f8cc7

+ 14 - 0
src/Hotline.Api/Controllers/Bi/BiCallController.cs

@@ -135,6 +135,20 @@ public class BiCallController : BaseController
         dto.QueryDto.EndTime = dto.QueryDto.EndTime.Value.AddDays(1).AddSeconds(-1);
 
         var list = await _trCallRecordRepositoryEx.GetQueryCalls(dto.QueryDto.StartTime.Value, dto.QueryDto.EndTime.Value);
+
+        if (list != null && list.Count > 0)
+        {
+            list.Add(new BiCallDto()
+            {
+                HourRange = "合计",
+                Hour = 13,
+                Total = list.Sum(p => p.Total),
+                Answered = list.Sum(p => p.Answered),
+                Hanguped = list.Sum(p => p.Hanguped)
+            });
+        }
+
+
         dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
 
         var dtos = list

+ 11 - 1
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -506,10 +506,19 @@ namespace Hotline.Api.Controllers.Bi
                 list = items;
             }
 
+            list.Add(new BiOrderDelayDataDto()
+            {
+                OrgName = "合计",
+                OrgCode = "",
+                AllTotal = list.Sum(p => p.AllTotal),
+                PassTotal = list.Sum(p => p.PassTotal),
+                NoPassTotal = list.Sum(p => p.NoPassTotal),
+                ExaminingTotal = list.Sum(p => p.ExaminingTotal)
+            });
+
             var orderDtos = _mapper.Map<ICollection<BiOrderDelayDataDto>>(list);
 
             dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);
-
             var dtos = orderDtos
                 .Select(stu => _mapper.Map(stu, typeof(BiOrderDelayDataDto), dynamicClass))
                 .Cast<object>()
@@ -552,6 +561,7 @@ namespace Hotline.Api.Controllers.Bi
                 list = items;
             }
 
+
             var orderDtos = _mapper.Map<ICollection<OrderDelayDto>>(list);
 
             dynamic? dynamicClass = DynamicClassHelper.CreateDynamicClass(dto.ColumnInfos);