using Hotline.FlowEngine.Workflows;
using Hotline.Share.Dtos.FlowEngine;
using XF.Domain.Entities;
namespace Hotline.FlowEngine;
public class FlowAssignMode
{
public FlowAssignMode(EFlowAssignType flowAssignType, HandlerObjects handlerObjects)
{
FlowAssignType = flowAssignType;
HandlerObjects = handlerObjects;
}
///
/// 流程指派类型
///
public EFlowAssignType FlowAssignType { get; set; }
/////
///// 办理人/办理部门(UserIds/OrgCodes)
/////
//public List Handlers { get; set; }
///
/// 办理对象
///
public HandlerObjects HandlerObjects { get; set; }
///
/// 办理人/办理部门(UserIds/OrgCodes)
///
///
public List GetHandlers()
{
switch (FlowAssignType)
{
case EFlowAssignType.Org:
return HandlerObjects.OrgGroups.SelectMany(d => d.HandlerOrgs.Select(x => x.Id)).ToList();
case EFlowAssignType.User:
return HandlerObjects.UserGroups.SelectMany(d => d.HandlerUsers.Select(x => x.Id)).ToList();
default:
throw new ArgumentOutOfRangeException();
}
}
}