Merge pull request 'S06' (#76) from S06 into uat

Reviewed-on: https://git.shijizhongyun.com/Dotnet/SJZY.Track.Api/pulls/76
This commit is contained in:
wangyunlong 2024-12-17 14:52:51 +08:00
commit 6c84dad074
35 changed files with 356 additions and 58 deletions

View File

@ -1,6 +1,6 @@
{ {
"Configuration": { "Configuration": {
"UseLocalConfiguration": false, "UseLocalConfiguration": true,
//是否使用本地配置文件 //是否使用本地配置文件
"ConfiguraFileName": "appsettings.Development.json", "ConfiguraFileName": "appsettings.Development.json",
//指定配置文件名称,开启UseLocalConfiguration时生效 //指定配置文件名称,开启UseLocalConfiguration时生效

View File

@ -119,4 +119,9 @@ public class BatchUpsertTrackInput : OrderNosInfo
/// </summary> /// </summary>
[Range(-12, 12)] [Range(-12, 12)]
public float? DestinationTimeZone { get; set; } public float? DestinationTimeZone { get; set; }
/// <summary>
/// 扩展信息字段,用与轨迹推送的附加字段
/// </summary>
public Dictionary<string,object>? Extra { get; set; }
} }

View File

@ -0,0 +1,29 @@
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class GetPageTrackTemplateListInput : PageInfoInput
{
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int? CustomerId { get; set; }
/// <summary>
/// 模版分类
/// </summary>
public int? TemplateType { get; set; }
/// <summary>
/// 模板code
/// </summary>
public string? TemplateCode { get; set; }
/// <summary>
/// 关键字
/// </summary>
public string? KeyWord { get; set; }
}

View File

@ -101,4 +101,9 @@ public class TrackDetail
/// 目的地时区 /// 目的地时区
/// </summary> /// </summary>
public float? DestinationTimeZone { get; set; } public float? DestinationTimeZone { get; set; }
/// <summary>
/// 扩展信息字段,用与轨迹推送的附加字段
/// </summary>
public Dictionary<string, object>? Extra { get; set; }
} }

View File

@ -16,4 +16,9 @@ public class GetTrackTemplateListInput
/// 模版分类 /// 模版分类
/// </summary> /// </summary>
public int? TemplateType { get; set; } public int? TemplateType { get; set; }
/// <summary>
/// 模板code
/// </summary>
public string? TemplateCode { get; set; }
} }

View File

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
@ -76,6 +76,12 @@ public class UpdateOrderInput : OrderNoInfo
/// 订单航班信息 /// 订单航班信息
/// </summary> /// </summary>
public List<OrderFlightInfo> FlightInfos { get; set; } = new(); public List<OrderFlightInfo> FlightInfos { get; set; } = new();
/// <summary>
/// 模板code
/// </summary>
public List<string> TemplateCodes { get; set; }
} }
public class PullConfigInfo public class PullConfigInfo

View File

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
@ -9,11 +9,6 @@ public class UpsertOrderInput : UpdateOrderInput
/// </summary> /// </summary>
public int CustomId { get; set; } public int CustomId { get; set; }
/// <summary>
/// 模板code
/// </summary>
public List<string> TemplateCodes { get; set; }
/// <summary> /// <summary>
/// 当前操作人 /// 当前操作人
/// </summary> /// </summary>

View File

@ -123,4 +123,9 @@ public class UpsertTrackInput : OrderNoInfo
/// 当前操作人 /// 当前操作人
/// </summary> /// </summary>
public int OptionUserId { get; set; } public int OptionUserId { get; set; }
/// <summary>
/// 扩展信息字段,用与轨迹推送的附加字段
/// </summary>
public Dictionary<string, object>? Extra { get; set; }
} }

View File

@ -141,6 +141,11 @@ public class TrackUpsertEvent
/// </summary> /// </summary>
public float? DestinationTimeZone { get; set; } public float? DestinationTimeZone { get; set; }
/// <summary>
/// 扩展信息字段,用与轨迹推送的附加字段
/// </summary>
public Dictionary<string, object>? Extra { get; set; }
public override string ToString() public override string ToString()
{ {
return return

View File

@ -21,11 +21,7 @@ public class OrderAutoMapperProfile : Profile
CreateMap<OrderFlightInfo, OrderFlightEntity>(MemberList.None); CreateMap<OrderFlightInfo, OrderFlightEntity>(MemberList.None);
CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None); CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None);
CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None) CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None);
.ForMember(dest => dest.OrderTypeName,
opt => opt.MapFrom(source => GetEnumDescription(2, source.OrderType)))
.ForMember(dest => dest.QuestionTypeName,
opt => opt.MapFrom(source => GetEnumDescription(1, source.QuestionType)));
CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None); CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None);
CreateMap<TrackDetailsIndex, TrackOrderDetailDto>(MemberList.None).Ignore(dest => dest.TrackTimeZone) CreateMap<TrackDetailsIndex, TrackOrderDetailDto>(MemberList.None).Ignore(dest => dest.TrackTimeZone)

View File

@ -20,6 +20,8 @@ public class TrackTemplateAutoMapperProfile : Profile
CreateMap<GetTrackTemplateListVO, GetTrackTemplateListDto>(MemberList.None); CreateMap<GetTrackTemplateListVO, GetTrackTemplateListDto>(MemberList.None);
CreateMap<UnifyPageResultDto<GetTrackTemplateListVO>, UnifyPageResultDto<GetTrackTemplateListDto>>(MemberList CreateMap<UnifyPageResultDto<GetTrackTemplateListVO>, UnifyPageResultDto<GetTrackTemplateListDto>>(MemberList
.None); .None);
CreateMap<GetPageTrackTemplateListInput, GetPageTrackTemplateListInputVo>(MemberList.None);
CreateMap<UnifyPageResultDto<TemplateContentDtoVo>, UnifyPageResultDto<TemplateContentDto>>(MemberList.None);
CreateMap<GetTrackTemplateListInput, GetTrackTemplateListInputVo>(MemberList.None); CreateMap<GetTrackTemplateListInput, GetTrackTemplateListInputVo>(MemberList.None);
CreateMap<TrackTemplateOutputVo, TrackTemplateOutput>(MemberList.None); CreateMap<TrackTemplateOutputVo, TrackTemplateOutput>(MemberList.None);

View File

@ -29,7 +29,7 @@ public class CapFilter : SubscribeFilter
context.DeliverMessage.Headers["sjzy-arguments-hash"] = hash; context.DeliverMessage.Headers["sjzy-arguments-hash"] = hash;
} }
if (await RedisHelper.Client.ExistsAsync($"CapExecuteFilter:{hash}")) if (await RedisHelper.Client.ExistsAsync($"CapExecuteFilter:{hash}{DateTime.Now:G}"))
{ {
throw new BusinessException(GlobalConst.CapNoRetryErrorCode, $"检测到重复消费,消费参数:{argumentJsonStr}"); throw new BusinessException(GlobalConst.CapNoRetryErrorCode, $"检测到重复消费,消费参数:{argumentJsonStr}");
} }
@ -41,7 +41,7 @@ public class CapFilter : SubscribeFilter
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments-hash", out var hash); context.DeliverMessage.Headers.TryGetValue("sjzy-arguments-hash", out var hash);
if (!hash.IsNullOrEmpty()) if (!hash.IsNullOrEmpty())
{ {
await RedisHelper.Client.SetAsync($"CapExecuteFilter:{hash}", 1, TimeSpan.FromMinutes(3)); await RedisHelper.Client.SetAsync($"CapExecuteFilter:{hash}{DateTime.Now:G}", 1, TimeSpan.FromMinutes(3));
} }
} }

View File

@ -175,23 +175,27 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
{ {
List<int> orderIds; List<int> orderIds;
List<TrackDetailsIndex> tracks; List<TrackDetailsIndex> tracks;
List<TrackDetailsIndex> deleteTracks;
if (@event.EsIds != null && @event.EsIds.Any()) //根据明确的esid进行删除 if (@event.EsIds != null && @event.EsIds.Any()) //根据明确的esid进行删除
{ {
tracks = await _trackDetailsEsRepository.GetDataByIds(@event.EsIds); deleteTracks = await _trackDetailsEsRepository.GetDataByIds(@event.EsIds);
orderIds = tracks.Select(m => m.OrderId).Distinct().ToList(); orderIds = deleteTracks.Select(m => m.OrderId).Distinct().ToList();
@event.OrderIds = orderIds.ToArray(); @event.OrderIds = orderIds.ToArray();
@event.TrackIdentifiers = tracks.Select(x => new TrackIdentifierDto @event.TrackIdentifiers = deleteTracks.Select(x => new TrackIdentifierDto
{ {
TrackCode = x.TrackCode, TrackCode = x.TrackCode,
TrackTime = x.TrackTime TrackTime = x.TrackTime
}).ToList(); }).ToList();
// 外部api获取的轨迹不允许删除 // 外部api获取的轨迹不允许删除
if (tracks.Any(m => m.Source == TrackSourceEnum.ExternalServiceProvide.GetHashCode())) if (deleteTracks.Any(m => m.Source == TrackSourceEnum.ExternalServiceProvide.GetHashCode()))
return tracks; return deleteTracks;
//查出订单下的所有轨迹,以供后面回退使用
tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds);
// 删除轨迹 // 删除轨迹
foreach (var item in tracks) foreach (var item in deleteTracks)
{ {
await _trackDetailsEsRepository.DeleteTrackByIdAsync(item.Id, item.IndexName); await _trackDetailsEsRepository.DeleteTrackByIdAsync(item.Id, item.IndexName);
} }
@ -205,9 +209,9 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds); tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds);
//构建标识符集合 //构建标识符集合
var ids = @event.TrackIdentifiers.Select(x => $"{x.TrackCode}{x.TrackTime}").ToList(); var ids = @event.TrackIdentifiers.Select(x => $"{x.TrackCode}{x.TrackTime:G}").ToList();
//根据标识符选出要删除的轨迹明细 //根据标识符选出要删除的轨迹明细
var deleteTracks = tracks.Where(x => ids.Contains($"{x.TrackCode}{x.TrackTime}")).ToList(); deleteTracks = tracks.Where(x => ids.Contains($"{x.TrackCode}{x.TrackTime:G}")).ToList();
if (deleteTracks.Count == 0) return deleteTracks; if (deleteTracks.Count == 0) return deleteTracks;
@ -218,10 +222,10 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
//从被删除轨迹寻找订单id,稍后会更新订单主表 //从被删除轨迹寻找订单id,稍后会更新订单主表
orderIds = deleteTracks.Select(m => m.OrderId).Distinct().ToList(); orderIds = deleteTracks.Select(m => m.OrderId).Distinct().ToList();
//排除掉已经删除的轨迹
tracks = tracks.Except(deleteTracks).ToList();
} }
//排除掉已经删除的轨迹
tracks = tracks.Except(deleteTracks).ToList();
var orders = await _orderRepository.GetListAsync(x => orderIds.Contains(x.Id), var orders = await _orderRepository.GetListAsync(x => orderIds.Contains(x.Id),
x => new OrderEntity x => new OrderEntity
@ -232,13 +236,15 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
LatestTrackPlace = x.LatestTrackPlace, LatestTrackPlace = x.LatestTrackPlace,
LatestTrackTime = x.LatestTrackTime, LatestTrackTime = x.LatestTrackTime,
LatestTrackTimeZone = x.LatestTrackTimeZone, LatestTrackTimeZone = x.LatestTrackTimeZone,
EstimatedDeliveryDate = x.EstimatedDeliveryDate,
DestinationTimeZone = x.DestinationTimeZone
}); });
if (orders.Count == 0) return tracks; if (orders.Count == 0) return tracks;
foreach (var order in orders) foreach (var order in orders)
{ {
//找到最新的轨迹数据 //找到最新的轨迹数据
var track = tracks?.OrderByDescending(x=>x.TrackTime) var track = tracks?.OrderByDescending(x => x.TrackTime)
.FirstOrDefault(x => x.OrderId == order.Id); .FirstOrDefault(x => x.OrderId == order.Id);
// 删除全部轨迹导致的重置行为 // 删除全部轨迹导致的重置行为
@ -258,6 +264,8 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
order.LatestTrackPlace = track.TrackPlace; order.LatestTrackPlace = track.TrackPlace;
order.LatestTrackTime = track.TrackTime; order.LatestTrackTime = track.TrackTime;
order.LatestTrackTimeZone = track.TrackTimeZone; order.LatestTrackTimeZone = track.TrackTimeZone;
order.EstimatedDeliveryDate = track.EstimatedDeliveryDate;
order.DestinationTimeZone = track.DestinationTimeZone;
} }
@ -267,7 +275,7 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
OrderId = order.Id, OrderId = order.Id,
OrderNo = order.OrderNo, OrderNo = order.OrderNo,
OptionType = OrderOperationType.删除轨迹.ToString(), OptionType = OrderOperationType.删除轨迹.ToString(),
Content = tracks?.Where(m => m.OrderId == order.Id).ToList().ToJson(), Content = deleteTracks?.Where(m => m.OrderId == order.Id).ToList().ToJson(),
CreateUserId = @event.OperationManId, CreateUserId = @event.OperationManId,
CreateUserName = @event.OperationMan ?? "", CreateUserName = @event.OperationMan ?? "",
CreateTime = DateTime.Now CreateTime = DateTime.Now
@ -281,9 +289,11 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
x.LatestTrackEnContent, x.LatestTrackEnContent,
x.LatestTrackPlace, x.LatestTrackPlace,
x.LatestTrackTime, x.LatestTrackTime,
x.LatestTrackTimeZone x.LatestTrackTimeZone,
x.EstimatedDeliveryDate,
x.DestinationTimeZone
}); });
return tracks; return deleteTracks;
} }
} }

View File

@ -199,7 +199,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
return default; return default;
} }
//#7001:未来潜在需求,当轨迹内容匹配预设,记录一个标记,保证下刷过程都是使用预设内衣 //#7001:未来潜在需求,当轨迹内容匹配预设,记录一个标记,保证下刷过程都是使用预设内容
//虽然在引发事件之前做了判断,引发之后并不一定立即处理,在此过程中轨迹内容仍然可能被修改,所以要二次进行判断。 //虽然在引发事件之前做了判断,引发之后并不一定立即处理,在此过程中轨迹内容仍然可能被修改,所以要二次进行判断。
//通过来源指示是否为手动操作 //通过来源指示是否为手动操作
var manualOperation = @event.Source == (int) TrackSourceEnum.Artificial; var manualOperation = @event.Source == (int) TrackSourceEnum.Artificial;
@ -241,7 +241,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
TrackContent = trackContent.TrackContent, TrackContent = trackContent.TrackContent,
TrackEnContent = trackContent.TrackEnContent, TrackEnContent = trackContent.TrackEnContent,
TrackPlace = @event.TrackPlace, TrackPlace = @event.TrackPlace,
TrackTime = @event.TrackTime, TrackTime = @event.NewTrackTime ?? @event.TrackTime,
TrackTimeZone = @event.TrackTimeZone, TrackTimeZone = @event.TrackTimeZone,
DestinationTimeZone = @event.DestinationTimeZone, DestinationTimeZone = @event.DestinationTimeZone,
EstimatedDeliveryDate = @event.EstimatedDeliveryDate EstimatedDeliveryDate = @event.EstimatedDeliveryDate
@ -261,7 +261,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
TrackStatus = trackContent.TrackStatus, TrackStatus = trackContent.TrackStatus,
TrackContent = trackContent.TrackContent, TrackContent = trackContent.TrackContent,
TrackPlace = @event.TrackPlace, TrackPlace = @event.TrackPlace,
TrackTime = @event.TrackTime, TrackTime = @event.NewTrackTime ?? @event.TrackTime,
TrackTimeZone = @event.TrackTimeZone TrackTimeZone = @event.TrackTimeZone
} }
}; };
@ -353,9 +353,11 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser, CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
//来源轨迹内容,第一次新增的时候使用轨迹内容表提供的 //来源轨迹内容,第一次新增的时候使用轨迹内容表提供的
TrackStatusId = trackContent.TrackStatusId,
TrackStatus = trackContent.TrackStatus, TrackStatus = trackContent.TrackStatus,
TrackStatusCode = trackContent.TrackStatusCode, TrackStatusCode = trackContent.TrackStatusCode,
//跨子系统? //跨子系统?
TrackContentId = trackContent.TrackContentId,
TrackContent = @event.Content ?? trackContent.TrackContent, TrackContent = @event.Content ?? trackContent.TrackContent,
TrackEnContent = @event.EnStatus ?? trackContent.TrackEnContent, TrackEnContent = @event.EnStatus ?? trackContent.TrackEnContent,
//S06新增轨迹明细字段 //S06新增轨迹明细字段
@ -376,6 +378,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
TrackPlacePostcode = @event.TrackPlacePostcode ?? GlobalConst.EmptyString, TrackPlacePostcode = @event.TrackPlacePostcode ?? GlobalConst.EmptyString,
DestinationTimeZone = @event.DestinationTimeZone, DestinationTimeZone = @event.DestinationTimeZone,
EstimatedDeliveryDate = @event.EstimatedDeliveryDate, EstimatedDeliveryDate = @event.EstimatedDeliveryDate,
Extra = @event.Extra
}; };
track.ZeroTrackTime = Math.Abs(track.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1 track.ZeroTrackTime = Math.Abs(track.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1
@ -432,6 +435,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
track.TrackPlacePostcode = @event.TrackPlacePostcode ?? GlobalConst.EmptyString; track.TrackPlacePostcode = @event.TrackPlacePostcode ?? GlobalConst.EmptyString;
track.DestinationTimeZone = @event.DestinationTimeZone; track.DestinationTimeZone = @event.DestinationTimeZone;
track.EstimatedDeliveryDate = @event.EstimatedDeliveryDate; track.EstimatedDeliveryDate = @event.EstimatedDeliveryDate;
track.Extra = @event.Extra;
updateTracks.Add(track); updateTracks.Add(track);

View File

@ -300,8 +300,10 @@ public class TrackRefreshEventHandler : ITransientDependency, IRabbitHandler
CreateUser = GlobalConst.SystemUser, CreateUser = GlobalConst.SystemUser,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
//来源轨迹内容,第一次新增的时候使用轨迹内容表提供的 //来源轨迹内容,第一次新增的时候使用轨迹内容表提供的
TrackStatusId = GlobalConst.NotExistId,
TrackStatus = GlobalConst.EmptyString, TrackStatus = GlobalConst.EmptyString,
TrackStatusCode = GlobalConst.EmptyString, TrackStatusCode = GlobalConst.EmptyString,
TrackContentId = GlobalConst.NotExistId,
TrackContent = GlobalConst.EmptyString, TrackContent = GlobalConst.EmptyString,
TrackEnContent = GlobalConst.EmptyString, TrackEnContent = GlobalConst.EmptyString,
//S06新增轨迹明细字段 //S06新增轨迹明细字段
@ -318,6 +320,7 @@ public class TrackRefreshEventHandler : ITransientDependency, IRabbitHandler
TrackPlacePostcode = null, TrackPlacePostcode = null,
DestinationTimeZone = null, DestinationTimeZone = null,
EstimatedDeliveryDate = null, EstimatedDeliveryDate = null,
Extra = null
}; };
track.ZeroTrackTime = Math.Abs(track.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1 track.ZeroTrackTime = Math.Abs(track.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1

View File

@ -11,10 +11,10 @@
<PackageReference Include="BSI.Stack.Rabbit" Version="2.1.3" /> <PackageReference Include="BSI.Stack.Rabbit" Version="2.1.3" />
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/> <PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/>
<PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.17" /> <PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.17" />
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.2.3"/> <PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.2.5-alpha" />
<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.9-alpha9"/> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.1.8.17-alpha" />
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" /> <PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" />
<PackageReference Include="DotNetCore.CAP" Version="8.2.0"/> <PackageReference Include="DotNetCore.CAP" Version="8.2.0"/>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="8.2.0"/> <PackageReference Include="DotNetCore.CAP.Dashboard" Version="8.2.0"/>

View File

@ -1,4 +1,4 @@
using DotNetCore.CAP; using DotNetCore.CAP;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Services.ProvideServices; using SJZY.Track.Application.Contract.Services.ProvideServices;
@ -131,6 +131,7 @@ public partial class OrderService : ApplicationService, IOrderService
order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos); order.OrderFlights = ObjectMapper.Map<List<OrderFlightInfo>, List<OrderFlightEntity>>(input.FlightInfos);
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos); order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos); order.OrderPlatformNumbers = BuiltOrderPlatformNumbers(input.PullConfigInfos);
order.TemplateCodes = string.Join(',', input.TemplateCodes);
await _orderRepository.UpdateOrderAsync(order); await _orderRepository.UpdateOrderAsync(order);
} }

View File

@ -8,7 +8,7 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Dtos.TrackPush; using SJZY.Track.Domain.Dtos.TrackPush;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;
using SJZY.UserCenter.HttpApi.Services; using SJZY.UserCenter.HttpApi.Services.User;
using Volo.Abp.Http.Client.DynamicProxying; using Volo.Abp.Http.Client.DynamicProxying;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -23,14 +23,14 @@ public class TrackPushService : ApplicationService, ITrackPushService
private readonly ICapPublisher _capPublisher; private readonly ICapPublisher _capPublisher;
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly IProvideQueries _provideQueries; private readonly IProvideQueries _provideQueries;
private readonly IHttpClientProxy<IRequestCurrentUserService> _requestCurrentUserService; private readonly IHttpClientProxy<IUserBaseInfoService> _requestCurrentUserService;
private readonly ITrackPushConfigRepository _trackPushConfigRepository; private readonly ITrackPushConfigRepository _trackPushConfigRepository;
private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository; private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository;
public TrackPushService(IOrderRepository orderRepository public TrackPushService(IOrderRepository orderRepository
, ICapPublisher capPublisher , ICapPublisher capPublisher
, ITrackPushRecordEsRepository trackPushRecordEsRepository , ITrackPushRecordEsRepository trackPushRecordEsRepository
, IHttpClientProxy<IRequestCurrentUserService> requestCurrentUserService , IHttpClientProxy<IUserBaseInfoService> requestCurrentUserService
, ITrackPushConfigRepository trackPushConfigRepository, IProvideQueries provideQueries) , ITrackPushConfigRepository trackPushConfigRepository, IProvideQueries provideQueries)
{ {
_orderRepository = orderRepository; _orderRepository = orderRepository;

View File

@ -79,7 +79,8 @@ public partial class TrackService
TrackPlaceNationId = x.TrackPlaceNationId, TrackPlaceNationId = x.TrackPlaceNationId,
TrackPlacePostcode = x.TrackPlacePostcode, TrackPlacePostcode = x.TrackPlacePostcode,
DestinationTimeZone = x.DestinationTimeZone, DestinationTimeZone = x.DestinationTimeZone,
EstimatedDeliveryDate = x.EstimatedDeliveryDate EstimatedDeliveryDate = x.EstimatedDeliveryDate,
Extra = x.Extra
}).ToList(); }).ToList();
res.Add(item); res.Add(item);

View File

@ -7,6 +7,7 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Enums; using SJZY.Track.Domain.Enums;
using SJZY.UserCenter.HttpApi.Services; using SJZY.UserCenter.HttpApi.Services;
using SJZY.UserCenter.HttpApi.Services.User;
using Volo.Abp.Http.Client.DynamicProxying; using Volo.Abp.Http.Client.DynamicProxying;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -20,12 +21,12 @@ public partial class TrackService : ApplicationService, ITrackService
{ {
private readonly ICapPublisher _capPublisher; private readonly ICapPublisher _capPublisher;
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly IHttpClientProxy<IRequestCurrentUserService> _requestCurrentUserService; private readonly IHttpClientProxy<IUserBaseInfoService> _requestCurrentUserService;
private readonly ITrackContentRepository _trackContentRepository; private readonly ITrackContentRepository _trackContentRepository;
public TrackService(IOrderRepository orderRepository, ICapPublisher capPublisher, public TrackService(IOrderRepository orderRepository, ICapPublisher capPublisher,
ITrackDetailsEsRepository trackDetailsEsRepository, ITrackContentRepository trackContentRepository, ITrackDetailsEsRepository trackDetailsEsRepository, ITrackContentRepository trackContentRepository,
IHttpClientProxy<IRequestCurrentUserService> requestCurrentUserService) IHttpClientProxy<IUserBaseInfoService> requestCurrentUserService)
{ {
_orderRepository = orderRepository; _orderRepository = orderRepository;
_capPublisher = capPublisher; _capPublisher = capPublisher;
@ -62,7 +63,7 @@ public partial class TrackService : ApplicationService, ITrackService
//要求时间在当前时间的前后100年之间内 //要求时间在当前时间的前后100年之间内
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100)); bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime)) if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime) || ValidateTrackTime(input.EstimatedDeliveryDate))
{ {
throw new BusinessException(message: "轨迹时间不合法"); throw new BusinessException(message: "轨迹时间不合法");
} }
@ -104,6 +105,35 @@ public partial class TrackService : ApplicationService, ITrackService
.Where(x => x.TrackTime == input.TrackTime) .Where(x => x.TrackTime == input.TrackTime)
.ToList(); .ToList();
//当为更新操作时发现更新的数目为0进行重试操作
if (!input.IsAdd && tracks.Count == 0)
{
var curRetryCount = 0;
var success = false;
while (!success && curRetryCount < GlobalConst.MaxUpdateTrackRetryCount)
{
try
{
tracks = (await _trackDetailsEsRepository.GetListAsync(new[] { order.Id }, input.TrackCode, true))
.Where(x => x.TrackTime == input.TrackTime)
.ToList();
if (tracks.Count > 0)
success = true;
await Task.Delay(300);
}
finally
{
curRetryCount++;
}
}
if (tracks.Count == 0)
{
throw new BusinessException(message: $"订单:{input.OrderNo},轨迹代码:{input.TrackCode}没有要更新的记录");
}
}
//更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改 //更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改
if (!input.IsAdd && tracks.Count > 1) if (!input.IsAdd && tracks.Count > 1)
{ {
@ -330,7 +360,7 @@ public partial class TrackService : ApplicationService, ITrackService
//要求时间在当前时间的前后100年之间内 //要求时间在当前时间的前后100年之间内
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100)); bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime)) if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime) || ValidateTrackTime(input.EstimatedDeliveryDate))
{ {
throw new BusinessException(message: "轨迹时间不合法"); throw new BusinessException(message: "轨迹时间不合法");
} }
@ -366,6 +396,34 @@ public partial class TrackService : ApplicationService, ITrackService
.Where(x => x.TrackTime == input.TrackTime) .Where(x => x.TrackTime == input.TrackTime)
.ToList(); .ToList();
//当为更新操作时发现更新的数目为0进行重试操作
if (!input.IsAdd && tracks.Count == 0)
{
var curRetryCount = 0;
var success = false;
while (!success && curRetryCount < GlobalConst.MaxUpdateTrackRetryCount)
{
try
{
tracks = (await _trackDetailsEsRepository.GetListAsync(new[] { order.Id }, input.TrackCode, true))
.Where(x => x.TrackTime == input.TrackTime)
.ToList();
if (tracks.Count > 0)
success = true;
await Task.Delay(300);
}
finally
{
curRetryCount++;
}
}
if (tracks.Count == 0)
{
throw new BusinessException(message: $"订单:[{string.Join(",", input.OrderNos)}],轨迹代码:{input.TrackCode}没有要更新的记录");
}
}
//更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改 //更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改
if (!input.IsAdd && tracks.Count > 1) if (!input.IsAdd && tracks.Count > 1)
{ {
@ -386,10 +444,10 @@ public partial class TrackService : ApplicationService, ITrackService
{ {
SubSystemId = input.SubSystemId, SubSystemId = input.SubSystemId,
CustomId = group.Key, CustomId = group.Key,
OrderIdentifiers = group.Select(order => new OrderIdentifier OrderIdentifiers = group.Select(o => new OrderIdentifier
{ {
OrderId = order.Id, OrderId = o.Id,
OrderNo = order.OrderNo, OrderNo = o.OrderNo,
OrderType = input.OrderType, OrderType = input.OrderType,
}).ToArray(), }).ToArray(),
IsAdd = input.IsAdd, IsAdd = input.IsAdd,
@ -415,6 +473,7 @@ public partial class TrackService : ApplicationService, ITrackService
TrackPlacePostcode = input.TrackPlacePostcode, TrackPlacePostcode = input.TrackPlacePostcode,
EstimatedDeliveryDate = input.EstimatedDeliveryDate, EstimatedDeliveryDate = input.EstimatedDeliveryDate,
DestinationTimeZone = input.DestinationTimeZone, DestinationTimeZone = input.DestinationTimeZone,
Extra = input.Extra
}; };
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event); await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
} }

View File

@ -33,4 +33,18 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService
var res = ObjectMapper.Map<List<TrackTemplateOutputVo>, List<TrackTemplateOutput>>(templates); var res = ObjectMapper.Map<List<TrackTemplateOutputVo>, List<TrackTemplateOutput>>(templates);
return res; return res;
} }
/// <summary>
/// 分页获取轨迹模版列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Template/GetTrackTemplateListByPage")]
public async Task<UnifyPageResultDto<TemplateContentDto>> GetTrackTemplateListByPageAsync(GetPageTrackTemplateListInput input)
{
var inputVo = ObjectMapper.Map<GetPageTrackTemplateListInput, GetPageTrackTemplateListInputVo>(input);
var templates = await _trackTemplateRepository.GetPageTrackTemplateListAsync(inputVo);
var res = ObjectMapper.Map<UnifyPageResultDto<TemplateContentDtoVo>, UnifyPageResultDto<TemplateContentDto>>(templates);
return res;
}
} }

View File

@ -127,13 +127,13 @@ public class TrackOrderService : ApplicationService
if (whereExpression == default) if (whereExpression == default)
throw new BusinessException(message: "请求参数异常"); throw new BusinessException(message: "请求参数异常");
var subSystemId = await _orderRepository.GetFirstAsync(whereExpression, x => x.SubSystemId); var order = await _orderRepository.GetFirstAsync(whereExpression);
if (subSystemId == default) if (order == default)
{ {
throw new BusinessException(message: "订单不存在"); throw new BusinessException(message: "订单不存在");
} }
var trackDetails = await _trackDetailsEsRepository.GetListAsync(orderId ?? 0); var trackDetails = await _trackDetailsEsRepository.GetListAsync(order.Id);
if (trackDetails.IsNullOrEmpty()) if (trackDetails.IsNullOrEmpty())
{ {
return new List<TrackOrderDetailDto>(); return new List<TrackOrderDetailDto>();
@ -150,7 +150,7 @@ public class TrackOrderService : ApplicationService
if (!trackCodes.IsNullOrEmpty()) if (!trackCodes.IsNullOrEmpty())
{ {
var trackContents = await _trackContentRepository.GetListAsync(x => var trackContents = await _trackContentRepository.GetListAsync(x =>
x.SubSystemId == subSystemId && trackCodes.Contains(x.Code), x => new x.SubSystemId == order.SubSystemId && trackCodes.Contains(x.Code), x => new
{ {
x.Code, x.Code,
x.IsExternal x.IsExternal

View File

@ -201,5 +201,7 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
LatestTrackTime = null; LatestTrackTime = null;
LatestTrackPlace = null; LatestTrackPlace = null;
LatestTrackTimeZone = null; LatestTrackTimeZone = null;
EstimatedDeliveryDate = null;
DestinationTimeZone = null;
} }
} }

View File

@ -32,6 +32,11 @@ public class TrackDetailsIndex : IdBaseIndex
/// </summary> /// </summary>
public int OrderType { get; set; } public int OrderType { get; set; }
/// <summary>
/// 轨迹状态Id
/// </summary>
public int TrackStatusId { get; set; } = GlobalConst.NotExistId;
/// <summary> /// <summary>
/// 轨迹状态 /// 轨迹状态
/// </summary> /// </summary>
@ -42,6 +47,11 @@ public class TrackDetailsIndex : IdBaseIndex
/// </summary> /// </summary>
public string TrackStatusCode { get; set; } = GlobalConst.EmptyString; public string TrackStatusCode { get; set; } = GlobalConst.EmptyString;
/// <summary>
/// 轨迹内容Id
/// </summary>
public int TrackContentId { get; set; } = GlobalConst.NotExistId;
/// <summary> /// <summary>
/// 轨迹内容代码 /// 轨迹内容代码
/// </summary> /// </summary>
@ -176,4 +186,9 @@ public class TrackDetailsIndex : IdBaseIndex
/// 签收地时区 /// 签收地时区
/// </summary> /// </summary>
public float? DestinationTimeZone { get; set; } public float? DestinationTimeZone { get; set; }
/// <summary>
/// 扩展信息字段,用与轨迹推送的附加字段
/// </summary>
public Dictionary<string, object>? Extra { get; set; }
} }

View File

@ -45,5 +45,6 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
Expression<Func<TrackTemplateContentEntity, bool>> whereExpression); Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
Task<List<TrackTemplateOutputVo>> GetTrackTemplateListAsync(GetTrackTemplateListInputVo input); Task<List<TrackTemplateOutputVo>> GetTrackTemplateListAsync(GetTrackTemplateListInputVo input);
Task<UnifyPageResultDto<TemplateContentDtoVo>> GetPageTrackTemplateListAsync(GetPageTrackTemplateListInputVo input);
Task<List<string>> GetContentByTemplateCodes(string[] codes, int systemId); Task<List<string>> GetContentByTemplateCodes(string[] codes, int systemId);
} }

View File

@ -8,4 +8,9 @@ public partial class GlobalConst
/// 轨迹数据来源:1外部服务商创建,2内部系统创建,3人工创建 /// 轨迹数据来源:1外部服务商创建,2内部系统创建,3人工创建
/// </summary> /// </summary>
public static readonly ImmutableHashSet<int> SupportTrackSources = ImmutableHashSet.Create(1, 2, 3); public static readonly ImmutableHashSet<int> SupportTrackSources = ImmutableHashSet.Create(1, 2, 3);
/// <summary>
/// 最大更新轨迹重试次数
/// </summary>
public const int MaxUpdateTrackRetryCount = 3;
} }

View File

@ -2,6 +2,8 @@ namespace SJZY.Track.Domain.Consts;
public partial class GlobalConst public partial class GlobalConst
{ {
public const string MainDataKey_OrderType = "TrackOrderType";
public const string MainDataKey_TrackQuestionType = "TrackQuestionType";
public const string SystemUser = "系统"; public const string SystemUser = "系统";
public const string EmptyString = "--"; public const string EmptyString = "--";
public const int ChunkSize = 100; public const int ChunkSize = 100;

View File

@ -17,6 +17,11 @@ public class TrackContentVO
/// </summary> /// </summary>
public string TrackStatus { get; set; } = null!; public string TrackStatus { get; set; } = null!;
/// <summary>
/// 轨迹内容Id
/// </summary>
public int TrackContentId { get; set; }
/// <summary> /// <summary>
/// 轨迹内容 /// 轨迹内容
/// </summary> /// </summary>

View File

@ -0,0 +1,29 @@
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
public class GetPageTrackTemplateListInputVo : PageInfoInput
{
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int? CustomerId { get; set; }
/// <summary>
/// 模版分类
/// </summary>
public int? TemplateType { get; set; }
/// <summary>
/// 模板code
/// </summary>
public string? TemplateCode { get; set; }
/// <summary>
/// 关键字
/// </summary>
public string? KeyWord { get; set; }
}

View File

@ -16,4 +16,9 @@ public class GetTrackTemplateListInputVo
/// 模版分类 /// 模版分类
/// </summary> /// </summary>
public int? TemplateType { get; set; } public int? TemplateType { get; set; }
/// <summary>
/// 模板code
/// </summary>
public string? TemplateCode { get; set; }
} }

View File

@ -1,3 +1,4 @@
using NUglify.Helpers;
using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.Logger;
using SJZY.Track.Domain; using SJZY.Track.Domain;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
@ -55,6 +56,45 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
}) })
.ToPagedListAsync(input.PageIndex, input.PageSize); .ToPagedListAsync(input.PageIndex, input.PageSize);
//查询订单类型描述
var orderTypes = pageList.List.Select(x => x.OrderType).Distinct().ToList();
var questTypes = pageList.List.Select(x => x.QuestionType).Distinct().ToList();
//从主数据中心查询类型描述
var typeDispDict = (await Context.Queryable<VEnumValueInfoEntity>()
.Where(x =>
(x.Property == GlobalConst.MainDataKey_OrderType && orderTypes.Contains(x.Enumkey))
|| (x.Property == GlobalConst.MainDataKey_TrackQuestionType && questTypes.Contains(x.Enumkey))
)
.Select(x => new
{
x.Property,
x.Enumkey,
x.Disp
})
.ToListAsync()
)
.GroupBy(x => x.Property)
.ToDictionary(
g => g.Key,
y => y.ToDictionary(x => x.Enumkey, x => x.Disp)
);
//填充数描述信息
pageList.List.ForEach(x =>
{
x.OrderTypeName = typeDispDict.TryGetValue(GlobalConst.MainDataKey_OrderType, out var orderTypeDisplayDict)
? orderTypeDisplayDict.TryGetValue(x.OrderType, out var orderTypeDisplay)
? orderTypeDisplay
: $"未在主数据中心找到Property:[{GlobalConst.MainDataKey_OrderType}] Enumkey:[{x.OrderType}]"
: $"未在主数据中心找到Property:[{GlobalConst.MainDataKey_OrderType}]";
x.QuestionTypeName = typeDispDict.TryGetValue(GlobalConst.MainDataKey_TrackQuestionType, out var questDisplayDict)
? questDisplayDict.TryGetValue(x.QuestionType, out var questDisplay)
? questDisplay
: $"未在主数据中心找到Property:[{GlobalConst.MainDataKey_OrderType}] Enumkey:[{x.OrderType}]"
: $"未在主数据中心找到Property:[{GlobalConst.MainDataKey_TrackQuestionType}]";
});
return pageList; return pageList;
} }

View File

@ -261,6 +261,7 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
TrackStatusId = x.TrackStatusId, TrackStatusId = x.TrackStatusId,
TrackStatus = y.Status, TrackStatus = y.Status,
TrackStatusCode = y.Code, TrackStatusCode = y.Code,
TrackContentId = x.Id,
TrackContent = x.Content, TrackContent = x.Content,
TrackContentCode = x.Code, TrackContentCode = x.Code,
TrackEnContent = x.EnContent, TrackEnContent = x.EnContent,

View File

@ -173,7 +173,8 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
track.TrackPlaceNationId, track.TrackPlaceNationId,
track.TrackPlacePostcode, track.TrackPlacePostcode,
track.DestinationTimeZone, track.DestinationTimeZone,
track.EstimatedDeliveryDate track.EstimatedDeliveryDate,
track.Extra
}) })
); );
@ -218,7 +219,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
ctx._source.trackPlacePostcode = params.trackPlacePostcode; ctx._source.trackPlacePostcode = params.trackPlacePostcode;
ctx._source.destinationTimeZone = params.destinationTimeZone; ctx._source.destinationTimeZone = params.destinationTimeZone;
ctx._source.estimatedDeliveryDate = params.estimatedDeliveryDate; ctx._source.estimatedDeliveryDate = params.estimatedDeliveryDate;
ctx._source.extra = params.extra;
") ")
.Params(p => p .Params(p => p
.Add("trackPlace", track.TrackPlace) .Add("trackPlace", track.TrackPlace)
@ -241,6 +242,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
.Add("trackPlacePostcode", track.TrackPlacePostcode) .Add("trackPlacePostcode", track.TrackPlacePostcode)
.Add("destinationTimeZone", track.DestinationTimeZone) .Add("destinationTimeZone", track.DestinationTimeZone)
.Add("estimatedDeliveryDate", track.EstimatedDeliveryDate) .Add("estimatedDeliveryDate", track.EstimatedDeliveryDate)
.Add("extra", track.Extra)
) )
) )
); );
@ -294,6 +296,7 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
ctx._source.trackPlacePostcode = params.trackPlacePostcode; ctx._source.trackPlacePostcode = params.trackPlacePostcode;
ctx._source.destinationTimeZone = params.destinationTimeZone; ctx._source.destinationTimeZone = params.destinationTimeZone;
ctx._source.estimatedDeliveryDate = params.estimatedDeliveryDate; ctx._source.estimatedDeliveryDate = params.estimatedDeliveryDate;
ctx._source.extra = params.extra;
").Params(p => p ").Params(p => p
.Add("trackPlace", track.TrackPlace) .Add("trackPlace", track.TrackPlace)
.Add("trackTime", track.TrackTime) .Add("trackTime", track.TrackTime)
@ -314,8 +317,9 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
.Add("trackPlaceNationId", track.TrackPlaceNationId) .Add("trackPlaceNationId", track.TrackPlaceNationId)
.Add("trackPlacePostcode", track.TrackPlacePostcode) .Add("trackPlacePostcode", track.TrackPlacePostcode)
.Add("destinationTimeZone", track.DestinationTimeZone) .Add("destinationTimeZone", track.DestinationTimeZone)
.Add("estimatedDeliveryDate", track.EstimatedDeliveryDate)) .Add("estimatedDeliveryDate", track.EstimatedDeliveryDate)
)); .Add("extra", track.Extra)
)));
var retryCount = 0; var retryCount = 0;
var updateSuccessful = false; var updateSuccessful = false;

View File

@ -191,6 +191,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
.Where(x => x.SubSystemId == input.SubSystemId) .Where(x => x.SubSystemId == input.SubSystemId)
.WhereIF(input.CustomerId.HasValue, x => x.CustomerId == input.CustomerId) .WhereIF(input.CustomerId.HasValue, x => x.CustomerId == input.CustomerId)
.WhereIF(input.TemplateType.HasValue, x => x.CategoryId == input.TemplateType) .WhereIF(input.TemplateType.HasValue, x => x.CategoryId == input.TemplateType)
.WhereIF(!input.TemplateCode.IsNullOrWhiteSpace(), x => x.Code == input.TemplateCode)
.Select(x => new TrackTemplateOutputVo .Select(x => new TrackTemplateOutputVo
{ {
Id = x.Id, Id = x.Id,
@ -227,9 +228,49 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
return templates; return templates;
} }
public async Task<UnifyPageResultDto<TemplateContentDtoVo>> GetPageTrackTemplateListAsync(GetPageTrackTemplateListInputVo input)
{
var templates = await Context.Queryable<TrackTemplateEntity>()
.Where(x => x.SubSystemId == input.SubSystemId)
.WhereIF(input.CustomerId.HasValue, x => x.CustomerId == input.CustomerId)
.WhereIF(input.TemplateType.HasValue, x => x.CategoryId == input.TemplateType)
.WhereIF(!input.TemplateCode.IsNullOrWhiteSpace(), x => x.Code == input.TemplateCode)
.Select(x => new TrackTemplateOutputVo
{
Id = x.Id,
TemplateName = x.Name,
TemplateCode = x.Code,
})
.ToListAsync();
if (templates == default) return new UnifyPageResultDto<TemplateContentDtoVo>();
var templateIds = templates.Select(x => x.Id).ToArray();
var contents = await Context.Queryable<TrackTemplateContentEntity>()
.LeftJoin<TrackContentEntity>((a, b) => a.TrackContentId == b.Id)
.LeftJoin<TrackStatusEntity>((a, b, c) => b.TrackStatusId == c.Id)
.LeftJoin<TrackNodeEntity>((a, b, c, d) => c.Node == d.Id)
.Where(a => templateIds.Contains(a.TrackTemplateId))
.WhereIF(!input.KeyWord.IsNullOrWhiteSpace(), (a, b, c, d) =>
b.Code.Contains(input.KeyWord!)
|| b.EnContent.Contains(input.KeyWord!)
|| b.Content.Contains(input.KeyWord!)
)
.Select((a, b, c, d) => new TemplateContentDtoVo
{
TemplateId = a.TrackTemplateId,
Code = b.Code,
ContentCn = b.Content,
ContentEn = b.EnContent,
Status = c.Status,
Node = d.NodeName
})
.ToPagedListAsync(input.PageIndex, input.PageSize);
return contents;
}
public async Task<List<string>> GetContentByTemplateCodes(string[] codes, int systemId) public async Task<List<string>> GetContentByTemplateCodes(string[] codes, int systemId)
{ {
var sql = @$" var sql = @$"
select select
distinct distinct
@ -244,7 +285,10 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
"; ";
var list = Context.Ado.SqlQuery<string>(sql, new {codes = codes}).ToList(); var list = Context.Ado.SqlQuery<string>(sql, new
{
codes = codes
}).ToList();
return list; return list;
} }

View File

@ -8,9 +8,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="SJZY.LoggerCenter.HttpApi" Version="7.0.5" /> <PackageReference Include="SJZY.LoggerCenter.HttpApi" Version="7.0.5" />
<PackageReference Include="SJZY.OTel.Extension" Version="1.0.6"/> <PackageReference Include="SJZY.OTel.Extension" Version="1.1.3" />
<PackageReference Include="Volo.Abp.Autofac" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Autofac" Version="7.0.2" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.9-alpha9"/> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.1.8.17-alpha" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>