Bladeren bron

Merge branch 'release' of http://110.188.24.182:10023/Fengwo/hotline into release

xf 6 maanden geleden
bovenliggende
commit
6d5393b9f5

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

@@ -30,6 +30,7 @@ using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using SqlSugar;
 using System.Data;
+using Hotline.SeedData;
 using XF.Domain.Authentications;
 using XF.Domain.Exceptions;
 using XF.Domain.Repository;
@@ -2518,7 +2519,8 @@ namespace Hotline.Api.Controllers.Bi
                        .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
                        //.LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId && wfsh.IsActualHandler == true)
                        .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
-                       .Where((x, w, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send)
+                       .Where((x, w, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send && x.Status == EWorkflowStepStatus.Handled
+	                && !string.IsNullOrEmpty(x.NextMainHandler) && x.NextMainHandler != OrgSeedData.CenterId)
                        .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
                        .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
                        .GroupBy((x, w, su) => x.WorkflowId)

+ 14 - 6
src/Hotline.Api/Controllers/OrderController.cs

@@ -6879,12 +6879,20 @@ public class OrderController : BaseController
                 new(dto.Handler.UserId,dto.Handler.Username,dto.Handler.OrgId,dto.Handler.OrgName,step.RoleId,step.RoleName, new List<WorkflowStep>{step})
             }, HttpContext.RequestAborted);
             var status = EOrderStatus.HandOver;
-            if (step.BusinessType == EBusinessType.Seat && step.StepType == EStepType.Start)
-                status = EOrderStatus.HandOverToUnAccept;
-            await _orderRepository.Updateable()
-                .SetColumns(o => new Orders.Order() { Status = status })
-                .Where(o => o.Id == dto.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
-        }
+			if (step.BusinessType == EBusinessType.Seat && step.StepType == EStepType.Start)
+			{
+				status = EOrderStatus.HandOverToUnAccept;
+				await _orderRepository.Updateable()
+					.SetColumns(o => new Orders.Order() { Status = status, SignerId = dto.Handler.UserId })
+					.Where(o => o.Id == dto.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
+			}
+			else
+			{
+				await _orderRepository.Updateable()
+					.SetColumns(o => new Orders.Order() { Status = status })
+					.Where(o => o.Id == dto.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
+			}
+		}
     }
 
     #endregion

+ 27 - 5
src/Hotline.Application/Orders/OrderApplication.cs

@@ -2222,25 +2222,47 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     /// <returns></returns>
     public async Task<List<SendOrderReportOutDto>> SendOrderReportAsync(QuerySendOrderRequest dto)
     {
-        var items = await _workflowTraceRepository.Queryable()
+        var itemsHandled =  _workflowTraceRepository.Queryable()
             .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
-            //.LeftJoin<WorkflowStepHandler>((x, w, wsh) => x.StepId == wsh.WorkflowStepId && wsh.IsActualHandler == true)
             .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
             .Where((x, w, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send && x.Status == EWorkflowStepStatus.Handled)
             .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
             .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
             .WhereIF(!string.IsNullOrEmpty(dto.UserName), (x, w, su) => su.UserName == dto.UserName)
             .GroupBy((x, w, su) => new { su.UserId, su.UserName })
-            //.Having((x, w, wsh, su) => SqlFunc.AggregateCount(x.WorkflowId) == 1)
             .Select((x, w, su) => new BiOrderSendVo
             {
                 UserId = su.UserId,
                 UserName = su.UserName,
                 SendOrderNum = SqlFunc.AggregateDistinctCount(w.ExternalId),
-                NoSendOrderNum = SqlFunc.AggregateSum(SqlFunc.IIF(x.HandlerId == null || x.HandlerId == "", 1, 0)),
+                NoSendOrderNum =  0,
+            });
+        var itemsNo = _workflowTraceRepository.Queryable()
+	        .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
+	        .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)
+	        .Where((x, w, su) => w.ModuleCode == "OrderHandle" && x.BusinessType == EBusinessType.Send && x.Status != EWorkflowStepStatus.Handled)
+	        .Where((x, w, su) => x.CreationTime >= dto.StartTime.Value)
+	        .Where((x, w, su) => x.CreationTime <= dto.EndTime.Value)
+	        .WhereIF(!string.IsNullOrEmpty(dto.UserName), (x, w, su) => su.UserName == dto.UserName)
+	        .GroupBy((x, w, su) => new { su.UserId, su.UserName })
+	        .Select((x, w, su) => new BiOrderSendVo
+	        {
+		        UserId = su.UserId,
+		        UserName = su.UserName,
+		        SendOrderNum = 0,
+		        NoSendOrderNum = SqlFunc.AggregateDistinctCount(w.ExternalId),
+	        });
+        var items = await itemsHandled.LeftJoin(itemsNo, (hand, nohand) => hand.UserId == nohand.UserId)
+            .GroupBy((hand, nohand) => new { hand.UserId , hand.UserName } )
+            .Select((hand, nohand) => new BiOrderSendVo
+            {
+                UserId = hand.UserId,
+                UserName = hand.UserName,
+                SendOrderNum = SqlFunc.AggregateSum(hand.SendOrderNum),
+                NoSendOrderNum = SqlFunc.AggregateSum(nohand.NoSendOrderNum),
             }).ToListAsync();
 
-        var items2 = await _workflowTraceRepository.Queryable()
+		var items2 = await _workflowTraceRepository.Queryable()
             .LeftJoin<Workflow>((x, w) => x.WorkflowId == w.Id)
             //.LeftJoin<WorkflowStepHandler>((x, w, wfsh) => x.StepId == wfsh.WorkflowStepId && wfsh.IsActualHandler == true)
             .InnerJoin<SchedulingUser>((x, w, su) => x.HandlerId == su.UserId)