Merge branch 'S06' into test
This commit is contained in:
commit
93dea380ea
@ -60,7 +60,9 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
throw new BusinessException(message: "轨迹来源是必须的");
|
||||
}
|
||||
|
||||
if (input.TrackTime < DateTime.Now.AddYears(-100) || input.TrackTime > DateTime.Now.AddYears(100))
|
||||
//要求时间在当前时间的前后100年之间内
|
||||
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
|
||||
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime))
|
||||
{
|
||||
throw new BusinessException(message: "轨迹时间不合法");
|
||||
}
|
||||
@ -326,7 +328,9 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
//【更新】存在指定轨迹的内容(匹配到多条则不处理)
|
||||
var order = orders.First();
|
||||
|
||||
if (input.TrackTime < DateTime.Now.AddYears(-100) || input.TrackTime > DateTime.Now.AddYears(100))
|
||||
//要求时间在当前时间的前后100年之间内
|
||||
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
|
||||
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime))
|
||||
{
|
||||
throw new BusinessException(message: "轨迹时间不合法");
|
||||
}
|
||||
|
||||
@ -113,22 +113,27 @@ public class TrackOrderService : ApplicationService
|
||||
/// <param name="systemId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("GetDetails")]
|
||||
public async Task<List<TrackOrderDetailDto>> GetTracksAsync(int orderId, string? orderNo, int systemId)
|
||||
public async Task<List<TrackOrderDetailDto>> GetTracksAsync(int? orderId, string? orderNo, int? systemId)
|
||||
{
|
||||
Expression<Func<OrderEntity, bool>> whereExpression = null;
|
||||
if (orderId > 0)
|
||||
Expression<Func<OrderEntity, bool>>? whereExpression = null;
|
||||
//根据订单id查询
|
||||
if (orderId != null && orderId > 0)
|
||||
whereExpression = m => m.Id == orderId;
|
||||
|
||||
if (string.IsNullOrEmpty(orderNo) && systemId > 0)
|
||||
//根据订单号+系统id查询
|
||||
if (!string.IsNullOrEmpty(orderNo) && systemId != null && systemId > 0)
|
||||
whereExpression = m => m.OrderNo == orderNo && m.SubSystemId == systemId;
|
||||
|
||||
if (whereExpression == default)
|
||||
throw new BusinessException(message: "请求参数异常");
|
||||
|
||||
var subSystemId = await _orderRepository.GetFirstAsync(whereExpression, x => x.SubSystemId);
|
||||
if (subSystemId == default)
|
||||
{
|
||||
throw new BusinessException(message: "订单不存在");
|
||||
}
|
||||
|
||||
var trackDetails = await _trackDetailsEsRepository.GetListAsync(orderId);
|
||||
var trackDetails = await _trackDetailsEsRepository.GetListAsync(orderId ?? 0);
|
||||
if (trackDetails.IsNullOrEmpty())
|
||||
{
|
||||
return new List<TrackOrderDetailDto>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user