106 lines
2.6 KiB
C#
106 lines
2.6 KiB
C#
using Dlhis.Canteen.Dishes.Request;
|
|
using Dlhis.Canteen.Order.Request;
|
|
using Dlhis.Canteen.Order.Response;
|
|
using Dlhis.Canteen.Order.Services;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Kurisu.Core.DataAccess.Dto;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Org.BouncyCastle.Asn1.Ocsp;
|
|
|
|
namespace Dlhis.Canteen.Dishes.Controllers;
|
|
|
|
/// <summary>
|
|
/// 订单
|
|
/// </summary>
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class OrdersController : ControllerBase
|
|
{
|
|
private readonly IOrderService _orderService;
|
|
|
|
public OrdersController(IOrderService orderService)
|
|
{
|
|
_orderService = orderService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 订单分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<OrderResponse>> GetPageAsync([FromQuery] OrderPageRequest request)
|
|
{
|
|
return await _orderService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加充值/消费订单
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[IgnoreTenant]
|
|
public async Task<OrderResultResponse> AddAsync(OrderAddRequest request)
|
|
{
|
|
return await _orderService.AddAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设备发起订单
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("device")]
|
|
[IgnoreTenant]
|
|
public async Task<OrderResultResponse> DeviceConsume(OrderAddRequest request)
|
|
{
|
|
return await _orderService.AddAsync(request);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 订餐
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost("booking")]
|
|
[Transactional]
|
|
public async Task Booking(BookingMealRequest request)
|
|
{
|
|
await _orderService.BookingAsync(request);
|
|
}
|
|
|
|
///// <summary>
|
|
///// 获取详情
|
|
///// </summary>
|
|
///// <param name="no"></param>
|
|
///// <returns></returns>
|
|
//[HttpGet("details")]
|
|
//public async Task<List<OrderDetailResponse>> GetDetailsAsync(string no)
|
|
//{
|
|
// return await _orderService.GetDetailsAsync(no);
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 充值
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost("recharge")]
|
|
public async Task ReCharge()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 订单聚合数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("aggregation")]
|
|
public async Task<Pagination<OrderAggregationResponse>> GetOrdersAggregationAsync([FromQuery] PageDto page)
|
|
{
|
|
return await _orderService.GetOrdersAggregationAsync(page);
|
|
}
|
|
}
|