IReportsAppService.cs 3.42 KB
using FoodLabeling.Application.Contracts.Dtos.Common;
using FoodLabeling.Application.Contracts.Dtos.Reports;
using FoodLabeling.Application.Contracts.Dtos.UsAppLabeling;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;

namespace FoodLabeling.Application.Contracts.IServices;

/// <summary>
/// Reports(Print Log / Label Report)管理端接口
/// </summary>
public interface IReportsAppService : IApplicationService
{
    /// <summary>
    /// Print Log 分页列表;角色 <c>admin</c> 可查全部,否则仅当前用户打印记录。
    /// </summary>
    Task<PagedResultWithPageDto<ReportsPrintLogListItemDto>> GetPrintLogListAsync(ReportsPrintLogGetListInputVo input);

    /// <summary>
    /// Print Log 导出 PDF(筛选与列表一致,最多 5000 条)
    /// </summary>
    Task<IActionResult> ExportPrintLogPdfAsync(ReportsPrintLogGetListInputVo input);

    /// <summary>
    /// Print Log 全量导出 Excel(筛选与列表一致;排序与列表 <c>PrintedAt</c> 规则一致;最多 5000 条)
    /// </summary>
    Task<IActionResult> ExportPrintLogExcelAsync(ReportsPrintLogGetListInputVo input);

    /// <summary>
    /// 根据历史任务重打(与 App 入参一致);<c>admin</c> 可重打任意用户任务,否则仅本人任务。
    /// </summary>
    Task<UsAppLabelPrintOutputDto> ReprintPrintLogAsync(UsAppLabelReprintInputVo input);

    /// <summary>
    /// Label Report 统计(卡片 + 分类柱数据 + 7 日趋势 + Top 产品);
    /// <c>admin</c> 统计全部门店;非管理员仅统计 <c>userlocation</c> 绑定门店内全部打印任务(不按 CreatedBy 过滤)。
    /// </summary>
    Task<ReportsLabelReportOutputDto> GetLabelReportAsync(ReportsLabelReportQueryInputVo input);

    /// <summary>
    /// Label Report 导出 PDF
    /// </summary>
    Task<IActionResult> ExportLabelReportPdfAsync(ReportsLabelReportQueryInputVo input);

    /// <summary>
    /// 按模板统计打印标签数量(分页列表:模板名称 + 打印数)。
    /// </summary>
    /// <remarks>
    /// 统计 <c>fl_label_print_task</c>,按 <c>TemplateId</c> 分组;数据范围与 <c>label-report</c> 一致:
    /// 管理员可查全部门店(可按 Company/Region/Location 收窄);非管理员仅 <c>userlocation</c> 绑定门店内全部打印任务。
    ///
    /// 示例请求:
    /// ```http
    /// GET /api/app/reports/template-print-stat-list?SkipCount=1&amp;MaxResultCount=20&amp;StartDate=2026-04-07&amp;EndDate=2026-05-18
    /// Authorization: Bearer {token}
    /// ```
    ///
    /// 参数说明:
    /// - SkipCount / MaxResultCount: 分页(SkipCount 为 1-based 页码约定,与项目其它列表一致)
    /// - StartDate / EndDate: 统计区间(含起止日;默认近 30 天至今天)
    /// - PartnerId / GroupId / LocationId: 组织范围筛选
    /// - Keyword: 模板名称模糊匹配
    /// - Sorting: 可选 <c>PrintedCount desc</c>(默认按打印数降序)
    /// </remarks>
    /// <param name="input">分页与筛选条件</param>
    /// <returns>各模板打印数量列表</returns>
    /// <response code="200">成功返回分页统计</response>
    /// <response code="400">入参无效或未登录</response>
    /// <response code="500">服务器错误</response>
    Task<PagedResultWithPageDto<ReportsTemplatePrintStatListItemDto>> GetTemplatePrintStatListAsync(
        ReportsTemplatePrintStatGetListInputVo input);
}