fix【S1-根据订单号获取轨迹接口-时区不填写,没有默认 +8,按模板顺序查询没有结果】https://www.tapd.cn/60863849/bugtrace/bugs/view?bug_id=1160863849001029746
This commit is contained in:
parent
aac436f61c
commit
9f2667ac6e
@ -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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
@ -70,6 +69,7 @@ public class TrackQueryService : ApplicationService
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 轨迹订单明细列表
|
#region 轨迹订单明细列表
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据轨迹订单id获取轨迹订单明细列表
|
/// 根据轨迹订单id获取轨迹订单明细列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -87,9 +87,11 @@ public class TrackQueryService : ApplicationService
|
|||||||
|
|
||||||
return new List<TrackOrderDetailDto>();
|
return new List<TrackOrderDetailDto>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 轨迹订单分页
|
#region 轨迹订单分页
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取分页的轨迹订单
|
/// 获取分页的轨迹订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -104,6 +106,7 @@ public class TrackQueryService : ApplicationService
|
|||||||
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
|
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
|
||||||
return pageResultDto;
|
return pageResultDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)
|
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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,7 +90,8 @@ 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))
|
||||||
|
.Size(1000)
|
||||||
.Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending)));
|
.Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending)));
|
||||||
|
|
||||||
return data?.Documents?.ToList();
|
return data?.Documents?.ToList();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user