You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.3 KiB
80 lines
2.3 KiB
4 months ago
|
using AutoMapper;
|
||
|
using Entity.Api.Req;
|
||
|
using Entity.Api.Resp;
|
||
|
using Entity.DbModel.Station;
|
||
|
using HybirdFrameworkCore.Entity;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using Service.Station;
|
||
|
|
||
|
namespace WebStarter.Controllers;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 充电订单
|
||
|
/// </summary>
|
||
|
[ApiController]
|
||
|
[Route("api/[controller]")]
|
||
|
public class ChargeOrderOutController : ControllerBase
|
||
|
{
|
||
|
private readonly ChargeOrderOutService chargeOrderService;
|
||
|
|
||
|
public ChargeOrderOutController(ChargeOrderOutService chargeOrderService)
|
||
|
{
|
||
|
this.chargeOrderService = chargeOrderService;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询分页数据
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
[HttpPost("QueryPage")]
|
||
|
public async Task<Result<PageResult<ChargeOrderResp>>> QueryPage([FromBody] QueryChargeOrderReq req)
|
||
|
{
|
||
|
PageResult<ChargeOrderResp> queryChargeOrder = chargeOrderService.QueryChargeOrder(req);
|
||
|
return Result<PageResult<ChargeOrderResp>>.Success(queryChargeOrder);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 修改充电订单
|
||
|
/// </summary>
|
||
|
/// <param name="req"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpPost("Modify")]
|
||
|
public async Task<Result<bool>> Modify([FromBody] ModifyChargeOrderReq req)
|
||
|
{
|
||
|
//映射数据
|
||
|
var config = new MapperConfiguration(cfg => cfg.CreateMap<ChargeOrder, ModifyChargeOrderReq>().ReverseMap());
|
||
|
IMapper mapper = config.CreateMapper();
|
||
|
ChargeOrder chargeOrder = mapper.Map<ChargeOrder>(req);
|
||
|
|
||
|
if (chargeOrderService.Update(chargeOrder))
|
||
|
{
|
||
|
return Result<bool>.Success(true,"更改成功");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return Result<bool>.Fail("更改失败");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 充电订单导出
|
||
|
/// </summary>
|
||
|
/// <param name="req"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpPost]
|
||
|
[Route("export")]
|
||
|
public async Task<IActionResult> ExportChargeOrder([FromBody] QueryChargeOrderReq req)
|
||
|
{
|
||
|
return await chargeOrderService.ExportChargeOrder(req);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 充电订单上报云端,入参传 CloudChargeOrder
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
[HttpGet("UploadCloud/{id}")]
|
||
|
public Result<bool> UploadCloud(string id)
|
||
|
{
|
||
|
return chargeOrderService.Upload2Cloud(id);
|
||
|
}
|
||
|
}
|