namespace Admin.NET.Plugin.ApprovalFlow.Service;
///
/// 审批统计通用筛选入参
///
public class FlowStatisticsInput
{
///
/// 开始时间(按实例发起时间过滤;不传默认近 30 天)
///
public DateTime? StartTime { get; set; }
///
/// 结束时间
///
public DateTime? EndTime { get; set; }
///
/// 指定流程 Id 列表(空则全部)
///
public List? FlowIds { get; set; }
///
/// 指定业务类型编码列表(空则全部)
///
public List? BizTypes { get; set; }
///
/// 指定发起人所在组织 Id 列表(空则全部)
///
public List? InitiatorOrgIds { get; set; }
}
///
/// 概览卡片 + 趋势图
///
public class FlowOverviewOutput
{
///
/// 发起总数
///
public int TotalInstances { get; set; }
///
/// 已完成实例数
///
public int CompletedInstances { get; set; }
///
/// 完成率(已完成 / 总数,0~1)
///
public decimal CompletionRate { get; set; }
///
/// 已完成实例的平均审批时长(小时)
///
public decimal AvgDurationHours { get; set; }
///
/// 超时任务数(实际耗时超过节点 timeoutHours)
///
public int TimeoutTaskCount { get; set; }
///
/// 超时率(超时任务 / 已处理任务,0~1)
///
public decimal TimeoutRate { get; set; }
///
/// 逐日趋势(发起量 / 完成量)
///
public List DailyTrend { get; set; } = new();
}
///
/// 逐日趋势项
///
public class FlowTrendItem
{
public string Date { get; set; } = "";
public int StartedCount { get; set; }
public int CompletedCount { get; set; }
}
///
/// 表①:按流程维度统计
///
public class FlowByFlowOutput
{
public long FlowId { get; set; }
public string? FlowCode { get; set; }
public string FlowName { get; set; } = "";
public string? BizType { get; set; }
public string? BizTypeName { get; set; }
public int TotalCount { get; set; }
public int CompletedCount { get; set; }
public int RunningCount { get; set; }
public int RejectedCount { get; set; }
///
/// 通过率 = 已完成 /(已完成 + 已拒绝)
///
public decimal PassRate { get; set; }
public decimal AvgDurationHours { get; set; }
public decimal MaxDurationHours { get; set; }
}
///
/// 表②:按节点维度统计(瓶颈分析核心表)
///
public class FlowByNodeOutput
{
public long FlowId { get; set; }
public string? FlowCode { get; set; }
public string FlowName { get; set; } = "";
public string NodeId { get; set; } = "";
public string? NodeName { get; set; }
public string? NodeType { get; set; }
///
/// 流经次数(该节点在已完成节点表中的记录数)
///
public int FlowCount { get; set; }
///
/// 平均停留时长(小时,仅 userTask 有意义)
///
public decimal AvgDurationHours { get; set; }
public decimal MaxDurationHours { get; set; }
public int ApproveCount { get; set; }
public int RejectCount { get; set; }
public decimal RejectRate { get; set; }
public int TimeoutCount { get; set; }
///
/// 当前仍在 Pending 的任务数
///
public int PendingCount { get; set; }
///
/// 该节点历史上用时最长的审批人
///
public string? LongestApproverName { get; set; }
///
/// 该节点历史上用时最短的审批人
///
public string? ShortestApproverName { get; set; }
}
///
/// 表③:按审批人维度统计
///
public class FlowByApproverOutput
{
public long ApproverId { get; set; }
public string ApproverName { get; set; } = "";
public string? OrgName { get; set; }
public int TotalAssigned { get; set; }
public int CompletedCount { get; set; }
public int PendingCount { get; set; }
public decimal AvgProcessHours { get; set; }
public int TimeoutCount { get; set; }
public int ApproveCount { get; set; }
public int RejectCount { get; set; }
public int TransferCount { get; set; }
}
///
/// Top N 最慢节点(柱图数据)
///
public class FlowTopSlowNodeItem
{
public string FlowName { get; set; } = "";
public string NodeName { get; set; } = "";
public decimal AvgDurationHours { get; set; }
public int FlowCount { get; set; }
}