浏览代码

Merge branch 'master' of http://git.fwt.com/Hotline/hotline

TANG JIANG 2 年之前
父节点
当前提交
eacfc2d792

+ 8 - 4
src/Hotline.Api/Controllers/OrderController.cs

@@ -126,14 +126,18 @@ public class OrderController : BaseController
             .Includes(d => d.OrderReport)
             .FirstAsync(d => d.Id == id);
         if (!string.IsNullOrEmpty(order?.WorkflowId))
+        {
             order.Workflow = await _workflowDomainService.GetWorkflowAsync(order.WorkflowId, withSteps: true, withSupplements: true, withAssigns: true, cancellationToken: HttpContext.RequestAborted);
 
-        _mediator.Publish(new GetOrderDetailNotify(order.Workflow, _sessionContext.RequiredUserId,
-            _sessionContext.UserName, _sessionContext.RequiredOrgCode, _sessionContext.OrgName));
+            _mediator.Publish(new GetOrderDetailNotify(order.Workflow, _sessionContext.RequiredUserId,
+                _sessionContext.UserName, _sessionContext.RequiredOrgCode, _sessionContext.OrgName));
+        }
 
         var dto = _mapper.Map<OrderDto>(order);
-        dto.Workflow.CanHandle =
-            order.Workflow.CanHandle(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgCode);
+
+        if (order.Workflow != null)
+            dto.Workflow.CanHandle =
+                order.Workflow.CanHandle(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgCode);
         return dto;
     }
 

+ 6 - 0
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -170,8 +170,12 @@ namespace Hotline.FlowEngine.Workflows
             if (currentStep.StepType is EStepType.End)
                 throw new UserFriendlyException("当前流程已流转到最终步骤");
 
+            var changedSteps = new List<WorkflowStep> { currentStep };
             if (currentStepBox.Status is EWorkflowStepStatus.Assigned)
+            {
                 currentStepBox.Status = EWorkflowStepStatus.Accepted;
+                changedSteps.Add(currentStepBox);
+            }
             currentStep.Accept(userId, userName);
 
             //接办时非会签并且有多个接办部门时需更新接办部门
@@ -187,6 +191,8 @@ namespace Hotline.FlowEngine.Workflows
                 }
             }
 
+            await _workflowStepRepository.UpdateRangeAsync(changedSteps, cancellationToken);
+
             await AcceptTraceAsync(workflow, currentStepBox, currentStep, cancellationToken);
 
             await _mediator.Publish(new AcceptWorkflowNotify(workflow), cancellationToken);