xf 4 ヶ月 前
コミット
2254753dc4

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

@@ -4277,20 +4277,41 @@ public class OrderController : BaseController
              (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))
-        && (!hasHandled || step.Status == EWorkflowStepStatus.Handled)
-        && (hasHandled || step.Status < EWorkflowStepStatus.Handled)
+        //&& (!hasHandled || step.Status == EWorkflowStepStatus.Handled)
+        //&& (hasHandled || step.Status < EWorkflowStepStatus.Handled)
             );
 
+        var expHandledStep =
+            new Func<WorkflowStep, bool>(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))
+                &&  step.Status == EWorkflowStepStatus.Handled
+            );
+        var expUnhandleStep = new Func<WorkflowStep, bool>(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))
+              && step.Status < EWorkflowStepStatus.Handled
+        );
+
         var isAdmin = _orderDomainService.IsCheckAdmin();
         if (!isAdmin)
         {
             query
-                .Includes(d => d.WorkflowSteps.Where(expStepFilter)
+                .Includes(d => d.WorkflowSteps//.Where(expStepFilter)
                     .OrderByDescending(step => step.CreationTime)
                     .Take(1)
                     .ToList()
                 )
-                .Where(d => d.WorkflowSteps.Any(expStepFilter)
+                .Where(d => d.WorkflowSteps
+                    .WhereIF(hasHandled, step=>step.Status == EWorkflowStepStatus.Handled)
+                    .WhereIF(!hasHandled, step=>step.Status < EWorkflowStepStatus.Handled)
+                    .Any(expStepFilter)
             );
         }
 

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -68,7 +68,7 @@
     "Host": "110.188.24.182",
     "Port": 50179,
     "Password": "fengwo123!$!$",
-    "Database": 5 //test:3, dev:5
+    "Database": 3 //test:3, dev:5
   },
   "Swagger": true,
   "AccLog":  false,