Merge branch 'refs/heads/S06' into test
This commit is contained in:
commit
9045a4b2ef
@ -5,9 +5,9 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
|||||||
public class BatchDeleteTrackInput : OrderNosInfo
|
public class BatchDeleteTrackInput : OrderNosInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹code,必填
|
/// 轨迹标识符集合,必填
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
[MaxLength(500)]
|
[MaxLength(500)]
|
||||||
public List<string> TrackCodes { get; set; } = new();
|
public List<TrackIdentifierDto> TrackIdentifiers { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,8 +9,8 @@ public class DeleteOrderInput : OrderNoInfo
|
|||||||
public class DeleteTrackInput : OrderNoInfo
|
public class DeleteTrackInput : OrderNoInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹code
|
/// 轨迹标识符集合,必填
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public List<string> TrackCodes { get; set; } = new();
|
public List<TrackIdentifierDto> TrackIdentifiers { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹标识符,用于唯一标识一个轨迹
|
||||||
|
/// </summary>
|
||||||
|
public sealed class TrackIdentifierDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹code
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string TrackCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public DateTime TrackTime { get; set; }
|
||||||
|
}
|
||||||
@ -10,6 +10,16 @@ public class UpsertOrderInput : UpdateOrderInput
|
|||||||
[Required]
|
[Required]
|
||||||
[Range(1, int.MaxValue)]
|
[Range(1, int.MaxValue)]
|
||||||
public int CustomId { get; set; }
|
public int CustomId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模板code
|
||||||
|
/// </summary>
|
||||||
|
public List<string> TemplateCodes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前操作人
|
||||||
|
/// </summary>
|
||||||
|
public int OptionUserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrderFlightInfo
|
public class OrderFlightInfo
|
||||||
|
|||||||
@ -118,4 +118,9 @@ public class UpsertTrackInput : OrderNoInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(-12, 12)]
|
[Range(-12, 12)]
|
||||||
public float? DestinationTimeZone { get; set; }
|
public float? DestinationTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前操作人
|
||||||
|
/// </summary>
|
||||||
|
public int OptionUserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
|
|
||||||
public class GetAvailableContentOutput
|
public class GetAvailableContentOutput
|
||||||
@ -89,4 +91,14 @@ public class GetAvailableContentOutput
|
|||||||
/// 目的地时区
|
/// 目的地时区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float? DestinationTimeZone { get; set; }
|
public float? DestinationTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附件文件集合
|
||||||
|
/// </summary>
|
||||||
|
public List<FileItemDto>? FileItems { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 客户是否可见
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVisibility { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class GetContentDetailInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统编号
|
||||||
|
/// </summary>
|
||||||
|
public int SystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹code
|
||||||
|
/// </summary>
|
||||||
|
public string TrackCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime TrackTime { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class GetContentDetailOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统
|
||||||
|
/// </summary>
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单Id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 索引名称
|
||||||
|
/// </summary>
|
||||||
|
public string IndexName { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型(主数据枚举TrackOrderType)
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹状态
|
||||||
|
/// </summary>
|
||||||
|
public string TrackStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹状态code
|
||||||
|
/// </summary>
|
||||||
|
public string TrackStatusCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string TrackCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容英文
|
||||||
|
/// </summary>
|
||||||
|
public string TrackEnContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务商code
|
||||||
|
/// </summary>
|
||||||
|
public string ServiceProviderCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string? OriginTrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹报文hash(刷新轨迹重复性校验使用)
|
||||||
|
/// </summary>
|
||||||
|
public string OriginTrackDataHash { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地
|
||||||
|
/// </summary>
|
||||||
|
public string TrackPlace { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime TrackTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时区
|
||||||
|
/// </summary>
|
||||||
|
public float TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转化后的轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ZeroTrackTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改人
|
||||||
|
/// </summary>
|
||||||
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 客户是否可见
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVisibility { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据来源:1外部服务商创建,2内部系统创建,3人工创建
|
||||||
|
/// </summary>
|
||||||
|
public int Source { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? Remarks { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附件集合
|
||||||
|
/// </summary>
|
||||||
|
public List<FileItem>? Files { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地(城市)
|
||||||
|
/// </summary>
|
||||||
|
public string? TrackPlaceCity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地(城市)Id
|
||||||
|
/// </summary>
|
||||||
|
public int? TrackPlaceCityId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地(省/州)
|
||||||
|
/// </summary>
|
||||||
|
public string? TrackPlaceProvince { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///轨迹发生地(省/州)Id
|
||||||
|
/// </summary>
|
||||||
|
public int? TrackPlaceProvinceId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地(国家/地区)
|
||||||
|
/// </summary>
|
||||||
|
public string? TrackPlaceNation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地(国家/地区)Id
|
||||||
|
/// </summary>
|
||||||
|
public int? TrackPlaceNationId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地邮编
|
||||||
|
/// </summary>
|
||||||
|
public string? TrackPlacePostcode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预计签收时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? EstimatedDeliveryDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签收地时区
|
||||||
|
/// </summary>
|
||||||
|
public float? DestinationTimeZone { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件osskey
|
||||||
|
/// </summary>
|
||||||
|
public string OssKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件名称
|
||||||
|
/// </summary>
|
||||||
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 路径
|
||||||
|
/// </summary>
|
||||||
|
public string Url { get; set; }
|
||||||
|
}
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Contract.Events;
|
namespace SJZY.Track.Application.Contract.Events;
|
||||||
|
|
||||||
public class TrackDeleteEvent
|
public class TrackDeleteEvent
|
||||||
@ -18,9 +20,9 @@ public class TrackDeleteEvent
|
|||||||
public int[] OrderIds { get; set; } = null!;
|
public int[] OrderIds { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码
|
/// 轨迹标识符
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> TrackCodes { get; set; } = null!;
|
public List<TrackIdentifierDto> TrackIdentifiers { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作人
|
/// 操作人
|
||||||
@ -40,6 +42,6 @@ public class TrackDeleteEvent
|
|||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"[TrackDelete by {OperationMan}] SubSystemId: {SubSystemId}, OrderIds: {string.Join(",",
|
return $"[TrackDelete by {OperationMan}] SubSystemId: {SubSystemId}, OrderIds: {string.Join(",",
|
||||||
OrderIds)}, TrackCodes: {string.Join(",", TrackCodes)}";
|
OrderIds)}, TrackCodes: {string.Join(",", TrackIdentifiers.Select(x=>x.TrackCode))}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.AutoMapper;
|
namespace SJZY.Track.Application.AutoMapper;
|
||||||
@ -16,5 +17,9 @@ public class TrackContentAutoMapperProfile : Profile
|
|||||||
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
||||||
MemberList.None);
|
MemberList.None);
|
||||||
CreateMap<EditTrackContentMapInput, TrackContentMapEntity>(MemberList.None);
|
CreateMap<EditTrackContentMapInput, TrackContentMapEntity>(MemberList.None);
|
||||||
|
|
||||||
|
CreateMap<TrackDetailsIndex, GetContentDetailOutput>(MemberList.None).ReverseMap();
|
||||||
|
CreateMap< SJZY.Track.Domain.Aggregates.TrackDetailsAggregate.FileItem, SJZY.Track.Application.Contract.Dtos.TrackContents.FileItem>(MemberList.None).ReverseMap();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using BSI.Stack.Rabbit;
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using SJZY.Expand.ABP.Core.Logger;
|
using SJZY.Expand.ABP.Core.Logger;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
@ -67,22 +68,29 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
var nextEvent = @event.DeepCopy();
|
var nextEvent = @event.DeepCopy();
|
||||||
nextEvent.Visited.AddRange(@event.OrderIds);
|
nextEvent.Visited.AddRange(@event.OrderIds);
|
||||||
nextEvent.TrackCodes = @event.TrackCodes;
|
nextEvent.TrackIdentifiers = @event.TrackIdentifiers;
|
||||||
nextEvent.SubSystemId = group.Key;
|
nextEvent.SubSystemId = group.Key;
|
||||||
|
|
||||||
// 不同子系统需要做内容映射
|
// 不同子系统需要做内容映射
|
||||||
if (@event.SubSystemId != nextEvent.SubSystemId)
|
if (@event.SubSystemId != nextEvent.SubSystemId)
|
||||||
{
|
{
|
||||||
var mapCodes = await _provideQueries
|
var codeMaps = await _provideQueries
|
||||||
.MapTrackCodesAsync(@event.SubSystemId, nextEvent.SubSystemId, @event.TrackCodes.ToArray());
|
.GetTrackCodeMapsAsync(@event.SubSystemId, nextEvent.SubSystemId,
|
||||||
|
@event.TrackIdentifiers.Select(x => x.TrackCode).ToArray());
|
||||||
|
|
||||||
if (mapCodes.Count == 0)
|
if (codeMaps.Count == 0)
|
||||||
{
|
{
|
||||||
LogHelper.Warn($"订单跨子系统,未配置内容映射,请联系管理员:{@event}", true);
|
LogHelper.Warn($"订单跨子系统,未配置内容映射,请联系管理员:{@event}", true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextEvent.TrackCodes = mapCodes;
|
//映射轨迹code
|
||||||
|
foreach (var trackIdentity in nextEvent.TrackIdentifiers)
|
||||||
|
{
|
||||||
|
var match = codeMaps.FirstOrDefault(x => x.MapTrackContentCode == trackIdentity.TrackCode);
|
||||||
|
if (match == null) continue;
|
||||||
|
trackIdentity.TrackCode = match.TrackContentCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var identifiers = group.Select(x => x.OrderId).ToList();
|
var identifiers = group.Select(x => x.OrderId).ToList();
|
||||||
@ -172,7 +180,11 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
tracks = await _trackDetailsEsRepository.GetDataByIds(@event.EsIds);
|
tracks = await _trackDetailsEsRepository.GetDataByIds(@event.EsIds);
|
||||||
orderIds = tracks.Select(m => m.OrderId).Distinct().ToList();
|
orderIds = tracks.Select(m => m.OrderId).Distinct().ToList();
|
||||||
@event.OrderIds = orderIds.ToArray();
|
@event.OrderIds = orderIds.ToArray();
|
||||||
@event.TrackCodes = tracks.Select(x => x.TrackCode).Distinct().ToList();
|
@event.TrackIdentifiers = tracks.Select(x => new TrackIdentifierDto
|
||||||
|
{
|
||||||
|
TrackCode = x.TrackCode,
|
||||||
|
TrackTime = x.TrackTime
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
// 外部api获取的轨迹不允许删除
|
// 外部api获取的轨迹不允许删除
|
||||||
if (tracks.Any(m => m.Source == TrackSourceEnum.ExternalServiceProvide.GetHashCode()))
|
if (tracks.Any(m => m.Source == TrackSourceEnum.ExternalServiceProvide.GetHashCode()))
|
||||||
@ -189,11 +201,24 @@ public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
else //原有逻辑,根据轨迹code和订单进行删除
|
else //原有逻辑,根据轨迹code和订单进行删除
|
||||||
{
|
{
|
||||||
|
var trackCodes = @event.TrackIdentifiers.Select(x => x.TrackCode).ToList();
|
||||||
// 删除轨迹(删的是同子系统下的单,所以code是统一的)
|
// 删除轨迹(删的是同子系统下的单,所以code是统一的)
|
||||||
tracks = await _trackDetailsEsRepository.GetLatestListAsync(@event.OrderIds, @event.TrackCodes);
|
tracks = await _trackDetailsEsRepository.GetListAsync(@event.OrderIds, trackCodes,null);
|
||||||
|
|
||||||
orderIds = await _trackDetailsEsRepository.DeleteTrackAsync(@event.OrderIds, @event.TrackCodes);
|
//构建标识符集合
|
||||||
if (orderIds.Count == 0) return tracks;
|
var ids = @event.TrackIdentifiers.Select(x => $"{x.TrackCode}{x.TrackTime}").ToList();
|
||||||
|
//根据标识符选出要删除的轨迹明细
|
||||||
|
var deleteTracks = tracks.Where(x => ids.Contains($"{x.TrackCode}{x.TrackTime}")).ToList();
|
||||||
|
|
||||||
|
if (deleteTracks.Count == 0) return deleteTracks;
|
||||||
|
|
||||||
|
foreach (var track in deleteTracks)
|
||||||
|
{
|
||||||
|
await _trackDetailsEsRepository.DeleteTrackByIdAsync(track.Id, track.IndexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
orderIds = tracks.Select(m => m.OrderId).Distinct().ToList();
|
||||||
|
tracks = deleteTracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
{
|
{
|
||||||
OrderId = order.Id,
|
OrderId = order.Id,
|
||||||
OrderNo = input.OrderNo,
|
OrderNo = input.OrderNo,
|
||||||
OptionType = OrderOperationType.修改订单.ToString(),
|
OptionType = OrderOperationType.修改订单.ToString(),
|
||||||
Content = input.ToJson(),
|
Content = input.ToJson(),
|
||||||
CreateUserId = currentUser.UserId,
|
CreateUserId = currentUser.UserId,
|
||||||
CreateUserName = currentUser.Name,
|
CreateUserName = currentUser.Name,
|
||||||
@ -76,6 +76,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);
|
||||||
|
|
||||||
var orderId = await _orderRepository.CreateOrderAsync(order);
|
var orderId = await _orderRepository.CreateOrderAsync(order);
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
throw new BusinessException(message: $"订单:{input.OrderNo},轨迹代码:{input.TrackCode}存在多条记录,不允许修改");
|
throw new BusinessException(message: $"订单:{input.OrderNo},轨迹代码:{input.TrackCode}存在多条记录,不允许修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
var userInfo = await _requestCurrentUserService.Service.GetCurrentUserBasicInfoAsync();
|
var userInfo = await _requestCurrentUserService.Service.GetCurrentUserBasicInfoAsync(input.OptionUserId);
|
||||||
if (userInfo.Code != GlobalConst.SuccessCode || userInfo.Data is null)
|
if (userInfo.Code != GlobalConst.SuccessCode || userInfo.Data is null)
|
||||||
{
|
{
|
||||||
//TODO: log || ex
|
//TODO: log || ex
|
||||||
@ -163,8 +163,14 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
|
|
||||||
//删除轨迹约束,只要其中有一条来源是外部的就立即返回错误
|
//删除轨迹约束,只要其中有一条来源是外部的就立即返回错误
|
||||||
var tracks = await _trackDetailsEsRepository
|
var tracks = await _trackDetailsEsRepository
|
||||||
.GetListAsync(new[] { orderId }, input.TrackCodes, TrackSourceEnum.ExternalServiceProvide);
|
.GetListAsync(new[] { orderId },
|
||||||
if (tracks.Count > 0)
|
input.TrackIdentifiers.Select(x => x.TrackCode).ToList(),
|
||||||
|
TrackSourceEnum.ExternalServiceProvide);
|
||||||
|
|
||||||
|
//当要删除的轨迹标识出现交叉则不允许删除
|
||||||
|
var intersect = tracks.Select(x => $"{x.TrackCode}{x.TrackTime}")
|
||||||
|
.Intersect(input.TrackIdentifiers.Select(y => $"{y.TrackCode}{y.TrackTime}")).ToList();
|
||||||
|
if (intersect.Count > 0)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "存在来源于外部服务商的轨迹,不允许删除");
|
throw new BusinessException(message: "存在来源于外部服务商的轨迹,不允许删除");
|
||||||
}
|
}
|
||||||
@ -173,7 +179,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
var @event = new TrackDeleteEvent
|
var @event = new TrackDeleteEvent
|
||||||
{
|
{
|
||||||
OrderIds = new[] { orderId },
|
OrderIds = new[] { orderId },
|
||||||
TrackCodes = input.TrackCodes,
|
TrackIdentifiers = input.TrackIdentifiers,
|
||||||
SubSystemId = input.SubSystemId,
|
SubSystemId = input.SubSystemId,
|
||||||
OperationMan = name
|
OperationMan = name
|
||||||
};
|
};
|
||||||
@ -254,8 +260,14 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
|
|
||||||
//删除轨迹约束,只要其中有一条来源是外部的就立即返回错误
|
//删除轨迹约束,只要其中有一条来源是外部的就立即返回错误
|
||||||
var tracks = await _trackDetailsEsRepository
|
var tracks = await _trackDetailsEsRepository
|
||||||
.GetListAsync(orderIds.ToArray(), input.TrackCodes, TrackSourceEnum.ExternalServiceProvide);
|
.GetListAsync(orderIds.ToArray(),
|
||||||
if (tracks.Count > 0)
|
input.TrackIdentifiers.Select(x => x.TrackCode).ToList(),
|
||||||
|
TrackSourceEnum.ExternalServiceProvide);
|
||||||
|
|
||||||
|
//当要删除的轨迹标识出现交叉则不允许删除
|
||||||
|
var intersect = tracks.Select(x => $"{x.TrackCode}{x.TrackTime}")
|
||||||
|
.Intersect(input.TrackIdentifiers.Select(y => $"{y.TrackCode}{y.TrackTime}")).ToList();
|
||||||
|
if (intersect.Count > 0)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "存在来源于外部服务商的轨迹,不允许删除");
|
throw new BusinessException(message: "存在来源于外部服务商的轨迹,不允许删除");
|
||||||
}
|
}
|
||||||
@ -264,7 +276,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
var @event = new TrackDeleteEvent
|
var @event = new TrackDeleteEvent
|
||||||
{
|
{
|
||||||
OrderIds = orderIds.ToArray(),
|
OrderIds = orderIds.ToArray(),
|
||||||
TrackCodes = input.TrackCodes,
|
TrackIdentifiers = input.TrackIdentifiers,
|
||||||
SubSystemId = input.SubSystemId,
|
SubSystemId = input.SubSystemId,
|
||||||
OperationMan = userInfo.Data.UserName,
|
OperationMan = userInfo.Data.UserName,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,6 +2,7 @@ using System.Linq.Expressions;
|
|||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using SJZY.Expand.ABP.Core.Localization;
|
using SJZY.Expand.ABP.Core.Localization;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
|
using SJZY.Expand.AliyunOSS;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
@ -10,7 +11,9 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
|||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.TrackContents;
|
namespace SJZY.Track.Application.Services.TrackContents;
|
||||||
@ -24,6 +27,7 @@ public class TrackContentService : ApplicationService
|
|||||||
{
|
{
|
||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackContentRepository _trackContentRepository;
|
private readonly ITrackContentRepository _trackContentRepository;
|
||||||
|
private readonly ITrackTemplateRepository _trackTemplateRepository;
|
||||||
private readonly IBasicQuery<TrackFlagEntity> _trackFlagBasicQuery;
|
private readonly IBasicQuery<TrackFlagEntity> _trackFlagBasicQuery;
|
||||||
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery;
|
private readonly IBasicQuery<TrackStatusEntity> _trackStatusBasicQuery;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
@ -35,7 +39,8 @@ public class TrackContentService : ApplicationService
|
|||||||
IBasicQuery<TrackStatusEntity> trackStatusBasicQuery,
|
IBasicQuery<TrackStatusEntity> trackStatusBasicQuery,
|
||||||
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery,
|
IBasicQuery<TrackFlagEntity> trackFlagBasicQuery,
|
||||||
IOrderRepository orderRepository,
|
IOrderRepository orderRepository,
|
||||||
ITrackDetailsEsRepository trackDetailsEsRepository)
|
ITrackDetailsEsRepository trackDetailsEsRepository,
|
||||||
|
ITrackTemplateRepository trackTemplateRepository)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackContentRepository = trackContentRepository;
|
_trackContentRepository = trackContentRepository;
|
||||||
@ -43,6 +48,7 @@ public class TrackContentService : ApplicationService
|
|||||||
_trackFlagBasicQuery = trackFlagBasicQuery;
|
_trackFlagBasicQuery = trackFlagBasicQuery;
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_trackDetailsEsRepository = trackDetailsEsRepository;
|
_trackDetailsEsRepository = trackDetailsEsRepository;
|
||||||
|
_trackTemplateRepository = trackTemplateRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -220,6 +226,50 @@ public class TrackContentService : ApplicationService
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据子系统id、单号、订单类型、轨迹发生时间、轨迹code获取轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetContentDetail")]
|
||||||
|
public async Task<UnifyResultDto<GetContentDetailOutput>> GetContentDetail([FromBody] GetContentDetailInput input)
|
||||||
|
{
|
||||||
|
if (input.SystemId <= 0)
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "子系统Id必须大于等于0");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.TrackCode))
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "轨迹内容code不能为空");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.OrderNumber))
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "订单code不能为空");
|
||||||
|
|
||||||
|
if (input.OrderType <= 0)
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "订单类型不能为空");
|
||||||
|
|
||||||
|
if (input.TrackTime == default)
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "轨迹发生时间不能为空");
|
||||||
|
|
||||||
|
var content = await _trackDetailsEsRepository.GetDetailAsync(input.OrderNumber, input.TrackCode, input.OrderType, input.SystemId, input.TrackTime);
|
||||||
|
if (content == default)
|
||||||
|
return new UnifyResultDto<GetContentDetailOutput>(false, "在当前子系统中未找到指定code的轨迹内容");
|
||||||
|
|
||||||
|
var res = new UnifyResultDto<GetContentDetailOutput>(true)
|
||||||
|
{
|
||||||
|
Data = ObjectMapper.Map<TrackDetailsIndex, GetContentDetailOutput>(content)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (res.Data != default && res.Data.Files.Any())
|
||||||
|
{
|
||||||
|
foreach (var item in res.Data.Files)
|
||||||
|
{
|
||||||
|
item.Url = OSSHelper.GetUrlByKey(item.OssKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建轨迹时获取可用的轨迹内容
|
/// 创建轨迹时获取可用的轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -235,18 +285,25 @@ public class TrackContentService : ApplicationService
|
|||||||
return new UnifyResultDto<List<GetAvailableContentOutput>>(false, "单号不能为空!");
|
return new UnifyResultDto<List<GetAvailableContentOutput>>(false, "单号不能为空!");
|
||||||
|
|
||||||
//获取当前订单下已有的轨迹内容
|
//获取当前订单下已有的轨迹内容
|
||||||
var orderId = await _orderRepository.GetFirstAsync(x => x.OrderNo == input.OrderNo && x.SubSystemId == input.SystemId, x => x.Id);
|
var order = await _orderRepository.GetFirstAsync(x => x.OrderNo == input.OrderNo && x.SubSystemId == input.SystemId);
|
||||||
if (orderId == default)
|
if (order == default)
|
||||||
throw new BusinessException(message: "订单不存在!");
|
throw new BusinessException(message: "订单不存在!");
|
||||||
|
|
||||||
//获取轨迹详情
|
//获取轨迹详情
|
||||||
var trackDetails = await _trackDetailsEsRepository.GetListAsync(orderId);
|
var trackDetails = await _trackDetailsEsRepository.GetListAsync(order.Id);
|
||||||
|
|
||||||
//获取当前子系统下所有的轨迹内容
|
//获取当前子系统下所有的轨迹内容
|
||||||
var contentList = await _trackContentRepository.GetListBySystemIdAsync(input.SystemId);
|
var contentList = await _trackContentRepository.GetListBySystemIdAsync(input.SystemId);
|
||||||
if (contentList == null)
|
if (contentList == null)
|
||||||
throw new BusinessException(message: "当前子系统下未找到任何可用的轨迹内容!");
|
throw new BusinessException(message: "当前子系统下未找到任何可用的轨迹内容!");
|
||||||
|
|
||||||
|
//如果订单给了获取模板code,则进一步根据模板code进行过滤
|
||||||
|
if (!string.IsNullOrEmpty(order.TemplateCodes))
|
||||||
|
{
|
||||||
|
var currentCodes = order.TemplateCodes.Split(",");
|
||||||
|
var template = await _trackTemplateRepository.GetContentByTemplateCodes(currentCodes, input.SystemId);
|
||||||
|
contentList = contentList.Where(m => template.Contains(m.Code)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
var res = new UnifyResultDto<List<GetAvailableContentOutput>>(true)
|
var res = new UnifyResultDto<List<GetAvailableContentOutput>>(true)
|
||||||
{
|
{
|
||||||
@ -323,6 +380,12 @@ public class TrackContentService : ApplicationService
|
|||||||
TrackPlaceCityId = matchItem.TrackPlaceCityId,
|
TrackPlaceCityId = matchItem.TrackPlaceCityId,
|
||||||
Remarks = matchItem.Remarks,
|
Remarks = matchItem.Remarks,
|
||||||
TrackTimeZoneValue = matchItem.DestinationTimeZone,
|
TrackTimeZoneValue = matchItem.DestinationTimeZone,
|
||||||
|
IsVisibility = matchItem.IsVisibility,
|
||||||
|
FileItems = matchItem.Files?.Select(x => new FileItemDto
|
||||||
|
{
|
||||||
|
FileName = x.FileName,
|
||||||
|
OssKey = x.OssKey
|
||||||
|
}).ToList()
|
||||||
});
|
});
|
||||||
matchContent.AddRange(match);
|
matchContent.AddRange(match);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,6 +180,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
[SugarColumn(ColumnName = "DestinationTimeZone")]
|
[SugarColumn(ColumnName = "DestinationTimeZone")]
|
||||||
public float? DestinationTimeZone { get; set; }
|
public float? DestinationTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模板code
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "TemplateCodes")]
|
||||||
|
public string? TemplateCodes { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)] public List<OrderFlightEntity> OrderFlights { get; set; }
|
[SugarColumn(IsIgnore = true)] public List<OrderFlightEntity> OrderFlights { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)] public List<OrderPullStatusEntity> OrderPullStatus { get; set; }
|
[SugarColumn(IsIgnore = true)] public List<OrderPullStatusEntity> OrderPullStatus { get; set; }
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using SJZY.Expand.ElasticSearch.Services;
|
using SJZY.Expand.ElasticSearch.Services;
|
||||||
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
@ -23,10 +24,11 @@ public interface ITrackDetailsEsRepository : IElasticsearchClientService<TrackDe
|
|||||||
|
|
||||||
Task<List<TrackDetailsIndex>> GetListAsync(int orderId);
|
Task<List<TrackDetailsIndex>> GetListAsync(int orderId);
|
||||||
|
|
||||||
Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, List<string> trackCodes, TrackSourceEnum source);
|
Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, List<string> trackCodes, TrackSourceEnum? source);
|
||||||
|
|
||||||
Task<List<int>> DeleteTrackAsync(int[] orderIds, List<string> trackCodes);
|
Task<List<int>> DeleteTrackAsync(int[] orderIds, List<string> trackCodes);
|
||||||
|
|
||||||
Task DeleteTrackByIdAsync(string id, string indexName);
|
Task DeleteTrackByIdAsync(string id, string indexName);
|
||||||
Task<List<TrackDetailsIndex>> GetDataByIds(string[] ids);
|
Task<List<TrackDetailsIndex>> GetDataByIds(string[] ids);
|
||||||
|
Task<TrackDetailsIndex> GetDetailAsync(string orderNo, string trackCode, int orderType, int subSystemId, DateTime trackTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,4 +45,5 @@ 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<List<string>> GetContentByTemplateCodes(string[] codes, int systemId);
|
||||||
}
|
}
|
||||||
|
|||||||
27
src/SJZY.Track.Domain/Dtos/TrackContents/TrackCodeMapVO.cs
Normal file
27
src/SJZY.Track.Domain/Dtos/TrackContents/TrackCodeMapVO.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹代码映射
|
||||||
|
/// </summary>
|
||||||
|
public sealed class TrackCodeMapVO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 源子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容code
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContentCode { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int MapSubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容code
|
||||||
|
/// </summary>
|
||||||
|
public string MapTrackContentCode { get; set; } = null!;
|
||||||
|
}
|
||||||
@ -18,6 +18,14 @@ public interface IProvideQueries
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<string>> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes);
|
Task<List<string>> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取子系统内容Code映射
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="upSubSystemId"></param>
|
||||||
|
/// <param name="subSystemId"></param>
|
||||||
|
/// <param name="trackCodes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<TrackCodeMapVO>> GetTrackCodeMapsAsync(int upSubSystemId, int subSystemId, params string[] trackCodes);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据订单模板找对应服务商
|
/// 根据订单模板找对应服务商
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -33,6 +33,22 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDepen
|
|||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<TrackCodeMapVO>> GetTrackCodeMapsAsync(int upSubSystemId, int subSystemId, params string[] trackCodes)
|
||||||
|
{
|
||||||
|
// 根据上游code得到下游code
|
||||||
|
return await Context.Queryable<TrackContentMapEntity>()
|
||||||
|
.Where(x => x.SubSystemId == subSystemId && x.MapSubSystemId == upSubSystemId &&
|
||||||
|
trackCodes.Contains(x.MapTrackContentCode))
|
||||||
|
.Select(x => new TrackCodeMapVO()
|
||||||
|
{
|
||||||
|
SubSystemId = x.SubSystemId,
|
||||||
|
TrackContentCode = x.TrackContentCode,
|
||||||
|
MapSubSystemId = x.MapSubSystemId,
|
||||||
|
MapTrackContentCode = x.MapTrackContentCode
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<List<OrderWithServiceProviderVO>> FindOrderWithServiceProviderAsync(int subSystemId,
|
public async Task<List<OrderWithServiceProviderVO>> FindOrderWithServiceProviderAsync(int subSystemId,
|
||||||
List<string> orderNos)
|
List<string> orderNos)
|
||||||
@ -46,7 +62,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDepen
|
|||||||
.Select((a, b, c) => new OrderWithServiceProviderVO
|
.Select((a, b, c) => new OrderWithServiceProviderVO
|
||||||
{
|
{
|
||||||
//优先使用第三方的订单号,为空时才使用主单号
|
//优先使用第三方的订单号,为空时才使用主单号
|
||||||
OrderNo = b.OrderNo ?? a.OrderNo,
|
OrderNo = b.OrderNo.IsNullOrWhiteSpace() ? a.OrderNo : b.OrderNo!,
|
||||||
OrderType = a.OrderType,
|
OrderType = a.OrderType,
|
||||||
SubSystemId = a.SubSystemId,
|
SubSystemId = a.SubSystemId,
|
||||||
ServiceProviderCode = b.ServiceProviderCode,
|
ServiceProviderCode = b.ServiceProviderCode,
|
||||||
@ -67,7 +83,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDepen
|
|||||||
.Select((a, b) => new OrderWithServiceProviderVO
|
.Select((a, b) => new OrderWithServiceProviderVO
|
||||||
{
|
{
|
||||||
//优先使用第三方的订单号,为空时才使用主单号
|
//优先使用第三方的订单号,为空时才使用主单号
|
||||||
OrderNo = b.OrderNo ?? a.OrderNo,
|
OrderNo = b.OrderNo.IsNullOrWhiteSpace() ? a.OrderNo : b.OrderNo!,
|
||||||
OrderType = a.OrderType,
|
OrderType = a.OrderType,
|
||||||
SubSystemId = a.SubSystemId,
|
SubSystemId = a.SubSystemId,
|
||||||
ServiceProviderCode = b.ServiceProviderCode
|
ServiceProviderCode = b.ServiceProviderCode
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
|||||||
using SJZY.Expand.ElasticSearch.Services;
|
using SJZY.Expand.ElasticSearch.Services;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
@ -75,6 +76,8 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
.Field(f => f.TrackTimeZone)
|
.Field(f => f.TrackTimeZone)
|
||||||
.Field(f => f.OrderId)
|
.Field(f => f.OrderId)
|
||||||
.Field(f => f.TrackCode)
|
.Field(f => f.TrackCode)
|
||||||
|
.Field(f => f.Id)
|
||||||
|
.Field(f => f.IndexName)
|
||||||
))
|
))
|
||||||
.Query(q => q
|
.Query(q => q
|
||||||
.Bool(b => b
|
.Bool(b => b
|
||||||
@ -99,6 +102,17 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
.Sort(so => so
|
.Sort(so => so
|
||||||
.Field(f => f.ZeroTrackTime, SortOrder.Descending)
|
.Field(f => f.ZeroTrackTime, SortOrder.Descending)
|
||||||
)
|
)
|
||||||
|
.Source(s2 => s2.Includes(fd2 => fd2
|
||||||
|
.Field(f => f.TrackEnContent)
|
||||||
|
.Field(f => f.TrackContent)
|
||||||
|
.Field(f => f.TrackPlace)
|
||||||
|
.Field(f => f.TrackTime)
|
||||||
|
.Field(f => f.TrackTimeZone)
|
||||||
|
.Field(f => f.OrderId)
|
||||||
|
.Field(f => f.TrackCode)
|
||||||
|
.Field(f => f.Id)
|
||||||
|
.Field(f => f.IndexName)
|
||||||
|
))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -343,15 +357,26 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
return r.ToIdList();
|
return r.ToIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, List<string> trackCodes, TrackSourceEnum source)
|
public async Task<List<TrackDetailsIndex>> GetListAsync(int[] orderIds, List<string> trackCodes, TrackSourceEnum? source)
|
||||||
{
|
{
|
||||||
|
var query = new QueryContainer();
|
||||||
|
|
||||||
|
if (orderIds.Length > 0)
|
||||||
|
{
|
||||||
|
query &= Query<TrackDetailsIndex>.Terms(t => t.Field(f => f.OrderId).Terms(orderIds));
|
||||||
|
}
|
||||||
|
if (trackCodes.Count > 0)
|
||||||
|
{
|
||||||
|
query &= Query<TrackDetailsIndex>.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes));
|
||||||
|
}
|
||||||
|
if (source.HasValue)
|
||||||
|
{
|
||||||
|
query &= Query<TrackDetailsIndex>.Term(t => t.Field(f => f.Source).Value(source.Value));
|
||||||
|
}
|
||||||
|
|
||||||
var r = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
var r = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
||||||
.Index(GlobalConst.TrackDetailsIndex)
|
.Index(GlobalConst.TrackDetailsIndex)
|
||||||
.Query(q =>
|
.Query(q => query)
|
||||||
q.Terms(t => t.Field(f => f.OrderId).Terms(orderIds))
|
|
||||||
&& q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))
|
|
||||||
&& q.Term(t => t.Source, (int) source)
|
|
||||||
)
|
|
||||||
.Size(SafelyLimit)
|
.Size(SafelyLimit)
|
||||||
.Sort(s => s.Field(f => f.ZeroTrackTime, SortOrder.Descending)));
|
.Sort(s => s.Field(f => f.ZeroTrackTime, SortOrder.Descending)));
|
||||||
|
|
||||||
@ -440,4 +465,38 @@ public class TrackDetailsEsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
|
|
||||||
return res.ToIdList();
|
return res.ToIdList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<TrackDetailsIndex> GetDetailAsync(string orderNo, string trackCode, int orderType, int subSystemId, DateTime trackTime)
|
||||||
|
{
|
||||||
|
var res = await Context.SearchAsync<TrackDetailsIndex>(s => s
|
||||||
|
.Index("sjzy_track_details")
|
||||||
|
.Query(q => q
|
||||||
|
.Bool(b => b
|
||||||
|
.Must(mu => mu
|
||||||
|
.Terms(t => t
|
||||||
|
.Field(f => f.OrderNo.Suffix("keyword"))
|
||||||
|
.Terms(orderNo)),
|
||||||
|
mu => mu
|
||||||
|
.Terms(t => t
|
||||||
|
.Field(f => f.TrackCode.Suffix("keyword"))
|
||||||
|
.Terms(trackCode)),
|
||||||
|
mu => mu
|
||||||
|
.Terms(t => t
|
||||||
|
.Field(f => f.OrderType)
|
||||||
|
.Terms(orderType)),
|
||||||
|
mu => mu
|
||||||
|
.Terms(t => t
|
||||||
|
.Field(f => f.SubSystemId)
|
||||||
|
.Terms(subSystemId)),
|
||||||
|
mu => mu
|
||||||
|
.Terms(t => t
|
||||||
|
.Field(f => f.TrackTime)
|
||||||
|
.Terms(trackTime)) // 注意:这里你重复了OrderType的查询,你可能需要移除重复的查询
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.Documents.FirstOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
|||||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
using SJZY.Track.Domain.VEntities;
|
using SJZY.Track.Domain.VEntities;
|
||||||
|
using SJZY.Expand.ABP.Core.SqlSugar.Tools;
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
|
|
||||||
@ -225,4 +226,26 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
|
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<string>> GetContentByTemplateCodes(string[] codes, int systemId)
|
||||||
|
{
|
||||||
|
|
||||||
|
var sql = @$"
|
||||||
|
select
|
||||||
|
distinct
|
||||||
|
c.Code
|
||||||
|
from t_track_template a
|
||||||
|
left join t_track_template_content b on a.id = b.TrackTemplateId and b.IsDeleted = 0
|
||||||
|
left join t_track_content c on b.TrackContentId = c.Id and c.IsDeleted = 0
|
||||||
|
where
|
||||||
|
a.SubSystemId = {systemId}
|
||||||
|
and a.Code in (@codes)
|
||||||
|
and a.IsDeleted = 0
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
var list = Context.Ado.SqlQuery<string>(sql, new {codes = codes}).ToList();
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user