|
@@ -34,7 +34,8 @@ namespace Hotline.Api.Controllers;
|
|
|
/// </summary>
|
|
|
public class OrderController : BaseController
|
|
|
{
|
|
|
- private readonly IOrderDomainService _orderDomainService;
|
|
|
+
|
|
|
+ private readonly IOrderDomainService _orderDomainService;
|
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
private readonly IWorkflowApplication _workflowApplication;
|
|
|
private readonly IWorkflowDomainService _workflowDomainService;
|
|
@@ -57,7 +58,8 @@ public class OrderController : BaseController
|
|
|
private readonly IOrderSuperviseRepository _orderSuperviseRepository;
|
|
|
private readonly IOrderUrgeRepository _orderUrgeRepository;
|
|
|
|
|
|
- public OrderController(
|
|
|
+
|
|
|
+ public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
@@ -79,7 +81,8 @@ public class OrderController : BaseController
|
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
IOrderRedoRepository orderRedoRepository,
|
|
|
IOrderSuperviseRepository orderSuperviseRepository,
|
|
|
- IOrderUrgeRepository orderUrgeRepository)
|
|
|
+ IOrderUrgeRepository orderUrgeRepository
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -103,7 +106,7 @@ public class OrderController : BaseController
|
|
|
_orderRedoRepository = orderRedoRepository;
|
|
|
_orderSuperviseRepository = orderSuperviseRepository;
|
|
|
_orderUrgeRepository = orderUrgeRepository;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
#region 工单发布
|
|
|
|
|
@@ -552,6 +555,7 @@ public class OrderController : BaseController
|
|
|
throw UserFriendlyException.SameMessage("无效工单");
|
|
|
|
|
|
var model = _mapper.Map<OrderSupervise>(dto);
|
|
|
+ model.State = 0;
|
|
|
await _orderSuperviseRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
@@ -609,111 +613,112 @@ public class OrderController : BaseController
|
|
|
.FirstAsync(x => x.Id == id);
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 工单催办
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单催办列表
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.UrgeOrderList)]
|
|
|
- [HttpGet("urge")]
|
|
|
- public async Task<PagedDto<OrderUrge>> UrgeList([FromQuery] UrgeListDto dto)
|
|
|
- {
|
|
|
- var (total, items) = await _orderUrgeRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .Includes(x => x.Organize)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
|
|
|
- .WhereIF(dto.SuperviseState > 0, x => x.State == dto.SuperviseState)
|
|
|
- .OrderByDescending(x => x.CreationTime)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
-
|
|
|
- return new PagedDto<OrderUrge>(total, _mapper.Map<IReadOnlyList<OrderUrge>>(items));
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 申请催办
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.ApplyUrge)]
|
|
|
- [HttpPost("urge/apply")]
|
|
|
- public async Task ApplyUrge([FromBody] ApplyOrderUrgeDto dto)
|
|
|
- {
|
|
|
- //验证工单是否可以申请
|
|
|
- var order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
|
|
|
- if (order is null)
|
|
|
- throw UserFriendlyException.SameMessage("无效工单");
|
|
|
-
|
|
|
- var model = _mapper.Map<OrderUrge>(dto);
|
|
|
- await _orderUrgeRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 回复催办
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.ReplyUrge)]
|
|
|
- [HttpPost("urge/reply")]
|
|
|
- public async Task ReplyUrge([FromBody] ReplyOrderUrgeDto dto)
|
|
|
- {
|
|
|
- //验证是否存在催办
|
|
|
- var supervise = await _orderUrgeRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
- if (supervise is null)
|
|
|
- throw UserFriendlyException.SameMessage("无效催办");
|
|
|
-
|
|
|
- var model = _mapper.Map<OrderUrge>(dto);
|
|
|
- model.ReplyId = _sessionContext.UserId;
|
|
|
- await _orderUrgeRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 签收催办
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.SignUrge)]
|
|
|
- [HttpPost("urge/sign")]
|
|
|
- public async Task SignUrge([FromBody] SignOrderUrgeDto dto)
|
|
|
- {
|
|
|
- //验证是否存在催办
|
|
|
- var supervise = await _orderUrgeRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
- if (supervise is null)
|
|
|
- throw UserFriendlyException.SameMessage("无效催办");
|
|
|
-
|
|
|
- var model = _mapper.Map<OrderUrge>(dto);
|
|
|
- model.SignTime = DateTime.Now;
|
|
|
- await _orderUrgeRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 催办详情
|
|
|
- /// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.UrgeEntity)]
|
|
|
- [HttpGet("urge/{id}")]
|
|
|
- public async Task<OrderUrge> UrgeEntity(string id)
|
|
|
- {
|
|
|
- return await _orderUrgeRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .Includes(x => x.Organize)
|
|
|
- .FirstAsync(x => x.Id == id);
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
- #region 工单办理
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单列表
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.OrderQuery)]
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单催办
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单催办列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UrgeOrderList)]
|
|
|
+ [HttpGet("urge")]
|
|
|
+ public async Task<PagedDto<OrderUrge>> UrgeList([FromQuery] UrgeListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderUrgeRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Organize)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(dto.SuperviseState > 0, x => x.State == dto.SuperviseState)
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ return new PagedDto<OrderUrge>(total, _mapper.Map<IReadOnlyList<OrderUrge>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 申请催办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.ApplyUrge)]
|
|
|
+ [HttpPost("urge/apply")]
|
|
|
+ public async Task ApplyUrge([FromBody] ApplyOrderUrgeDto dto)
|
|
|
+ {
|
|
|
+ //验证工单是否可以申请
|
|
|
+ var order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
|
|
|
+ if (order is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效工单");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderUrge>(dto);
|
|
|
+ await _orderUrgeRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 回复催办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.ReplyUrge)]
|
|
|
+ [HttpPost("urge/reply")]
|
|
|
+ public async Task ReplyUrge([FromBody] ReplyOrderUrgeDto dto)
|
|
|
+ {
|
|
|
+ //验证是否存在催办
|
|
|
+ var supervise = await _orderUrgeRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (supervise is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效催办");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderUrge>(dto);
|
|
|
+ model.ReplyId = _sessionContext.UserId;
|
|
|
+ await _orderUrgeRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 签收催办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.SignUrge)]
|
|
|
+ [HttpPost("urge/sign")]
|
|
|
+ public async Task SignUrge([FromBody] SignOrderUrgeDto dto)
|
|
|
+ {
|
|
|
+ //验证是否存在催办
|
|
|
+ var supervise = await _orderUrgeRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (supervise is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效催办");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderUrge>(dto);
|
|
|
+ model.SignTime = DateTime.Now;
|
|
|
+ await _orderUrgeRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 催办详情
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UrgeEntity)]
|
|
|
+ [HttpGet("urge/{id}")]
|
|
|
+ public async Task<OrderUrge> UrgeEntity(string id)
|
|
|
+ {
|
|
|
+ return await _orderUrgeRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Organize)
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单办理
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.OrderQuery)]
|
|
|
[HttpGet]
|
|
|
public async Task<PagedDto<OrderDto>> Query([FromQuery] QueryOrderDto dto)
|
|
|
{
|