新增统计功能
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
|
||||
using MoYu.FriendlyException;
|
||||
using SimpleAdmin.Application.Services.Statistics;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 统计分析
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "统计分析")]
|
||||
[Route("biz/weibingju/statistics")]
|
||||
[RolePermission]
|
||||
public class StatisticsController : IDynamicApiController
|
||||
{
|
||||
private readonly IStatisticsService _service;
|
||||
|
||||
public StatisticsController(IStatisticsService service)
|
||||
{
|
||||
_service = service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取全量总览数据(不区分年份,含剩余药材库存价值)
|
||||
/// </summary>
|
||||
[HttpGet("overview")]
|
||||
[DisplayName("获取全量总览数据")]
|
||||
public async Task<dynamic> GetTotalOverview()
|
||||
{
|
||||
return await _service.GetTotalOverview();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取年度统计数据(含同比趋势)
|
||||
/// </summary>
|
||||
[HttpGet("yearly")]
|
||||
[DisplayName("获取年度统计数据")]
|
||||
public async Task<dynamic> GetYearlyStatistics([FromQuery] string year)
|
||||
{
|
||||
if (!int.TryParse(year, out int yearInt) || yearInt < 2000 || yearInt > 2100)
|
||||
throw Oops.Bah("年份参数不合法");
|
||||
|
||||
return await _service.GetYearlyStatistics(yearInt);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取月度明细数据(返回 12 个月,无数据月份自动补零)
|
||||
/// </summary>
|
||||
[HttpGet("monthly")]
|
||||
[DisplayName("获取月度明细数据")]
|
||||
public async Task<dynamic> GetMonthlyDetails([FromQuery] string year)
|
||||
{
|
||||
if (!int.TryParse(year, out int yearInt) || yearInt < 2000 || yearInt > 2100)
|
||||
throw Oops.Bah("年份参数不合法");
|
||||
|
||||
return await _service.GetMonthlyDetails(yearInt);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user