|
@@ -28,6 +28,7 @@ using DotNetCore.CAP;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
|
+using Hotline.Share.Enums.FlowEngine;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
|
|
|
@@ -204,16 +205,25 @@ public abstract class SnapshotApplicationBase
|
|
|
|
|
|
var outDto = publish.Adapt<OrderPublishDetailOutDto>();
|
|
|
var fileServiceUrl = _systemSettingCacheManager.FileServerUrl;
|
|
|
- foreach (var item in outDto.FileJson)
|
|
|
+ if (outDto.FileJson != null)
|
|
|
{
|
|
|
- item.Path = fileServiceUrl + item.Path;
|
|
|
+ foreach (var item in outDto.FileJson)
|
|
|
+ {
|
|
|
+ item.Path = fileServiceUrl + item.Path;
|
|
|
+ }
|
|
|
}
|
|
|
- outDto.Workflow = await _workflowTraceRepository.Queryable()
|
|
|
- .Where(m => m.ExternalId == publish.OrderId && m.AcceptTime != null && m.AcceptorOrgName != null)
|
|
|
+ var traces = await _workflowTraceRepository.Queryable()
|
|
|
+ .Where(m => m.ExternalId == publish.OrderId && m.Status == EWorkflowStepStatus.Handled)
|
|
|
.OrderBy(m => m.AcceptTime)
|
|
|
- .Select<SnapshotWorkflow>()
|
|
|
.ToListAsync(requestAborted);
|
|
|
-
|
|
|
+ var centre = traces.Where(m => m.StepType == EStepType.End || m.StepType == EStepType.Start || m.BusinessType == EBusinessType.Send || m.BusinessType == EBusinessType.Seat || m.BusinessType == EBusinessType.File)
|
|
|
+ .Select(m => new SnapshotWorkflow(m.Id, m.Name, m.HandleTime.Value))
|
|
|
+ .ToList();
|
|
|
+ outDto.Workflow = traces.Where(m => !centre.Select(s => s.Id).ToList().Contains(m.Id))
|
|
|
+ .Select(m => new SnapshotWorkflow(m.Id, m.Name, m.HandleTime.Value))
|
|
|
+ .ToList();
|
|
|
+ outDto.Workflow.AddRange(centre);
|
|
|
+ outDto.Workflow = outDto.Workflow.OrderBy(m => m.HandleTime).ToList();
|
|
|
return outDto;
|
|
|
}
|
|
|
|
|
@@ -262,16 +272,14 @@ public abstract class SnapshotApplicationBase
|
|
|
return outDto;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单列表
|
|
|
+ /// </summary>
|
|
|
public async Task<IList<OrderOutDto>> GetSnapshotOrdersAsync(OrderInDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var member = await _thirdAccountRepository.QueryByOpenIdAsync(_sessionContext.OpenId);
|
|
|
- if (member == null)
|
|
|
- {
|
|
|
- return new List<OrderOutDto>();
|
|
|
- }
|
|
|
var items = await _orderSnapshotRepository.Queryable()
|
|
|
.LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
|
|
|
- .Where((snapshot, order) => order.Contact == member.PhoneNumber)
|
|
|
+ .Where((snapshot, order) => order.Contact == _sessionContext.Phone)
|
|
|
.WhereIF(dto.Status == EOrderQueryStatus.Appraise, (snapshot, order) => order.Status == EOrderStatus.Visited)
|
|
|
.WhereIF(dto.Status == EOrderQueryStatus.NoReply, (snapshot, order) => order.Status < EOrderStatus.Filed)
|
|
|
.WhereIF(dto.Status == EOrderQueryStatus.Reply, (snapshot, order) => order.Status >= EOrderStatus.Filed)
|
|
@@ -291,24 +299,38 @@ public abstract class SnapshotApplicationBase
|
|
|
return items;
|
|
|
}
|
|
|
|
|
|
- public async Task<OrderDetailOutDto> GetSnapshotOrderDetailAsync(string id)
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单详情
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<OrderPublishDetailOutDto> GetSnapshotOrderDetailAsync(string id, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var detail = await _orderSnapshotRepository.Queryable()
|
|
|
- .Where(m => m.Id == id)
|
|
|
- .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
|
|
|
- .Select((snapshot, order) => new OrderDetailOutDto
|
|
|
- {
|
|
|
- Id = snapshot.Id,
|
|
|
- OrderNo = order.No,
|
|
|
- Title = order.Title,
|
|
|
- Status = order.Status,
|
|
|
- IndustryName = snapshot.IndustryName,
|
|
|
- CreationTime = order.CreationTime,
|
|
|
- Area = order.City
|
|
|
- })
|
|
|
- .FirstAsync();
|
|
|
+ var order = await _orderRepository.GetAsync(id) ??
|
|
|
+ throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
|
|
|
- return detail;
|
|
|
+ var outDto = order.Adapt<OrderPublishDetailOutDto>();
|
|
|
+ var fileServiceUrl = _systemSettingCacheManager.FileServerUrl;
|
|
|
+ if (outDto.FileJson != null)
|
|
|
+ {
|
|
|
+ foreach (var item in outDto.FileJson)
|
|
|
+ {
|
|
|
+ item.Path = fileServiceUrl + item.Path;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var traces = await _workflowTraceRepository.Queryable()
|
|
|
+ .Where(m => m.ExternalId == order.Id && m.Status == EWorkflowStepStatus.Handled)
|
|
|
+ .OrderBy(m => m.AcceptTime)
|
|
|
+ .ToListAsync(cancellationToken);
|
|
|
+ var centre = traces.Where(m => m.StepType == EStepType.End || m.StepType == EStepType.Start || m.BusinessType == EBusinessType.Send || m.BusinessType == EBusinessType.Seat || m.BusinessType == EBusinessType.File)
|
|
|
+ .Select(m => new SnapshotWorkflow(m.Id, m.Name, m.HandleTime.Value))
|
|
|
+ .ToList();
|
|
|
+ outDto.Workflow = traces.Where(m => !centre.Select(s => s.Id).ToList().Contains(m.Id))
|
|
|
+ .Select(m => new SnapshotWorkflow(m.Id, m.Name, m.HandleTime.Value))
|
|
|
+ .ToList();
|
|
|
+ outDto.Workflow.AddRange(centre);
|
|
|
+ outDto.Workflow = outDto.Workflow.OrderBy(m => m.HandleTime).ToList();
|
|
|
+ return outDto;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -316,11 +338,11 @@ public abstract class SnapshotApplicationBase
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<PagedDto<RedPackOutDto>> GetRedPacksAsync(RedPacksInDto dto)
|
|
|
+ public async Task<IList<RedPackOutDto>> GetRedPacksAsync(RedPacksInDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var openId = _sessionContext.OpenId;
|
|
|
- var (total, items) = await _redPackRecordRepository.Queryable()
|
|
|
- .Where(m => m.WXOpenId == openId)
|
|
|
+ var items = await _redPackRecordRepository.Queryable(includeDeleted: true)
|
|
|
+ .Where(m => m.IsDeleted == false)
|
|
|
+ .Where(m => m.WXOpenId == _sessionContext.OpenId)
|
|
|
.Where(m => m.PickupStatus == dto.Status)
|
|
|
.Where(m => m.CreationTime.ToString("yyyy-MM") == dto.Time)
|
|
|
.LeftJoin<Order>((red, order) => red.OrderId == order.Id)
|
|
@@ -330,9 +352,9 @@ public abstract class SnapshotApplicationBase
|
|
|
Title = order.Title,
|
|
|
CreationTime = red.CreationTime
|
|
|
})
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize);
|
|
|
+ .ToFixedListAsync(dto, cancellationToken);
|
|
|
|
|
|
- return new PagedDto<RedPackOutDto>(total, items);
|
|
|
+ return items;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|