Browse Source

派单量统计

田爽 11 months ago
parent
commit
6de46f3cb8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Hotline.Api/Controllers/Bi/BiOrderController.cs

+ 2 - 2
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -2755,11 +2755,11 @@ namespace Hotline.Api.Controllers.Bi
                 .Where((x, w, wfsh, su) => x.CreationTime <= dto.EndTime.Value)
                 .GroupBy((x, w, wfsh, su) => x.WorkflowId)
                 .Having((x, w, wfsh, su) => SqlFunc.AggregateCount(x.WorkflowId) > 1)
-                .Select((x, w, wfsh, su) => new { Id = x.WorkflowId })
+                .Select((x, w, wfsh, su) => new { Id = x.WorkflowId , CreationTime = SqlFunc.AggregateMin(wfsh.CreationTime) })
                 .MergeTable()
                 .LeftJoin<WorkflowTrace>((a, wt) => a.Id == wt.WorkflowId)
                 .LeftJoin<Workflow>((a, wt, wf) => wt.WorkflowId == wf.Id)
-                .LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId)
+                .LeftJoin<WorkflowStepHandler>((a, wt, wf, wsh) => wt.StepId == wsh.WorkflowStepId && wsh.CreationTime == a.CreationTime)
                 .InnerJoin<SchedulingUser>((a, wt, wf, wsh, su) => wsh.UserId == su.UserId)
                 .WhereIF(!string.IsNullOrEmpty(dto.UserName), ((a, wt, wf, wsh, su) => su.UserName == dto.UserName))
                 .GroupBy((a, wt, wf, wsh, su) => new { su.UserId, su.UserName })