From 6a911177f7485729146368a4711d5403b808ee70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 13 Mar 2024 15:41:59 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=A0=A1=E9=AA=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=87=B3=E5=B0=91=E6=9C=89=E4=B8=80=E4=B8=AA=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpdateOrderInput.cs | 4 ++-- .../Dtos/ProvideServices/UpsertOrderInput.cs | 1 + src/SJZY.Track.Application/SJZY.Track.Application.csproj | 2 +- .../Services/ProvideServices/OrderService.cs | 9 +++++---- .../Services/ProvideServices/TrackPushPullService.cs | 2 +- src/SJZY.Track.Application/SjzyTrackApplicationModule.cs | 5 ++--- 6 files changed, 12 insertions(+), 11 deletions(-) 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/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/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