|
@@ -33,6 +33,11 @@ using XF.Domain.Constants;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
using XF.Utility.EnumExtensions;
|
|
|
+using Microsoft.IdentityModel.Tokens;
|
|
|
+using System.Linq;
|
|
|
+using Hotline.Share.Dtos.FlowEngine.Workflow;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Transactions;
|
|
|
|
|
|
namespace Hotline.Api.Controllers;
|
|
|
|
|
@@ -209,6 +214,7 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
//验证订单
|
|
|
var order = await _orderRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+
|
|
|
if (order is null)
|
|
|
throw UserFriendlyException.SameMessage("未找到工单,无法发布");
|
|
|
|
|
@@ -242,26 +248,17 @@ public class OrderController : BaseController
|
|
|
var seatDetail = new OrderVisitDetail();
|
|
|
seatDetail.VisitId = visitId;
|
|
|
seatDetail.VisitTarget = EVisitTarget.Seat;
|
|
|
- if (order.ProcessType== EProcessType.Zhiban)
|
|
|
- {
|
|
|
- seatDetail.VoiceEvaluate = EVoiceEvaluate.Satisfied;
|
|
|
- seatDetail.SeatEvaluate = ESeatEvaluate.Satisfied;
|
|
|
- order.Visited("1", "满意");
|
|
|
- await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+
|
|
|
visitedDetail.Add(seatDetail);
|
|
|
|
|
|
- if (order.ProcessType != EProcessType.Zhiban)
|
|
|
+ foreach (var item in dto.IdNames)
|
|
|
{
|
|
|
- foreach (var item in dto.IdNames)
|
|
|
- {
|
|
|
- var orgDetail = new OrderVisitDetail();
|
|
|
- orgDetail.VisitId = visitId;
|
|
|
- orgDetail.VisitOrgCode = item.Key;
|
|
|
- orgDetail.VisitOrgName = item.Value;
|
|
|
- orgDetail.VisitTarget = EVisitTarget.Org;
|
|
|
- visitedDetail.Add(orgDetail);
|
|
|
- }
|
|
|
+ var orgDetail = new OrderVisitDetail();
|
|
|
+ orgDetail.VisitId = visitId;
|
|
|
+ orgDetail.VisitOrgCode = item.Key;
|
|
|
+ orgDetail.VisitOrgName = item.Value;
|
|
|
+ orgDetail.VisitTarget = EVisitTarget.Org;
|
|
|
+ visitedDetail.Add(orgDetail);
|
|
|
}
|
|
|
|
|
|
await _mediator.Publish(new AddVisitNotify(visitedDetail), HttpContext.RequestAborted);
|
|
@@ -2352,8 +2349,25 @@ public class OrderController : BaseController
|
|
|
await _orderSpecialRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
|
if (model.State == 1)
|
|
|
{
|
|
|
- //TODO 调用流程
|
|
|
- }
|
|
|
+ var step =await _workflowStepRepository.GetAsync(dto.StepId);
|
|
|
+ var recall = new RecallDto
|
|
|
+ {
|
|
|
+ WorkflowId = step?.WorkflowId!,
|
|
|
+ NextStepCode = step.Code,
|
|
|
+ NextStepName = step.Name,
|
|
|
+ NextHandlers = step.Handlers
|
|
|
+ };
|
|
|
+ if (dto.AlterTime)
|
|
|
+ {
|
|
|
+ recall.External = new External
|
|
|
+ {
|
|
|
+ TimeLimit = dto.TimeLimit,
|
|
|
+ TimeLimitUnit = dto.TimeLimitUnit
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (dto.Files.Any()) recall.Additions = dto.Files;
|
|
|
+ await _workflowApplication.RecallAsync(recall, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -2372,8 +2386,25 @@ public class OrderController : BaseController
|
|
|
await _orderSpecialRepository.UpdateAsync(special, HttpContext.RequestAborted);
|
|
|
if (special.State == 1)
|
|
|
{
|
|
|
- //TODO 调用流程
|
|
|
- }
|
|
|
+ var step = await _workflowStepRepository.GetAsync(dto.StepId);
|
|
|
+ var recall = new RecallDto
|
|
|
+ {
|
|
|
+ WorkflowId = step?.WorkflowId!,
|
|
|
+ NextStepCode = step.Code,
|
|
|
+ NextStepName = step.Name,
|
|
|
+ NextHandlers = step.Handlers
|
|
|
+ };
|
|
|
+ if (dto.AlterTime)
|
|
|
+ {
|
|
|
+ recall.External = new External
|
|
|
+ {
|
|
|
+ TimeLimit = dto.TimeLimit,
|
|
|
+ TimeLimitUnit = dto.TimeLimitUnit
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (dto.Files.Any()) recall.Additions = dto.Files;
|
|
|
+ await _workflowApplication.RecallAsync(recall, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -2387,7 +2418,7 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
var (total, items) = await _orderSpecialRepository.Queryable()
|
|
|
.Includes(x => x.Order)
|
|
|
- .Includes(x => x.Trace)
|
|
|
+ .Includes(x => x.Step)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
x => x.Order.No.Contains(dto.Keyword!) || x.Order.Title.Contains(dto.Keyword!))
|
|
|
.WhereIF(dto.State.HasValue, x => x.State == dto.State)
|
|
@@ -2450,7 +2481,7 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
var item = await _orderSpecialRepository.Queryable()
|
|
|
.Includes(x => x.Order)
|
|
|
- .Includes(x => x.Trace)
|
|
|
+ .Includes(x => x.Step)
|
|
|
.FirstAsync(x => x.Id == id);
|
|
|
return _mapper.Map<OrderSpecialDto>(item);
|
|
|
}
|
|
@@ -2466,8 +2497,8 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
SpecialTimeType = EnumExts.GetDescriptions<ETimeType>(),
|
|
|
SpecialReason = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.SpecialReason),
|
|
|
- Traces = await _workflowTraceRepository.Queryable().Where(x => x.WorkflowId == id).ToListAsync()
|
|
|
- };
|
|
|
+ Step = await _workflowApplication.GetRecallStepsAsync(id, HttpContext.RequestAborted)
|
|
|
+ };
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
@@ -2480,9 +2511,9 @@ public class OrderController : BaseController
|
|
|
public async Task<int> SpecialHandleTime([FromQuery] OrderSpecialHandleTime dto)
|
|
|
{
|
|
|
var order = await _orderRepository.GetAsync(dto.OrderId);
|
|
|
- var trace = await _workflowTraceRepository.GetAsync(dto.TraceId);
|
|
|
- var org = await _organizeRepository.GetAsync(trace.HandlerOrgId);
|
|
|
- if (org != null && org.IsCenter) return _timeLimitDomainService.GetOrderTimeLimitConfig(string.Empty);
|
|
|
+ var step = await _workflowStepRepository.GetAsync(dto.StepId);
|
|
|
+ var org = await _organizeRepository.GetAsync(step.HandlerOrgId);
|
|
|
+ if (org is { IsCenter: true }) return _timeLimitDomainService.GetOrderTimeLimitConfig(string.Empty);
|
|
|
return _timeLimitDomainService.GetOrderTimeLimitConfig(order.AcceptTypeCode);
|
|
|
}
|
|
|
|