|
@@ -20,6 +20,7 @@ using Hotline.Share.Mq;
|
|
|
using MapsterMapper;
|
|
|
using MediatR;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using Microsoft.IdentityModel.Tokens;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Authentications;
|
|
|
using XF.Domain.Constants;
|
|
@@ -53,8 +54,9 @@ public class OrderController : BaseController
|
|
|
private readonly ITimeLimitApplication _timeLimitApplication;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
private readonly IOrderRedoRepository _orderRedoRepository;
|
|
|
+ private readonly IOrderSuperviseRepository _orderSuperviseRepository;
|
|
|
|
|
|
- public OrderController(
|
|
|
+ public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
@@ -74,7 +76,8 @@ public class OrderController : BaseController
|
|
|
IOrderDelayRepository orderDelayRepository,
|
|
|
ITimeLimitApplication timeLimitApplication,
|
|
|
ISystemSettingCacheManager systemSettingCacheManager,
|
|
|
- IOrderRedoRepository orderRedoRepository)
|
|
|
+ IOrderRedoRepository orderRedoRepository,
|
|
|
+ IOrderSuperviseRepository orderSuperviseRepository)
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -96,7 +99,9 @@ public class OrderController : BaseController
|
|
|
_timeLimitApplication = timeLimitApplication;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
_orderRedoRepository = orderRedoRepository;
|
|
|
- }
|
|
|
+ _orderSuperviseRepository = orderSuperviseRepository;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
#region 工单发布
|
|
|
|
|
@@ -510,7 +515,97 @@ public class OrderController : BaseController
|
|
|
|
|
|
#region 工单督办
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 工单督办列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.SuperviseOrderList)]
|
|
|
+ [HttpGet("supervise")]
|
|
|
+ public async Task<PagedDto<OrderSupervise>> SuperviseList([FromQuery] SuperviseListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderSuperviseRepository.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<OrderSupervise>(total, _mapper.Map<IReadOnlyList<OrderSupervise>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 申请督办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.ApplySupervise)]
|
|
|
+ [HttpPost("supervise/apply")]
|
|
|
+ public async Task ApplySupervise([FromBody] ApplyOrderSuperviseDto dto)
|
|
|
+ {
|
|
|
+ //验证工单是否可以申请
|
|
|
+ var order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
|
|
|
+ if (order is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效工单");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderSupervise>(dto);
|
|
|
+ await _orderSuperviseRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 回复督办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.ReplySupervise)]
|
|
|
+ [HttpPost("supervise/reply")]
|
|
|
+ public async Task ReplySupervise([FromBody] ReplyOrderSuperviseDto dto)
|
|
|
+ {
|
|
|
+ //验证是否存在督办
|
|
|
+ var supervise = await _orderSuperviseRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (supervise is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效督办");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderSupervise>(dto);
|
|
|
+ model.ReplyId = _sessionContext.UserId;
|
|
|
+ await _orderSuperviseRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 签收督办
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.SignSupervise)]
|
|
|
+ [HttpPost("supervise/sign")]
|
|
|
+ public async Task SignSupervise([FromBody] SignOrderSuperviseDto dto)
|
|
|
+ {
|
|
|
+ //验证是否存在督办
|
|
|
+ var supervise = await _orderSuperviseRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (supervise is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效督办");
|
|
|
+
|
|
|
+ var model = _mapper.Map<OrderSupervise>(dto);
|
|
|
+ model.SignTime = DateTime.Now;
|
|
|
+ await _orderSuperviseRepository.UpdateAsync(model, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 督办详情
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.DelayEntity)]
|
|
|
+ [HttpGet("supervise/{id}")]
|
|
|
+ public async Task<OrderSupervise> SuperviseEntity(string id)
|
|
|
+ {
|
|
|
+ return await _orderSuperviseRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .Includes(x => x.Organize)
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
|
|