Merge branch 'S02-轨迹中台' into dev

This commit is contained in:
moyongzhen 2024-03-13 17:42:40 +08:00
commit 82ffaaccdb
10 changed files with 29 additions and 15 deletions

View File

@ -32,6 +32,16 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
/// </summary>
public int OrderId { set; get; }
/// <summary>
/// 订单类型(主数据枚举TrackOrderType)
/// </summary>
public int OrderType { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string OrderNo { get; set; } = null!;
/// <summary>
/// 轨迹代码
/// </summary>

View File

@ -45,10 +45,10 @@ public class UpdateOrderInput : OrderNoInfo
/// <summary>
/// 订单模板(传全量)
/// </summary>
public List<OrderTemplateInfo>? Templates { get; set; } = new();
public List<OrderTemplateInfo> Templates { get; set; } = new();
/// <summary>
/// 订单航班信息
/// </summary>
public List<OrderFlightInfo>? FlightInfos { get; set; } = new();
public List<OrderFlightInfo> FlightInfos { get; set; } = new();
}

View File

@ -17,6 +17,7 @@ public class OrderTemplateInfo
/// 模板id
/// </summary>
[Required]
[Range(1, Int32.MaxValue)]
public int TemplateId { get; set; }
/// <summary>

View File

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

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.3"/>
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.4"/>
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />

View File

@ -32,6 +32,7 @@ public partial class OrderService : ApplicationService, IOrderService
[HttpPost("Order/Upsert")]
public async Task<string> 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<UpsertOrderInput, OrderEntity>(input);
order.SubSystemId = CurrentUserRequest.SubSystemId;
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(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<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
await _orderRepository.UpdateOrderAsync(order);
}
}

View File

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

View File

@ -35,7 +35,7 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService,
var data = new TrackPullConfigDto();
Expression<Func<TrackPullConfigEntity, bool>> 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;

View File

@ -68,9 +68,8 @@ namespace SJZY.Track.Application
//用户中心
context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);
context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler<InterfaceForwardHeaderHandler>();
context.Services.AddHttpClientProxy<IInterfaceForwardService>(
remoteServiceConfigurationName: "InterfaceForward",
asDefaultService: false
context.Services.AddHttpClientProxies(typeof(SJZYInterfaceRelayApplicationContractsModule).Assembly,
"InterfaceForward", false
);
//CAP

View File

@ -66,7 +66,7 @@ namespace SJZY.Track.Domain.Dtos.Order
public int OrderType { get; set; }
/// <summary>
/// 订单名称
/// 订单类型名称
/// </summary>
public string OrderTypeName { get; set; }