xf 11 months ago
parent
commit
00e7265e2b

+ 27 - 27
src/Hotline.Api/Controllers/KnowledgeController.cs

@@ -587,7 +587,7 @@ namespace Hotline.Api.Controllers
         /// <returns></returns>
         [HttpPost("finding_duplicate")]
 
-        public async Task<bool> FindingDuplicate([FromBody] KnowledgeFindingDuplicateDto dto) 
+        public async Task<bool> FindingDuplicate([FromBody] KnowledgeFindingDuplicateDto dto)
         {
             var any = await _knowledgeRepository.Queryable().Where(x => x.Status == EKnowledgeStatus.Auditing || x.Status >= EKnowledgeStatus.OnShelf)
                 .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Title.Equals(dto.Title))
@@ -595,16 +595,16 @@ namespace Hotline.Api.Controllers
                 .WhereIF(!string.IsNullOrEmpty(dto.Content), x => x.Content.Equals(dto.Content))
                 .AnyAsync();
             return any;
-		}
+        }
 
-		#endregion
+        #endregion
 
-		#region 我的知识删除列表
-		/// <summary>
-		/// 我的知识删除列表页面枚举值
-		/// </summary>
-		/// <returns></returns>
-		[HttpGet("delete-status-data")]
+        #region 我的知识删除列表
+        /// <summary>
+        /// 我的知识删除列表页面枚举值
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("delete-status-data")]
         public async Task<object> DeleteApplyStatus()
         {
             return EnumExts.GetDescriptions<EKnowledgeWorkFlowStatus>();
@@ -809,7 +809,7 @@ namespace Hotline.Api.Controllers
 
             dto.DefinitionModuleCode = moduleCode;
             dto.Title = knowledge.Title;
-            await _workflowApplication.StartWorkflowAsync(dto, flowId, cancellationToken: HttpContext.RequestAborted);
+            await _workflowApplication.StartWorkflowAsync(dto, _sessionContext, flowId, cancellationToken: HttpContext.RequestAborted);
         }
         #endregion
 
@@ -976,17 +976,17 @@ namespace Hotline.Api.Controllers
         public async Task<PagedDto<KnowledgeCorrectionDto>> List([FromQuery] KnowledgeCorrectionListDto dto)
         {
             var typeSpliceName = string.Empty;
-			if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
-	        {
-		        var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
-		        typeSpliceName = type?.SpliceName;
-	        }
-			var (total, items) = await _knowledgeCorrectionRepository.Queryable()
+            if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
+            {
+                var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
+                typeSpliceName = type?.SpliceName;
+            }
+            var (total, items) = await _knowledgeCorrectionRepository.Queryable()
                 .Includes(x => x.Knowledge)
                 //.WhereIF(!string.IsNullOrEmpty(dto.KnowledgeTypeId), x => x.Knowledge.KnowledgeTypeId == dto.KnowledgeTypeId!)
                 .WhereIF(!string.IsNullOrEmpty(dto.CreatorName), x => x.CreatorName == dto.CreatorName!)
                 .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => SqlFunc.JsonLike(x.Knowledge.KnowledgeType, typeSpliceName))
-				.Where(x => !string.IsNullOrEmpty(x.Knowledge.Id))
+                .Where(x => !string.IsNullOrEmpty(x.Knowledge.Id))
                 .OrderByDescending(x => x.CreationTime)
                 .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
             return new PagedDto<KnowledgeCorrectionDto>(total, _mapper.Map<IReadOnlyList<KnowledgeCorrectionDto>>(items));
@@ -1079,17 +1079,17 @@ namespace Hotline.Api.Controllers
         [HttpGet("knowledge_questions/list")]
         public async Task<PagedDto<KnowledgeQuestionsDto>> List([FromQuery] KnowledgeQuestionsListDto dto)
         {
-	        var typeSpliceName = string.Empty;
-	        if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
-	        {
-		        var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
-		        typeSpliceName = type?.SpliceName;
-	        }
-			var (total, items) = await _knowledgeQuestionsRepository.Queryable()
+            var typeSpliceName = string.Empty;
+            if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
+            {
+                var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
+                typeSpliceName = type?.SpliceName;
+            }
+            var (total, items) = await _knowledgeQuestionsRepository.Queryable()
                 .Includes(x => x.Knowledge)
-				 //.WhereIF(!string.IsNullOrEmpty(dto.KnowledgeTypeId), x => x.Knowledge.KnowledgeTypeId == dto.KnowledgeTypeId!)
-				.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => SqlFunc.JsonLike(x.Knowledge.KnowledgeType, typeSpliceName))
-				.WhereIF(!string.IsNullOrEmpty(dto.CreatorName), x => x.CreatorName == dto.CreatorName!)
+                //.WhereIF(!string.IsNullOrEmpty(dto.KnowledgeTypeId), x => x.Knowledge.KnowledgeTypeId == dto.KnowledgeTypeId!)
+                .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => SqlFunc.JsonLike(x.Knowledge.KnowledgeType, typeSpliceName))
+                .WhereIF(!string.IsNullOrEmpty(dto.CreatorName), x => x.CreatorName == dto.CreatorName!)
                 .Where(x => !string.IsNullOrEmpty(x.Knowledge.Id))
                 .OrderByDescending(x => x.CreationTime)
                 .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

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

@@ -1219,7 +1219,7 @@ public class OrderController : BaseController
             var startDto = _mapper.Map<StartWorkflowDto>(dto.Workflow);
             startDto.DefinitionModuleCode = WorkflowModuleConsts.OrderDelay;
             startDto.Title = model.DelayReason;
-            string workFlowId = await _workflowApplication.StartWorkflowAsync(startDto, model.Id,
+            string workFlowId = await _workflowApplication.StartWorkflowAsync(startDto, _sessionContext, model.Id,
                     cancellationToken: HttpContext.RequestAborted);
             //model.WorkflowId = workFlowId;
             //await _orderDelayRepository.UpdateAsync(model, HttpContext.RequestAborted);
@@ -1346,7 +1346,7 @@ public class OrderController : BaseController
         var (total, items) = await _orderDelayRepository
             .Queryable(viewFilter: true, handlerFilter: !isHandled)
             .Includes(x => x.Order)
-            .Includes(x=>x.Workflow)
+            .Includes(x => x.Workflow)
             .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
                 d => d.Order.Title.Contains(dto.Keyword!) || d.No.Contains(dto.Keyword!))
             .WhereIF(dto.IsApply == true, x => x.DelayState != EDelayState.Examining)
@@ -2189,7 +2189,7 @@ public class OrderController : BaseController
 
         var stream = ExcelHelper.CreateStream(dtos);
 
-        return ExcelStreamResult(stream,"工单数据");
+        return ExcelStreamResult(stream, "工单数据");
     }
 
     /// <summary>
@@ -2333,13 +2333,13 @@ public class OrderController : BaseController
     public async Task<string> Add([FromBody] AddOrderDto dto)
     {
         dto.InitAddress();
-		//todo dto validation
-		//交通工单校验
-		var valid = await _orderDomainService.OrderValidation(dto, HttpContext.RequestAborted);
+        //todo dto validation
+        //交通工单校验
+        var valid = await _orderDomainService.OrderValidation(dto, HttpContext.RequestAborted);
         if (valid.Validation)
-	        throw UserFriendlyException.SameMessage(valid.Result);
+            throw UserFriendlyException.SameMessage(valid.Result);
 
-		if (!string.IsNullOrEmpty(dto.CallId))
+        if (!string.IsNullOrEmpty(dto.CallId))
         {
             var exists = await _orderRepository.AnyAsync(d => d.CallId == dto.CallId, HttpContext.RequestAborted);
             if (exists)
@@ -2461,9 +2461,9 @@ public class OrderController : BaseController
         //交通工单校验
         var valid = await _orderDomainService.OrderValidation(dto, HttpContext.RequestAborted);
         if (valid.Validation)
-	        throw UserFriendlyException.SameMessage(valid.Result);
+            throw UserFriendlyException.SameMessage(valid.Result);
 
-		var order = await _orderRepository.Queryable()
+        var order = await _orderRepository.Queryable()
             .FirstAsync(d => d.Id == dto.Id);
         if (order == null)
             throw UserFriendlyException.SameMessage("无效工单编号");
@@ -2541,7 +2541,7 @@ public class OrderController : BaseController
         }
         else
         {
-			await Update(dto.Data);
+            await Update(dto.Data);
         }
 
         try
@@ -2574,7 +2574,7 @@ public class OrderController : BaseController
             var startDto = _mapper.Map<StartWorkflowDto>(dto.Workflow);
             startDto.DefinitionModuleCode = WorkflowModuleConsts.OrderHandle;
             startDto.Title = dto.Data.Title;
-            await _workflowApplication.StartWorkflowAsync(startDto, id, dto.Data.ExpiredTime, HttpContext.RequestAborted);
+            await _workflowApplication.StartWorkflowAsync(startDto, _sessionContext, id, dto.Data.ExpiredTime, HttpContext.RequestAborted);
         }
         catch (Exception e)
         {
@@ -2659,7 +2659,7 @@ public class OrderController : BaseController
             dto.NextHandlers = await _orderDomainService.AverageOrder(HttpContext.RequestAborted);
         }
 
-        await _workflowApplication.NextAsync(dto, order.ExpiredTime, HttpContext.RequestAborted);
+        await _workflowApplication.NextAsync(dto, _sessionContext, order.ExpiredTime, HttpContext.RequestAborted);
     }
 
     /// <summary>

+ 3 - 3
src/Hotline.Api/Controllers/PbxController.cs

@@ -288,7 +288,7 @@ namespace Hotline.Api.Controllers
                 var startWorkflowDto = _mapper.Map<StartWorkflowDto>(dto);
                 startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApply;
                 startWorkflowDto.Title = dto.Reason;
-                await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
+                await _workflowApplication.StartWorkflowAsync(startWorkflowDto, _sessionContext, telRest.Id, cancellationToken: HttpContext.RequestAborted);
             }
         }
 
@@ -323,7 +323,7 @@ namespace Hotline.Api.Controllers
             var startWorkflowDto = _mapper.Map<StartWorkflowDto>(dto);
             startWorkflowDto.DefinitionModuleCode = WorkflowModuleConsts.TelRestApply;
             startWorkflowDto.Title = dto.Reason;
-            await _workflowApplication.StartWorkflowAsync(startWorkflowDto, telRest.Id, cancellationToken: HttpContext.RequestAborted);
+            await _workflowApplication.StartWorkflowAsync(startWorkflowDto, _sessionContext, telRest.Id, cancellationToken: HttpContext.RequestAborted);
         }
 
 
@@ -422,7 +422,7 @@ namespace Hotline.Api.Controllers
 
         #endregion
 
-        
+
 
 
         /// <summary>

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

@@ -343,7 +343,7 @@ public class WorkflowController : BaseController
     [HttpPost("next")]
     public async Task Next([FromBody] NextWorkflowDto dto)
     {
-        await _workflowApplication.NextAsync(dto, cancellationToken: HttpContext.RequestAborted);
+        await _workflowApplication.NextAsync(dto, _sessionContext, cancellationToken: HttpContext.RequestAborted);
     }
 
     /// <summary>

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

@@ -463,7 +463,7 @@ namespace Hotline.FlowEngine.Workflows
             //检查是否流转到流程终点
             if (nextStepDefine.StepType is EStepType.End)
             {
-                var endTrace = await EndAsync(current, workflow, dto, nextStepDefine, currentStep, cancellationToken);
+                var endTrace = await EndAsync(workflow, dto, nextStepDefine, currentStep, current, cancellationToken);
                 return;
             }