xf 6 달 전
부모
커밋
ee401f06a6
1개의 변경된 파일80개의 추가작업 그리고 73개의 파일을 삭제
  1. 80 73
      src/Hotline.Application/FlowEngine/WorkflowApplication.cs

+ 80 - 73
src/Hotline.Application/FlowEngine/WorkflowApplication.cs

@@ -1301,80 +1301,87 @@ public class WorkflowApplication : IWorkflowApplication, IScopeDependency
                         roleId = handleRoleCode;
                         roleName = handleRoleName;
                     }
-                    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,
-                            RoleId = roleId,
-                            RoleName = roleName
-                        })
-                        .ToListAsync(cancellationToken);
-                }
-
-                break;
-            case EDynamicPolicy.OrgUpLead:
-                businessType = _sessionContext.OrgIsCenter
-                    ? EBusinessType.Send
-                    : _sessionContext.RequiredOrgId.CalcOrgLevel() == 1
-                        ? EBusinessType.Send
-                        : EBusinessType.Department;
-                orgLevel = _sessionContext.OrgLevel - 1;
-                if (orgLevel <= 0) orgLevel = 1;
-                handlerType = EHandlerType.AssignedOrgOrRole;
-                upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(_sessionContext.OrgLevel);
-                isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
-                if (!isLead)
-                {
-                    isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.RequiredOrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
-                    if (isSkip)
-                    {
-                        roleId = leadRoleCode;
-                        roleName = leadRoleName;
+                    else {
+                        orgLevel += 1;
                     }
-                }
-                if (isLead || !isSkip)
-                {
-                    //上级部门Id
-                    upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(orgLevel);
-                    roleId = handleRoleCode;
-                    roleName = handleRoleName;
-                }
-                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,
-                        RoleId = roleId,
-                        RoleName = roleName
-                    })
-                    .ToListAsync(cancellationToken);
-                break;
-            case EDynamicPolicy.ArriveCenter:
-                businessType = _sessionContext.OrgIsCenter
-                    ? EBusinessType.Send
-                    : _sessionContext.RequiredOrgId.CalcOrgLevel() == 1
-                        ? EBusinessType.Send
-                        : EBusinessType.Department;
-                orgLevel = _sessionContext.OrgLevel - 1;
-                if (orgLevel <= 0) orgLevel = 1;
-                items = await _organizeRepository.Queryable()
-                    .Where(d => d.IsCenter)
-                    .Select(d => new FlowStepHandler
-                    {
-                        Key = d.Id,
-                        Value = d.Name,
-                        OrgId = d.Id,
-                        OrgName = d.Name
-                    })
-                    .ToListAsync(cancellationToken);
-                break;
+					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,
+							RoleId = roleId,
+							RoleName = roleName
+						})
+						.ToListAsync(cancellationToken);
+				}
+
+				break;
+			case EDynamicPolicy.OrgUpLead:
+				businessType = _sessionContext.OrgIsCenter
+					? EBusinessType.Send
+					: _sessionContext.RequiredOrgId.CalcOrgLevel() == 1
+						? EBusinessType.Send
+						: EBusinessType.Department;
+				orgLevel = _sessionContext.OrgLevel - 1;
+				if (orgLevel <= 0) orgLevel = 1;
+				handlerType = EHandlerType.AssignedOrgOrRole;
+				upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(_sessionContext.OrgLevel);
+				isLead = _sessionContext.Roles.Any(x => x == leadRoleCode);
+				if (!isLead)
+				{
+					isSkip = await _userRepository.Queryable().AnyAsync(x => x.OrgId == _sessionContext.RequiredOrgId && x.Roles.Any(r => r.Name == leadRoleCode), cancellationToken);
+					if (isSkip)
+					{
+						roleId = leadRoleCode;
+						roleName = leadRoleName;
+					}
+				}
+				if (isLead || !isSkip)
+				{
+					//上级部门Id
+					upperOrgId = _sessionContext.RequiredOrgId.GetHigherOrgId(orgLevel);
+					roleId = handleRoleCode;
+					roleName = handleRoleName;
+				}
+				else
+				{
+					orgLevel += 1;
+				}
+				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,
+						RoleId = roleId,
+						RoleName = roleName
+					})
+					.ToListAsync(cancellationToken);
+				break;
+			case EDynamicPolicy.ArriveCenter:
+				businessType = _sessionContext.OrgIsCenter
+					? EBusinessType.Send
+					: _sessionContext.RequiredOrgId.CalcOrgLevel() == 1
+						? EBusinessType.Send
+						: EBusinessType.Department;
+				orgLevel = _sessionContext.OrgLevel - 1;
+				if (orgLevel <= 0) orgLevel = 1;
+				items = await _organizeRepository.Queryable()
+					.Where(d =>  d.IsCenter)
+					.Select(d => new FlowStepHandler
+					{
+						Key = d.Id,
+						Value = d.Name,
+						OrgId = d.Id,
+						OrgName = d.Name
+					})
+					.ToListAsync(cancellationToken);
+				break;
             case EDynamicPolicy.ArriveOneOrg:
                 businessType = _sessionContext.OrgIsCenter ? EBusinessType.Send : EBusinessType.Department;
                 orgLevel = _sessionContext.OrgIsCenter ? 0 : 1;