using Admin.NET.Plugin.AiDOP.Const.S8;
using Admin.NET.Plugin.AiDOP.Dto.S8.OrderFlow;
using Admin.NET.Plugin.AiDOP.Infrastructure.S8;
using Admin.NET.Plugin.AiDOP.Service.S8.OrderFlow;
namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
///
/// S8 Stage-1「订单评审」实际耗时 API。
/// 数据链:aidop_action_run_log → mdp_stg_action_run → mdp_std_action_event → dwd_order_review_kpi。
/// 本控制器只消费 DWD,不直读任何源业务表;租户从 JWT 解析,不接受前端 tenantId。
/// 路由:api/aidop/s8/order-review-kpi/*。
///
[ApiController]
[Route("api/aidop/s8/order-review-kpi")]
[NonUnify]
public class AdoS8OrderReviewKpiController : ControllerBase
{
private readonly S8OrderReviewKpiService _svc;
public AdoS8OrderReviewKpiController(S8OrderReviewKpiService svc)
{
_svc = svc;
}
/// 订单评审耗时列表(分页)。
[HttpGet("list")]
[S8Permission(S8PermissionCatalog.DashboardRead)]
public async Task ListAsync([FromQuery] AdoS8OrderReviewKpiQueryDto query)
=> Ok(await _svc.GetListAsync(query));
/// 订单评审耗时汇总(本批无 TargetHours / 红黄绿)。
[HttpGet("summary")]
[S8Permission(S8PermissionCatalog.DashboardRead)]
public async Task SummaryAsync()
=> Ok(await _svc.GetSummaryAsync());
/// 手动重跑中台链路(幂等)。
[HttpPost("refresh")]
[S8Permission(S8PermissionCatalog.DashboardRead)]
public async Task RefreshAsync(CancellationToken cancellationToken)
=> Ok(await _svc.RefreshAsync(cancellationToken));
}