TANG JIANG 1 vuosi sitten
vanhempi
commit
35db59bf81
1 muutettua tiedostoa jossa 21 lisäystä ja 8 poistoa
  1. 21 8
      src/Hotline.Api/Controllers/Bi/BiOrderController.cs

+ 21 - 8
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -1192,21 +1192,33 @@ namespace Hotline.Api.Controllers.Bi
             var IsCenter = _sessionContext.OrgIsCenter;
 
             var orderData = await _orderRepository.Queryable()
-              .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
-              .Where((it, o) => it.CreationTime >= StartDate && it.CreationTime <= EndDate && (int)it.Status >= 300)
-                .WhereIF(TypeCode == 1, (it, o) => it.OrgLevelOneCode == "001")
-                .WhereIF(TypeCode == 2, (it, o) => it.OrgLevelOneCode != "001")
-                .WhereIF(IsCenter == false, (it, o) => it.OrgLevelOneCode.StartsWith(_sessionContext.RequiredOrgId))
+              // .LeftJoin<SystemOrganize>((it, o) => it.OrgLevelOneCode == o.Id)
+              .Where(it => it.CreationTime >= StartDate && it.CreationTime <= EndDate && it.Status >= EOrderStatus.Filed)
+
+              .Select(it => new
+              {
+                  OrgCode = IsCenter == false ? it.ActualHandleOrgCode : it.OrgLevelOneCode,
+                  it.AcceptTypeCode,
+                  it.FileDurationWorkday,
+                  it.AllDuration
+              })
+              .MergeTable()
+              .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
+
+              .WhereIF(TypeCode == 1, (it, o) => it.OrgCode == "001")
+              .WhereIF(TypeCode == 2, (it, o) => it.OrgCode != "001")
+              .WhereIF(IsCenter == false, (it, o) => it.OrgCode.StartsWith(_sessionContext.RequiredOrgId))
+
                .GroupBy((it, o) => new
                {
-                   it.OrgLevelOneCode,
+                   it.OrgCode,
                    o.Name,
                    o.OrgType
                })
                 .Select((it, o) => new DepartmentAcceptanceTypeStatisticsDto
                 {
-                    OrgName = it.OrgLevelOneCode == "001" ? "热线中心" : o.Name,
-                    OrgCode = it.OrgLevelOneCode,
+                    OrgName = it.OrgCode == "001" ? "热线中心" : o.Name,
+                    OrgCode = it.OrgCode,
                     OrgType = (int)o.OrgType == 2 ? "区县部门" : "市直部门",
                     ZxAllCount = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10", 1, 0)),
                     ZxAllTimes = SqlFunc.AggregateSum(SqlFunc.IIF(it.AcceptTypeCode == "10" && it.AllDuration != null, it.AllDuration, 0)),
@@ -1241,6 +1253,7 @@ namespace Hotline.Api.Controllers.Bi
             return orderData;
         }
 
+
         /// <summary>
         /// 部门受理类型统计周期--明细列表
         /// </summary>