xf 5 months ago
parent
commit
eb6aa89a97
1 changed files with 27 additions and 12 deletions
  1. 27 12
      src/Hotline.Api/Controllers/OrderController.cs

+ 27 - 12
src/Hotline.Api/Controllers/OrderController.cs

@@ -4202,24 +4202,39 @@ public class OrderController : BaseController
         if (hasHandled)
             dto.QueryType = null;
 
-        var expStepFilter = Expressionable.Create<WorkflowStep>(step =>
-            ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
-             (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
-             (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
-             (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) 
-                                                                && _sessionContext.Roles.Contains(step.RoleId) 
-                                                                && !string.IsNullOrEmpty(step.HandlerOrgId) 
-                                                                && step.HandlerOrgId == _sessionContext.RequiredOrgId)
-            )).ToExpression();
+        var expStepFilter = Expressionable.Create<WorkflowStep>()
+            .And(step =>
+                    ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
+                     (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
+                     (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
+                     (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId)
+                                                                        && _sessionContext.Roles.Contains(step.RoleId)
+                                                                        && !string.IsNullOrEmpty(step.HandlerOrgId)
+                                                                        && step.HandlerOrgId == _sessionContext.RequiredOrgId)
+                    )
+                )
+            .ToExpression();
+
+        /*
+         *step =>
+           ((step.FlowAssignType == EFlowAssignType.User && !string.IsNullOrEmpty(step.HandlerId) && step.HandlerId == _sessionContext.RequiredUserId) ||
+            (step.FlowAssignType == EFlowAssignType.Org && !string.IsNullOrEmpty(step.HandlerOrgId) && step.HandlerOrgId == _sessionContext.RequiredOrgId) ||
+            (step.FlowAssignType == EFlowAssignType.Role && !string.IsNullOrEmpty(step.RoleId) && _sessionContext.Roles.Contains(step.RoleId)) ||
+            (step.FlowAssignType == EFlowAssignType.OrgAndRole && !string.IsNullOrEmpty(step.RoleId) 
+                                                               && _sessionContext.Roles.Contains(step.RoleId) 
+                                                               && !string.IsNullOrEmpty(step.HandlerOrgId) 
+                                                               && step.HandlerOrgId == _sessionContext.RequiredOrgId)
+           )
+         */
         var isAdmin = _orderDomainService.IsCheckAdmin();
         if (!isAdmin)
         {
-            query.Where(d=>d.WorkflowSteps.Where());
+            query.Where(d=>d.WorkflowSteps.Where(expStepFilter));
 
         }
 
-        query.WhereIF(hasHandled, d => d.Status == EWorkflowStepStatus.Handled)
-            .WhereIF(!hasHandled, step => step.Status != EWorkflowStepStatus.Handled)
+        //query.WhereIF(hasHandled, d => d.Status == EWorkflowStepStatus.Handled)
+        //    .WhereIF(!hasHandled, step => step.Status != EWorkflowStepStatus.Handled)
 
         throw new NotImplementedException();
     }