Merge pull request 'S01-轨迹中台' (#52) from S01-轨迹中台 into dev
Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/52
This commit is contained in:
commit
118e383d1e
@ -11,29 +11,34 @@
|
|||||||
public class TrackOrderDetailDto
|
public class TrackOrderDetailDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹订单id
|
/// Id es主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹订单id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码
|
/// 轨迹代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Code { get; set; }
|
public string? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容
|
/// 轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Content { get; set; }
|
public string? Content { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容英文
|
/// 轨迹内容英文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EnContent { get; set; }
|
public string? EnContent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生地
|
/// 轨迹发生地
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackPlace { get; set; }
|
public string? TrackPlace { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生时间
|
/// 轨迹发生时间
|
||||||
@ -43,6 +48,6 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生时区
|
/// 轨迹发生时区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTimeZone { get; set; }
|
public string? TrackTimeZone { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
public class GetTrackInput
|
public class GetTrackInput
|
||||||
@ -5,6 +7,8 @@ public class GetTrackInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单类型
|
/// 订单类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[Range(1, int.MaxValue)]
|
||||||
public int OrderType { get; set; }
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -14,12 +18,14 @@ public class GetTrackInput
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 时区 +8 +8.25 -8.5 -9
|
/// 时区 +8 +8.25 -8.5 -9
|
||||||
|
/// 不传默认+8
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float TimeZone { get; set; }
|
public float? TimeZone { get; set; } = 8;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 排序方式
|
/// 排序方式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Required]
|
||||||
public SortMethod SortMethod { get; set; }
|
public SortMethod SortMethod { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ public class UpsertOrderInput : UpdateOrderInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户id
|
/// 客户id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Required]
|
||||||
public int CustomId { get; set; }
|
public int CustomId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,8 @@ public class OrderAutoMapperProfile : Profile
|
|||||||
CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None);
|
CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None);
|
||||||
CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None);
|
CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None);
|
||||||
CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None);
|
CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None);
|
||||||
CreateMap<TrackDetailsIndex, TrackOrderDetailDto>(MemberList.None).ForMember(dest => dest.Id, opt => opt.MapFrom(m => m.OrderId))
|
CreateMap<TrackDetailsIndex, TrackOrderDetailDto>(MemberList.None)
|
||||||
|
.ForMember(dest => dest.Id, opt => opt.Ignore())
|
||||||
.ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode))
|
.ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode))
|
||||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
||||||
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
||||||
|
|||||||
@ -43,8 +43,8 @@ public class OrderLinkService : ApplicationService
|
|||||||
|
|
||||||
if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true;
|
if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true;
|
||||||
|
|
||||||
// 单号去重
|
// 单号去重,去空
|
||||||
input.LinkOrderNos = input.LinkOrderNos.Distinct().ToList();
|
input.LinkOrderNos = input.LinkOrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList();
|
||||||
|
|
||||||
// 解绑
|
// 解绑
|
||||||
if (!input.IsLink) return await UnLinkOrderAsync(input);
|
if (!input.IsLink) return await UnLinkOrderAsync(input);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.Order;
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
|
using SJZY.UserCenter.HttpApi.Services;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.ProvideServices;
|
namespace SJZY.Track.Application.Services.ProvideServices;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class OrderService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
||||||
order.SubSystemId = 1;
|
order.SubSystemId = CurrentUserRequest.SubSystemId;
|
||||||
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
|
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
|
||||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
|
||||||
|
|
||||||
@ -85,6 +86,11 @@ public class OrderService : ApplicationService
|
|||||||
if (!trackDetails.IsNullOrEmpty())
|
if (!trackDetails.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
|
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
|
||||||
|
int id = 1;
|
||||||
|
list.ForEach(a =>
|
||||||
|
{
|
||||||
|
a.Id = id++;
|
||||||
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class TrackQueryService : ApplicationService
|
|||||||
IProvideQueries provideQueries)
|
IProvideQueries provideQueries)
|
||||||
{
|
{
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_orderRepository=orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_provideQueries = provideQueries;
|
_provideQueries = provideQueries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,6 @@ public class TrackQueryService : ApplicationService
|
|||||||
input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重
|
input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重
|
||||||
var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos);
|
var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos);
|
||||||
|
|
||||||
var isTurn = input.TimeZone != 0;
|
|
||||||
foreach (var group in details.GroupBy(x => x.OrderId))
|
foreach (var group in details.GroupBy(x => x.OrderId))
|
||||||
{
|
{
|
||||||
var item = new GetTrackOutput();
|
var item = new GetTrackOutput();
|
||||||
@ -57,8 +56,8 @@ public class TrackQueryService : ApplicationService
|
|||||||
Status = x.TrackStatus,
|
Status = x.TrackStatus,
|
||||||
Content = x.TrackContent,
|
Content = x.TrackContent,
|
||||||
Location = x.TrackPlace,
|
Location = x.TrackPlace,
|
||||||
Time = isTurn ? x.TrackTime.AddHours(input.TimeZone - x.TraceTimeZone) : x.TrackTime,
|
Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TraceTimeZone),
|
||||||
TimeZone = isTurn ? input.TimeZone : x.TraceTimeZone
|
TimeZone = input.TimeZone!.Value
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
res.Add(item);
|
res.Add(item);
|
||||||
@ -69,43 +68,6 @@ public class TrackQueryService : ApplicationService
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 轨迹订单明细列表
|
|
||||||
/// <summary>
|
|
||||||
/// 根据轨迹订单id获取轨迹订单明细列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("/Track/GetDetails")]
|
|
||||||
public async Task<List<TrackOrderDetailDto>> GetOrderDetails(GetOrderDetailsInput input)
|
|
||||||
{
|
|
||||||
var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId);
|
|
||||||
if (!trackDetails.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<TrackOrderDetailDto>();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 轨迹订单分页
|
|
||||||
/// <summary>
|
|
||||||
/// 获取分页的轨迹订单
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("/Track/GetTrackOrderList")]
|
|
||||||
public async Task<UnifyPageResultDto<TrackOrderDto>> GetPageTrackOrder(GetPageTrackOrderInput input)
|
|
||||||
{
|
|
||||||
var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input);
|
|
||||||
var pageList = await _orderRepository.GetPageTrackOrder(vo);
|
|
||||||
var pageResultDto =
|
|
||||||
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
|
|
||||||
return pageResultDto;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)
|
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)
|
||||||
{
|
{
|
||||||
switch (input.SortMethod)
|
switch (input.SortMethod)
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Services.TrackOrders
|
||||||
|
{
|
||||||
|
[ApiExplorerSettings(GroupName = "轨迹订单")]
|
||||||
|
[Route("/Track/Order")]
|
||||||
|
public class TrackOrderService : ApplicationService, ITransientDependency
|
||||||
|
{
|
||||||
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
|
|
||||||
|
public TrackOrderService(
|
||||||
|
IOrderRepository orderRepository,
|
||||||
|
ITrackDetailsRepository trackDetailsRepository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this._orderRepository=orderRepository;
|
||||||
|
this._trackDetailsRepository=trackDetailsRepository;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 轨迹订单明细
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据轨迹订单id获取轨迹订单明细列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetDetails")]
|
||||||
|
public async Task<List<TrackOrderDetailDto>> GetOrderDetails(GetOrderDetailsInput input)
|
||||||
|
{
|
||||||
|
var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId);
|
||||||
|
if (!trackDetails.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
|
||||||
|
int id = 1;
|
||||||
|
list.ForEach(a =>
|
||||||
|
{
|
||||||
|
a.Id = id++;
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<TrackOrderDetailDto>();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 轨迹订单列表
|
||||||
|
/// <summary>
|
||||||
|
/// 获取分页的轨迹订单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetTrackOrderList")]
|
||||||
|
public async Task<UnifyPageResultDto<TrackOrderDto>> GetPageTrackOrder(GetPageTrackOrderInput input)
|
||||||
|
{
|
||||||
|
var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input);
|
||||||
|
var pageList = await _orderRepository.GetPageTrackOrder(vo);
|
||||||
|
var pageResultDto =
|
||||||
|
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
|
||||||
|
return pageResultDto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -222,7 +222,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
||||||
else if (!input.TrackKeywords.IsNullOrEmpty())
|
else if (!input.TrackKeywords.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => true;
|
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
|
||||||
input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
||||||
|
|
||||||
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
.OrderBy(a => a.Sort)
|
.OrderBy(a => a.Sort)
|
||||||
.Select((a, b) => new OrderedTrackCodeDto
|
.Select((a, b) => new OrderedTrackCodeDto
|
||||||
{
|
{
|
||||||
TemplateId = a.Id,
|
TemplateId = a.TrackTemplateId,
|
||||||
Code = b.Code
|
Code = b.Code
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|||||||
@ -61,17 +61,16 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
public async Task<List<LinkedOrderVO>> GetLinkedOrdersAsync(int orderId)
|
public async Task<List<LinkedOrderVO>> GetLinkedOrdersAsync(int orderId)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<OrderLinkEntity>()
|
return await Context.Queryable<OrderLinkEntity>()
|
||||||
.LeftJoin<OrderLinkEntity>((a, b) => a.Id == b.OrderId)
|
.LeftJoin<OrderEntity>((a, b) => a.LinkOrderId == b.Id)
|
||||||
.LeftJoin<OrderEntity>((a, b, c) => b.LinkOrderId == c.Id)
|
.Where(a => a.OrderId == orderId)
|
||||||
.Where(a => a.Id == orderId)
|
.Select((a, b) => new LinkedOrderVO
|
||||||
.Select((a, b, c) => new LinkedOrderVO
|
|
||||||
{
|
{
|
||||||
OrderId = c.Id,
|
OrderId = b.Id,
|
||||||
OrderType = c.OrderType,
|
OrderType = b.OrderType,
|
||||||
OrderNo = c.OrderNo,
|
OrderNo = b.OrderNo,
|
||||||
SubSystemId = c.SubSystemId,
|
SubSystemId = b.SubSystemId,
|
||||||
IsPushCompleted = c.IsPushCompleted,
|
IsPushCompleted = b.IsPushCompleted,
|
||||||
CustomId = c.CustomId
|
CustomId = b.CustomId
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
|
|
||||||
if (!r.IsValid)
|
if (!r.IsValid)
|
||||||
{
|
{
|
||||||
LogHelper.Error($"轨迹数据新增失败,原因:{r.DebugInformation}。");
|
LogHelper.Error($"轨迹新增失败,原因:{r.DebugInformation}。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -52,12 +52,12 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
var r = await Context.UpdateAsync<TrackDetailsIndex>(index.Id, u => u
|
var r = await Context.UpdateAsync<TrackDetailsIndex>(index.Id, u => u
|
||||||
.Index(index.IndexName)
|
.Index(index.IndexName)
|
||||||
.Doc(index)
|
.Doc(index)
|
||||||
//.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见
|
//.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!r.IsValid)
|
if (!r.IsValid)
|
||||||
{
|
{
|
||||||
LogHelper.Error($"轨迹数据更新失败,原因:{r.DebugInformation}。");
|
LogHelper.Error($"轨迹更新失败,原因:{r.DebugInformation}。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,6 +68,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
|
|
||||||
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
||||||
.Source(s => s.Includes(fd => fd
|
.Source(s => s.Includes(fd => fd
|
||||||
|
.Field(f => f.OrderNo)
|
||||||
.Field(f => f.TrackStatus)
|
.Field(f => f.TrackStatus)
|
||||||
.Field(f => f.TrackCode)
|
.Field(f => f.TrackCode)
|
||||||
.Field(f => f.TrackContent)
|
.Field(f => f.TrackContent)
|
||||||
@ -89,22 +90,26 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
|
|
||||||
public async Task<List<TrackDetailsIndex>?> GetListAsync(int orderId)
|
public async Task<List<TrackDetailsIndex>?> GetListAsync(int orderId)
|
||||||
{
|
{
|
||||||
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x.Query(q => q.Term(t => t.OrderId, orderId)).Size(1000)
|
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x.Query(q => q.Term(t => t.OrderId, orderId))
|
||||||
.Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending)));
|
.Size(1000)
|
||||||
|
.Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending)));
|
||||||
|
|
||||||
return data?.Documents?.ToList();
|
return data?.Documents?.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteTrackAsync(int orderId, List<string> trackCodes)
|
public async Task DeleteTrackAsync(int orderId, List<string> trackCodes)
|
||||||
{
|
{
|
||||||
await Context.UpdateByQueryAsync<TrackDetailsIndex>(x => x
|
var r = await Context.UpdateByQueryAsync<TrackDetailsIndex>(x => x
|
||||||
.Query(
|
.Query(
|
||||||
q =>
|
q =>
|
||||||
q.Term(t => t.OrderId, orderId)
|
q.Term(t => t.OrderId, orderId)
|
||||||
&& q.Terms(t => t.Field(f => f.TrackCode).Terms(trackCodes)))
|
&& q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes)))
|
||||||
.Script(s => s
|
.Script(s => s
|
||||||
.Source("ctx._source.isDeleted = true"))
|
.Source("ctx._source.isDeleted = true"))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!r.IsValid)
|
||||||
|
throw new Exception($"轨迹数据删除失败,原因:{r.DebugInformation}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)
|
public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user