diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index 3920f5c1..9ec96ba5 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -32,6 +32,16 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices /// public int OrderId { set; get; } + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + public int OrderType { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } = null!; + /// /// 轨迹代码 /// diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs index 69ad9a0b..ebb47f17 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -45,10 +45,10 @@ public class UpdateOrderInput : OrderNoInfo /// /// 订单模板(传全量) /// - public List? Templates { get; set; } = new(); + public List Templates { get; set; } = new(); /// /// 订单航班信息 /// - public List? FlightInfos { get; set; } = new(); + public List FlightInfos { get; set; } = new(); } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs index 91ae6d11..4293ccc0 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -17,6 +17,7 @@ public class OrderTemplateInfo /// 模板id /// [Required] + [Range(1, Int32.MaxValue)] public int TemplateId { get; set; } /// diff --git a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs index f2fca16a..72316cef 100644 --- a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs @@ -24,12 +24,15 @@ public class UpdateOrderTrackEventHandler : ITransientDependency, ICapSubscribe { if (@event.TrackTime == default) { + if (order.LatestTrackTime == null) return; // 删除全部轨迹导致的重置行为 order.ResetTrackInfo(); } - else if (@event.TrackTime == order.LatestTrackTime) return; + else if (order.LatestTrackTime != null && + order.LatestTrackTime.Value.Subtract(TimeSpan.FromHours(order.LatestTrackTimeZone ?? 0)) == + @event.TrackTime.Subtract(TimeSpan.FromHours(@event.TrackTimeZone))) return; } - else // upsert引发的更新,需要校验发生时间是否大于最新时间 + else // upsert引发的更新 { if (order.LatestTrackTime != null && order.LatestTrackTime.Value.Subtract(TimeSpan.FromHours(order.LatestTrackTimeZone ?? 0)) > diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index da60d1a4..160ca752 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 765ff6ad..712b775c 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -32,6 +32,7 @@ public partial class OrderService : ApplicationService, IOrderService [HttpPost("Order/Upsert")] public async Task UpsertAsync(UpsertOrderInput input) { + if (input.Templates.Count == 0) throw new BusinessException(message: "至少有一个模板"); var order = await _orderRepository.GetFirstAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo); if (order != default) @@ -43,8 +44,8 @@ public partial class OrderService : ApplicationService, IOrderService order = ObjectMapper.Map(input); order.SubSystemId = CurrentUserRequest.SubSystemId; - order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); - order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); await _orderRepository.CreateOrderAsync(order); return "创建成功"; @@ -74,8 +75,8 @@ public partial class OrderService : ApplicationService, IOrderService private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) { order = ObjectMapper.Map(input, order); - order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); - order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); await _orderRepository.UpdateOrderAsync(order); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushPullService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushPullService.cs index 8e32d1c1..2e1dd08b 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushPullService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushPullService.cs @@ -49,7 +49,7 @@ public class TrackPushPullService : ApplicationService x.OrderNo }).ToList(); - // 批量获取轨迹 这里报错了,我先随便给个 写死的主体值 + // 批量获取轨迹 await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( "A012", group.Key.ServiceProviderCode, data, GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key)); diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullCacheService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullCacheService.cs index 168dae3a..420c44e6 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullCacheService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullCacheService.cs @@ -35,7 +35,7 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService, var data = new TrackPullConfigDto(); Expression> exp = x => - (!id.HasValue || x.Id == id) && (id.HasValue || (x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId)); + (id == null || x.Id == id) && (id != null || (x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId)); var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp); if (trackPullConfigEntity == null) return data; diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index ba706085..b2b2cd06 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -68,9 +68,8 @@ namespace SJZY.Track.Application //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler(); - context.Services.AddHttpClientProxy( - remoteServiceConfigurationName: "InterfaceForward", - asDefaultService: false + context.Services.AddHttpClientProxies(typeof(SJZYInterfaceRelayApplicationContractsModule).Assembly, + "InterfaceForward", false ); //CAP diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index c4eacc83..0d66f479 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -66,7 +66,7 @@ namespace SJZY.Track.Domain.Dtos.Order public int OrderType { get; set; } /// - /// 订单名称 + /// 订单类型名称 /// public string OrderTypeName { get; set; }