Forráskód Böngészése

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/hotline

田爽 1 éve
szülő
commit
651cc0c404

+ 28 - 0
src/Hotline.Application.Contracts/Validators/FlowEngine/BasicWorkflowDtoValidator.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FluentValidation;
+using Hotline.Application.Contracts.Validators.Orgs;
+using Hotline.Share.Dtos.FlowEngine;
+
+namespace Hotline.Application.Contracts.Validators.FlowEngine
+{
+    public class BasicWorkflowDtoValidator : AbstractValidator<BasicWorkflowDto>
+    {
+        public BasicWorkflowDtoValidator()
+        {
+            RuleFor(d => d.BusinessType).NotNull();
+            RuleFor(d => d.HandlerType).NotNull();
+        }
+    }
+
+    public class RecallDtoValidator : AbstractValidator<RecallDto>
+    {
+        public RecallDtoValidator()
+        {
+            Include(new BasicWorkflowDtoValidator());
+        }
+    }
+}

+ 6 - 1
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -302,6 +302,11 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
     /// </summary>
     public async Task RecallAsync(RecallDto dto, DateTime? expiredTime, CancellationToken cancellationToken)
     {
+        var validator = new RecallDtoValidator();
+        var validationResult = await validator.ValidateAsync(dto, cancellationToken);
+        if (!validationResult.IsValid)
+            throw new UserFriendlyException(string.Join(',', validationResult.Errors));
+
         var workflow = await _workflowDomainService.GetWorkflowAsync(dto.WorkflowId, withDefine: true, withSteps: true,
             cancellationToken: cancellationToken);
 
@@ -730,7 +735,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                 }
                 else
                 {
-                    var upLevels = levels.Where(d => d < _sessionContext.OrgLevel).ToList();
+                    var upLevels = levels.Where(d => d <= _sessionContext.OrgLevel).ToList();
                     var lowLevels = levels.Where(d => d > _sessionContext.OrgLevel).ToList();
                     orgs1 = await query
                         .Where(d => (upLevels.Contains(d.Level) && d.Id.StartsWith(levelOneOrgId)) ||

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

@@ -1612,7 +1612,10 @@ namespace Hotline.FlowEngine.Workflows
             newStep.StartCountersignId = step.StartCountersignId;
             newStep.CountersignId = step.CountersignId;
             newStep.IsStartedCountersignEnd = step.IsStartedCountersignEnd;
-            await _workflowStepRepository.AddAsync(newStep, cancellationToken);
+            //await _workflowStepRepository.AddAsync(newStep, cancellationToken);
+            await _workflowStepRepository.AddNav(newStep)
+                .Include(d => d.StepHandlers)
+                .ExecuteCommandAsync();
 
             await CreateTraceAsync(workflow, newStep, traceType, cancellationToken);
 

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

@@ -10,7 +10,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="SqlSugarCore" Version="5.1.4.149" />
+    <PackageReference Include="SqlSugarCore" Version="5.1.4.153" />
     <PackageReference Include="XF.Utility.SequentialId" Version="1.0.2" />
   </ItemGroup>