upd: 修改订单与家政人员接口
This commit is contained in:
@ -18,18 +18,6 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository = orderRepository;
|
||||
|
||||
/// <summary>
|
||||
/// 分配师傅
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="workerId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task AssignAsync(Guid orderId, Guid workerId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.AssignWorker(workerId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
@ -44,29 +32,6 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
order.Cancel(reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 完成订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CompleteServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.CompleteService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task ConfirmAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.ConfirmCompletion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
@ -97,10 +62,9 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改订单信息
|
||||
/// 修改订单信息
|
||||
/// </summary>
|
||||
/// <param name="input">订单DTO对象</param>
|
||||
/// s
|
||||
public async Task EditAsync(OrderDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
@ -111,35 +75,37 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 更新订单
|
||||
await _orderRepository.UpdateAsync(order);
|
||||
//await _orderRepository.UpdateAsync(order);
|
||||
}
|
||||
|
||||
public async Task PayServiceCallFeeAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.PayServiceCallFee();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付
|
||||
/// 支付
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input)
|
||||
public async Task PayAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var order = await _orderRepository.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null) throw new BusinessException("未找到订单");
|
||||
|
||||
order.Pay();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task StartServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.StartService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据订单ID获取单个订单
|
||||
/// 根据订单ID获取单个订单
|
||||
/// </summary>
|
||||
public async Task<OrderDto> GetAsync(Guid id)
|
||||
{
|
||||
@ -151,12 +117,13 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有订单列表
|
||||
/// 获取订单列表
|
||||
/// </summary>
|
||||
public async Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input)
|
||||
public async Task<PagedResultDto<OrderDto>> GetListAsync(OrderPagedResultRequestDto input)
|
||||
{
|
||||
// 查询所有订单
|
||||
var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, "Id");
|
||||
//TODO 默认根据角色筛选对应订单,整合到一个接口中
|
||||
var query = await _orderRepository.GetQueryableAsync();
|
||||
var orders = query.PageBy(input).OrderBy(o => o.Id).ToList();
|
||||
|
||||
var totalCount = await _orderRepository.CountAsync();
|
||||
|
||||
@ -164,4 +131,8 @@ public class OrderAppService(IOrderRepository orderRepository) : ApplicationServ
|
||||
|
||||
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user