add 校验订单至少有一个模板
This commit is contained in:
parent
be086de68f
commit
6a911177f7
@ -45,10 +45,10 @@ public class UpdateOrderInput : OrderNoInfo
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单模板(传全量)
|
/// 订单模板(传全量)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<OrderTemplateInfo>? Templates { get; set; } = new();
|
public List<OrderTemplateInfo> Templates { get; set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单航班信息
|
/// 订单航班信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<OrderFlightInfo>? FlightInfos { get; set; } = new();
|
public List<OrderFlightInfo> FlightInfos { get; set; } = new();
|
||||||
}
|
}
|
||||||
@ -17,6 +17,7 @@ public class OrderTemplateInfo
|
|||||||
/// 模板id
|
/// 模板id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
|
[Range(1, Int32.MaxValue)]
|
||||||
public int TemplateId { get; set; }
|
public int TemplateId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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.Http.Client" Version="7.0.2" />
|
||||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
[HttpPost("Order/Upsert")]
|
[HttpPost("Order/Upsert")]
|
||||||
public async Task<string> UpsertAsync(UpsertOrderInput input)
|
public async Task<string> UpsertAsync(UpsertOrderInput input)
|
||||||
{
|
{
|
||||||
|
if (input.Templates.Count == 0) throw new BusinessException(message: "至少有一个模板");
|
||||||
var order = await _orderRepository.GetFirstAsync(x =>
|
var order = await _orderRepository.GetFirstAsync(x =>
|
||||||
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
|
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
|
||||||
if (order != default)
|
if (order != default)
|
||||||
@ -43,8 +44,8 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
|
|
||||||
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
order = ObjectMapper.Map<UpsertOrderInput, OrderEntity>(input);
|
||||||
order.SubSystemId = CurrentUserRequest.SubSystemId;
|
order.SubSystemId = CurrentUserRequest.SubSystemId;
|
||||||
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
|
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
|
||||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||||
|
|
||||||
await _orderRepository.CreateOrderAsync(order);
|
await _orderRepository.CreateOrderAsync(order);
|
||||||
return "创建成功";
|
return "创建成功";
|
||||||
@ -74,8 +75,8 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
||||||
{
|
{
|
||||||
order = ObjectMapper.Map(input, order);
|
order = ObjectMapper.Map(input, order);
|
||||||
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates!);
|
order.OrderTemplates = ObjectMapper.Map<List<OrderTemplateInfo>, List<OrderTemplateEntity>>(input.Templates);
|
||||||
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos!);
|
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
|
||||||
await _orderRepository.UpdateOrderAsync(order);
|
await _orderRepository.UpdateOrderAsync(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class TrackPushPullService : ApplicationService
|
|||||||
x.OrderNo
|
x.OrderNo
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
// 批量获取轨迹 这里报错了,我先随便给个 写死的主体值
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
"A012", group.Key.ServiceProviderCode, data,
|
"A012", group.Key.ServiceProviderCode, data,
|
||||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
||||||
|
|||||||
@ -68,9 +68,8 @@ namespace SJZY.Track.Application
|
|||||||
//用户中心
|
//用户中心
|
||||||
context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);
|
context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);
|
||||||
context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler<InterfaceForwardHeaderHandler>();
|
context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler<InterfaceForwardHeaderHandler>();
|
||||||
context.Services.AddHttpClientProxy<IInterfaceForwardService>(
|
context.Services.AddHttpClientProxies(typeof(SJZYInterfaceRelayApplicationContractsModule).Assembly,
|
||||||
remoteServiceConfigurationName: "InterfaceForward",
|
"InterfaceForward", false
|
||||||
asDefaultService: false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//CAP
|
//CAP
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user