fix:修复按状态查询运输时效预警明细反参异常
- 由于已超时状态不实时维护,则需要查出即将超时的数据然后计算状态后在过滤
This commit is contained in:
parent
9281d7b482
commit
a56319d8b6
@ -3,7 +3,7 @@ namespace SJZY.Track.Application.Contract.Dtos.Warning.Transport;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运输时效预警明细
|
/// 运输时效预警明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class TransportWarningDetailsDto // todo:需要根据状态排序
|
public sealed class TransportWarningDetailsDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预警明细唯一id
|
/// 预警明细唯一id
|
||||||
@ -18,7 +18,7 @@ public sealed class TransportWarningDetailsDto // todo:需要根据状态排
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子系统名称
|
/// 子系统名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SubSystemName { get; set; } // todo:id换名称
|
public string SubSystemName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户id
|
/// 客户id
|
||||||
@ -28,7 +28,7 @@ public sealed class TransportWarningDetailsDto // todo:需要根据状态排
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户简称
|
/// 客户简称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CustomName { get; set; } // todo:id换名称
|
public string CustomName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单id
|
/// 订单id
|
||||||
@ -48,10 +48,10 @@ public sealed class TransportWarningDetailsDto // todo:需要根据状态排
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单类型名称
|
/// 订单类型名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderTypeName { get; set; } // todo:type换名称
|
public string OrderTypeName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// 实时属性 todo:从es查询
|
// 实时属性 tips:从es查询
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最新轨迹内容
|
/// 最新轨迹内容
|
||||||
@ -134,7 +134,7 @@ public sealed class TransportWarningDetailsDto // todo:需要根据状态排
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 累计运输时间
|
/// 累计运输时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CumulativeTimeSpan { get; set; } // todo:需要转换为某个格式
|
public string CumulativeTimeSpan { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 预警状态 (根据key展示对应名称,即将超时需要标红)
|
/// 预警状态 (根据key展示对应名称,即将超时需要标红)
|
||||||
|
|||||||
@ -1235,8 +1235,6 @@ public class TransportWarningHandler : ITransportWarningHandler, ITransientDepen
|
|||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 一开始创建预警就可能为已超时的状态
|
|
||||||
detail.Status = detail.CalcStatus();
|
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -171,6 +171,9 @@ public class TransportWarningService : ApplicationService
|
|||||||
public async Task<UnifyPageResultDto<TransportWarningDetailsDto>> GetPageTransportWarningDetails(GetPageTransportWarningDetailsInput input)
|
public async Task<UnifyPageResultDto<TransportWarningDetailsDto>> GetPageTransportWarningDetails(GetPageTransportWarningDetailsInput input)
|
||||||
{
|
{
|
||||||
var vo = ObjectMapper.Map<GetPageTransportWarningDetailsInput, GetPageTransportWarningDetailsInputVO>(input);
|
var vo = ObjectMapper.Map<GetPageTransportWarningDetailsInput, GetPageTransportWarningDetailsInputVO>(input);
|
||||||
|
// 存储只存即将超时,对于已超时的则是查出计算后过滤
|
||||||
|
if (input.Status == (int) TransportWarningStatus.已超时)
|
||||||
|
vo.Status = (int) TransportWarningStatus.即将超时;
|
||||||
var result = await _warningDetailsEsRepository.GetPageTransportWarningDetailsAsync(vo);
|
var result = await _warningDetailsEsRepository.GetPageTransportWarningDetailsAsync(vo);
|
||||||
if (result.List.Count == 0)
|
if (result.List.Count == 0)
|
||||||
{
|
{
|
||||||
@ -247,19 +250,23 @@ public class TransportWarningService : ApplicationService
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
var sorted = map.OrderBy(x =>
|
// 计算后的状态过滤
|
||||||
|
var filtered = map.WhereIf(input.Status > 0, x => x.Status == input.Status);
|
||||||
|
|
||||||
|
// 按状态排序
|
||||||
|
var sorted = filtered.OrderBy(x =>
|
||||||
{
|
{
|
||||||
// 即将超时,已超时置顶
|
// 即将超时,已超时置顶
|
||||||
if (x.Status is 1 or 2) return x.Status;
|
if (x.Status is 1 or 2) return x.Status;
|
||||||
// 其他按创建时间从早到晚
|
// 其他按创建时间从早到晚
|
||||||
return DateTimeHelper.ConvertToUnixTimestamp(x.CreateTime);
|
return DateTimeHelper.ConvertToUnixTimestamp(x.CreateTime);
|
||||||
});
|
}).ToList();
|
||||||
|
|
||||||
return new UnifyPageResultDto<TransportWarningDetailsDto>(
|
return new UnifyPageResultDto<TransportWarningDetailsDto>(
|
||||||
sorted.ToList(),
|
sorted,
|
||||||
result.Pagination.PageIndex,
|
result.Pagination.PageIndex,
|
||||||
result.Pagination.PageSize,
|
result.Pagination.PageSize,
|
||||||
result.Pagination.Total);
|
sorted.Count);
|
||||||
|
|
||||||
// 通知用户提取用户名称
|
// 通知用户提取用户名称
|
||||||
string ToUserNames(string notifyUsers)
|
string ToUserNames(string notifyUsers)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user