diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index ce0c265e..772cef1e 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -80,7 +80,6 @@ public partial class OrderService : ApplicationService, IOrderService var orderId = await _orderRepository.CreateOrderAsync(order); // 写入操作日志 - var indexForAdd = new OrderOperationRecordIndex { OrderId = orderId, @@ -129,6 +128,8 @@ public partial class OrderService : ApplicationService, IOrderService { order = ObjectMapper.Map(input, order); order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); + order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos); + order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos); await _orderRepository.UpdateOrderAsync(order); } diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderPlatformNumberEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderPlatformNumberEntity.cs index 07a331db..b4ae68bf 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderPlatformNumberEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderPlatformNumberEntity.cs @@ -22,7 +22,7 @@ public class OrderPlatformNumberEntity : IFullAuditedBasicEntitys, IEntity /// 外部单号 /// [SugarColumn(ColumnName = "OrderNumber")] - public string OrderNumber { get; set; } + public string? OrderNumber { get; set; } /// /// 平台名称 diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 710dd407..31855027 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -45,7 +45,8 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDepen && b.StartTime <= DateTime.Now && b.EndTime >= DateTime.Now) .Select((a, b, c) => new OrderWithServiceProviderVO { - OrderNo = a.OrderNo, + //优先使用第三方的订单号,为空时才使用主单号 + OrderNo = b.OrderNo ?? a.OrderNo, OrderType = a.OrderType, SubSystemId = a.SubSystemId, ServiceProviderCode = b.ServiceProviderCode, @@ -65,7 +66,8 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDepen b.EndTime >= DateTime.Now) .Select((a, b) => new OrderWithServiceProviderVO { - OrderNo = a.OrderNo, + //优先使用第三方的订单号,为空时才使用主单号 + OrderNo = b.OrderNo ?? a.OrderNo, OrderType = a.OrderType, SubSystemId = a.SubSystemId, ServiceProviderCode = b.ServiceProviderCode diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index bb7d8dd3..5d427cab 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -99,6 +99,13 @@ public class OrderRepository : BasicRepository, IOrderRepository, I // 更新订单模板 await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderPullStatus.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderPullStatus).ExecuteCommandAsync(); + + // 更新订单三方关联 + await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderPlatformNumbers.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderPlatformNumbers).ExecuteCommandAsync(); // 更新订单航班 await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();