xfe 1 year ago
parent
commit
8bc2ecebe6

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

@@ -2411,10 +2411,10 @@ public class OrderController : BaseController
             .FirstAsync(d => d.WorkflowId == dto.WorkflowId, HttpContext.RequestAborted);
         if (order is null)
             throw new UserFriendlyException("无效工单编号");
-        //if (await _orderDelayRepository.AnyAsync(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
-        //{
-        //    throw UserFriendlyException.SameMessage("该工单存在正在审核中的延期,不能办理");
-        //}
+        if (await _orderDelayRepository.AnyAsync(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
+        {
+            throw UserFriendlyException.SameMessage("该工单存在正在审核中的延期,不能办理");
+        }
         if (await _orderSendBackAuditRepository.AnyAsync(x => x.OrderId == order.Id && x.State == ESendBackAuditState.Apply, HttpContext.RequestAborted))
         {
             throw UserFriendlyException.SameMessage("该工单存在正在审核中的退回,不能办理");
@@ -3026,7 +3026,11 @@ public class OrderController : BaseController
             //if (dto.AlterTime)
             //    recall.External = new External { TimeLimit = dto.TimeLimit, TimeLimitUnit = dto.TimeLimitUnit };
             //if (dto.Files.Any()) recall.Files = dto.Files;
-            await _workflowApplication.RecallAsync(recall, HttpContext.RequestAborted);
+
+            //todo 特提重办(确认重办需求:目标节点必须是坐席?派单?中心?,特提是否会出现45工作日),按审批通过时间依据中心派至部门的规则计算期满时间,更新order
+
+
+            await _workflowApplication.RecallAsync(recall, null, HttpContext.RequestAborted);
             var publish = await _orderPublishRepository.GetAsync(x => x.OrderId == dto.OrderId);
             if (publish != null)
             {
@@ -3105,7 +3109,10 @@ public class OrderController : BaseController
             //if (dto.AlterTime)
             //    recall.External = new External { TimeLimit = dto.TimeLimit, TimeLimitUnit = dto.TimeLimitUnit };
             //if (dto.Files.Any()) recall.Files = dto.Files;
-            await _workflowApplication.RecallAsync(recall, HttpContext.RequestAborted);
+
+            //todo 特提重办,按审批通过时间依据中心派至部门的规则计算期满时间,更新order
+
+            await _workflowApplication.RecallAsync(recall, null, HttpContext.RequestAborted);
             var publish = await _orderPublishRepository.GetAsync(x => x.OrderId == special.OrderId);
             if (publish != null)
             {

+ 2 - 2
src/Hotline.Api/Controllers/WorkflowController.cs

@@ -368,7 +368,7 @@ public class WorkflowController : BaseController
     [HttpPost("recall")]
     public async Task Recall([FromBody] RecallDto dto)
     {
-        await _workflowApplication.RecallAsync(dto, HttpContext.RequestAborted);
+        await _workflowApplication.RecallAsync(dto, null, HttpContext.RequestAborted);
     }
 
     /// <summary>
@@ -555,7 +555,7 @@ public class WorkflowController : BaseController
             .Includes(x => x.Members)
             .LeftJoin<Workflow>((c, w) => c.WorkflowId == w.Id)
             .InnerJoin<Order>((c, w, o) => w.ExternalId == o.Id)
-            .WhereIF(!_sessionContext.OrgIsCenter, (c, w, o) => c.Members.Any(m=>m.Key== _sessionContext.OrgId))
+            .WhereIF(!_sessionContext.OrgIsCenter, (c, w, o) => c.Members.Any(m => m.Key == _sessionContext.OrgId))
             .WhereIF(dto.IsProvince.HasValue, (c, w, o) => o.IsProvince == dto.IsProvince.Value)
             .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
                 (c, w, o) => o.No.Contains(dto.Keyword) || o.Title.Contains(dto.Keyword));

+ 1 - 1
src/Hotline.Application/FlowEngine/IWorkflowApplication.cs

@@ -40,7 +40,7 @@ namespace Hotline.Application.FlowEngine
         /// <summary>
         /// 撤回至任意节点
         /// </summary>
-        Task RecallAsync(RecallDto dto, CancellationToken cancellationToken);
+        Task RecallAsync(RecallDto dto, DateTime? expiredTime, CancellationToken cancellationToken);
 
         ///// <summary>
         ///// 跳转至任意节点

+ 2 - 2
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -279,7 +279,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
     /// <summary>
     /// 撤回至任意节点
     /// </summary>
-    public async Task RecallAsync(RecallDto dto, CancellationToken cancellationToken)
+    public async Task RecallAsync(RecallDto dto, DateTime? expiredTime, CancellationToken cancellationToken)
     {
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, withDefine: true, withSteps: true,
                 cancellationToken: cancellationToken);
@@ -293,7 +293,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
         var flowAssignInfo = await GetNextStepFlowAssignInfoByDefineAsync(targetStepDefine, dto.IsStartCountersign, dto.NextHandlers,
                 cancellationToken);
 
-        await _workflowDomainService.RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, null, cancellationToken);
+        await _workflowDomainService.RecallAsync(workflow, dto, targetStepDefine, flowAssignInfo, expiredTime, cancellationToken);
     }
 
     ///// <summary>

+ 1 - 1
src/Hotline/FlowEngine/Workflows/IWorkflowDomainService.cs

@@ -15,7 +15,7 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// 创建流程
         /// </summary>
-        Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId, string userCode,
+        Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId, string orgId,
             string? externalId = null, CancellationToken cancellationToken = default);
 
         /// <summary>

+ 2 - 4
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -61,9 +61,7 @@ namespace Hotline.FlowEngine.Workflows
         }
 
         public async Task<Workflow> CreateWorkflowAsync(WorkflowModule wfModule, string title, string userId,
-            string userCode,
-            string? externalId = null,
-            CancellationToken cancellationToken = default)
+            string orgId, string? externalId = null, CancellationToken cancellationToken = default)
         {
             var definition = wfModule.Definition;
             if (definition is null)
@@ -85,7 +83,7 @@ namespace Hotline.FlowEngine.Workflows
                 Traces = new(),
                 WorkflowDefinition = definition,
                 ExternalId = externalId ?? string.Empty,
-                FlowedOrgIds = new List<string> { userCode },
+                FlowedOrgIds = new List<string> { orgId },
                 FlowedUserIds = new List<string> { userId },
                 FlowType = definition.FlowType,
             };