115 lines
3.4 KiB
C#
115 lines
3.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Service.Interface;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WebAPI.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 统计报表(设备统计/维护报表/维修报表)
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("api/inspection/report")]
|
|
public class StatisticsReportController : ControllerBase
|
|
{
|
|
private readonly IStatisticsReportService _statisticsReportService;
|
|
|
|
public StatisticsReportController(IStatisticsReportService statisticsReportService)
|
|
{
|
|
_statisticsReportService = statisticsReportService;
|
|
}
|
|
|
|
#region 设备统计报表
|
|
|
|
/// <summary>
|
|
/// 设备统计概览(总数/在用/闲置/报废等)
|
|
/// </summary>
|
|
[HttpGet("device/statistics")]
|
|
public async Task<IActionResult> GetDeviceStatistics()
|
|
{
|
|
return Ok(await _statisticsReportService.GetDeviceStatisticsAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按分类统计设备数量
|
|
/// </summary>
|
|
[HttpGet("device/category")]
|
|
public async Task<IActionResult> GetCategoryStatistics()
|
|
{
|
|
return Ok(await _statisticsReportService.GetCategoryStatisticsAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按部门统计设备数量
|
|
/// </summary>
|
|
[HttpGet("device/department")]
|
|
public async Task<IActionResult> GetDepartmentStatistics()
|
|
{
|
|
return Ok(await _statisticsReportService.GetDepartmentStatisticsAsync());
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 设备维护报表
|
|
|
|
/// <summary>
|
|
/// 设备维护统计(校准/保养及时率、超期数量等)
|
|
/// </summary>
|
|
[HttpGet("maintenance/statistics")]
|
|
public async Task<IActionResult> GetMaintenanceStatistics()
|
|
{
|
|
return Ok(await _statisticsReportService.GetMaintenanceStatisticsAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 维护超期设备明细
|
|
/// </summary>
|
|
[HttpGet("maintenance/overdue")]
|
|
public async Task<IActionResult> GetMaintenanceOverdueDetails()
|
|
{
|
|
return Ok(await _statisticsReportService.GetMaintenanceOverdueDetailsAsync());
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 维修类报表
|
|
|
|
/// <summary>
|
|
/// 维修统计概览
|
|
/// </summary>
|
|
[HttpGet("repair/statistics")]
|
|
public async Task<IActionResult> GetRepairStatistics()
|
|
{
|
|
return Ok(await _statisticsReportService.GetRepairStatisticsAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 故障类型分布
|
|
/// </summary>
|
|
[HttpGet("repair/fault-type")]
|
|
public async Task<IActionResult> GetFaultTypeDistribution()
|
|
{
|
|
return Ok(await _statisticsReportService.GetFaultTypeDistributionAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 维修工时分析
|
|
/// </summary>
|
|
[HttpGet("repair/hours-analysis")]
|
|
public async Task<IActionResult> GetRepairHoursAnalysis()
|
|
{
|
|
return Ok(await _statisticsReportService.GetRepairHoursAnalysisAsync());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 维修记录明细列表
|
|
/// </summary>
|
|
[HttpGet("repair/records")]
|
|
public async Task<IActionResult> GetRepairRecordDetails()
|
|
{
|
|
return Ok(await _statisticsReportService.GetRepairRecordDetailsAsync());
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|