using Entity.Api.Req; using Entity.Api.Resp; using HybirdFrameworkCore.Entity; using Microsoft.AspNetCore.Mvc; using Service.Station; namespace WebStarter.Controllers; /// /// 首页统计 /// [ApiController] [Route("api/[controller]")] public class HomeController : ControllerBase { private readonly SwapOrderService _swapOrderService; private readonly ChargeOrderService _chargeOrderService; /// /// 注入 /// /// /// public HomeController(SwapOrderService swapOrderService ,ChargeOrderService chargeOrderService ) { _swapOrderService = swapOrderService; _chargeOrderService = chargeOrderService; } /// /// 统计当月的每一天换电数量、充电量 /// /// [HttpGet("GetDaySwapOrderCount")] public async Task>> GetDaySwapOrderCount() { return Result>.Success(await _swapOrderService.GetDaySwapOrderCount(), "成功"); } /// /// 查询月换电次数、换电车辆、充电统计 /// /// [HttpGet("GetMonthSwapOrderCount")] public async Task> GetMonthSwapOrderCount() { return Result.Success(await _swapOrderService.GetMonthSwapOrderCount(), "成功"); } /// /// 用电量查询 /// /// /// [HttpPost("GetElectricityConsumption")] public async Task>> GetElectricityConsumption([FromBody] ChargeCountReq req) { return Result>.Success(await _chargeOrderService.GetElectricityConsumptionByTime(req), "成功"); } /// /// 用电量查询、根据充电机分组 /// /// /// [HttpPost("GetElectricityChargerNoConsumption")] public async Task>> GetElectricityChargerNoConsumption([FromBody] ChargeCountReq req) { return Result>.Success(await _chargeOrderService.GetElectricityConsumptionByChargerNo(req), "成功"); } /// /// 充电量导出 /// /// /// [HttpPost] [Route("export")] public async Task ExportSwapOrder([FromBody] ChargeCountReq req) { // 获取请求头中的语言信息 var language = Request.Headers["Accept-Language"].ToString().ToLower(); return await _chargeOrderService.ExportElectricityChargerNoConsumption(req,language); } }