Quellcode durchsuchen

流程动态策略 直达一级部门

田爽 vor 8 Monaten
Ursprung
Commit
bbeadbfb02

+ 19 - 3
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -1195,7 +1195,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
 					isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
                     if (!isLead)
                     {
-	                    isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.OrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
+	                    isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.RequiredOrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
 	                    if (isSkip)
 	                    {
 		                    roleId = leadRoleCode;
@@ -1237,7 +1237,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
 				isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
 				if (!isLead)
 				{
-					isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.OrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
+					isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.RequiredOrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
 					if (isSkip)
 					{
 						roleId = leadRoleCode;
@@ -1283,6 +1283,22 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
 					})
 					.ToListAsync(cancellationToken);
 				break;
+            case EDynamicPolicy.ArriveOneOrg:
+	            businessType = _sessionContext.OrgIsCenter? EBusinessType.Send: EBusinessType.Department;
+                orgLevel = _sessionContext.OrgIsCenter ? 0 : 1;
+				//上级部门Id
+				upperOrgId = _sessionContext.OrgIsCenter ? _sessionContext.RequiredOrgId.Substring(0,3) : _sessionContext.RequiredOrgId.Substring(0, 6);
+				items = await _organizeRepository.Queryable()
+		            .Where(d => d.Id == upperOrgId)
+		            .Select(d => new FlowStepHandler
+		            {
+			            Key = d.Id,
+			            Value = d.Name,
+			            OrgId = d.Id,
+			            OrgName = d.Name
+		            })
+		            .ToListAsync(cancellationToken);
+	            break;
 			case EDynamicPolicy.OrgDownCenterTop:
                 businessType = EBusinessType.Department;
                 if (_sessionContext.OrgIsCenter)
@@ -1337,7 +1353,7 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
         return new NextStepOption
         {
             Key = orgLevel.ToString(),
-            Value = orgLevel == 0 ? "市民热线服务中心" : $"{orgLevel.ToChinese()}级部门{roleName}",
+            Value = orgLevel == 0 ? "市民热线服务中心" : $"{orgLevel.ToChinese()}级部门 {roleName}",
             FlowDirection = flowDirection,
             StepType = stepType,
             BusinessType = businessType,

+ 6 - 0
src/Hotline.Share/Enums/FlowEngine/EDynamicPolicy.cs

@@ -60,4 +60,10 @@ public enum EDynamicPolicy
 	/// </summary>
 	[Description("直达中心")]
     ArriveCenter= 8,
+
+	/// <summary>
+	/// 直达一级部门
+	/// </summary>
+	[Description("直达一级部门")]
+	ArriveOneOrg = 9,
 }