From f6590de824204529267fef13cb9418cfc3f53e22 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Mon, 28 Sep 2026 16:57:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20UpsertBigBag=20=E6=94=AF=E6=8C=81=20api?= =?UTF-8?q?Code=20=E5=B9=B6=E5=8C=B9=E9=85=8D=E5=A4=A7=E5=8C=85=E6=8B=89?= =?UTF-8?q?=E5=8F=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../Dtos/ProvideServices/V2/OrderDtos.cs | 7 ++++- .../ProvideServices/OrderService.V2.cs | 30 +++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs b/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs index edf9b3aa..8256c0d4 100644 --- a/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs +++ b/src/TrackCenter.Application/Dtos/ProvideServices/V2/OrderDtos.cs @@ -80,6 +80,11 @@ public class Consignee public class UpsertBigBagInput { + /// + /// 服务商code + /// + public string ApiCode { get; set; } + /// /// 客户名称,或者code,必填 /// @@ -108,7 +113,7 @@ public class UpsertBigBagInput public string Product { get; set; } /// - /// 产品名称,或者code + /// 目的国家二字码 /// public string Country { get; set; } } diff --git a/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs b/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs index f8949f36..cbcfc734 100644 --- a/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs +++ b/src/TrackCenter.Application/Services/ProvideServices/OrderService.V2.cs @@ -179,7 +179,8 @@ public partial class OrderService var config = await _trackPullConfigRepository .FirstOrDefaultAsync(x => x.AppKey == AppKey - && x.ServiceProviderCode == input.ApiCode); + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.小包); if (config == null) { @@ -192,11 +193,12 @@ public partial class OrderService return order; } - private Task BuiltOrder(UpsertBigBagInput input) + private async Task BuiltOrder(UpsertBigBagInput input) { var order = new OrderEntity { AppKey = AppKey!, + ServiceProviderCode = input.ApiCode, OrderType = TrackOrderType.大包, OrderNo = input.BagNo, ThirdPartyOrderNumber = input.OtherNo, @@ -206,8 +208,25 @@ public partial class OrderService ArrivalCountry = input.Country }; - // tips: 2025-11-29 zzh 大包没有轨迹拉取能力 - return Task.FromResult(order); + if (string.IsNullOrWhiteSpace(input.ApiCode)) + { + // 未传 apiCode 时保持兼容:不挂拉取配置 + return order; + } + + var config = await _trackPullConfigRepository + .FirstOrDefaultAsync(x => x.AppKey == AppKey + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.大包); + + if (config == null) + { + throw ProviderServiceActionResult.Exception("创建/更新失败", + "没有适用的大包拉取配置,请先配置轨迹拉取,否则无法拉取轨迹"); + } + + order.OrderPullStatus = [CreateOrderPullStatus(config, order)]; + return order; } private async Task BuiltOrder(UpsertMasterOrderInput input) @@ -227,7 +246,8 @@ public partial class OrderService var config = await _trackPullConfigRepository .FirstOrDefaultAsync(x => x.AppKey == AppKey - && x.ServiceProviderCode == input.ApiCode); + && x.ServiceProviderCode == input.ApiCode + && x.OrderType == TrackOrderType.小包); if (config == null) {