|
@@ -2323,29 +2323,24 @@ public class OrderController : BaseController
|
|
|
[HttpPost("handle")]
|
|
|
public async Task Handle([FromBody] OrderHandleFlowDto dto)
|
|
|
{
|
|
|
- Order order;
|
|
|
- if (string.IsNullOrEmpty(dto.Data?.Id))
|
|
|
+ var orderId = dto.Data?.Id;
|
|
|
+ if (string.IsNullOrEmpty(orderId))
|
|
|
{
|
|
|
- order = await _orderRepository.Queryable()
|
|
|
+ var order = await _orderRepository.Queryable()
|
|
|
.FirstAsync(d => d.WorkflowId == dto.Workflow.WorkflowId, HttpContext.RequestAborted);
|
|
|
if (order is null)
|
|
|
throw new UserFriendlyException("流程无对应工单");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- order = await _orderRepository.Queryable()
|
|
|
- .FirstAsync(d => d.Id == dto.Data.Id, HttpContext.RequestAborted);
|
|
|
+ orderId = order.Id;
|
|
|
}
|
|
|
|
|
|
- if (await _orderDelayRepository.AnyAsync(x => x.OrderId == order.Id && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
|
|
|
+ if (await _orderDelayRepository.AnyAsync(x => x.OrderId == orderId && x.DelayState == EDelayState.Examining, HttpContext.RequestAborted))
|
|
|
{
|
|
|
throw UserFriendlyException.SameMessage("该工单存在正在审核中的延期,不能办理");
|
|
|
}
|
|
|
|
|
|
if(dto.Data is not null && !string.IsNullOrEmpty(dto.Data.Id))
|
|
|
{
|
|
|
- _mapper.Map(dto.Data, order);
|
|
|
- await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
+ await Update(dto.Data);
|
|
|
}
|
|
|
|
|
|
await _workflowApplication.NextAsync(dto.Workflow, HttpContext.RequestAborted);
|