|
@@ -74,9 +74,11 @@ public class OrderController : BaseController
|
|
|
private readonly IRepeatableEventDetailRepository _repeatableEventDetailRepository;
|
|
|
private readonly IRepository<OrderWord> _orderWrodRepository;
|
|
|
private readonly IRepository<OrderObserve> _orderObserveRepository;
|
|
|
+ private readonly IRepository<OrderFinality> _orderFinalityRepository;
|
|
|
+
|
|
|
|
|
|
|
|
|
- public OrderController(
|
|
|
+ public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
@@ -109,8 +111,9 @@ public class OrderController : BaseController
|
|
|
IRepository<RepeatableEvent> repeatableEventRepository,
|
|
|
IRepeatableEventDetailRepository repeatableEventDetailRepository,
|
|
|
IRepository<OrderWord> orderWrodRepository,
|
|
|
- IRepository<OrderObserve> orderObserveRepository
|
|
|
- )
|
|
|
+ IRepository<OrderObserve> orderObserveRepository,
|
|
|
+ IRepository<OrderFinality> orderFinalityRepository
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -145,8 +148,10 @@ public class OrderController : BaseController
|
|
|
_repeatableEventDetailRepository = repeatableEventDetailRepository;
|
|
|
_orderWrodRepository = orderWrodRepository;
|
|
|
_orderObserveRepository = orderObserveRepository;
|
|
|
+ _orderFinalityRepository = orderFinalityRepository;
|
|
|
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
#region 工单发布
|
|
|
|
|
@@ -2202,6 +2207,79 @@ public class OrderController : BaseController
|
|
|
return await _orderObserveRepository.Queryable()
|
|
|
.FirstAsync(x => x.Id == id);
|
|
|
}
|
|
|
- #endregion
|
|
|
-
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单终结
|
|
|
+ /// <summary>
|
|
|
+ /// 新增工单终结
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dtos"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.AddOrderFinality)]
|
|
|
+ [HttpPost("order_finality")]
|
|
|
+ public async Task Add([FromBody] OrderFinalityAddDto dto)
|
|
|
+ {
|
|
|
+ var observe = _mapper.Map<OrderFinality>(dto);
|
|
|
+ await _orderFinalityRepository.AddAsync(observe, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 删除工单终结
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.DeleteOrderFinality)]
|
|
|
+ [HttpDelete("order_finality")]
|
|
|
+ public async Task Delete([FromBody] OrderFinalityDeleteDto dto)
|
|
|
+ {
|
|
|
+ await _orderRepository.RemoveOrderFinalityBatchAsync(dto.Ids, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新工单终结
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UpdateOrderFinality)]
|
|
|
+ [HttpPut("order_finality")]
|
|
|
+ public async Task Update([FromBody] OrderFinalityUpdateDto dto)
|
|
|
+ {
|
|
|
+ var word = await _orderFinalityRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (word is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效工单观察");
|
|
|
+ _mapper.Map(dto, word);
|
|
|
+ await _orderFinalityRepository.UpdateAsync(word, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单终结列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.OrderFinalityList)]
|
|
|
+ [HttpGet("order_finality/list")]
|
|
|
+ public async Task<PagedDto<OrderFinalityDto>> List([FromQuery] OrderFinalityListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderFinalityRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue, x => x.Order.IsProvince == dto.IsProvince)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.Order.No.Contains(dto.No!))
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderFinalityDto>(total, _mapper.Map<IReadOnlyList<OrderFinalityDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单终结
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("order_finality/{id}")]
|
|
|
+ public async Task<OrderFinality> OrderFinalityEntity(string id)
|
|
|
+ {
|
|
|
+ return await _orderFinalityRepository.Queryable()
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|