update: 修改轨迹拉取使用单号,优先使用来源于【OrderPullStatus】中的三方单号,若三方单号为空才使用主单号

update-entity: 修改三方订单关联实体字段OrderNumber为可控

fix:修复【更新轨迹订单】订单关联信息更新失败的问题,修复办法:替换关联实体集合【OrderFlightEntity】【OrderPullStatusEntity】【OrderPlatformNumberEntity】先删后增的方式
This commit is contained in:
云龙 王 2024-11-18 15:57:04 +08:00
parent 811b38c38d
commit 90258e8168
4 changed files with 14 additions and 4 deletions

View File

@ -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<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos);
await _orderRepository.UpdateOrderAsync(order);
}

View File

@ -22,7 +22,7 @@ public class OrderPlatformNumberEntity : IFullAuditedBasicEntitys, IEntity
/// 外部单号
/// </summary>
[SugarColumn(ColumnName = "OrderNumber")]
public string OrderNumber { get; set; }
public string? OrderNumber { get; set; }
/// <summary>
/// 平台名称

View File

@ -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

View File

@ -99,6 +99,13 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
// 更新订单模板
await Context.Deleteable<OrderPullStatusEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
order.OrderPullStatus.ForEach(x => x.OrderId = order.Id);
await Context.Insertable(order.OrderPullStatus).ExecuteCommandAsync();
// 更新订单三方关联
await Context.Deleteable<OrderPlatformNumberEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();
order.OrderPlatformNumbers.ForEach(x => x.OrderId = order.Id);
await Context.Insertable(order.OrderPlatformNumbers).ExecuteCommandAsync();
// 更新订单航班
await Context.Deleteable<OrderFlightEntity>().Where(x => x.OrderId == order.Id).ExecuteCommandAsync();