Merge branch 'S06' into test

This commit is contained in:
云龙 王 2024-11-28 10:08:09 +08:00
commit 342eb13e26

View File

@ -1,3 +1,4 @@
using System.Linq.Expressions;
using SJZY.Expand.AliyunOSS;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
@ -108,11 +109,20 @@ public class TrackOrderService : ApplicationService
/// 根据订单id获取轨迹明细列表
/// </summary>
/// <param name="orderId"></param>
/// <param name="orderNo"></param>
/// <param name="systemId"></param>
/// <returns></returns>
[HttpPost("GetDetails")]
public async Task<List<TrackOrderDetailDto>> GetTracksAsync(int orderId)
public async Task<List<TrackOrderDetailDto>> GetTracksAsync(int orderId, string orderNo, int systemId)
{
var subSystemId = await _orderRepository.GetFirstAsync(x => x.Id == orderId, x => x.SubSystemId);
Expression<Func<OrderEntity, bool>> whereExpression = null;
if (orderId > 0)
whereExpression = m => m.Id == orderId;
if (string.IsNullOrEmpty(orderNo) && systemId > 0)
whereExpression = m => m.OrderNo == orderNo && m.SubSystemId == systemId;
var subSystemId = await _orderRepository.GetFirstAsync(whereExpression, x => x.SubSystemId);
if (subSystemId == default)
{
throw new BusinessException(message: "订单不存在");
@ -241,16 +251,20 @@ public class TrackOrderService : ApplicationService
if (!order.IsCompleted) //如果没完结则显示签收节点
{
var eddUnixTimestamp = order.EstimatedDeliveryDate.HasValue ? ToUnixTimestamp(DateTime.Parse(order.EstimatedDeliveryDate.ToString()!)) : 0;
var isShowTime = eddUnixTimestamp > 0 && res.Data.All(m => m.TrackTime < eddUnixTimestamp);
var isShowTime = eddUnixTimestamp > 0 && res.Data != null && res.Data.All(m => m.TrackTime < eddUnixTimestamp);
res.Data.Add(new GetDetailTimelineOutput()
//当存在需要显示的轨迹才需要补充签收节点
if (res.Data.Count != 0)
{
Content = "签收",
IsHighlight = false,
TrackTimeZone = isShowTime ? $"GMT{(order.DestinationTimeZone >= 0 ? "+" : "-")}{order.DestinationTimeZone}" : "",
TrackTime = isShowTime ? eddUnixTimestamp : 0,
TrackTimePrefix = isShowTime ? "预计签收时间:" : "",
});
res.Data.Add(new GetDetailTimelineOutput()
{
Content = "签收",
IsHighlight = false,
TrackTimeZone = isShowTime ? $"GMT{(order.DestinationTimeZone >= 0 ? "+" : "-")}{order.DestinationTimeZone}" : "",
TrackTime = isShowTime ? eddUnixTimestamp : 0,
TrackTimePrefix = isShowTime ? "预计签收时间:" : "",
});
}
}
return res;