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