Merge branch 'S02-轨迹中台' into test
This commit is contained in:
commit
850ff601dd
@ -32,6 +32,16 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int OrderId { set; get; }
|
public int OrderId { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型(主数据枚举TrackOrderType)
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码
|
/// 轨迹代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -10,32 +10,32 @@ public class TrackPullParamConfigDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹时区参数名
|
/// 轨迹时区参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTimeZoneName { get; set; } = null!;
|
public string? TrackTimeZoneName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码参数名
|
/// 轨迹代码参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackContentCodeName { get; set; } = null!;
|
public string? TrackContentCodeName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容参数名
|
/// 轨迹内容参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackContentName { get; set; } = null!;
|
public string? TrackContentName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生地参数名
|
/// 轨迹发生地参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackPlaceName { get; set; } = null!;
|
public string? TrackPlaceName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹状态参数名
|
/// 轨迹状态参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackStatusName { get; set; } = null!;
|
public string? TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生时间参数名
|
/// 轨迹发生时间参数名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTimeName { get; set; } = null!;
|
public string? TrackTimeName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单数组路径
|
/// 订单数组路径
|
||||||
|
|||||||
@ -29,14 +29,14 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CapSubscribe(GlobalConst.TrackRefreshSubscribe)]
|
[CapSubscribe(GlobalConst.TrackRefreshSubscribe)]
|
||||||
public async Task ConsumerAsync(InterfaceRelayTrackRefreshEvent @event)
|
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
|
||||||
{
|
{
|
||||||
// tips:attach返回的是服务商id,必有
|
// tips:attach返回的是服务商id,必有
|
||||||
var attach = JsonConvert.DeserializeObject<TrackRefreshAttach>(@event.Attach);
|
var attach = JsonConvert.DeserializeObject<TrackRefreshAttach>(@event.Attach);
|
||||||
if (attach is null) return;
|
if (attach is null) return;
|
||||||
var config = await _trackPullCacheService.GetPullConfigAsync(attach.ServiceProviderId, attach.SubSystemId);
|
var config = await _trackPullCacheService.GetPullConfigAsync(attach.SubSystemId, attach.ServiceProviderId);
|
||||||
|
|
||||||
var data = JObject.FromObject(@event.Data);
|
var data = JObject.Parse(@event.Data.ToString()!);
|
||||||
var orderToken = data[config.ParamConfig.OrderPath];
|
var orderToken = data[config.ParamConfig.OrderPath];
|
||||||
if (orderToken is JArray orderTokens)
|
if (orderToken is JArray orderTokens)
|
||||||
{
|
{
|
||||||
@ -98,30 +98,31 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackPullContentConfigDto? matchedContentConfig = null;
|
TrackPullContentConfigDto? matchedContentConfig = null;
|
||||||
|
|
||||||
// 1、匹配轨迹代码
|
// 1、匹配轨迹代码
|
||||||
var trackCode = trackToken[paramConfig.TrackContentCodeName]?.Value<string>();
|
if (paramConfig.TrackContentCodeName != null)
|
||||||
if (!trackCode.IsNullOrWhiteSpace())
|
|
||||||
{
|
{
|
||||||
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentCodeValue == trackCode);
|
var trackCode = trackToken[paramConfig.TrackContentCodeName]?.Value<string>();
|
||||||
|
if (!trackCode.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentCodeValue == trackCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2、匹配轨迹状态
|
// 2、匹配轨迹状态
|
||||||
if (matchedContentConfig is null)
|
else if (paramConfig.TrackStatusName != null)
|
||||||
{
|
{
|
||||||
var trackStatus = trackToken[paramConfig.TrackStatusName]?.Value<string>();
|
var trackStatus = trackToken[paramConfig.TrackStatusName]?.Value<string>();
|
||||||
if (!trackStatus.IsNullOrWhiteSpace())
|
if (!trackStatus.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackStatusValue == trackCode);
|
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackStatusValue == trackStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3、匹配轨迹内容
|
// 3、匹配轨迹内容
|
||||||
if (matchedContentConfig is null)
|
else if (paramConfig.TrackContentName != null)
|
||||||
{
|
{
|
||||||
var trackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
var trackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
||||||
if (!trackContent.IsNullOrWhiteSpace())
|
if (!trackContent.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
Debug.Assert(trackContent != null, nameof(trackContent) + " != null");
|
Debug.Assert(trackContent != null, nameof(trackContent) + " != null");
|
||||||
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentValue == trackCode);
|
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentValue == trackContent);
|
||||||
|
|
||||||
// 按关键字分析轨迹内容
|
// 按关键字分析轨迹内容
|
||||||
if (matchedContentConfig is null)
|
if (matchedContentConfig is null)
|
||||||
@ -155,7 +156,10 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
if (matchedContentConfig is null) return;
|
if (matchedContentConfig is null) return;
|
||||||
|
|
||||||
var trackPlace = trackToken[paramConfig.TrackPlaceName]?.Value<string>();
|
// 轨迹发生地
|
||||||
|
var trackPlace = paramConfig.TrackPlaceName == null
|
||||||
|
? null
|
||||||
|
: trackToken[paramConfig.TrackPlaceName]?.Value<string>();
|
||||||
if (trackPlace.IsNullOrWhiteSpace())
|
if (trackPlace.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
Expression<Func<OrderEntity, string?>> resultExpression =
|
Expression<Func<OrderEntity, string?>> resultExpression =
|
||||||
@ -173,12 +177,20 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
x.Id == trackUpsertEvent.OrderId, resultExpression);
|
x.Id == trackUpsertEvent.OrderId, resultExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 轨迹发生时间
|
||||||
|
var trackTime = paramConfig.TrackTimeName == null
|
||||||
|
? null
|
||||||
|
: trackToken[paramConfig.TrackTimeName]?.Value<DateTime>();
|
||||||
|
// 轨迹发生时区
|
||||||
|
var trackTimeZone = paramConfig.TrackTimeZoneName == null
|
||||||
|
? null
|
||||||
|
: trackToken[paramConfig.TrackTimeZoneName]?.Value<float>();
|
||||||
|
|
||||||
// 新增/更新轨迹
|
// 新增/更新轨迹
|
||||||
trackUpsertEvent.TrackCode = matchedContentConfig.TrackContentCode;
|
trackUpsertEvent.TrackCode = matchedContentConfig.TrackContentCode;
|
||||||
trackUpsertEvent.TrackPlace = trackPlace ?? "CN";
|
trackUpsertEvent.TrackPlace = trackPlace ?? "CN";
|
||||||
trackUpsertEvent.TrackTime = trackToken[paramConfig.TrackTimeName]?.Value<DateTime>() ?? DateTime.Now;
|
trackUpsertEvent.TrackTime = trackTime ?? DateTime.Now;
|
||||||
trackUpsertEvent.TrackTimeZone = trackToken[paramConfig.TrackTimeZoneName]?.Value<float>() ??
|
trackUpsertEvent.TrackTimeZone = trackTimeZone ?? matchedContentConfig.TrackTimeZoneValue ?? 8;
|
||||||
matchedContentConfig.TrackTimeZoneValue ?? 8;
|
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.4"/>
|
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.5-beta3"/>
|
||||||
<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" />
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public class TrackPushPullService : ApplicationService
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
var requestId = 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));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
|
throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(new List<int>(order.Id), input.TrackCodes);
|
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(new List<int> { order.Id }, input.TrackCodes);
|
||||||
|
|
||||||
if (codes.Count == 0)
|
if (codes.Count == 0)
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
public async Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
|
public async Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
|
||||||
{
|
{
|
||||||
var orders = await _orderRepository.GetListAsync(x =>
|
var orders = await _orderRepository.GetListAsync(x =>
|
||||||
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo) && !x.IsPushCompleted
|
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo)
|
||||||
, x => new
|
, x => new
|
||||||
{
|
{
|
||||||
x.Id, x.SubSystemId
|
x.Id, x.SubSystemId
|
||||||
|
|||||||
@ -34,8 +34,10 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService,
|
|||||||
{
|
{
|
||||||
var data = new TrackPullConfigDto();
|
var data = new TrackPullConfigDto();
|
||||||
|
|
||||||
Expression<Func<TrackPullConfigEntity, bool>> exp = x =>
|
Expression<Func<TrackPullConfigEntity, bool>> exp = x => true;
|
||||||
(!id.HasValue || x.Id == id) && (id.HasValue || (x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId));
|
if (id.HasValue) exp = x => x.Id == id;
|
||||||
|
else if (subSystemId.HasValue && serviceProviderId.HasValue)
|
||||||
|
exp = x => x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId;
|
||||||
|
|
||||||
var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp);
|
var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp);
|
||||||
if (trackPullConfigEntity == null) return data;
|
if (trackPullConfigEntity == null) return data;
|
||||||
|
|||||||
@ -70,9 +70,9 @@ namespace SJZY.Track.Domain.Dtos.Order
|
|||||||
public int OrderType { get; set; }
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单名称
|
/// 订单类型名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderTypeName { get; set; }
|
public string? OrderTypeName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单号
|
/// 订单号
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user