Browse Source

cappublish

xf 1 year ago
parent
commit
43f5f8ae38
31 changed files with 385 additions and 490 deletions
  1. 1 1
      src/Hotline.Api/Controllers/OrderController.cs
  2. 0 1
      src/Hotline.Api/Controllers/UserController.cs
  3. 1 1
      src/Hotline.Api/Controllers/WorkflowController.cs
  4. 4 2
      src/Hotline.Application/FlowEngine/WorkflowApplication.cs
  5. 26 5
      src/Hotline.Application/Handlers/FlowEngine/EndWorkflowHandler.cs
  6. 25 2
      src/Hotline.Application/Handlers/FlowEngine/JumpHandler.cs
  7. 20 12
      src/Hotline.Application/Handlers/FlowEngine/NextStepHandler.cs
  8. 17 3
      src/Hotline.Application/Handlers/FlowEngine/PreviousStepHandler.cs
  9. 61 0
      src/Hotline.Application/Handlers/FlowEngine/RecallStepHandler.cs
  10. 13 1
      src/Hotline.Application/Handlers/FlowEngine/StartWorkflowHandler.cs
  11. 2 1
      src/Hotline.Application/Identity/IdentityAppService.cs
  12. 5 0
      src/Hotline.Application/Mappers/MapperConfigs.cs
  13. 14 0
      src/Hotline.Share/Dtos/Order/CallConnectOrderDto.cs
  14. 14 0
      src/Hotline.Share/Mq/EventNames.Call.cs
  15. 30 0
      src/Hotline.Share/Mq/EventNames.Knowledge.cs
  16. 41 0
      src/Hotline.Share/Mq/EventNames.Order.cs
  17. 0 240
      src/Hotline.Share/Mq/EventNames.Province.cs
  18. 10 4
      src/Hotline/FlowEngine/Notifications/WorkflowNotify.cs
  19. 1 1
      src/Hotline/FlowEngine/Workflows/IWorkflowDomainService.cs
  20. 26 14
      src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs
  21. 3 1
      src/Hotline/FlowEngine/Workflows/WorkflowStep.cs
  22. 3 3
      src/Hotline/KnowledgeBase/KnowledgeDomainService.cs
  23. 0 50
      src/Hotline/Orders/IOrderDomainService.cs
  24. 9 1
      src/Hotline/Orders/Order.cs
  25. 16 0
      src/Hotline/Orders/OrderDefaults.cs
  26. 13 143
      src/Hotline/Orders/OrderDomainService.cs
  27. 2 2
      src/Hotline/Settings/SystemOrganize.cs
  28. 14 0
      src/XF.Domain/Authentications/AppClaimTypes.cs
  29. 8 1
      src/XF.Domain/Authentications/DefaultSessionContext.cs
  30. 6 0
      src/XF.Domain/Authentications/ISessionContext.cs
  31. 0 1
      src/XF.Domain/XF.Domain.csproj

+ 1 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -186,7 +186,7 @@ public class OrderController : BaseController
             throw UserFriendlyException.SameMessage("未知工单,无法发布");
             throw UserFriendlyException.SameMessage("未知工单,无法发布");
 
 
         var res = new PublishOrderPageBaseDto() { SourceChannel = order.SourceChannel, OrderTitle = order.Title, Content = order.Content, ActualOpinion = order.ActualOpinion };
         var res = new PublishOrderPageBaseDto() { SourceChannel = order.SourceChannel, OrderTitle = order.Title, Content = order.Content, ActualOpinion = order.ActualOpinion };
-        var (idName, idNames) = await _workflowDomainService.GetNoVisiteOrgsAsync(order.WorkflowId, HttpContext.RequestAborted);
+        var (idName, idNames) = await _workflowDomainService.GetUnvisitOrgsAsync(order.WorkflowId, HttpContext.RequestAborted);
         res.ActualHandleOrgName = idName;
         res.ActualHandleOrgName = idName;
         res.idNames = idNames.ToList();
         res.idNames = idNames.ToList();
         return res;
         return res;

+ 0 - 1
src/Hotline.Api/Controllers/UserController.cs

@@ -8,7 +8,6 @@ using MapsterMapper;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc;
 using XF.Domain.Authentications;
 using XF.Domain.Authentications;
 using XF.Domain.Exceptions;
 using XF.Domain.Exceptions;
-using XF.Utility.AppIdentityModel;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Users;
 using Hotline.Share.Dtos.Users;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Order;

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

@@ -125,7 +125,7 @@ public class WorkflowController : BaseController
 
 
         var (total, items) = await _definitionRepository.Queryable()
         var (total, items) = await _definitionRepository.Queryable()
             .WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)
             .WhereIF(dto.Status.HasValue, d => d.Status == dto.Status)
-            .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Code.Contains(dto.Keyword) || d.Name.Contains(dto.Keyword))
+            .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Code.Contains(dto.Keyword!) || d.Name.Contains(dto.Keyword!))
             .OrderBy(d => d.Status)
             .OrderBy(d => d.Status)
             .OrderBy(d => d.Code)
             .OrderBy(d => d.Code)
             .OrderByDescending(d => d.CreationTime)
             .OrderByDescending(d => d.CreationTime)

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

@@ -213,16 +213,18 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
             case EHandlerType.OrgLevel:
             case EHandlerType.OrgLevel:
                 //当前操作人所属部门的下级部门并且属于配置orgLevel的部门
                 //当前操作人所属部门的下级部门并且属于配置orgLevel的部门
                 var levels = stepDefine.HandlerClassifies.Select(d => d.Id).Select(d => int.Parse(d));
                 var levels = stepDefine.HandlerClassifies.Select(d => d.Id).Select(d => int.Parse(d));
+                var levelOneOrg = _sessionContext.RequiredOrgCode.GetOrgUpper();
                 var orgs1 = await _organizeRepository.QueryAsync(d =>
                 var orgs1 = await _organizeRepository.QueryAsync(d =>
-                    d.IsEnable && d.OrgCode.StartsWith(_sessionContext.RequiredOrgCode) &&
+                    d.IsEnable && d.OrgCode.StartsWith(levelOneOrg) &&
                     levels.Contains(d.OrgLevel));
                     levels.Contains(d.OrgLevel));
                 return orgs1.Select(d => new KeyValuePair<string, string>(d.OrgCode, d.OrgName))
                 return orgs1.Select(d => new KeyValuePair<string, string>(d.OrgCode, d.OrgName))
                     .ToList();
                     .ToList();
             case EHandlerType.OrgType:
             case EHandlerType.OrgType:
                 var types = stepDefine.HandlerClassifies.Select(d => d.Id)
                 var types = stepDefine.HandlerClassifies.Select(d => d.Id)
                     .Select(d => Enum.Parse<EOrgType>(d));
                     .Select(d => Enum.Parse<EOrgType>(d));
+                var levelOneOrg1 = _sessionContext.RequiredOrgCode.GetOrgUpper();
                 var org2 = await _organizeRepository.QueryAsync(d =>
                 var org2 = await _organizeRepository.QueryAsync(d =>
-                    d.IsEnable && d.OrgCode.StartsWith(_sessionContext.RequiredOrgCode) &&
+                    d.IsEnable && d.OrgCode.StartsWith(levelOneOrg1) &&
                     types.Contains(d.OrgType));
                     types.Contains(d.OrgType));
                 return org2.Select(d => new KeyValuePair<string, string>(d.OrgCode, d.OrgName))
                 return org2.Select(d => new KeyValuePair<string, string>(d.OrgCode, d.OrgName))
                     .ToList();
                     .ToList();

+ 26 - 5
src/Hotline.Application/Handlers/FlowEngine/EndWorkflowHandler.cs

@@ -1,10 +1,15 @@
-using Hotline.CallCenter.Tels;
+using DotNetCore.CAP;
+using Hotline.CallCenter.Tels;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.Workflows;
 using Hotline.FlowEngine.Workflows;
 using Hotline.KnowledgeBase;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
 using Hotline.Orders;
+using Hotline.Repository.SqlSugar.Orders;
 using Hotline.Settings;
 using Hotline.Settings;
+using Hotline.Share.Dtos.Order;
+using Hotline.Share.Mq;
+using MapsterMapper;
 using MediatR;
 using MediatR;
 using XF.Domain.Exceptions;
 using XF.Domain.Exceptions;
 
 
@@ -18,13 +23,19 @@ public class EndWorkflowHandler : INotificationHandler<EndWorkflowNotify>
     private readonly ITelDomainService _telDomainService;
     private readonly ITelDomainService _telDomainService;
     private readonly IWorkflowDomainService _workflowDomainService;
     private readonly IWorkflowDomainService _workflowDomainService;
     private readonly ISystemOrganizeRepository _orgRepository;
     private readonly ISystemOrganizeRepository _orgRepository;
+    private readonly IOrderRepository _orderRepository;
+    private readonly ICapPublisher _capPublisher;
+    private readonly IMapper _mapper;
 
 
     public EndWorkflowHandler(
     public EndWorkflowHandler(
         IKnowledgeDomainService knowledgeDomainService,
         IKnowledgeDomainService knowledgeDomainService,
         IOrderDomainService orderDomainService,
         IOrderDomainService orderDomainService,
         ITelDomainService telDomainService,
         ITelDomainService telDomainService,
         IWorkflowDomainService workflowDomainService,
         IWorkflowDomainService workflowDomainService,
-        ISystemOrganizeRepository orgRepository
+        ISystemOrganizeRepository orgRepository,
+        IOrderRepository orderRepository,
+        ICapPublisher capPublisher,
+        IMapper mapper
         )
         )
     {
     {
         _knowledgeDomainService = knowledgeDomainService;
         _knowledgeDomainService = knowledgeDomainService;
@@ -32,6 +43,9 @@ public class EndWorkflowHandler : INotificationHandler<EndWorkflowNotify>
         _telDomainService = telDomainService;
         _telDomainService = telDomainService;
         _workflowDomainService = workflowDomainService;
         _workflowDomainService = workflowDomainService;
         _orgRepository = orgRepository;
         _orgRepository = orgRepository;
+        _orderRepository = orderRepository;
+        _capPublisher = capPublisher;
+        _mapper = mapper;
     }
     }
 
 
     /// <summary>Handles a notification</summary>
     /// <summary>Handles a notification</summary>
@@ -54,14 +68,21 @@ public class EndWorkflowHandler : INotificationHandler<EndWorkflowNotify>
                 break;
                 break;
 
 
             case WorkflowModuleConsts.OrderManage:
             case WorkflowModuleConsts.OrderManage:
-                var levelOneOrg = workflow.ActualHandleOrgCode.GetOrgLevel();
+                var levelOneOrg = workflow.ActualHandleOrgCode.GetOrgUpper();
                 var org = await _orgRepository.GetAsync(d => d.OrgCode == levelOneOrg, cancellationToken);
                 var org = await _orgRepository.GetAsync(d => d.OrgCode == levelOneOrg, cancellationToken);
                 if (org is null)
                 if (org is null)
                     throw new UserFriendlyException($"无效部门编码, levelOneOrg: {levelOneOrg}", "无效部门编码");
                     throw new UserFriendlyException($"无效部门编码, levelOneOrg: {levelOneOrg}", "无效部门编码");
-
                 await _workflowDomainService.UpdateOrgLevelOneAsync(workflow, org.OrgCode, org.OrgName, cancellationToken);
                 await _workflowDomainService.UpdateOrgLevelOneAsync(workflow, org.OrgCode, org.OrgName, cancellationToken);
 
 
-                await _orderDomainService.ManageFlowEndAsync(workflow.ExternalId, cancellationToken);
+                var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                order.CheckIfFiled();
+                _mapper.Map(workflow, order);
+                order.Filed();
+                await _orderRepository.UpdateAsync(order, cancellationToken);
+                
+                await _capPublisher.PublishAsync(EventNames.HotlineOrderFiled, _mapper.Map<OrderDto>(order),
+                    cancellationToken: cancellationToken);
+                
                 break;
                 break;
         }
         }
     }
     }

+ 25 - 2
src/Hotline.Application/Handlers/FlowEngine/JumpHandler.cs

@@ -1,6 +1,11 @@
-using Hotline.FlowEngine.Notifications;
+using DotNetCore.CAP;
+using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.WfModules;
 using Hotline.Orders;
 using Hotline.Orders;
+using Hotline.Repository.SqlSugar.Orders;
+using Hotline.Share.Dtos.Order;
+using Hotline.Share.Mq;
+using MapsterMapper;
 using MediatR;
 using MediatR;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 
 
@@ -9,13 +14,22 @@ namespace Hotline.Application.Handlers.FlowEngine;
 public class JumpHandler : INotificationHandler<JumpNotify>
 public class JumpHandler : INotificationHandler<JumpNotify>
 {
 {
     private readonly IOrderDomainService _orderDomainService;
     private readonly IOrderDomainService _orderDomainService;
+    private readonly IOrderRepository _orderRepository;
+    private readonly ICapPublisher _capPublisher;
+    private readonly IMapper _mapper;
     private readonly ILogger<JumpHandler> _logger;
     private readonly ILogger<JumpHandler> _logger;
 
 
     public JumpHandler(
     public JumpHandler(
         IOrderDomainService orderDomainService,
         IOrderDomainService orderDomainService,
+        IOrderRepository orderRepository,
+        ICapPublisher capPublisher,
+        IMapper mapper,
         ILogger<JumpHandler> logger)
         ILogger<JumpHandler> logger)
     {
     {
         _orderDomainService = orderDomainService;
         _orderDomainService = orderDomainService;
+        _orderRepository = orderRepository;
+        _capPublisher = capPublisher;
+        _mapper = mapper;
         _logger = logger;
         _logger = logger;
     }
     }
 
 
@@ -30,7 +44,16 @@ public class JumpHandler : INotificationHandler<JumpNotify>
         switch (workflow.ModuleCode)
         switch (workflow.ModuleCode)
         {
         {
             case WorkflowModuleConsts.OrderManage:
             case WorkflowModuleConsts.OrderManage:
-                await _orderDomainService.ManageFlowJumpAsync(workflow.Id, notification.FlowAssignInfo, cancellationToken);
+                var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                _mapper.Map(workflow, order);
+                await _orderRepository.UpdateAsync(order, cancellationToken);
+
+                if (notification.IsOrgToCenter || notification.IsCenterToOrg)
+                {
+                    var dto = _mapper.Map<OrderDto>(order);
+                    await _capPublisher.PublishAsync(EventNames.HotlineOrderExpiredTimeUpdate, dto, cancellationToken: cancellationToken);
+                }
+
                 break;
                 break;
         }
         }
     }
     }

+ 20 - 12
src/Hotline.Application/Handlers/FlowEngine/NextStepHandler.cs

@@ -5,6 +5,8 @@ using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.Workflows;
 using Hotline.FlowEngine.Workflows;
 using Hotline.KnowledgeBase;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
 using Hotline.Orders;
+using Hotline.Repository.SqlSugar.Orders;
+using Hotline.Settings;
 using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Order;
@@ -21,20 +23,23 @@ namespace Hotline.Application.Handlers.FlowEngine;
 public class NextStepHandler : INotificationHandler<NextStepNotify>
 public class NextStepHandler : INotificationHandler<NextStepNotify>
 {
 {
     private readonly IOrderDomainService _orderDomainService;
     private readonly IOrderDomainService _orderDomainService;
-    private readonly ILogger<NextStepHandler> _logger;
     private readonly IKnowledgeDomainService _knowledgeDomainService;
     private readonly IKnowledgeDomainService _knowledgeDomainService;
+    private readonly IOrderRepository _orderRepository;
     private readonly ICapPublisher _capPublisher;
     private readonly ICapPublisher _capPublisher;
     private readonly IMapper _mapper;
     private readonly IMapper _mapper;
+    private readonly ILogger<NextStepHandler> _logger;
 
 
     public NextStepHandler(
     public NextStepHandler(
         IOrderDomainService orderDomainService,
         IOrderDomainService orderDomainService,
         IKnowledgeDomainService knowledgeDomainService,
         IKnowledgeDomainService knowledgeDomainService,
+        IOrderRepository orderRepository,
         ICapPublisher capPublisher,
         ICapPublisher capPublisher,
         IMapper mapper,
         IMapper mapper,
         ILogger<NextStepHandler> logger)
         ILogger<NextStepHandler> logger)
     {
     {
         _orderDomainService = orderDomainService;
         _orderDomainService = orderDomainService;
         _knowledgeDomainService = knowledgeDomainService;
         _knowledgeDomainService = knowledgeDomainService;
+        _orderRepository = orderRepository;
         _capPublisher = capPublisher;
         _capPublisher = capPublisher;
         _mapper = mapper;
         _mapper = mapper;
         _logger = logger;
         _logger = logger;
@@ -48,23 +53,26 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
         _logger.LogInformation($"收到{nameof(NextStepNotify)}, notification: {JsonConvert.SerializeObject(notification)}");
         _logger.LogInformation($"收到{nameof(NextStepNotify)}, notification: {JsonConvert.SerializeObject(notification)}");
         var workflow = notification.Workflow;
         var workflow = notification.Workflow;
         var data = notification.Dto;
         var data = notification.Dto;
-        //var assignMode = await _workflowApplication.GetFlowAssignModeAsync(notification.StepDefine,
-        //    data.NextHandlers.Select(d => d.Id).ToList(), cancellationToken);
-
+        
         switch (workflow.ModuleCode)
         switch (workflow.ModuleCode)
         {
         {
             case WorkflowModuleConsts.OrderManage:
             case WorkflowModuleConsts.OrderManage:
                 var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
                 var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                order.CheckIfFiled();
                 _mapper.Map(workflow, order);
                 _mapper.Map(workflow, order);
-                var orderDto = await _orderDomainService.ManageFlowNextAsync(notification.FlowAssignInfo, order,
-                    notification.IsFromCenterToOrg, workflow.IsInCountersign(), cancellationToken);
+                await _orderRepository.UpdateAsync(order, cancellationToken);
+
+                var orderDto = _mapper.Map<OrderDto>(order);
+                if (notification.IsCenterToOrg)
+                    await _capPublisher.PublishAsync(EventNames.HotlineOrderExpiredTimeUpdate, orderDto, cancellationToken: cancellationToken);
+
+                if (notification.HandlerOrgCode.CheckIfOrgLevelIs(1))
+                    await _capPublisher.PublishAsync(EventNames.HotlineOrderLevelOneOrgHandled, new OrderFlowDto
+                    {
+                        Order = orderDto,
+                        WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
+                    }, cancellationToken: cancellationToken);
 
 
-                await _capPublisher.PublishAsync(EventNames.HotlineOrderFlow, new OrderFlowDto
-                {
-                    Order = orderDto,
-                    WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
-                },
-                    cancellationToken: cancellationToken);
                 break;
                 break;
             case WorkflowModuleConsts.KnowledgeAdd:
             case WorkflowModuleConsts.KnowledgeAdd:
             case WorkflowModuleConsts.KnowledgeUpdate:
             case WorkflowModuleConsts.KnowledgeUpdate:

+ 17 - 3
src/Hotline.Application/Handlers/FlowEngine/PreviousStepHandler.cs

@@ -3,11 +3,14 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using DotNetCore.CAP;
 using Hotline.CallCenter.Tels;
 using Hotline.CallCenter.Tels;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.WfModules;
 using Hotline.KnowledgeBase;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
 using Hotline.Orders;
+using Hotline.Share.Dtos.Order;
+using Hotline.Share.Mq;
 using MapsterMapper;
 using MapsterMapper;
 using MediatR;
 using MediatR;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
@@ -17,13 +20,19 @@ namespace Hotline.Application.Handlers.FlowEngine
     public class PreviousStepHandler : INotificationHandler<PreviousNotify>
     public class PreviousStepHandler : INotificationHandler<PreviousNotify>
     {
     {
         private readonly IOrderDomainService _orderDomainService;
         private readonly IOrderDomainService _orderDomainService;
+        private readonly IOrderRepository _orderRepository;
+        private readonly ICapPublisher _capPublisher;
         private readonly IMapper _mapper;
         private readonly IMapper _mapper;
 
 
         public PreviousStepHandler(
         public PreviousStepHandler(
             IOrderDomainService orderDomainService,
             IOrderDomainService orderDomainService,
+            IOrderRepository orderRepository,
+            ICapPublisher capPublisher,
             IMapper mapper)
             IMapper mapper)
         {
         {
             _orderDomainService = orderDomainService;
             _orderDomainService = orderDomainService;
+            _orderRepository = orderRepository;
+            _capPublisher = capPublisher;
             _mapper = mapper;
             _mapper = mapper;
         }
         }
 
 
@@ -32,7 +41,6 @@ namespace Hotline.Application.Handlers.FlowEngine
         /// <param name="cancellationToken">Cancellation token</param>
         /// <param name="cancellationToken">Cancellation token</param>
         public async Task Handle(PreviousNotify notification, CancellationToken cancellationToken)
         public async Task Handle(PreviousNotify notification, CancellationToken cancellationToken)
         {
         {
-            //todo 1.query order 2.remove depCode from assignDepCodes, userId from assignUserIds
             var workflow = notification.Workflow;
             var workflow = notification.Workflow;
             var data = notification.Dto;
             var data = notification.Dto;
 
 
@@ -40,9 +48,15 @@ namespace Hotline.Application.Handlers.FlowEngine
             {
             {
                 case WorkflowModuleConsts.OrderManage:
                 case WorkflowModuleConsts.OrderManage:
                     var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
                     var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                    order.CheckIfFiled();
                     _mapper.Map(workflow, order);
                     _mapper.Map(workflow, order);
-                    //todo 退回是否推送省12345?退回/撤销/跳转操作是否影响省12345数据?
-                    await _orderDomainService.ManageFlowPreviousAsync(order, false, workflow.IsInCountersign(), cancellationToken);
+                    await _orderRepository.UpdateAsync(order, cancellationToken);
+                    if (notification.IsOrgToCenter)
+                    {
+                        var dto = _mapper.Map<OrderDto>(order);
+                        await _capPublisher.PublishAsync(EventNames.HotlineOrderExpiredTimeUpdate, dto, cancellationToken: cancellationToken);
+                    }
+
                     break;
                     break;
                 case WorkflowModuleConsts.KnowledgeAdd:
                 case WorkflowModuleConsts.KnowledgeAdd:
                 case WorkflowModuleConsts.KnowledgeUpdate:
                 case WorkflowModuleConsts.KnowledgeUpdate:

+ 61 - 0
src/Hotline.Application/Handlers/FlowEngine/RecallStepHandler.cs

@@ -0,0 +1,61 @@
+using DotNetCore.CAP;
+using Hotline.FlowEngine.Notifications;
+using Hotline.FlowEngine.WfModules;
+using Hotline.Orders;
+using Hotline.Repository.SqlSugar.Orders;
+using Hotline.Share.Dtos.Order;
+using Hotline.Share.Mq;
+using MapsterMapper;
+using MediatR;
+
+namespace Hotline.Application.Handlers.FlowEngine;
+
+public class RecallStepHandler : INotificationHandler<RecallNotify>
+{
+    private readonly IOrderDomainService _orderDomainService;
+    private readonly IOrderRepository _orderRepository;
+    private readonly ICapPublisher _capPublisher;
+    private readonly IMapper _mapper;
+
+    public RecallStepHandler(
+        IOrderDomainService orderDomainService,
+        IOrderRepository orderRepository,
+        ICapPublisher capPublisher,
+        IMapper mapper)
+    {
+        _orderDomainService = orderDomainService;
+        _orderRepository = orderRepository;
+        _capPublisher = capPublisher;
+        _mapper = mapper;
+    }
+
+    /// <summary>Handles a notification</summary>
+    /// <param name="notification">The notification</param>
+    /// <param name="cancellationToken">Cancellation token</param>
+    public async Task Handle(RecallNotify notification, CancellationToken cancellationToken)
+    {
+        var workflow = notification.Workflow;
+        var data = notification.Dto;
+
+        switch (workflow.ModuleCode)
+        {
+            case WorkflowModuleConsts.OrderManage:
+                var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                _mapper.Map(workflow, order);
+                await _orderRepository.UpdateAsync(order, cancellationToken);
+
+                if (notification.IsOrgToCenter)
+                {
+                    var dto = _mapper.Map<OrderDto>(order);
+                    await _capPublisher.PublishAsync(EventNames.HotlineOrderExpiredTimeUpdate, dto, cancellationToken: cancellationToken);
+                }
+                
+                break;
+            case WorkflowModuleConsts.KnowledgeAdd:
+            case WorkflowModuleConsts.KnowledgeUpdate:
+            case WorkflowModuleConsts.KnowledgeDelete:
+            case WorkflowModuleConsts.TelRestApply:
+                break;
+        }
+    }
+}

+ 13 - 1
src/Hotline.Application/Handlers/FlowEngine/StartWorkflowHandler.cs

@@ -1,12 +1,15 @@
 using System.Text.Encodings.Web;
 using System.Text.Encodings.Web;
 using System.Text.Json;
 using System.Text.Json;
 using System.Text.Unicode;
 using System.Text.Unicode;
+using DotNetCore.CAP;
 using Hotline.CallCenter.Tels;
 using Hotline.CallCenter.Tels;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.Notifications;
 using Hotline.FlowEngine.WfModules;
 using Hotline.FlowEngine.WfModules;
 using Hotline.KnowledgeBase;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
 using Hotline.Orders;
+using Hotline.Share.Dtos.Order;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Order;
+using Hotline.Share.Mq;
 using MapsterMapper;
 using MapsterMapper;
 using MediatR;
 using MediatR;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
@@ -18,6 +21,8 @@ namespace Hotline.Application.Handlers.FlowEngine
         private readonly IOrderDomainService _orderDomainService;
         private readonly IOrderDomainService _orderDomainService;
         private readonly IKnowledgeDomainService _knowledgeDomainService;
         private readonly IKnowledgeDomainService _knowledgeDomainService;
         private readonly ITelDomainService _telDomainService;
         private readonly ITelDomainService _telDomainService;
+        private readonly IOrderRepository _orderRepository;
+        private readonly ICapPublisher _capPublisher;
         private readonly IMapper _mapper;
         private readonly IMapper _mapper;
         private readonly ILogger<StartWorkflowHandler> _logger;
         private readonly ILogger<StartWorkflowHandler> _logger;
 
 
@@ -25,12 +30,16 @@ namespace Hotline.Application.Handlers.FlowEngine
             IOrderDomainService orderDomainService,
             IOrderDomainService orderDomainService,
             IKnowledgeDomainService knowledgeDomainService,
             IKnowledgeDomainService knowledgeDomainService,
             ITelDomainService telDomainService,
             ITelDomainService telDomainService,
+            IOrderRepository orderRepository,
+            ICapPublisher capPublisher,
             IMapper mapper,
             IMapper mapper,
             ILogger<StartWorkflowHandler> logger)
             ILogger<StartWorkflowHandler> logger)
         {
         {
             _orderDomainService = orderDomainService;
             _orderDomainService = orderDomainService;
             _knowledgeDomainService = knowledgeDomainService;
             _knowledgeDomainService = knowledgeDomainService;
             _telDomainService = telDomainService;
             _telDomainService = telDomainService;
+            _orderRepository = orderRepository;
+            _capPublisher = capPublisher;
             _mapper = mapper;
             _mapper = mapper;
             _logger = logger;
             _logger = logger;
         }
         }
@@ -50,8 +59,11 @@ namespace Hotline.Application.Handlers.FlowEngine
             {
             {
                 case WorkflowModuleConsts.OrderManage:
                 case WorkflowModuleConsts.OrderManage:
                     var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
                     var order = await _orderDomainService.GetOrderAsync(workflow.ExternalId, cancellationToken);
+                    order.CheckIfFiled();
                     _mapper.Map(workflow, order);
                     _mapper.Map(workflow, order);
-                    await _orderDomainService.ManageFlowStartAsync(notification.FlowAssignInfo, order, workflow.IsInCountersign(), cancellationToken);
+                    await _orderRepository.UpdateAsync(order, cancellationToken);
+                    await _capPublisher.PublishAsync(EventNames.HotlineOrderFlowStarted, _mapper.Map<OrderDto>(order),
+                        cancellationToken: cancellationToken);
                     break;
                     break;
                 case WorkflowModuleConsts.KnowledgeAdd:
                 case WorkflowModuleConsts.KnowledgeAdd:
                 case WorkflowModuleConsts.KnowledgeUpdate:
                 case WorkflowModuleConsts.KnowledgeUpdate:

+ 2 - 1
src/Hotline.Application/Identity/IdentityAppService.cs

@@ -10,7 +10,6 @@ using XF.Domain.Authentications;
 using XF.Domain.Dependency;
 using XF.Domain.Dependency;
 using XF.Domain.Exceptions;
 using XF.Domain.Exceptions;
 using XF.Domain.Options;
 using XF.Domain.Options;
-using XF.Utility.AppIdentityModel;
 
 
 namespace Hotline.Application.Identity;
 namespace Hotline.Application.Identity;
 
 
@@ -83,6 +82,8 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
             new(AppClaimTypes.DepartmentId, user.OrgId??string.Empty),
             new(AppClaimTypes.DepartmentId, user.OrgId??string.Empty),
             new(AppClaimTypes.DepartmentCode, user.OrgCode??string.Empty),
             new(AppClaimTypes.DepartmentCode, user.OrgCode??string.Empty),
             new(AppClaimTypes.DepartmentName, user.Organization?.OrgName??string.Empty),
             new(AppClaimTypes.DepartmentName, user.Organization?.OrgName??string.Empty),
+            new(AppClaimTypes.DepartmentAreaCode, user.Organization?.AreaCode??string.Empty),
+            new(AppClaimTypes.DepartmentAreaName, user.Organization?.AreaName??string.Empty),
             new(AppClaimTypes.StaffNo, user.StaffNo),
             new(AppClaimTypes.StaffNo, user.StaffNo),
         };
         };
         claims.AddRange(account.Roles.Select(d => new Claim(JwtClaimTypes.Role, d.Name)));
         claims.AddRange(account.Roles.Select(d => new Claim(JwtClaimTypes.Role, d.Name)));

+ 5 - 0
src/Hotline.Application/Mappers/MapperConfigs.cs

@@ -15,6 +15,7 @@ using Hotline.Share.Dtos.Roles;
 using Hotline.Share.Dtos.Users;
 using Hotline.Share.Dtos.Users;
 using Hotline.Users;
 using Hotline.Users;
 using Mapster;
 using Mapster;
+using XF.Domain.Entities;
 
 
 namespace Hotline.Application.Mappers
 namespace Hotline.Application.Mappers
 {
 {
@@ -211,6 +212,10 @@ namespace Hotline.Application.Mappers
                 .Map(d => d.AssignUserIds, s => s.AssignUserIds)
                 .Map(d => d.AssignUserIds, s => s.AssignUserIds)
                 .Map(d => d.AssignOrgCodes, s => s.AssignOrgCodes)
                 .Map(d => d.AssignOrgCodes, s => s.AssignOrgCodes)
                 .IgnoreNonMapped(true)
                 .IgnoreNonMapped(true)
+                .AfterMapping((s, d) =>
+                {
+                    d.UpdateHandlingStatus(s.IsInCountersign());
+                })
                 ;
                 ;
 
 
             #endregion
             #endregion

+ 14 - 0
src/Hotline.Share/Dtos/Order/CallConnectOrderDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Dtos.Order
+{
+    public class CallConnectOrderDto
+    {
+        public OrderDto Order { get; set; }
+        //todo 补充calldto
+    }
+}

+ 14 - 0
src/Hotline.Share/Mq/EventNames.Call.cs

@@ -0,0 +1,14 @@
+namespace Hotline.Share.Mq;
+
+public partial class EventNames
+{
+    /// <summary>
+    /// 挂断电话
+    /// </summary>
+    public const string HotlineCallBye= "hotline.call.bye";
+
+    /// <summary>
+    /// 通话记录与工单关联
+    /// </summary>
+    public const string HotlineCallConnectWithOrder = "hotline.call.connect.order";
+}

+ 30 - 0
src/Hotline.Share/Mq/EventNames.Knowledge.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Mq
+{
+    public partial class EventNames
+    {
+        #region 知识库
+
+        /// <summary>
+        /// 知识库上报
+        /// </summary>
+        public const string HotlineKnowledgeAdd = "hotline.knowledge.add";
+
+        /// <summary>
+        /// 知识库变更
+        /// </summary>
+        public const string HotlineKnowledgeUpdate = "hotline.knowledge.update";
+
+        /// <summary>
+        /// 知识库下架
+        /// </summary>
+        public const string HotlineKnowledgeRemove = "hotline.knowledge.remove";
+
+        #endregion
+    }
+}

+ 41 - 0
src/Hotline.Share/Mq/EventNames.Order.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Mq
+{
+    public partial class EventNames
+    {
+        /// <summary>
+        /// 热线工单流程开启
+        /// </summary>
+        public const string HotlineOrderFlowStarted = "hotline.order.flow.started";
+
+        /// <summary>
+        /// 热线工单期满时间变更
+        /// </summary>
+        public const string HotlineOrderExpiredTimeUpdate = "hotline.order.expiredtime.update";
+
+        /// <summary>
+        /// 热线工单一级部门办理完
+        /// </summary>
+        public const string HotlineOrderLevelOneOrgHandled = "hotline.order.leveloneorg.handled";
+
+        /// <summary>
+        /// 热线工单归档---服务工单结果
+        /// </summary>
+        public const string HotlineOrderFiled = "hotline.order.filed";
+
+        /// <summary>
+        /// 回访完成
+        /// </summary>
+        public const string HotlineOrderVisited = "hotline.order.visited";
+
+        ///// <summary>
+        ///// 甄别通过
+        ///// </summary>
+        public const string HotlineOrderScreenSuccess = "hotline.order.screen.success";
+    }
+}

+ 0 - 240
src/Hotline.Share/Mq/EventNames.Province.cs

@@ -1,240 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Hotline.Share.Mq
-{
-    public partial class EventNames
-    {
-        #region 下行(省上向市州推送)
-        /// <summary>
-        /// 服务工单交办
-        /// </summary>
-        public const string HotlineOrderReceiveCaseInfo = "hotline.order.receivecaseinfo";
-
-        /// <summary>
-        /// 服务工单退回反馈
-        /// </summary>
-        public const string HotlineOrderGetCaseBackResult = "hotline.order.getcasebackresult";
-
-        /// <summary>
-        /// 服务工单延时审核结果
-        /// </summary>
-        public const string HotlineOrderDelayCaseResultReceive = "hotline.order.delaycaseresultreceive";
-
-        /// <summary>
-        /// 服务工单交办补充诉求
-        /// </summary>
-        public const string HotlineOrderSupplyCaseInfoReceive = "hotline.order.supplycaseinforeceive";
-
-        /// <summary>
-        /// 服务工单撤单
-        /// </summary>
-        public const string HotlineOrderRevokeCaseInfo = "hotline.order.revokecaseinfo";
-
-        /// <summary>
-        /// 服务工单催单
-        /// </summary>
-        public const string HotlineOrderRemindCaseInfo = "hotline.order.remindcaseinfo";
-
-        /// <summary>
-        /// 服务工单预警
-        /// </summary>
-        public const string HotlineOrderSendWarnInfo = "hotline.order.sendwarninfo";
-
-        /// <summary>
-        /// 督办工单派发
-        /// </summary>
-        public const string HotlineOrderSendSuperviseInfo = "hotline.order.sendsuperviseinfo";
-
-        /// <summary>
-        /// 服务工单甄别结果
-        /// </summary>
-        public const string HotlineOrderScreenCaseResultReceive = "hotline.order.screencaseresultreceive";
-
-        /// <summary>
-        /// 交办工单满意度接收
-        /// </summary>
-        public const string HotlineOrderSendCaseEvlResult = "hotline.order.sendcaseevlresult";
-
-        /// <summary>
-        /// 上报工单处理结果/退回
-        /// </summary>
-        public const string HotlineOrderGetCaseReultSend = "hotline.order.getcasereultsend";
-
-        /// <summary>
-        /// 上报工单评价
-        /// </summary>
-        public const string HotlineOrderGetVisitInfoSend = "hotline.order.getvisitinfosend";
-        #endregion
-
-        #region 上行(市州向省上推送)
-        #region 协同-第一批次
-
-        /// <summary>
-        /// 服务工单交办处理
-        /// </summary>
-        public const string HotlineOrderGetCaseResultReceive = "hotline.order.getcaseresultreceive";
-
-        /// <summary>
-        /// 服务工单交办处理过程
-        /// </summary>
-        public const string HotlineOrderGetCaseProcessReceive = "hotline.order.getcaseprocessreceive";
-
-        /// <summary>
-        /// 服务工单交办评价
-        /// </summary>
-        public const string HotlineOrderGetVisitInfoReceive = "hotline.order.getvisitinforeceive";
-
-        /// <summary>
-        /// 退回申请
-        /// </summary>
-        public const string HotlineOrderGetCaseBackApply = "hotline.order.getcasebackapply";
-
-        /// <summary>
-        /// 服务工单申请延时
-        /// </summary>
-        public const string HotlineOrderDelayCaseInfoSend = "hotline.order.delaycaseinfosend";
-
-        /// <summary>
-        /// 服务工单督办过程
-        /// </summary>
-        public const string HotlineOrderSendSuperviseProcessInfo = "hotline.order.sendsuperviseprocessinfo";
-
-        /// <summary>
-        /// 服务工单督办结果
-        /// </summary>
-        public const string HotlineOrderSendSuperviseResultInfo = "hotline.order.sendsuperviseresultinfo";
-
-        /// <summary>
-        /// 工单发起甄别
-        /// </summary>
-        public const string HotlineOrderScreenCaseInfoSend = "hotline.order.screencaseinfosend";
-
-        /// <summary>
-        /// 政民互动提交公开
-        /// </summary>
-        public const string HotlineOrderZMHDCaseInfoPublic = "hotline.order.zmhdcaseinfopublic";
-
-        /// <summary>
-        /// 服务工单拓展信息交办
-        /// </summary>
-        public const string HotlineOrderReceiveCaseExtends = "hotline.order.receivecaseextends";
-
-        /// <summary>
-        /// 材料接口
-        /// </summary>
-        public const string HotlineOrderGetCaseMaterialInfo = "hotline.order.getcasematerialinfo";
-        #endregion
-
-        #region 汇聚-第二批次
-        /// <summary>
-        /// 热线工单创建成功
-        /// </summary>
-        public const string HotlineOrderCreated = "hotline.order.created";
-
-        /// <summary>
-        /// 热线工单流转--服务工单处理
-        /// </summary>
-        public const string HotlineOrderFlow = "hotline.order.flow";
-
-        /// <summary>
-        /// 工单从中心派往部门
-        /// </summary>
-        public const string HotlineOrderCenterToOrg = "hotline.order.centertoorg";
-
-        /// <summary>
-        /// 热线工单归档---服务工单结果
-        /// </summary>
-        public const string HotlineOrderFiled = "hotline.order.filed";
-
-        /// <summary>
-        /// 工单发布
-        /// </summary>
-        public const string HotlineOrderPublished = "hotline.order.published";
-
-        /// <summary>
-        /// 服务工单处理结果
-        /// </summary>
-        public const string HotlineOrderSubmitCaseResult = "hotline.order.submitcaseresult";
-
-        /// <summary>
-        /// 服务工单处理
-        /// </summary>
-        public const string HotlineOrderSubmitCaseProcess = "hotline.order.submitcaseprocess";
-
-        /// <summary>
-        /// 服务工单回访评价
-        /// </summary>
-        public const string HotlineOrderSubmitVisitInfo = "hotline.order.submitvisitinfo";
-
-        /// <summary>
-        /// 电话记录
-        /// </summary>
-        public const string HotlineOrderSubmitCaseRecord = "hotline.order.submitcaserecord";
-
-        /// <summary>
-        /// 统计数据
-        /// </summary>
-        public const string HotlineOrderSubmitCaseTotal = "hotline.order.submitcasetotal";
-
-        /// <summary>
-        /// 服务工单拓展信息
-        /// </summary>
-        public const string HotlineOrderSubmitCaseExtends = "hotline.order.submitcaseextends";
-        #endregion
-
-        #region 协同-第三批次
-        /// <summary>
-        /// 服务工单上报
-        /// </summary>
-        public const string SendCaseInfo = "hotline.order.sendcaseinfo";
-
-        /// <summary>
-        /// 上报补充诉求
-        /// </summary>
-        public const string SupplyCaseInfoSend = "hotline.order.supplycaseinfosend";
-
-        /// <summary>
-        /// 服务工单撤单
-        /// </summary>
-        public const string SendRevokeCaseInfo = "hotline.order.sendrevokecaseinfo";
-
-        /// <summary>
-        /// 服务工单催单
-        /// </summary>
-        public const string SendRemindCaseInfo = "hotline.order.sendremindcaseinfo";
-
-        #endregion
-
-        #region  协同-第四批次
-
-        #region 知识库
-        /// <summary>
-        /// 知识库上报
-        /// </summary>
-        public const string HotlineKnowledgeInfoSend = "hotline.knowledge.infosend";
-
-        /// <summary>
-        /// 知识库变更
-        /// </summary>
-        public const string HotlineKnowledgeInfoUpdate = "hotline.knowledge.infoupdate";
-
-        /// <summary>
-        /// 知识库下架
-        /// </summary>
-        public const string HotlineKnowledgeInfoAbandon = "hotline.knowledge.infoabandon";
-
-        #endregion
-
-        /// <summary>
-        /// 统计数据
-        /// </summary>
-        public const string HotlineSendRealTimeStatus = "hotline.order.sendrealtimestatus";
-        #endregion
-        #endregion
-
-    }
-}

+ 10 - 4
src/Hotline/FlowEngine/Notifications/WorkflowNotify.cs

@@ -9,19 +9,25 @@ public record WorkflowNotify(Workflow Workflow, BasicWorkflowDto Dto) : INotific
 
 
 public record StartWorkflowNotify(Workflow Workflow, BasicWorkflowDto Dto, FlowAssignInfo FlowAssignInfo) : WorkflowNotify(Workflow, Dto);
 public record StartWorkflowNotify(Workflow Workflow, BasicWorkflowDto Dto, FlowAssignInfo FlowAssignInfo) : WorkflowNotify(Workflow, Dto);
 
 
-public record NextStepNotify(Workflow Workflow, BasicWorkflowDto Dto, WorkflowTrace Trace, bool IsFromCenterToOrg, bool IsCountersignStart, bool IsCountersignEnd, FlowAssignInfo FlowAssignInfo) : WorkflowNotify(Workflow, Dto);
+public record NextStepNotify(Workflow Workflow, BasicWorkflowDto Dto, WorkflowTrace Trace,
+    bool IsCenterToOrg, bool IsCountersignStart, bool IsCountersignEnd, string HandlerOrgCode,
+    FlowAssignInfo FlowAssignInfo) : WorkflowNotify(Workflow, Dto);
 
 
 public record AcceptWorkflowNotify(Workflow Workflow) : INotification;
 public record AcceptWorkflowNotify(Workflow Workflow) : INotification;
 
 
+/// <summary>
+/// 会签汇总节点已指派(该汇总节点可以被接办/办理)
+/// </summary>
+/// <param name="Workflow"></param>
 public record CountersignEndAssigned(Workflow Workflow) : INotification;
 public record CountersignEndAssigned(Workflow Workflow) : INotification;
 
 
 public record CountersignStartAssigned(Workflow Workflow) : INotification;
 public record CountersignStartAssigned(Workflow Workflow) : INotification;
 
 
-public record PreviousNotify(Workflow Workflow, PreviousWorkflowDto Dto) : INotification;
+public record PreviousNotify(Workflow Workflow, PreviousWorkflowDto Dto, bool IsOrgToCenter) : INotification;
 
 
-public record RecallNotify(Workflow Workflow, NextWorkflowDto Dto) : INotification;
+public record RecallNotify(Workflow Workflow, NextWorkflowDto Dto, bool IsOrgToCenter) : INotification;
 
 
-public record JumpNotify(Workflow Workflow, NextWorkflowDto Dto, FlowAssignInfo FlowAssignInfo) : INotification;
+public record JumpNotify(Workflow Workflow, NextWorkflowDto Dto, FlowAssignInfo FlowAssignInfo, bool IsCenterToOrg, bool IsOrgToCenter) : INotification;
 
 
 public record EndWorkflowNotify(Workflow Workflow) : INotification;
 public record EndWorkflowNotify(Workflow Workflow) : INotification;
 
 

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

@@ -75,7 +75,7 @@ namespace Hotline.FlowEngine.Workflows
         /// <summary>
         /// <summary>
         /// 查询待回访部门
         /// 查询待回访部门
         /// </summary>
         /// </summary>
-        Task<(IdName, IReadOnlyList<IdName>)> GetNoVisiteOrgsAsync(string workflowId,
+        Task<(IdName, IReadOnlyList<IdName>)> GetUnvisitOrgsAsync(string workflowId,
             CancellationToken cancellationToken);
             CancellationToken cancellationToken);
 
 
         /// <summary>
         /// <summary>

+ 26 - 14
src/Hotline/FlowEngine/Workflows/WorkflowDomainService.cs

@@ -331,8 +331,8 @@ namespace Hotline.FlowEngine.Workflows
             }
             }
 
 
             //是否从中心流转出去,重新计算expiredTime 
             //是否从中心流转出去,重新计算expiredTime 
-            var isFromCenterToOrg = CheckIfFlowFromCenterToOrg(currentStepBox, nextStepBoxDefine);
-            if (isFromCenterToOrg)
+            var isCenterToOrg = CheckIfFlowFromCenterToOrg(currentStepBox, nextStepBoxDefine);
+            if (isCenterToOrg)
                 workflow.CenterToOrg(CalculateExpiredTime(workflow.Definition.Code));//todo 过期时间
                 workflow.CenterToOrg(CalculateExpiredTime(workflow.Definition.Code));//todo 过期时间
 
 
             ////最终办理意见与时间处理(解决工单业务需求,如果流程配置普通节点后未配置汇总节点则不会运行到此处)
             ////最终办理意见与时间处理(解决工单业务需求,如果流程配置普通节点后未配置汇总节点则不会运行到此处)
@@ -414,7 +414,9 @@ namespace Hotline.FlowEngine.Workflows
 
 
             #endregion
             #endregion
 
 
-            await _mediator.Publish(new NextStepNotify(workflow, dto, trace, isFromCenterToOrg, isStartCountersign, isCountersignOver, flowAssignInfo), cancellationToken);
+            await _mediator.Publish(new NextStepNotify(workflow, dto, trace,
+                isCenterToOrg, isStartCountersign, isCountersignOver,
+                _sessionContext.RequiredOrgCode, flowAssignInfo), cancellationToken);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -458,12 +460,13 @@ namespace Hotline.FlowEngine.Workflows
             workflow.UpdatePreviousHandlers(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgCode, newPrevStep);
             workflow.UpdatePreviousHandlers(_sessionContext.RequiredUserId, _sessionContext.RequiredOrgCode, newPrevStep);
 
 
             //orgToCenter会触发重新计算期满时间,1.无需审核按当前时间进行计算 2.需审核按审核通过时间计算
             //orgToCenter会触发重新计算期满时间,1.无需审核按当前时间进行计算 2.需审核按审核通过时间计算
-            if (CheckIfFlowFromOrgToCenter(currentStepBox, prevStepBox))
+            var isOrgToCenter = CheckIfFlowFromOrgToCenter(currentStepBox, prevStepBox);
+            if (isOrgToCenter)
                 workflow.OrgToCenter(CalculateExpiredTime(""));//todo 过期时间
                 workflow.OrgToCenter(CalculateExpiredTime(""));//todo 过期时间
 
 
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
 
 
-            await _mediator.Publish(new PreviousNotify(workflow, dto), cancellationToken);
+            await _mediator.Publish(new PreviousNotify(workflow, dto, isOrgToCenter), cancellationToken);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -481,13 +484,13 @@ namespace Hotline.FlowEngine.Workflows
             if (targetStepBox is null)
             if (targetStepBox is null)
                 throw UserFriendlyException.SameMessage("该流程尚未流转至该节点");
                 throw UserFriendlyException.SameMessage("该流程尚未流转至该节点");
 
 
-            await RecallAsync(workflow, dto, targetStepDefine, targetStepBox, EWorkflowTraceStatus.Recall, cancellationToken);
+            var isOrgToCenter = await RecallAsync(workflow, dto, targetStepDefine, targetStepBox, EWorkflowTraceStatus.Recall, cancellationToken);
 
 
             workflow.ResetHandlers(flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects);
             workflow.ResetHandlers(flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects);
 
 
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
 
 
-            await _mediator.Publish(new RecallNotify(workflow, dto), cancellationToken);
+            await _mediator.Publish(new RecallNotify(workflow, dto, isOrgToCenter), cancellationToken);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -501,6 +504,7 @@ namespace Hotline.FlowEngine.Workflows
             //update uncompleted traces
             //update uncompleted traces
             await JumpTraceAsync(workflow.Id, dto, cancellationToken);
             await JumpTraceAsync(workflow.Id, dto, cancellationToken);
 
 
+            bool isOrgToCenter = false, isCenterToOrg = false;
             var targetStepBox = workflow.StepBoxes.FirstOrDefault(d => d.Code == dto.NextStepCode);
             var targetStepBox = workflow.StepBoxes.FirstOrDefault(d => d.Code == dto.NextStepCode);
             if (targetStepBox == null)
             if (targetStepBox == null)
             {
             {
@@ -521,7 +525,7 @@ namespace Hotline.FlowEngine.Workflows
                 workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign, nextStep: targetStepBox.Steps.First());
                 workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign, nextStep: targetStepBox.Steps.First());
 
 
                 //calc workflow expired time
                 //calc workflow expired time
-                var isCenterToOrg = CheckIfFlowFromCenterToOrg(workflow, targetStepBox);
+                isCenterToOrg = CheckIfFlowFromCenterToOrg(workflow, targetStepBox);
                 if (isCenterToOrg)
                 if (isCenterToOrg)
                     workflow.ExpiredTime = CalculateExpiredTime("");
                     workflow.ExpiredTime = CalculateExpiredTime("");
 
 
@@ -553,13 +557,13 @@ namespace Hotline.FlowEngine.Workflows
             else
             else
             {
             {
                 //返回之前节点
                 //返回之前节点
-                await RecallAsync(workflow, dto, targetStepDefine, targetStepBox, EWorkflowTraceStatus.Jump, cancellationToken);
+                isOrgToCenter = await RecallAsync(workflow, dto, targetStepDefine, targetStepBox, EWorkflowTraceStatus.Jump, cancellationToken);
             }
             }
 
 
             workflow.ResetHandlers(flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects);
             workflow.ResetHandlers(flowAssignInfo.FlowAssignType, flowAssignInfo.HandlerObjects);
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
             await _workflowRepository.UpdateAsync(workflow, cancellationToken);
 
 
-            await _mediator.Publish(new JumpNotify(workflow, dto, flowAssignInfo), cancellationToken);
+            await _mediator.Publish(new JumpNotify(workflow, dto, flowAssignInfo, isCenterToOrg, isOrgToCenter), cancellationToken);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -616,7 +620,7 @@ namespace Hotline.FlowEngine.Workflows
         /// 查询待回访部门
         /// 查询待回访部门
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public async Task<(IdName, IReadOnlyList<IdName>)> GetNoVisiteOrgsAsync(string workflowId, CancellationToken cancellationToken)
+        public async Task<(IdName, IReadOnlyList<IdName>)> GetUnvisitOrgsAsync(string workflowId, CancellationToken cancellationToken)
         {
         {
             var workflow = await GetWorkflowAsync(workflowId, withSteps: true, cancellationToken: cancellationToken);
             var workflow = await GetWorkflowAsync(workflowId, withSteps: true, cancellationToken: cancellationToken);
             if (workflow.CounterSignType is not ECounterSignType.Center)
             if (workflow.CounterSignType is not ECounterSignType.Center)
@@ -684,6 +688,7 @@ namespace Hotline.FlowEngine.Workflows
             currentStep.Complete(
             currentStep.Complete(
                 _sessionContext.RequiredUserId, _sessionContext.UserName,
                 _sessionContext.RequiredUserId, _sessionContext.UserName,
                 _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
                 _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
+                _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
                 dto.NextStepCode);
                 dto.NextStepCode);
 
 
             //stepBox办理状态
             //stepBox办理状态
@@ -973,7 +978,7 @@ namespace Hotline.FlowEngine.Workflows
             return parentTrace;
             return parentTrace;
         }
         }
 
 
-        private async Task RecallAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, WorkflowStep targetStepBox, EWorkflowTraceStatus traceStatus, CancellationToken cancellationToken)
+        private async Task<bool> RecallAsync(Workflow workflow, NextWorkflowDto dto, StepDefine targetStepDefine, WorkflowStep targetStepBox, EWorkflowTraceStatus traceStatus, CancellationToken cancellationToken)
         {
         {
             //get targetStep's previous
             //get targetStep's previous
             var targetPrevStepBox = workflow.StepBoxes.FirstOrDefault(d => d.Id == targetStepBox.PreviousId);
             var targetPrevStepBox = workflow.StepBoxes.FirstOrDefault(d => d.Id == targetStepBox.PreviousId);
@@ -1005,6 +1010,8 @@ namespace Hotline.FlowEngine.Workflows
             var isOrgToCenter = CheckIfFlowFromOrgToCenter(workflow, targetStepBox);
             var isOrgToCenter = CheckIfFlowFromOrgToCenter(workflow, targetStepBox);
             if (isOrgToCenter)
             if (isOrgToCenter)
                 workflow.ExpiredTime = CalculateExpiredTime("");
                 workflow.ExpiredTime = CalculateExpiredTime("");
+
+            return isOrgToCenter;
         }
         }
 
 
         private ICollection<WorkflowStep> GetStepsBehindTargetStepBox(List<WorkflowStep> stepBoxes, WorkflowStep targetStepBox)
         private ICollection<WorkflowStep> GetStepsBehindTargetStepBox(List<WorkflowStep> stepBoxes, WorkflowStep targetStepBox)
@@ -1153,6 +1160,7 @@ namespace Hotline.FlowEngine.Workflows
             subStep.Complete(
             subStep.Complete(
                 _sessionContext.RequiredUserId, _sessionContext.UserName,
                 _sessionContext.RequiredUserId, _sessionContext.UserName,
                 _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
                 _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
+                _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
                 dto.NextStepCode);
                 dto.NextStepCode);
             _mapper.Map(dto, subStep);
             _mapper.Map(dto, subStep);
 
 
@@ -1175,7 +1183,9 @@ namespace Hotline.FlowEngine.Workflows
 
 
             //step办理状态
             //step办理状态
             subStep.Complete(_sessionContext.RequiredUserId, _sessionContext.UserName,
             subStep.Complete(_sessionContext.RequiredUserId, _sessionContext.UserName,
-                _sessionContext.RequiredOrgCode, _sessionContext.OrgName, nextStepCode);
+                _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
+                _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
+                nextStepCode);
 
 
             subStep.Opinion = "流程开启";
             subStep.Opinion = "流程开启";
             stepBox.Steps.Add(subStep);
             stepBox.Steps.Add(subStep);
@@ -1194,7 +1204,9 @@ namespace Hotline.FlowEngine.Workflows
             subStep.Accept(_sessionContext.RequiredUserId, _sessionContext.UserName, _sessionContext.RequiredOrgCode,
             subStep.Accept(_sessionContext.RequiredUserId, _sessionContext.UserName, _sessionContext.RequiredOrgCode,
                 _sessionContext.OrgName);
                 _sessionContext.OrgName);
             subStep.Complete(_sessionContext.RequiredUserId, _sessionContext.UserName,
             subStep.Complete(_sessionContext.RequiredUserId, _sessionContext.UserName,
-                _sessionContext.RequiredOrgCode, _sessionContext.OrgName, string.Empty);
+                _sessionContext.RequiredOrgCode, _sessionContext.OrgName,
+                _sessionContext.OrgAreaCode, _sessionContext.OrgAreaName,
+                string.Empty);
 
 
             currentStepBox.Steps.Add(subStep);
             currentStepBox.Steps.Add(subStep);
             await _workflowStepRepository.AddAsync(subStep, cancellationToken);
             await _workflowStepRepository.AddAsync(subStep, cancellationToken);

+ 3 - 1
src/Hotline/FlowEngine/Workflows/WorkflowStep.cs

@@ -115,12 +115,14 @@ public class WorkflowStep : StepBasicEntity
     /// <param name="userName"></param>
     /// <param name="userName"></param>
     /// <param name="orgCode"></param>
     /// <param name="orgCode"></param>
     /// <param name="orgName"></param>
     /// <param name="orgName"></param>
-    public void Complete(string userId, string userName, string orgCode, string orgName, string nextStepCode)
+    public void Complete(string userId, string userName, string orgCode, string orgName, string? areaCode, string? areaName, string nextStepCode)
     {
     {
         UserId = userId;
         UserId = userId;
         UserName = userName;
         UserName = userName;
         OrgCode = orgCode;
         OrgCode = orgCode;
         OrgName = orgName;
         OrgName = orgName;
+        OrgAreaCode = areaCode;
+        OrgAreaName = areaName;
         CompleteTime = DateTime.Now;
         CompleteTime = DateTime.Now;
         Status = EWorkflowStepStatus.Completed;
         Status = EWorkflowStepStatus.Completed;
 
 

+ 3 - 3
src/Hotline/KnowledgeBase/KnowledgeDomainService.cs

@@ -353,13 +353,13 @@ namespace Hotline.KnowledgeBase
             //推送
             //推送
             if (isSendType == "0")  //新增知识推送
             if (isSendType == "0")  //新增知识推送
 
 
-                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeInfoSend, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
+                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeAdd, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
             else if (isSendType == "1")  //修改知识推送
             else if (isSendType == "1")  //修改知识推送
 
 
-                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeInfoUpdate, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
+                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeUpdate, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
             else if (isSendType == "2")   //删除知识推送
             else if (isSendType == "2")   //删除知识推送
 
 
-                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeInfoAbandon, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
+                await _capPublisher.PublishAsync(EventNames.HotlineKnowledgeRemove, _mapper.Map<KnowledgeSendDto>(knowledge), cancellationToken: cancellationToken);
             #endregion
             #endregion
         }
         }
     }
     }

+ 0 - 50
src/Hotline/Orders/IOrderDomainService.cs

@@ -20,55 +20,5 @@ namespace Hotline.Orders
         /// 归档
         /// 归档
         /// </summary>
         /// </summary>
         Task FileAsync(string? orderId, CancellationToken cancellationToken);
         Task FileAsync(string? orderId, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 接办工单(查看详情视为接办)
-        /// </summary>
-        Task AcceptAsync(string? orderId, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 工单办理流程开始(流程开始后触发)
-        /// </summary>
-        Task ManageFlowStartAsync(FlowAssignInfo assignInfo, Order order, bool isInCountersign, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 工单办理流程流转(每个节点办理都会触发)
-        /// </summary>
-        Task<OrderDto> ManageFlowNextAsync(FlowAssignInfo assignInfo, Order order, bool isFromCenterToOrg, bool isInCountersign, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 工单办理流程退回操作
-        /// </summary>
-        Task<OrderDto> ManageFlowPreviousAsync(Order order, bool isFromCenterToOrg, bool isInCountersign, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 工单最终办理(此完结流程并未结束)
-        /// </summary>
-        /// <remarks>
-        /// 需求:工单实际办理部门办理完成视为工单最终办理完结,
-        /// 实际办理部门指:1.第一个汇总节点的前一个非汇总节点代表的办理部门 2.汇总以后如果再次开启会签需将工单回退到未办理完结的状态重新等待下一个汇总节点
-        /// </remarks>
-        /// <returns></returns>
-        Task FinalManageAsync(string? orderId, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 撤回最终办理(汇总以后又重新指派到非汇总汇总节点办理的场景)
-        /// </summary>
-        /// <returns></returns>
-        Task RecallFinalManageAsync(string? orderId, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 工单办理流程流转到结束节点
-        /// </summary>
-        Task ManageFlowEndAsync(string? orderId, CancellationToken cancellationToken);
-
-        /// <summary>
-        /// 流程跳转
-        /// </summary>
-        /// <param name="workflowId"></param>
-        /// <param name="assignInfo"></param>
-        /// <param name="cancellationToken"></param>
-        /// <returns></returns>
-        Task ManageFlowJumpAsync(string workflowId, FlowAssignInfo assignInfo, CancellationToken cancellationToken);
     }
     }
 }
 }

+ 9 - 1
src/Hotline/Orders/Order.cs

@@ -3,6 +3,7 @@ using Hotline.Settings.Hotspots;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Order;
 using Hotline.Users;
 using Hotline.Users;
 using SqlSugar;
 using SqlSugar;
+using XF.Domain.Exceptions;
 using XF.Domain.Extensions;
 using XF.Domain.Extensions;
 using XF.Domain.Repository;
 using XF.Domain.Repository;
 
 
@@ -434,6 +435,12 @@ namespace Hotline.Orders
 
 
         #region Method
         #region Method
 
 
+        public void CheckIfFiled()
+        {
+            if (Status is EOrderStatus.Filed)
+                throw UserFriendlyException.SameMessage("工单已归档");
+        }
+
         public void Init(string employeeId)
         public void Init(string employeeId)
         {
         {
             EmployeeId = employeeId;
             EmployeeId = employeeId;
@@ -484,6 +491,7 @@ namespace Hotline.Orders
         /// </summary>
         /// </summary>
         public void Filed()
         public void Filed()
         {
         {
+            if (Status is EOrderStatus.Filed) return;
             Status = EOrderStatus.Filed;
             Status = EOrderStatus.Filed;
             FiledTime = DateTime.Now;
             FiledTime = DateTime.Now;
         }
         }
@@ -492,7 +500,7 @@ namespace Hotline.Orders
         //{
         //{
         //    Status = EOrderStatus.WaitForSign;
         //    Status = EOrderStatus.WaitForSign;
         //}
         //}
-        
+
         /// <summary>
         /// <summary>
         /// 发布
         /// 发布
         /// </summary>
         /// </summary>

+ 16 - 0
src/Hotline/Orders/OrderDefaults.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Orders
+{
+    internal class OrderDefaults
+    {
+        internal class SourceChannel
+        {
+            public const string DianHua = "RGDH";
+        }
+    }
+}

+ 13 - 143
src/Hotline/Orders/OrderDomainService.cs

@@ -6,6 +6,7 @@ using Hotline.Share.Enums.Order;
 using Hotline.Share.Mq;
 using Hotline.Share.Mq;
 using MapsterMapper;
 using MapsterMapper;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
+using System.Threading;
 using XF.Domain.Authentications;
 using XF.Domain.Authentications;
 using XF.Domain.Cache;
 using XF.Domain.Cache;
 using XF.Domain.Dependency;
 using XF.Domain.Dependency;
@@ -51,6 +52,12 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         order.Init(_sessionContext.RequiredUserId);
         order.Init(_sessionContext.RequiredUserId);
         order.No = GenerateNewOrderNo();
         order.No = GenerateNewOrderNo();
 
 
+        if (order.SourceChannelCode == OrderDefaults.SourceChannel.DianHua && !string.IsNullOrEmpty(order.CallId))
+            await _capPublisher.PublishAsync(EventNames.HotlineCallConnectWithOrder, new CallConnectOrderDto
+            {
+                Order = _mapper.Map<OrderDto>(order),
+            }, cancellationToken: cancellationToken);//todo dto
+
         return await _orderRepository.AddOrderNavAsync(order, cancellationToken);
         return await _orderRepository.AddOrderNavAsync(order, cancellationToken);
     }
     }
 
 
@@ -60,145 +67,8 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
     public async Task FileAsync(string? orderId, CancellationToken cancellationToken)
     public async Task FileAsync(string? orderId, CancellationToken cancellationToken)
     {
     {
         var order = await GetOrderAsync(orderId, cancellationToken);
         var order = await GetOrderAsync(orderId, cancellationToken);
-        if (order.Status is EOrderStatus.Filed) return;
-        order.Status = EOrderStatus.Filed;
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-    }
-
-    /// <summary>
-    /// 接办工单(查看详情视为接办)
-    /// </summary>
-    public async Task AcceptAsync(string? orderId, CancellationToken cancellationToken)
-    {
-        _logger.LogInformation($"接办工单,orderId: {orderId}");
-        var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
-        //order.Accept();
-        _logger.LogInformation($"接办工单,before order.status: {order.Status}");
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-        _logger.LogInformation($"接办工单,after order.status: {order.Status}");
-    }
-
-    /// <summary>
-    /// 工单办理流程开始(流程开始后触发)
-    /// </summary>
-    public async Task ManageFlowStartAsync(FlowAssignInfo assignInfo, Order order, bool isInCountersign, CancellationToken cancellationToken)
-    {
-        //var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
-
-        ////更新指派信息
-        //order.Assign(assignInfo.FlowAssignType, assignInfo.GetHandlers());
-
-        order.UpdateHandlingStatus(isInCountersign);
-
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-
-        await _capPublisher.PublishAsync(EventNames.HotlineOrderCreated, _mapper.Map<OrderDto>(order),
-            cancellationToken: cancellationToken);
-    }
-
-    /// <summary>
-    /// 工单办理(每个节点都会触发)
-    /// </summary>
-    public async Task<OrderDto> ManageFlowNextAsync(FlowAssignInfo assignInfo, Order order, bool isFromCenterToOrg, bool isInCountersign, CancellationToken cancellationToken)
-    {
-        //var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
-
-        ////更新指派信息
-        //order.Assign(assignInfo.FlowAssignType, assignInfo.GetHandlers());
-
-        order.UpdateHandlingStatus(isInCountersign);
-
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-
-        var dto = _mapper.Map<OrderDto>(order);
-
-        if (isFromCenterToOrg)
-            await _capPublisher.PublishAsync(EventNames.HotlineOrderCenterToOrg, dto, cancellationToken: cancellationToken);
-
-        return dto;
-        //await _capPublisher.PublishAsync(EventNames.HotlineOrderFlow, _mapper.Map<OrderDto>(order),
-        //    cancellationToken: cancellationToken);
-    }
-
-    /// <summary>
-    /// 工单办理流程退回操作
-    /// </summary>
-    public async Task<OrderDto> ManageFlowPreviousAsync(Order order, bool isFromCenterToOrg, bool isInCountersign,
-        CancellationToken cancellationToken)
-    {
-        CheckOrderIfFiled(order);
-
-        order.UpdateHandlingStatus(isInCountersign);
-
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-
-        var dto = _mapper.Map<OrderDto>(order);
-
-        return dto;
-    }
-
-    /// <summary>
-    /// 工单最终办理(此完结流程并未结束)
-    /// </summary>
-    /// <remarks>
-    /// 需求:工单实际办理部门办理完成视为工单最终办理完结,
-    /// 实际办理部门指:1.第一个汇总节点的前一个非汇总节点代表的办理部门 2.汇总以后如果再次开启会签需将工单回退到未办理完结的状态重新等待下一个汇总节点
-    /// </remarks>
-    /// <returns></returns>
-    public async Task FinalManageAsync(string? orderId, CancellationToken cancellationToken)
-    {
-        var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
-        //order.FinalManage();
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-    }
-
-    /// <summary>
-    /// 取消最终办理(汇总以后又重新指派到非汇总汇总节点办理的场景)
-    /// </summary>
-    /// <returns></returns>
-    public async Task RecallFinalManageAsync(string? orderId, CancellationToken cancellationToken)
-    {
-        var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
-        //order.RecallFinalManage();
-        await _orderRepository.UpdateAsync(order, cancellationToken);
-    }
-
-    /// <summary>
-    /// 工单办理流程流转到结束节点
-    /// </summary>
-    public async Task ManageFlowEndAsync(string? orderId, CancellationToken cancellationToken)
-    {
-        var order = await GetOrderAsync(orderId, cancellationToken);
-        CheckOrderIfFiled(order);
         order.Filed();
         order.Filed();
         await _orderRepository.UpdateAsync(order, cancellationToken);
         await _orderRepository.UpdateAsync(order, cancellationToken);
-
-        await _capPublisher.PublishAsync(EventNames.HotlineOrderFiled, _mapper.Map<OrderDto>(order),
-            cancellationToken: cancellationToken);
-    }
-
-    /// <summary>
-    /// 流程跳转
-    /// </summary>
-    /// <param name="workflowId"></param>
-    /// <param name="assignInfo"></param>
-    /// <param name="cancellationToken"></param>
-    /// <returns></returns>
-    public async Task ManageFlowJumpAsync(string workflowId, FlowAssignInfo assignInfo, CancellationToken cancellationToken)
-    {
-        var order = await GetOrderByFlowIdAsync(workflowId, cancellationToken);
-        CheckOrderIfFiled(order);
-
-        order.Assign(assignInfo.FlowAssignType, assignInfo.GetHandlers());
-
-        //order.Jump();
-
-        await _orderRepository.UpdateAsync(order, cancellationToken);
     }
     }
 
 
     public async Task<Order> GetOrderAsync(string? orderId, CancellationToken cancellationToken)
     public async Task<Order> GetOrderAsync(string? orderId, CancellationToken cancellationToken)
@@ -208,7 +78,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         var order = await _orderRepository.Queryable()
         var order = await _orderRepository.Queryable()
             .Includes(d => d.Hotspot)
             .Includes(d => d.Hotspot)
             .Includes(d => d.Employee)
             .Includes(d => d.Employee)
-            .FirstAsync(d => d.Id == orderId);
+            .FirstAsync(d => d.Id == orderId, cancellationToken);
 
 
         if (order == null)
         if (order == null)
             throw new UserFriendlyException($"无效工单编号, orderId: {orderId}", "无效工单编号");
             throw new UserFriendlyException($"无效工单编号, orderId: {orderId}", "无效工单编号");
@@ -230,11 +100,11 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
         return order;
         return order;
     }
     }
 
 
-    private void CheckOrderIfFiled(Order order)
-    {
-        if (order.Status is EOrderStatus.Filed)
-            throw UserFriendlyException.SameMessage("工单已归档");
-    }
+    //private void CheckOrderIfFiled(Order order)
+    //{
+    //    if (order.Status is EOrderStatus.Filed)
+    //        throw UserFriendlyException.SameMessage("工单已归档");
+    //}
 
 
     private string GenerateNewOrderNo()
     private string GenerateNewOrderNo()
     {
     {

+ 2 - 2
src/Hotline/Settings/SystemOrganize.cs

@@ -96,12 +96,12 @@ public static class OrgExtensions
     }
     }
 
 
     /// <summary>
     /// <summary>
-    /// 根据orgCode获取该部门所属等级的部门
+    /// 根据orgCode获取该部门所属对应级别的上级部门
     /// </summary>
     /// </summary>
     /// <param name="orgCode"></param>
     /// <param name="orgCode"></param>
     /// <param name="orgLevel"></param>
     /// <param name="orgLevel"></param>
     /// <returns></returns>
     /// <returns></returns>
-    public static string GetOrgLevel(this string orgCode, int orgLevel = 1)
+    public static string GetOrgUpper(this string orgCode, int orgLevel = 1)
     {
     {
         if (string.IsNullOrEmpty(orgCode))
         if (string.IsNullOrEmpty(orgCode))
             throw UserFriendlyException.SameMessage("无效部门编码");
             throw UserFriendlyException.SameMessage("无效部门编码");

+ 14 - 0
src/XF.Domain/Authentications/AppClaimTypes.cs

@@ -0,0 +1,14 @@
+namespace XF.Domain.Authentications
+{
+    public class AppClaimTypes
+    {
+        public const string UserDisplayName = "user_display_name";
+        public const string UserPasswordChanged = "user_password_changed";
+        public const string DepartmentId = "department_id";
+        public const string DepartmentCode = "department_code";
+        public const string DepartmentName = "department_name";
+        public const string DepartmentAreaCode = "department_areacode";
+        public const string DepartmentAreaName = "department_areaname";
+        public const string StaffNo = "staff_no";
+    }
+}

+ 8 - 1
src/XF.Domain/Authentications/DefaultSessionContext.cs

@@ -3,7 +3,6 @@ using System.Security.Claims;
 using IdentityModel;
 using IdentityModel;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using XF.Domain.Dependency;
 using XF.Domain.Dependency;
-using XF.Utility.AppIdentityModel;
 
 
 namespace XF.Domain.Authentications
 namespace XF.Domain.Authentications
 {
 {
@@ -26,6 +25,8 @@ namespace XF.Domain.Authentications
             OrgId = user.FindFirstValue(AppClaimTypes.DepartmentId);
             OrgId = user.FindFirstValue(AppClaimTypes.DepartmentId);
             OrgCode = user.FindFirstValue(AppClaimTypes.DepartmentCode);
             OrgCode = user.FindFirstValue(AppClaimTypes.DepartmentCode);
             OrgName = user.FindFirstValue(AppClaimTypes.DepartmentName);
             OrgName = user.FindFirstValue(AppClaimTypes.DepartmentName);
+            OrgAreaCode = user.FindFirstValue(AppClaimTypes.DepartmentAreaCode);
+            OrgAreaName = user.FindFirstValue(AppClaimTypes.DepartmentAreaName);
             ClientId = user.FindFirstValue(JwtClaimTypes.ClientId);
             ClientId = user.FindFirstValue(JwtClaimTypes.ClientId);
             StaffNo = user.FindFirstValue(AppClaimTypes.StaffNo);
             StaffNo = user.FindFirstValue(AppClaimTypes.StaffNo);
         }
         }
@@ -53,6 +54,12 @@ namespace XF.Domain.Authentications
         public string? OrgId { get; set; }
         public string? OrgId { get; set; }
         public string? OrgCode { get; set; }
         public string? OrgCode { get; set; }
         public string? OrgName { get; set; }
         public string? OrgName { get; set; }
+        public string? OrgAreaCode { get; set; }
+
+        /// <summary>
+        /// 部门行政区划名称
+        /// </summary>
+        public string? OrgAreaName { get; set; }
         public string RequiredOrgId => OrgId ?? throw new ArgumentNullException();
         public string RequiredOrgId => OrgId ?? throw new ArgumentNullException();
         public string RequiredOrgCode => OrgCode ?? throw new ArgumentNullException();
         public string RequiredOrgCode => OrgCode ?? throw new ArgumentNullException();
         public string? ClientId { get; }
         public string? ClientId { get; }

+ 6 - 0
src/XF.Domain/Authentications/ISessionContext.cs

@@ -34,6 +34,12 @@ public interface ISessionContext
     string? OrgId { get; set; }
     string? OrgId { get; set; }
     string? OrgCode { get; set; }
     string? OrgCode { get; set; }
     string? OrgName { get; set; }
     string? OrgName { get; set; }
+    string? OrgAreaCode { get; set; }
+
+    /// <summary>
+    /// 部门行政区划名称
+    /// </summary>
+    string? OrgAreaName { get; set; }
 
 
     string RequiredOrgId { get; }
     string RequiredOrgId { get; }
     string RequiredOrgCode { get; }
     string RequiredOrgCode { get; }

+ 0 - 1
src/XF.Domain/XF.Domain.csproj

@@ -17,7 +17,6 @@
     <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
     <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
     <PackageReference Include="Serilog.Enrichers.Span" Version="2.3.0" />
     <PackageReference Include="Serilog.Enrichers.Span" Version="2.3.0" />
     <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.1" />
     <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.1" />
-    <PackageReference Include="XF.Utility.AppIdentityModel" Version="1.0.5" />
   </ItemGroup>
   </ItemGroup>
 
 
 </Project>
 </Project>