important:重构
This commit is contained in:
parent
83f391dfcc
commit
3de76a713d
@ -1,7 +1,5 @@
|
|||||||
using System.Reflection.Metadata.Ecma335;
|
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
|
|
||||||
{
|
|
||||||
public class GetOrderDetailsInput
|
public class GetOrderDetailsInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -25,7 +23,7 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id es主键
|
/// Id es主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public string Id { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹订单id
|
/// 轨迹订单id
|
||||||
@ -97,4 +95,3 @@ namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? CreateUser { get; set; }
|
public string? CreateUser { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -20,7 +20,7 @@ public class LinkOrderInput
|
|||||||
/// 订单号,必填
|
/// 订单号,必填
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public string OrderNo { get; set; }
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关联单类型
|
/// 关联单类型
|
||||||
|
|||||||
@ -41,11 +41,6 @@
|
|||||||
/// 轨迹标记id
|
/// 轨迹标记id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackFlagId { get; set; }
|
public int TrackFlagId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFinish { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetTrackContentDetailDto
|
public class GetTrackContentDetailDto
|
||||||
|
|||||||
@ -41,4 +41,9 @@ public class TrackPullContentConfigDto
|
|||||||
/// 轨迹时区GMT值
|
/// 轨迹时区GMT值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float? TrackTimeZoneValue { get; set; }
|
public float? TrackTimeZoneValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单是否完成(由轨迹刷新配置决定)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@ namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
|||||||
|
|
||||||
public class TrackPullParamWithContentConfigDto
|
public class TrackPullParamWithContentConfigDto
|
||||||
{
|
{
|
||||||
public TrackPullParamConfigDto ParamConfig { get; set; }
|
public TrackPullParamConfigDto ParamConfig { get; set; } = new();
|
||||||
|
|
||||||
public List<TrackPullContentConfigDto> ContentConfigs { get; set; }
|
public List<TrackPullContentConfigDto> ContentConfigs { get; set; } = new();
|
||||||
}
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
|
|
||||||
|
public class TrackRefreshContext
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务商
|
||||||
|
/// </summary>
|
||||||
|
public string ServiceProviderName { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 客户id
|
||||||
|
/// </summary>
|
||||||
|
public int CustomId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
}
|
||||||
@ -7,11 +7,6 @@ public class EditTrackPushConfigInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? CustomId { get; set; }
|
public int? CustomId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送扩展字段
|
|
||||||
/// </summary>
|
|
||||||
public string? ExpandFieldsName { get; set; }
|
|
||||||
|
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -39,41 +34,6 @@ public class EditTrackPushConfigInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? SubSystemId { get; set; }
|
public int? SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹时区
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackTimeZoneName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹内容代码
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackContentCodeName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹内容
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackContentName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹内容英文
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackEnContentName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹发生地
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackPlaceName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹状态
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackStatusName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 推送轨迹发生时间
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackTimeName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否支持更新
|
/// 是否支持更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,4 +43,9 @@ public class EditTrackPushConfigInput
|
|||||||
/// 是否支持删除
|
/// 是否支持删除
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IsCanDelete { get; set; }
|
public bool? IsCanDelete { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否全量推送
|
||||||
|
/// </summary>
|
||||||
|
public bool? IsAllPush { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Events;
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
public class TrackPushAfterUpdateOrderEvent
|
public class TrackPushAfterUpdateOrderDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作类型
|
/// 操作类型
|
||||||
@ -13,9 +13,9 @@ public class TrackPushAfterUpdateOrderEvent
|
|||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容id
|
/// 轨迹code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackContentId { get; set; }
|
public string TrackCode { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 问题类型
|
/// 问题类型
|
||||||
@ -1,18 +1,5 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
public class TrackPushConfigDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 是否自动推送
|
|
||||||
/// </summary>
|
|
||||||
public bool IsAutoPush { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹推送内容配置
|
|
||||||
/// </summary>
|
|
||||||
public List<TrackPushContentConfigDto> ContentConfigs { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TrackPushContentConfigDto
|
public class TrackPushContentConfigDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -25,31 +12,41 @@ public class TrackPushContentConfigDto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsCanUpdate { get; set; }
|
public bool IsCanUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否全量推送
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAllPush { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持删除
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCanDelete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商code
|
/// 服务商code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServiceProviderCode { get; set; } = null!;
|
public string ServiceProviderCode { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扩展字段参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? ExpandFieldsValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送单号类型(主数据枚举TrackOrderType)
|
/// 推送单号类型(主数据枚举TrackOrderType)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OrderType { get; set; }
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 我们系统的轨迹code
|
||||||
|
/// </summary>
|
||||||
|
public string TrackCode { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可交换顺序的轨迹code
|
||||||
|
/// </summary>
|
||||||
|
public string? SwapTrackCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码参数值
|
/// 轨迹代码参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackContentCodeValue { get; set; }
|
public string? TrackContentCodeValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容id
|
|
||||||
/// </summary>
|
|
||||||
public int TrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容参数值
|
/// 轨迹内容参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,4 +66,9 @@ public class TrackPushContentConfigDto
|
|||||||
/// 轨迹时区GMT
|
/// 轨迹时区GMT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double? TrackTimeZone { get; set; }
|
public double? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展字段参数值
|
||||||
|
/// </summary>
|
||||||
|
public string? ExpandFieldsValue { get; set; }
|
||||||
}
|
}
|
||||||
@ -15,5 +15,14 @@ public class OrderLinkAfterFillTrackEvent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关联订单
|
/// 关联订单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int> LinkedOrderIds { get; set; } = null!;
|
public List<LinkedOrder> LinkedOrders { get; set; } = null!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct LinkedOrder
|
||||||
|
{
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
public string OrderNo { get; set; }
|
||||||
|
public int OrderType { get; set; }
|
||||||
}
|
}
|
||||||
@ -13,7 +13,7 @@ public class TrackChangeAfterUpdateOrderEvent
|
|||||||
public bool IsDelete { get; set; }
|
public bool IsDelete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 这条轨迹是否意味着完成
|
/// 这条轨迹是否意味着完成(只有刷新会设为true)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsCompleted { get; set; }
|
public bool IsCompleted { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Events;
|
||||||
|
|
||||||
|
public class TrackInsertForNotMappedEvent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单id
|
||||||
|
/// </summary>
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单类型
|
||||||
|
/// </summary>
|
||||||
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务商
|
||||||
|
/// </summary>
|
||||||
|
public string ServiceProviderName { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string? OriginTrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原轨迹报文
|
||||||
|
/// </summary>
|
||||||
|
public string? OriginTrackData { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地
|
||||||
|
/// </summary>
|
||||||
|
public string TrackPlace { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime TrackTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生时区
|
||||||
|
/// </summary>
|
||||||
|
public float TrackTimeZone { get; set; }
|
||||||
|
}
|
||||||
@ -5,12 +5,7 @@ public class TrackPushEvent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作类型
|
/// 操作类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OptionType OptionType { get; set; } = OptionType.新增;
|
public OptionType OptionType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 服务商code
|
|
||||||
/// </summary>
|
|
||||||
public string ServiceProviderCode { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单id
|
/// 订单id
|
||||||
@ -22,23 +17,13 @@ public class TrackPushEvent
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderNo { get; set; } = null!;
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单类型
|
|
||||||
/// </summary>
|
|
||||||
public int OrderType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容id
|
|
||||||
/// </summary>
|
|
||||||
public int TrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹状态
|
/// 轨迹状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackStatus { get; set; } = null!;
|
public string TrackStatus { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容代码
|
/// 轨迹代码(我们系统的)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackCode { get; set; } = null!;
|
public string TrackCode { get; set; } = null!;
|
||||||
|
|
||||||
@ -62,31 +47,6 @@ public class TrackPushEvent
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float TrackTimeZone { get; set; }
|
public float TrackTimeZone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹代码参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackContentCodeValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackContentValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容英文参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackEnContentValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹状态参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? TrackStatusValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扩展字段参数值
|
|
||||||
/// </summary>
|
|
||||||
public string? ExpandFieldsValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作人
|
/// 操作人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -18,14 +18,15 @@ public class TrackUpsertEvent
|
|||||||
public string OrderNo { get; set; } = null!;
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单是否完成
|
/// 服务商
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsCompleted { get; set; }
|
public string? ServiceProviderName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户id
|
/// 表示订单是否完成(只由轨迹刷新配置决定)
|
||||||
|
/// tips:能够使得IsCompleted为true的点,全局只有一个:轨迹刷新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CustomId { get; set; }
|
public bool IsCompleted { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子系统id
|
/// 子系统id
|
||||||
@ -33,32 +34,17 @@ public class TrackUpsertEvent
|
|||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最新推送轨迹内容id(异步维护)
|
/// 上游子系统id(0表示事件起点)
|
||||||
/// </summary>
|
|
||||||
public int? LatestPushTrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上游子系统id
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UpSubSystemId { get; set; }
|
public int UpSubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 原轨迹内容
|
/// 操作人(null则默认系统)
|
||||||
/// </summary>
|
|
||||||
public string? OriginTrackContent { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 原轨迹报文
|
|
||||||
/// </summary>
|
|
||||||
public string? OriginTrackData { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作人
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? OperationMan { get; set; }
|
public string? OperationMan { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// true新增,false更新,null表示刷新引发的新增/更新
|
/// true新增,false更新,null表示新增/更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IsAdd { get; set; }
|
public bool? IsAdd { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -10,26 +10,29 @@ public interface ITrackPushCacheService
|
|||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="customId">服务商id</param>
|
/// <param name="customId">服务商id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<TrackPushContentConfigDto>> GetPushContentConfigsAsync(int subSystemId, int customId);
|
Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取服务商拉取配置
|
/// 获取服务商拉取配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="customId">服务商id</param>
|
/// <param name="customId">服务商id</param>
|
||||||
/// <param name="trackContentId"></param>
|
/// <param name="trackConde">轨迹代码</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
|
Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId, string trackConde);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null
|
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了
|
||||||
|
/// 则查询有没有可交换的推送,没有就返回null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="subSystemId"></param>
|
/// <param name="subSystemId"></param>
|
||||||
/// <param name="customId"></param>
|
/// <param name="customId"></param>
|
||||||
/// <param name="trackContentId"></param>
|
/// <param name="latestPushTrackCode"></param>
|
||||||
|
/// <param name="trackCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TrackPushContentConfigDto?> InferNextPushContentOrNullAsync(int subSystemId, int customId,
|
Task<TrackPushContentConfigDto?> IsValidPushAsync(int subSystemId, int customId,
|
||||||
int? trackContentId);
|
string? latestPushTrackCode,
|
||||||
|
string? trackCode);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置推送配置缓存
|
/// 设置推送配置缓存
|
||||||
@ -38,5 +41,6 @@ public interface ITrackPushCacheService
|
|||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="customId">客户id</param>
|
/// <param name="customId">客户id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TrackPushConfigDto> SetPushContentConfigsAsync(int? id = null, int? subSystemId = null, int? customId = null);
|
Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int? id = null, int? subSystemId = null,
|
||||||
|
int? customId = null);
|
||||||
}
|
}
|
||||||
@ -1,13 +1,10 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
|
||||||
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.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.Order;
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Reflection;
|
|
||||||
using Volo.Abp.AutoMapper;
|
using Volo.Abp.AutoMapper;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.AutoMapper;
|
namespace SJZY.Track.Application.AutoMapper;
|
||||||
@ -26,12 +23,13 @@ public class OrderAutoMapperProfile : Profile
|
|||||||
|
|
||||||
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.OrderTypeName,
|
||||||
.ForMember(dest => dest.QuestionTypeName, opt => opt.MapFrom(source => GetEnumDescription(1, source.QuestionType)));
|
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)
|
||||||
.ForMember(dest => dest.Id, opt => opt.Ignore())
|
|
||||||
.ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode))
|
.ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode))
|
||||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
||||||
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
||||||
@ -62,7 +60,6 @@ public class OrderAutoMapperProfile : Profile
|
|||||||
enumDescription = "";
|
enumDescription = "";
|
||||||
else
|
else
|
||||||
enumDescription = orderType.GetDescription(); // 获取描述标记
|
enumDescription = orderType.GetDescription(); // 获取描述标记
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return enumDescription;
|
return enumDescription;
|
||||||
|
|||||||
@ -9,8 +9,7 @@ namespace SJZY.Track.Application.AutoMapper
|
|||||||
{
|
{
|
||||||
public TrackContentAutoMapperProfile()
|
public TrackContentAutoMapperProfile()
|
||||||
{
|
{
|
||||||
CreateMap<EditTrackContentInput, TrackContentEntity>(MemberList.None)
|
CreateMap<EditTrackContentInput, TrackContentEntity>(MemberList.None);
|
||||||
.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
|
|
||||||
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
|
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
|
||||||
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
|
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
|
||||||
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
||||||
|
|||||||
@ -27,31 +27,21 @@ public class OrderLinkAfterFillTrackHandler : ITransientDependency, ICapSubscrib
|
|||||||
var tracks = await _trackDetailsRepository.GetListAsync(@event.OrderId);
|
var tracks = await _trackDetailsRepository.GetListAsync(@event.OrderId);
|
||||||
|
|
||||||
|
|
||||||
foreach (var linkOrderId in @event.LinkedOrderIds)
|
foreach (var order in @event.LinkedOrders)
|
||||||
{
|
{
|
||||||
var order = await _orderRepository.GetFirstAsync(x =>
|
|
||||||
x.Id == linkOrderId, x => new
|
|
||||||
{
|
|
||||||
x.OrderType, x.OrderNo, x.CustomId, x.LatestPushTrackContentId, x.SubSystemId
|
|
||||||
});
|
|
||||||
|
|
||||||
if (order == default) continue;
|
|
||||||
|
|
||||||
// 补轨迹
|
// 补轨迹
|
||||||
foreach (var track in tracks)
|
foreach (var track in tracks)
|
||||||
{
|
{
|
||||||
var fillTrackEvent = new TrackUpsertEvent
|
var fillTrackEvent = new TrackUpsertEvent
|
||||||
{
|
{
|
||||||
|
OrderId = order.OrderId,
|
||||||
OrderType = order.OrderType,
|
OrderType = order.OrderType,
|
||||||
OrderNo = order.OrderNo,
|
OrderNo = order.OrderNo,
|
||||||
TrackCode = track.TrackCode,
|
TrackCode = track.TrackCode,
|
||||||
TrackPlace = track.TrackPlace,
|
TrackPlace = track.TrackPlace,
|
||||||
TrackTime = track.TrackTime,
|
TrackTime = track.TrackTime,
|
||||||
TrackTimeZone = track.TrackTimeZone,
|
TrackTimeZone = track.TrackTimeZone,
|
||||||
OrderId = linkOrderId,
|
|
||||||
CustomId = order.CustomId,
|
|
||||||
SubSystemId = order.SubSystemId,
|
SubSystemId = order.SubSystemId,
|
||||||
LatestPushTrackContentId = order.LatestPushTrackContentId,
|
|
||||||
UpSubSystemId = @event.SubSystemId,
|
UpSubSystemId = @event.SubSystemId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class TrackChangeAfterUpdateOrderEventHandler : ITransientDependency, ICa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除引发的回退更新
|
// 删除引发的回退更新
|
||||||
order.IsCompleted = track.IsCompleted;
|
order.IsCompleted = @event.IsCompleted;
|
||||||
order.LatestTrackContent = track.TrackContent;
|
order.LatestTrackContent = track.TrackContent;
|
||||||
order.LatestTrackEnContent = track.TrackEnContent;
|
order.LatestTrackEnContent = track.TrackEnContent;
|
||||||
order.LatestTrackPlace = track.TrackPlace;
|
order.LatestTrackPlace = track.TrackPlace;
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
using DotNetCore.CAP;
|
||||||
|
using SJZY.Track.Application.Contract.Events;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
|
using SJZY.Track.Domain.Consts;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.EventHandlers;
|
||||||
|
|
||||||
|
public class TrackInsertForNotMappedEventHandler : ITransientDependency, ICapSubscribe
|
||||||
|
{
|
||||||
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
|
|
||||||
|
public TrackInsertForNotMappedEventHandler(ITrackDetailsRepository trackDetailsRepository)
|
||||||
|
{
|
||||||
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CapSubscribe(GlobalConst.TrackInsertForNotMappedEventSubscribe)]
|
||||||
|
public async Task ConsumerAsync(TrackInsertForNotMappedEvent @event)
|
||||||
|
{
|
||||||
|
if (await _trackDetailsRepository.AnyAsync(@event.OrderId, @event.TrackTime))
|
||||||
|
{
|
||||||
|
return; // 无法映射的轨迹只做新增
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增服务商轨迹到es
|
||||||
|
var track = new TrackDetailsIndex
|
||||||
|
{
|
||||||
|
IndexName = $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}",
|
||||||
|
OrderId = @event.OrderId,
|
||||||
|
OrderNo = @event.OrderNo,
|
||||||
|
OrderType = @event.OrderType,
|
||||||
|
TrackPlace = @event.TrackPlace,
|
||||||
|
TrackTime = @event.TrackTime,
|
||||||
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
|
ServiceProviderName = @event.ServiceProviderName,
|
||||||
|
OriginTrackContent = @event.OriginTrackContent,
|
||||||
|
OriginTrackData = @event.OriginTrackData,
|
||||||
|
CreateUser = GlobalConst.SystemUser,
|
||||||
|
CreateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
track.TrackCode = GlobalConst.EmptyString;
|
||||||
|
track.TrackStatus = GlobalConst.EmptyString;
|
||||||
|
track.TrackContent = GlobalConst.EmptyString;
|
||||||
|
track.TrackEnContent = GlobalConst.EmptyString;
|
||||||
|
track.ZeroTrackTime = track.TrackTime.Subtract(TimeSpan.FromHours(track.TrackTimeZone));
|
||||||
|
|
||||||
|
await _trackDetailsRepository.UpsertAsync(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
using SJZY.Track.Domain.Enums;
|
using SJZY.Track.Domain.Enums;
|
||||||
@ -17,34 +17,34 @@ public class TrackPushAfterUpdateOrderEventHandler : ITransientDependency, ICapS
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CapSubscribe(GlobalConst.TrackPushAfterUpdateOrderSubscribe)]
|
[CapSubscribe(GlobalConst.TrackPushAfterUpdateOrderSubscribe)]
|
||||||
public async Task ConsumerAsync(TrackPushAfterUpdateOrderEvent @event)
|
public async Task ConsumerAsync(TrackPushAfterUpdateOrderDto dto)
|
||||||
{
|
{
|
||||||
var order = await _orderRepository.GetFirstAsync(x => x.Id == @event.OrderId);
|
var order = await _orderRepository.GetFirstAsync(x => x.Id == dto.OrderId);
|
||||||
if (order == default) return;
|
if (order == default) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 异常:最近一条推送是失败
|
* 异常:最近一条推送是失败
|
||||||
*/
|
*/
|
||||||
if (!@event.IsSuccess)
|
if (!dto.IsSuccess)
|
||||||
{
|
{
|
||||||
order.QuestionType = (int)TrackProblemType.Error;
|
order.QuestionType = (int)TrackProblemType.Error;
|
||||||
order.ProblemDescription = @event.Message;
|
order.LatestPushError = dto.Message;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
order.QuestionType = (int)TrackProblemType.None;
|
order.QuestionType = (int)TrackProblemType.None;
|
||||||
if (@event.OptionType == OptionType.新增)
|
order.LatestPushError = null;
|
||||||
|
if (dto.OptionType == OptionType.新增)
|
||||||
{
|
{
|
||||||
// tips:只有新增会影响推送进度?
|
// tips:只有新增会影响推送进度
|
||||||
order.LatestPushTrackContentId = @event.TrackContentId;
|
order.LatestPushTrackCode = dto.TrackCode;
|
||||||
order.LatestPushTime = DateTime.Now;
|
order.LatestPushTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await _orderRepository.UpdateColumnAsync(order, x => new
|
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||||
{
|
{
|
||||||
x.LatestPushTrackContentId, x.QuestionType, x.ProblemDescription, x.LatestPushTime
|
x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,12 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
|
using SJZY.Track.Domain.Enums;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
using Volo.Abp.Http.Client.DynamicProxying;
|
using Volo.Abp.Http.Client.DynamicProxying;
|
||||||
|
|
||||||
@ -12,31 +16,63 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
||||||
private readonly ITrackPushRecordsRepository _trackPushRecordsRepository;
|
private readonly ITrackPushRecordsRepository _trackPushRecordsRepository;
|
||||||
private readonly ICapPublisher _capPublisher;
|
private readonly IOrderRepository _orderRepository;
|
||||||
|
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||||
|
|
||||||
public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
|
public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
|
||||||
ITrackPushRecordsRepository trackPushRecordsRepository, ICapPublisher capPublisher)
|
ITrackPushRecordsRepository trackPushRecordsRepository,
|
||||||
|
IOrderRepository orderRepository, ITrackPushCacheService trackPushCacheService)
|
||||||
{
|
{
|
||||||
_httpClientProxy = httpClientProxy;
|
_httpClientProxy = httpClientProxy;
|
||||||
_trackPushRecordsRepository = trackPushRecordsRepository;
|
_trackPushRecordsRepository = trackPushRecordsRepository;
|
||||||
_capPublisher = capPublisher;
|
_orderRepository = orderRepository;
|
||||||
|
_trackPushCacheService = trackPushCacheService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CapSubscribe(GlobalConst.TrackPushSubscribe, Group = GlobalConst.TrackPushSubscribe)]
|
[CapSubscribe(GlobalConst.TrackPushSubscribe, Group = GlobalConst.TrackPushSubscribe)]
|
||||||
public async Task ConsumerAsync(TrackPushEvent @event)
|
public async Task ConsumerAsync(TrackPushEvent @event)
|
||||||
{
|
{
|
||||||
InterfaceRelayUnifyResultDto res = null!;
|
InterfaceRelayUnifyResultDto res = null!;
|
||||||
|
|
||||||
|
var order = await _orderRepository.GetFirstAsync(x =>
|
||||||
|
x.Id == @event.OrderId, x => new
|
||||||
|
{
|
||||||
|
x.SubSystemId, x.LatestPushTrackCode, x.CustomId, x.OrderType
|
||||||
|
});
|
||||||
|
if (order == null) return;
|
||||||
|
|
||||||
|
TrackPushContentConfigDto? config = null;
|
||||||
switch (@event.OptionType)
|
switch (@event.OptionType)
|
||||||
{
|
{
|
||||||
case OptionType.无:
|
case OptionType.无:
|
||||||
return;
|
return;
|
||||||
case OptionType.新增:
|
case OptionType.新增:
|
||||||
res = await PushAddAsync(@event);
|
if (@event.OperationMan == null) // 系统推送需要推断
|
||||||
|
{
|
||||||
|
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
||||||
|
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
||||||
|
order.LatestPushTrackCode, @event.TrackCode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 手工推送不推断,直接无脑推
|
||||||
|
config = await _trackPushCacheService.GetPushContentConfigAsync(order.SubSystemId, order.CustomId,
|
||||||
|
@event.TrackCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config == null) return;
|
||||||
|
|
||||||
|
// 当前发生的轨迹不是要推送的,直接结束
|
||||||
|
if (config.TrackCode != @event.TrackCode) return;
|
||||||
|
res = await DoAddAsync(@event, config);
|
||||||
break;
|
break;
|
||||||
case OptionType.删除:
|
case OptionType.删除:
|
||||||
break;
|
break;
|
||||||
case OptionType.修改:
|
case OptionType.修改:
|
||||||
res = await PushUpdateAsync(@event);
|
config = await _trackPushCacheService.GetPushContentConfigAsync(order.SubSystemId, order.CustomId,
|
||||||
|
@event.TrackCode);
|
||||||
|
if (config == null || !config.IsCanUpdate) return;
|
||||||
|
res = await DoUpdateAsync(@event, config);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
@ -44,6 +80,8 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
var isSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
var isSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
||||||
|
|
||||||
|
if (config == null) return;
|
||||||
|
|
||||||
// 往es 写推送日志
|
// 往es 写推送日志
|
||||||
await _trackPushRecordsRepository.AddAsync(new TrackPushRecordIndex
|
await _trackPushRecordsRepository.AddAsync(new TrackPushRecordIndex
|
||||||
{
|
{
|
||||||
@ -52,7 +90,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
Message = res.Msg,
|
Message = res.Msg,
|
||||||
OptionType = @event.OptionType.ToString(),
|
OptionType = @event.OptionType.ToString(),
|
||||||
OrderId = @event.OrderId,
|
OrderId = @event.OrderId,
|
||||||
OrderType = @event.OrderType,
|
OrderType = order.OrderType,
|
||||||
OrderNo = @event.OrderNo,
|
OrderNo = @event.OrderNo,
|
||||||
TrackStatus = @event.TrackStatus,
|
TrackStatus = @event.TrackStatus,
|
||||||
TrackCode = @event.TrackCode,
|
TrackCode = @event.TrackCode,
|
||||||
@ -60,29 +98,59 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackPlace = @event.TrackPlace,
|
TrackPlace = @event.TrackPlace,
|
||||||
TrackTime = @event.TrackTime,
|
TrackTime = @event.TrackTime,
|
||||||
TrackTimeZone = @event.TrackTimeZone,
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
TrackContentCodeValue = @event.TrackContentCodeValue,
|
TrackContentCodeValue = config.TrackContentCodeValue,
|
||||||
TrackContentValue = @event.TrackContentValue,
|
TrackContentValue = config.TrackContentValue,
|
||||||
TrackEnContentValue = @event.TrackEnContentValue,
|
TrackEnContentValue = config.TrackEnContentValue,
|
||||||
TrackStatusValue = @event.TrackStatusValue,
|
TrackStatusValue = config.TrackStatusValue,
|
||||||
ExpandFieldsValue = @event.ExpandFieldsValue,
|
ExpandFieldsValue = config.ExpandFieldsValue,
|
||||||
IsSuccess = isSuccess,
|
IsSuccess = isSuccess,
|
||||||
CreateUser = @event.OperationMan ?? "系统",
|
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新订单主表(异步)
|
// 同步去更新订单主表
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushAfterUpdateOrderSubscribe,
|
await TrackPushAfterUpdateOrderAsync(new TrackPushAfterUpdateOrderDto
|
||||||
new TrackPushAfterUpdateOrderEvent
|
|
||||||
{
|
{
|
||||||
OptionType = @event.OptionType,
|
OptionType = @event.OptionType,
|
||||||
OrderId = @event.OrderId,
|
OrderId = @event.OrderId,
|
||||||
TrackContentId = @event.TrackContentId,
|
TrackCode = @event.TrackCode,
|
||||||
IsSuccess = isSuccess,
|
IsSuccess = isSuccess,
|
||||||
Message = res.Msg
|
Message = res.Msg
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<InterfaceRelayUnifyResultDto> PushAddAsync(TrackPushEvent @event)
|
private async Task TrackPushAfterUpdateOrderAsync(TrackPushAfterUpdateOrderDto dto)
|
||||||
|
{
|
||||||
|
var order = new OrderEntity();
|
||||||
|
order.Id = dto.OrderId;
|
||||||
|
/*
|
||||||
|
* 异常:最近一条推送是失败
|
||||||
|
*/
|
||||||
|
if (!dto.IsSuccess)
|
||||||
|
{
|
||||||
|
order.QuestionType = (int)TrackProblemType.Error;
|
||||||
|
order.LatestPushError = dto.Message;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
order.QuestionType = (int)TrackProblemType.None;
|
||||||
|
order.LatestPushError = null;
|
||||||
|
if (dto.OptionType == OptionType.新增)
|
||||||
|
{
|
||||||
|
// tips:只有新增会影响推送进度?
|
||||||
|
order.LatestPushTrackCode = dto.TrackCode;
|
||||||
|
order.LatestPushTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _orderRepository.UpdateColumnAsync(order, x => new
|
||||||
|
{
|
||||||
|
x.LatestPushTrackCode, x.QuestionType, x.LatestPushError, x.LatestPushTime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<InterfaceRelayUnifyResultDto> DoAddAsync(TrackPushEvent @event,
|
||||||
|
TrackPushContentConfigDto config)
|
||||||
{
|
{
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
@ -93,25 +161,27 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
// 推真实的发生地和发生时间(时间是计算后的)
|
// 推真实的发生地和发生时间(时间是计算后的)
|
||||||
location = @event.TrackPlace,
|
location = @event.TrackPlace,
|
||||||
date = @event.TrackTime,
|
date = @event.TrackTime.AddHours(
|
||||||
timeZone = @event.TrackTimeZone,
|
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
||||||
description = @event.TrackEnContentValue,
|
timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
||||||
description_cn = @event.TrackContentValue,
|
description = config.TrackEnContentValue,
|
||||||
code = @event.TrackContentCodeValue,
|
description_cn = config.TrackContentValue,
|
||||||
status = @event.TrackStatusValue,
|
code = config.TrackContentCodeValue,
|
||||||
extra = @event.ExpandFieldsValue
|
status = config.TrackStatusValue,
|
||||||
|
extra = config.ExpandFieldsValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.PushTrackInterfaceCode,
|
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.PushTrackInterfaceCode,
|
||||||
@event.ServiceProviderCode, data);
|
config.ServiceProviderCode, data);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<InterfaceRelayUnifyResultDto> PushUpdateAsync(TrackPushEvent @event)
|
private async Task<InterfaceRelayUnifyResultDto> DoUpdateAsync(TrackPushEvent @event,
|
||||||
|
TrackPushContentConfigDto config)
|
||||||
{
|
{
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
@ -122,20 +192,21 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
// 推真实的发生地和发生时间
|
// 推真实的发生地和发生时间
|
||||||
location = @event.TrackPlace,
|
location = @event.TrackPlace,
|
||||||
date = @event.TrackTime,
|
date = @event.TrackTime.AddHours(
|
||||||
timeZone = @event.TrackTimeZone,
|
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
||||||
description = @event.TrackEnContentValue,
|
timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
||||||
description_cn = @event.TrackContentValue,
|
description = config.TrackEnContentValue,
|
||||||
code = @event.TrackContentCodeValue,
|
description_cn = config.TrackContentValue,
|
||||||
status = @event.TrackStatusValue,
|
code = config.TrackContentCodeValue,
|
||||||
extra = @event.ExpandFieldsValue
|
status = config.TrackStatusValue,
|
||||||
|
extra = config.ExpandFieldsValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.TrackUpdateInterfaceCode,
|
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.TrackUpdateInterfaceCode,
|
||||||
@event.ServiceProviderCode, data);
|
config.ServiceProviderCode, data);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ using System.Linq.Expressions;
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
@ -46,59 +45,59 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
foreach (var token in orderTokens)
|
foreach (var token in orderTokens)
|
||||||
{
|
{
|
||||||
await HandleOrderAsync(token, config, attach.OrderType);
|
await HandleOrderAsync(token, config, attach);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (orderToken is JObject)
|
else if (orderToken is JObject)
|
||||||
{
|
{
|
||||||
await HandleOrderAsync(orderToken, config, attach.OrderType);
|
await HandleOrderAsync(orderToken, config, attach);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleOrderAsync(JToken orderToken, TrackPullParamWithContentConfigDto paramWithContentConfig,
|
private async Task HandleOrderAsync(JToken orderToken, TrackPullParamWithContentConfigDto paramWithContentConfig,
|
||||||
int orderType)
|
TrackRefreshAttach attach)
|
||||||
{
|
{
|
||||||
var paramConfig = paramWithContentConfig.ParamConfig;
|
var paramConfig = paramWithContentConfig.ParamConfig;
|
||||||
var orderNo = orderToken[paramConfig.OrderNoName]?.Value<string>();
|
var orderNo = orderToken[paramConfig.OrderNoName]?.Value<string>();
|
||||||
if (orderNo.IsNullOrWhiteSpace()) return;
|
if (orderNo.IsNullOrWhiteSpace()) return;
|
||||||
|
|
||||||
|
var trackToken = orderToken[paramConfig.TrackDetailsPath];
|
||||||
|
if (trackToken is null) return;
|
||||||
|
|
||||||
var order = await _orderRepository.GetFirstAsync(x =>
|
var order = await _orderRepository.GetFirstAsync(x =>
|
||||||
x.OrderType == orderType && x.OrderNo == orderNo, x => new
|
x.OrderType == attach.OrderType && x.OrderNo == orderNo, x => new
|
||||||
{
|
{
|
||||||
x.Id, x.SubSystemId, x.LatestPushTrackContentId, x.CustomId
|
x.Id, x.LatestPushTrackCode, x.CustomId
|
||||||
});
|
});
|
||||||
if (order == default) return;
|
if (order == default) return;
|
||||||
|
|
||||||
var trackToken = orderToken[paramConfig.TrackDetailsPath];
|
var context = new TrackRefreshContext
|
||||||
if (trackToken is null) return;
|
|
||||||
var trackUpsertEvent = new TrackUpsertEvent
|
|
||||||
{
|
{
|
||||||
OrderId = order.Id,
|
OrderId = order.Id,
|
||||||
SubSystemId = order.SubSystemId,
|
OrderType = attach.OrderType,
|
||||||
LatestPushTrackContentId = order.LatestPushTrackContentId,
|
|
||||||
CustomId = order.CustomId,
|
|
||||||
OrderType = orderType,
|
|
||||||
OrderNo = orderNo!,
|
OrderNo = orderNo!,
|
||||||
|
ServiceProviderName = attach.ServiceProviderName,
|
||||||
|
CustomId = order.CustomId,
|
||||||
|
SubSystemId = attach.SubSystemId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (trackToken is JArray trackTokens)
|
if (trackToken is JArray trackTokens)
|
||||||
{
|
{
|
||||||
foreach (var item in trackTokens)
|
foreach (var item in trackTokens)
|
||||||
{
|
{
|
||||||
await HandleTrackAsync(item, paramWithContentConfig, trackUpsertEvent);
|
await HandleTrackAsync(item, paramWithContentConfig, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (orderToken is JObject)
|
else if (orderToken is JObject)
|
||||||
{
|
{
|
||||||
await HandleTrackAsync(orderToken, paramWithContentConfig, trackUpsertEvent);
|
await HandleTrackAsync(orderToken, paramWithContentConfig, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleTrackAsync(JToken trackToken, TrackPullParamWithContentConfigDto paramWithContentConfig,
|
private async Task HandleTrackAsync(JToken trackToken, TrackPullParamWithContentConfigDto paramWithContentConfig,
|
||||||
TrackUpsertEvent @event)
|
TrackRefreshContext context)
|
||||||
{
|
{
|
||||||
var trackUpsertEvent = @event.DeepCopy();
|
|
||||||
trackUpsertEvent.OriginTrackData = JsonConvert.SerializeObject(trackToken);
|
|
||||||
var paramConfig = paramWithContentConfig.ParamConfig;
|
var paramConfig = paramWithContentConfig.ParamConfig;
|
||||||
var contentConfigs = paramWithContentConfig.ContentConfigs;
|
var contentConfigs = paramWithContentConfig.ContentConfigs;
|
||||||
TrackPullContentConfigDto? matchedContentConfig = null;
|
TrackPullContentConfigDto? matchedContentConfig = null;
|
||||||
@ -127,7 +126,6 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
var trackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
var trackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
||||||
if (!trackContent.IsNullOrWhiteSpace())
|
if (!trackContent.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
trackUpsertEvent.OriginTrackContent = trackContent;
|
|
||||||
Debug.Assert(trackContent != null, nameof(trackContent) + " != null");
|
Debug.Assert(trackContent != null, nameof(trackContent) + " != null");
|
||||||
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentValue == trackContent);
|
matchedContentConfig = contentConfigs.FirstOrDefault(x => x.TrackContentValue == trackContent);
|
||||||
|
|
||||||
@ -161,8 +159,6 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchedContentConfig is null) return;
|
|
||||||
|
|
||||||
// 轨迹发生地
|
// 轨迹发生地
|
||||||
var trackPlace = paramConfig.TrackPlaceName == null
|
var trackPlace = paramConfig.TrackPlaceName == null
|
||||||
? null
|
? null
|
||||||
@ -181,7 +177,7 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
_ => x => x.LeaveCountry
|
_ => x => x.LeaveCountry
|
||||||
};
|
};
|
||||||
trackPlace = await _orderRepository.GetFirstAsync(x =>
|
trackPlace = await _orderRepository.GetFirstAsync(x =>
|
||||||
x.Id == trackUpsertEvent.OrderId, resultExpression);
|
x.Id == context.OrderId, resultExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 轨迹发生时间
|
// 轨迹发生时间
|
||||||
@ -193,11 +189,42 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
? null
|
? null
|
||||||
: trackToken[paramConfig.TrackTimeZoneName]?.Value<float>();
|
: trackToken[paramConfig.TrackTimeZoneName]?.Value<float>();
|
||||||
|
|
||||||
|
if (matchedContentConfig is null)
|
||||||
|
{
|
||||||
|
var notMappedEvent = new TrackInsertForNotMappedEvent
|
||||||
|
{
|
||||||
|
OrderId = context.OrderId,
|
||||||
|
OrderType = context.OrderType,
|
||||||
|
OrderNo = context.OrderNo,
|
||||||
|
ServiceProviderName = context.ServiceProviderName,
|
||||||
|
OriginTrackData = JsonConvert.SerializeObject(trackToken),
|
||||||
|
TrackPlace = trackPlace ?? GlobalConst.EmptyString,
|
||||||
|
TrackTime = trackTime ?? DateTime.Now,
|
||||||
|
TrackTimeZone = trackTimeZone ?? matchedContentConfig?.TrackTimeZoneValue ?? 8
|
||||||
|
};
|
||||||
|
if (paramConfig.TrackContentName != null)
|
||||||
|
{
|
||||||
|
notMappedEvent.OriginTrackContent = trackToken[paramConfig.TrackContentName]?.Value<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
await _capPublisher.PublishAsync(GlobalConst.TrackInsertForNotMappedEventSubscribe, notMappedEvent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 新增/更新轨迹
|
// 新增/更新轨迹
|
||||||
trackUpsertEvent.TrackCode = matchedContentConfig?.TrackContentCode ?? GlobalConst.EmptyString;
|
var trackUpsertEvent = new TrackUpsertEvent
|
||||||
trackUpsertEvent.TrackPlace = trackPlace ?? GlobalConst.EmptyString;
|
{
|
||||||
trackUpsertEvent.TrackTime = trackTime ?? DateTime.Now;
|
OrderId = context.OrderId,
|
||||||
trackUpsertEvent.TrackTimeZone = trackTimeZone ?? matchedContentConfig?.TrackTimeZoneValue ?? 8;
|
OrderType = context.OrderType,
|
||||||
|
OrderNo = context.OrderNo,
|
||||||
|
ServiceProviderName = context.ServiceProviderName,
|
||||||
|
IsCompleted = matchedContentConfig.IsCompleted,
|
||||||
|
SubSystemId = context.SubSystemId,
|
||||||
|
TrackCode = matchedContentConfig.TrackContentCode,
|
||||||
|
TrackPlace = trackPlace ?? GlobalConst.EmptyString,
|
||||||
|
TrackTime = trackTime ?? DateTime.Now,
|
||||||
|
TrackTimeZone = trackTimeZone ?? matchedContentConfig.TrackTimeZoneValue ?? 8
|
||||||
|
};
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, trackUpsertEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,7 @@
|
|||||||
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.TrackPush;
|
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
@ -17,18 +15,15 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly IProvideQueries _provideQueries;
|
private readonly IProvideQueries _provideQueries;
|
||||||
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
|
||||||
private readonly ICapPublisher _capPublisher;
|
private readonly ICapPublisher _capPublisher;
|
||||||
|
|
||||||
public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher,
|
public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher,
|
||||||
IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository,
|
IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository)
|
||||||
ITrackPushCacheService trackPushCacheService)
|
|
||||||
{
|
{
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_capPublisher = capPublisher;
|
_capPublisher = capPublisher;
|
||||||
_provideQueries = provideQueries;
|
_provideQueries = provideQueries;
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_trackPushCacheService = trackPushCacheService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[CapSubscribe(GlobalConst.TrackUpsertSubscribe, Group = GlobalConst.TrackUpsertSubscribe)]
|
[CapSubscribe(GlobalConst.TrackUpsertSubscribe, Group = GlobalConst.TrackUpsertSubscribe)]
|
||||||
@ -56,13 +51,9 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
@event.TrackCode = mapCode;
|
@event.TrackCode = mapCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
var track = @event.TrackCode == GlobalConst.EmptyString
|
var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode);
|
||||||
? await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackTime)
|
|
||||||
: await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode);
|
|
||||||
|
|
||||||
if (@event.TrackCode == GlobalConst.EmptyString && track != null) return; // 无法映射的轨迹只做新增
|
if (@event.IsAdd != null)
|
||||||
|
|
||||||
if (@event.IsAdd != null) // 手动操作需要做区分
|
|
||||||
{
|
{
|
||||||
if (track == null && !@event.IsAdd!.Value) return; // 不存在不让改
|
if (track == null && !@event.IsAdd!.Value) return; // 不存在不让改
|
||||||
if (track != null && @event.IsAdd!.Value) return; // 存在不让创建
|
if (track != null && @event.IsAdd!.Value) return; // 存在不让创建
|
||||||
@ -71,17 +62,30 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
// step1、upsert es轨迹
|
// step1、upsert es轨迹
|
||||||
track = await UpsertTrackAsync(track, @event);
|
track = await UpsertTrackAsync(track, @event);
|
||||||
|
|
||||||
if (track == null || @event.TrackCode == GlobalConst.EmptyString) return; // 模板没配该轨迹代码,不再继续
|
if (track == null) return; // 模板没配该轨迹代码,不再继续
|
||||||
|
|
||||||
// step2、触发轨迹推送事件(异步)
|
// step2、触发轨迹推送事件(异步)
|
||||||
await HandleTrackPushAsync(@event, track);
|
var trackPushEvent = new TrackPushEvent
|
||||||
|
{
|
||||||
|
OptionType = track.Id.IsNullOrWhiteSpace() ? OptionType.新增 : OptionType.修改,
|
||||||
|
OrderId = track.OrderId,
|
||||||
|
OrderNo = track.OrderNo,
|
||||||
|
TrackStatus = track.TrackStatus,
|
||||||
|
TrackCode = track.TrackCode,
|
||||||
|
TrackContent = track.TrackContent,
|
||||||
|
TrackPlace = track.TrackPlace,
|
||||||
|
TrackTime = track.TrackTime,
|
||||||
|
TrackTimeZone = track.TrackTimeZone,
|
||||||
|
};
|
||||||
|
|
||||||
|
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
||||||
|
|
||||||
// step3、触发订单主表更新事件(异步)
|
// step3、触发订单主表更新事件(异步)
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackChangeAfterUpdateOrderSubscribe,
|
await _capPublisher.PublishAsync(GlobalConst.TrackChangeAfterUpdateOrderSubscribe,
|
||||||
new TrackChangeAfterUpdateOrderEvent
|
new TrackChangeAfterUpdateOrderEvent
|
||||||
{
|
{
|
||||||
OrderId = track.OrderId,
|
OrderId = track.OrderId,
|
||||||
IsCompleted = track.IsCompleted,
|
IsCompleted = @event.IsCompleted,
|
||||||
TrackCode = track.TrackCode,
|
TrackCode = track.TrackCode,
|
||||||
TrackContent = track.TrackContent,
|
TrackContent = track.TrackContent,
|
||||||
TrackEnContent = track.TrackEnContent,
|
TrackEnContent = track.TrackEnContent,
|
||||||
@ -96,12 +100,12 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
{
|
{
|
||||||
var nextEvent = @event.DeepCopy();
|
var nextEvent = @event.DeepCopy();
|
||||||
nextEvent.Visited.Add(@event.OrderId);
|
nextEvent.Visited.Add(@event.OrderId);
|
||||||
|
// tips:一定要重置为false,父级订单的完成不会使得关联订单完成,关联单也必须由刷新来完成或手动设置完成!!
|
||||||
|
nextEvent.IsCompleted = false; // 能够使得轨迹IsCompleted为true的点,全局只有一个:轨迹刷新
|
||||||
nextEvent.OrderId = linkedOrder.OrderId;
|
nextEvent.OrderId = linkedOrder.OrderId;
|
||||||
nextEvent.OrderType = linkedOrder.OrderType;
|
nextEvent.OrderType = linkedOrder.OrderType;
|
||||||
nextEvent.OrderNo = linkedOrder.OrderNo;
|
nextEvent.OrderNo = linkedOrder.OrderNo;
|
||||||
nextEvent.SubSystemId = linkedOrder.SubSystemId;
|
nextEvent.SubSystemId = linkedOrder.SubSystemId;
|
||||||
nextEvent.LatestPushTrackContentId = linkedOrder.LatestPushTrackContentId;
|
|
||||||
nextEvent.CustomId = linkedOrder.CustomId;
|
|
||||||
nextEvent.UpSubSystemId = @event.SubSystemId;
|
nextEvent.UpSubSystemId = @event.SubSystemId;
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent);
|
||||||
}
|
}
|
||||||
@ -126,24 +130,12 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
TrackPlace = @event.TrackPlace,
|
TrackPlace = @event.TrackPlace,
|
||||||
TrackTime = @event.TrackTime,
|
TrackTime = @event.TrackTime,
|
||||||
TrackTimeZone = @event.TrackTimeZone,
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
|
ServiceProviderName = @event.ServiceProviderName,
|
||||||
IsCanDelete = false,
|
IsCanDelete = false,
|
||||||
OriginTrackContent = @event.OriginTrackContent,
|
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
|
||||||
OriginTrackData = @event.OriginTrackData,
|
|
||||||
CreateUser = @event.OperationMan ?? "系统",
|
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
|
||||||
// tips:刷新到无法匹配内容的轨迹引起的插入
|
|
||||||
if (@event.TrackCode == GlobalConst.EmptyString)
|
|
||||||
{
|
|
||||||
track.TrackStatus = GlobalConst.EmptyString;
|
|
||||||
track.TrackContent = GlobalConst.EmptyString;
|
|
||||||
track.TrackContentId = 0;
|
|
||||||
track.IsCompleted = false;
|
|
||||||
track.TrackEnContent = GlobalConst.EmptyString;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//todo:可以优化
|
//todo:可以优化
|
||||||
// 根据轨迹code在订单模板内容中寻找匹配的
|
// 根据轨迹code在订单模板内容中寻找匹配的
|
||||||
var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
|
var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
|
||||||
@ -154,23 +146,18 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
}
|
}
|
||||||
|
|
||||||
track.TrackStatus = trackContent.Status;
|
track.TrackStatus = trackContent.Status;
|
||||||
|
track.TrackCode = trackContent.TrackCode;
|
||||||
track.TrackContent = trackContent.Content;
|
track.TrackContent = trackContent.Content;
|
||||||
track.TrackContentId = trackContent.Id;
|
|
||||||
track.IsCompleted = trackContent.IsCompleted;
|
|
||||||
track.TrackEnContent = trackContent.EnContent;
|
track.TrackEnContent = trackContent.EnContent;
|
||||||
track.IsCanDelete = trackContent.IsCanDelete;
|
track.IsCanDelete = trackContent.IsCanDelete;
|
||||||
track.ZeroTrackTime = track.TrackTime.Subtract(TimeSpan.FromHours(track.TrackTimeZone));
|
track.ZeroTrackTime = track.TrackTime.Subtract(TimeSpan.FromHours(track.TrackTimeZone));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// tips:刷新到无法匹配内容的轨迹 相同的发生时间不做更新处理
|
|
||||||
if (@event.TrackCode == GlobalConst.EmptyString) return track;
|
|
||||||
|
|
||||||
track.TrackPlace = @event.TrackPlace;
|
track.TrackPlace = @event.TrackPlace;
|
||||||
track.TrackTime = @event.TrackTime;
|
track.TrackTime = @event.TrackTime;
|
||||||
track.TrackTimeZone = @event.TrackTimeZone;
|
track.TrackTimeZone = @event.TrackTimeZone;
|
||||||
track.UpdateUser = @event.OperationMan ?? "系统";
|
track.UpdateUser = @event.OperationMan ?? GlobalConst.SystemUser;
|
||||||
track.UpdateTime = DateTime.Now;
|
track.UpdateTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,60 +165,4 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 处理轨迹自动推送
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="event"></param>
|
|
||||||
/// <param name="track"></param>
|
|
||||||
private async Task HandleTrackPushAsync(TrackUpsertEvent @event, TrackDetailsIndex track)
|
|
||||||
{
|
|
||||||
TrackPushContentConfigDto? config;
|
|
||||||
OptionType optionType = OptionType.修改;
|
|
||||||
// 推送更新
|
|
||||||
if (!track.Id.IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
config = await _trackPushCacheService.GetPushContentConfigAsync(
|
|
||||||
@event.SubSystemId, @event.CustomId, track.TrackContentId);
|
|
||||||
if (config == null || !config.IsCanUpdate) return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
|
||||||
config = await _trackPushCacheService.InferNextPushContentOrNullAsync(
|
|
||||||
@event.SubSystemId, @event.CustomId, @event.LatestPushTrackContentId);
|
|
||||||
|
|
||||||
if (config == null || !config.IsAutoPush) return;
|
|
||||||
|
|
||||||
// 当前发生的轨迹就是要推送的
|
|
||||||
if (config.TrackContentId != track.TrackContentId) return;
|
|
||||||
|
|
||||||
optionType = OptionType.新增;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.OrderType != @event.OrderType) return;
|
|
||||||
|
|
||||||
var trackPushEvent = new TrackPushEvent
|
|
||||||
{
|
|
||||||
OptionType = optionType,
|
|
||||||
ServiceProviderCode = config.ServiceProviderCode,
|
|
||||||
OrderNo = track.OrderNo,
|
|
||||||
OrderType = track.OrderType,
|
|
||||||
OrderId = track.OrderId,
|
|
||||||
TrackContentId = config.TrackContentId,
|
|
||||||
TrackStatus = track.TrackStatus,
|
|
||||||
TrackCode = track.TrackCode,
|
|
||||||
TrackContent = track.TrackContent,
|
|
||||||
TrackPlace = track.TrackPlace,
|
|
||||||
TrackTime = track.TrackTime.AddHours(config.TrackTimeZone ?? track.TrackTimeZone - track.TrackTimeZone),
|
|
||||||
TrackTimeZone = (float)(config.TrackTimeZone ?? track.TrackTimeZone),
|
|
||||||
TrackContentCodeValue = config.TrackContentCodeValue,
|
|
||||||
TrackContentValue = config.TrackContentValue,
|
|
||||||
TrackEnContentValue = config.TrackEnContentValue,
|
|
||||||
TrackStatusValue = config.TrackStatusValue,
|
|
||||||
ExpandFieldsValue = config.ExpandFieldsValue
|
|
||||||
};
|
|
||||||
|
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushSubscribe, trackPushEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -52,23 +52,23 @@ public partial class OrderService
|
|||||||
if (!input.IsLink) return await UnLinkOrderAsync(input);
|
if (!input.IsLink) return await UnLinkOrderAsync(input);
|
||||||
|
|
||||||
// 关联订单
|
// 关联订单
|
||||||
var linkedOrderIds = await DoLinkOrderAsync(input, order.Id);
|
var linkedOrders = await DoLinkOrderAsync(input, order.Id);
|
||||||
|
|
||||||
// 补轨迹
|
// 补轨迹
|
||||||
if (linkedOrderIds.Count > 0)
|
if (linkedOrders.Count > 0)
|
||||||
{
|
{
|
||||||
await _capPublisher.PublishAsync(GlobalConst.OrderLinkAfterFillTrack, new OrderLinkAfterFillTrackEvent
|
await _capPublisher.PublishAsync(GlobalConst.OrderLinkAfterFillTrack, new OrderLinkAfterFillTrackEvent
|
||||||
{
|
{
|
||||||
OrderId = order.Id,
|
OrderId = order.Id,
|
||||||
SubSystemId = order.SubSystemId,
|
SubSystemId = order.SubSystemId,
|
||||||
LinkedOrderIds = linkedOrderIds,
|
LinkedOrders = linkedOrders,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnifyResultDto(true, true);
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<int>> DoLinkOrderAsync(LinkOrderInput input, int orderId)
|
private async Task<List<LinkedOrder>> DoLinkOrderAsync(LinkOrderInput input, int orderId)
|
||||||
{
|
{
|
||||||
// 获取已关联的订单
|
// 获取已关联的订单
|
||||||
var linkOrderNos = await _orderLinkQuery.GetListAsync(x =>
|
var linkOrderNos = await _orderLinkQuery.GetListAsync(x =>
|
||||||
@ -81,9 +81,9 @@ public partial class OrderService
|
|||||||
// 过滤掉不存在的订单
|
// 过滤掉不存在的订单
|
||||||
var canLinkOrders = await _orderRepository.GetListAsync(x =>
|
var canLinkOrders = await _orderRepository.GetListAsync(x =>
|
||||||
x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo),
|
x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo),
|
||||||
x => new { x.Id, x.OrderNo });
|
x => new { x.Id, x.OrderNo, x.SubSystemId });
|
||||||
|
|
||||||
if (canLinkOrders.Count == 0) return new List<int>();
|
if (canLinkOrders.Count == 0) return new List<LinkedOrder>();
|
||||||
|
|
||||||
await _orderRepository.LinkOrderAsync(canLinkOrders.Select(x => new OrderLinkEntity
|
await _orderRepository.LinkOrderAsync(canLinkOrders.Select(x => new OrderLinkEntity
|
||||||
{
|
{
|
||||||
@ -95,7 +95,13 @@ public partial class OrderService
|
|||||||
LinkOrderType = input.LinkOrderType
|
LinkOrderType = input.LinkOrderType
|
||||||
}).ToList());
|
}).ToList());
|
||||||
|
|
||||||
return canLinkOrders.Select(x => x.Id).ToList();
|
return canLinkOrders.Select(x => new LinkedOrder
|
||||||
|
{
|
||||||
|
SubSystemId = x.SubSystemId,
|
||||||
|
OrderId = x.Id,
|
||||||
|
OrderNo = x.OrderNo,
|
||||||
|
OrderType = input.LinkOrderType
|
||||||
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UnifyResultDto> UnLinkOrderAsync(LinkOrderInput input)
|
private async Task<UnifyResultDto> UnLinkOrderAsync(LinkOrderInput input)
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Events;
|
using SJZY.Track.Application.Contract.Events;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
@ -21,17 +20,14 @@ public class TrackPushService : ApplicationService
|
|||||||
{
|
{
|
||||||
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||||
private readonly IOrderRepository _orderRepository;
|
private readonly IOrderRepository _orderRepository;
|
||||||
private readonly ITrackPushCacheService _pushCacheService;
|
|
||||||
private readonly ICapPublisher _capPublisher;
|
private readonly ICapPublisher _capPublisher;
|
||||||
private readonly ITrackPushRecordsRepository _trackPushRecordsRepository;
|
private readonly ITrackPushRecordsRepository _trackPushRecordsRepository;
|
||||||
|
|
||||||
public TrackPushService(ITrackPushCacheService pushCacheService,
|
public TrackPushService(ITrackDetailsRepository trackDetailsRepository
|
||||||
ITrackDetailsRepository trackDetailsRepository
|
|
||||||
, IOrderRepository orderRepository
|
, IOrderRepository orderRepository
|
||||||
, ICapPublisher capPublisher
|
, ICapPublisher capPublisher
|
||||||
, ITrackPushRecordsRepository trackPushRecordsRepository)
|
, ITrackPushRecordsRepository trackPushRecordsRepository)
|
||||||
{
|
{
|
||||||
_pushCacheService = pushCacheService;
|
|
||||||
_trackDetailsRepository = trackDetailsRepository;
|
_trackDetailsRepository = trackDetailsRepository;
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_capPublisher = capPublisher;
|
_capPublisher = capPublisher;
|
||||||
@ -68,38 +64,19 @@ public class TrackPushService : ApplicationService
|
|||||||
|
|
||||||
var res = 0;
|
var res = 0;
|
||||||
|
|
||||||
foreach (var order in orders)
|
foreach (var track in tracks)
|
||||||
{
|
{
|
||||||
// 如果没有轨迹,就不需要推
|
|
||||||
var track = tracks.FirstOrDefault(x => x.OrderId == order.Id);
|
|
||||||
if (track == null) continue;
|
|
||||||
|
|
||||||
// 手工推送不推断,直接无脑推
|
|
||||||
var config =
|
|
||||||
await _pushCacheService.GetPushContentConfigAsync(order.SubSystemId, order.CustomId,
|
|
||||||
track.TrackContentId);
|
|
||||||
|
|
||||||
if (config == null) continue;
|
|
||||||
|
|
||||||
var trackPushEvent = new TrackPushEvent
|
var trackPushEvent = new TrackPushEvent
|
||||||
{
|
{
|
||||||
ServiceProviderCode = config.ServiceProviderCode,
|
OptionType = OptionType.新增,
|
||||||
OrderNo = order.OrderNo,
|
OrderId = track.OrderId,
|
||||||
OrderType = order.OrderType,
|
OrderNo = track.OrderNo,
|
||||||
OrderId = order.Id,
|
|
||||||
TrackContentId = config.TrackContentId,
|
|
||||||
TrackStatus = track.TrackStatus,
|
TrackStatus = track.TrackStatus,
|
||||||
TrackCode = track.TrackCode,
|
TrackCode = track.TrackCode,
|
||||||
TrackContent = track.TrackContent,
|
TrackContent = track.TrackContent,
|
||||||
TrackPlace = track.TrackPlace,
|
TrackPlace = track.TrackPlace,
|
||||||
TrackTime = track.TrackTime.AddHours(config.TrackTimeZone ??
|
TrackTime = track.TrackTime,
|
||||||
track.TrackTimeZone - track.TrackTimeZone),
|
TrackTimeZone = track.TrackTimeZone,
|
||||||
TrackTimeZone = (float)(config.TrackTimeZone ?? track.TrackTimeZone),
|
|
||||||
TrackContentCodeValue = config.TrackContentCodeValue,
|
|
||||||
TrackContentValue = config.TrackContentValue,
|
|
||||||
TrackEnContentValue = config.TrackEnContentValue,
|
|
||||||
TrackStatusValue = config.TrackStatusValue,
|
|
||||||
ExpandFieldsValue = config.ExpandFieldsValue,
|
|
||||||
OperationMan = CurrentUserRequest.CurrentUser.Name,
|
OperationMan = CurrentUserRequest.CurrentUser.Name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
var order = await _orderRepository.GetFirstAsync(x =>
|
var order = await _orderRepository.GetFirstAsync(x =>
|
||||||
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
|
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
|
||||||
{
|
{
|
||||||
x.Id,
|
x.Id, x.SubSystemId
|
||||||
x.SubSystemId,
|
|
||||||
x.LatestPushTrackContentId,
|
|
||||||
x.CustomId,
|
|
||||||
x.IsCompleted
|
|
||||||
});
|
});
|
||||||
if (order == default)
|
if (order == default)
|
||||||
{
|
{
|
||||||
@ -58,9 +54,6 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
var @event = ObjectMapper.Map<UpsertTrackInput, TrackUpsertEvent>(input);
|
var @event = ObjectMapper.Map<UpsertTrackInput, TrackUpsertEvent>(input);
|
||||||
@event.OrderId = order.Id;
|
@event.OrderId = order.Id;
|
||||||
@event.SubSystemId = order.SubSystemId;
|
@event.SubSystemId = order.SubSystemId;
|
||||||
@event.LatestPushTrackContentId = order.LatestPushTrackContentId;
|
|
||||||
@event.CustomId = order.CustomId;
|
|
||||||
@event.IsCompleted = order.IsCompleted;
|
|
||||||
@event.OperationMan = CurrentUserRequest.CurrentUser.Name;
|
@event.OperationMan = CurrentUserRequest.CurrentUser.Name;
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
||||||
return new UnifyResultDto(true, true);
|
return new UnifyResultDto(true, true);
|
||||||
@ -84,12 +77,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
var orders = await _orderRepository.GetListAsync(x =>
|
var orders = await _orderRepository.GetListAsync(x =>
|
||||||
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new
|
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo), x => new
|
||||||
{
|
{
|
||||||
x.Id,
|
x.Id, x.OrderNo, x.SubSystemId
|
||||||
x.OrderNo,
|
|
||||||
x.SubSystemId,
|
|
||||||
x.LatestPushTrackContentId,
|
|
||||||
x.CustomId,
|
|
||||||
x.IsCompleted
|
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var order in orders)
|
foreach (var order in orders)
|
||||||
@ -106,9 +94,6 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
OrderNo = order.OrderNo,
|
OrderNo = order.OrderNo,
|
||||||
OrderId = order.Id,
|
OrderId = order.Id,
|
||||||
SubSystemId = order.SubSystemId,
|
SubSystemId = order.SubSystemId,
|
||||||
LatestPushTrackContentId = order.LatestPushTrackContentId,
|
|
||||||
CustomId = order.CustomId,
|
|
||||||
IsCompleted = order.IsCompleted,
|
|
||||||
OperationMan = CurrentUserRequest.CurrentUser.Name
|
OperationMan = CurrentUserRequest.CurrentUser.Name
|
||||||
};
|
};
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
|
||||||
|
|||||||
@ -58,14 +58,12 @@ public class TrackOrderService : ApplicationService
|
|||||||
});
|
});
|
||||||
Debug.Assert(input.TrackTemplateIds != null, "input.TrackTemplateIds != null");
|
Debug.Assert(input.TrackTemplateIds != null, "input.TrackTemplateIds != null");
|
||||||
input.TrackTemplateIds = input.TrackTemplateIds.Where(a => a > 0).ToList();
|
input.TrackTemplateIds = input.TrackTemplateIds.Where(a => a > 0).ToList();
|
||||||
int id = 1;
|
|
||||||
list.ForEach(a =>
|
list.ForEach(a =>
|
||||||
{
|
{
|
||||||
a.Id = id++;
|
var trackContentsOfTemplates = trackContents.Where(b =>
|
||||||
var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId == input.SubSystemId &&
|
b.SubSystemId == input.SubSystemId && b.TrackCode == a.Code &&
|
||||||
b.TrackCode == a.Code
|
input.TrackTemplateIds.Contains(b.TrackTemplateId))
|
||||||
&& input.TrackTemplateIds.Contains(
|
.ToList();
|
||||||
b.TrackTemplateId)).ToList();
|
|
||||||
GetTemplateContentAttributeValueVO? trackContent = null;
|
GetTemplateContentAttributeValueVO? trackContent = null;
|
||||||
var insertData = input.TrackTemplateIds
|
var insertData = input.TrackTemplateIds
|
||||||
.Intersect(trackContentsOfTemplates.Select(aa => aa.TrackTemplateId)).ToList();
|
.Intersect(trackContentsOfTemplates.Select(aa => aa.TrackTemplateId)).ToList();
|
||||||
@ -78,7 +76,6 @@ public class TrackOrderService : ApplicationService
|
|||||||
|
|
||||||
if (trackContent != null)
|
if (trackContent != null)
|
||||||
{
|
{
|
||||||
a.IsCanDelete = trackContent.IsCanDelete;
|
|
||||||
a.IsExternal = trackContent.IsExternal;
|
a.IsExternal = trackContent.IsExternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +84,6 @@ public class TrackOrderService : ApplicationService
|
|||||||
a.TrackTimeZone = "GTM +00:00";
|
a.TrackTimeZone = "GTM +00:00";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
// 将小数形式的小时转换为时区偏移量
|
// 将小数形式的小时转换为时区偏移量
|
||||||
int hours = (int)a.TrackTimeZoneValue; // 提取整数部分作为小时
|
int hours = (int)a.TrackTimeZoneValue; // 提取整数部分作为小时
|
||||||
|
|||||||
@ -4,11 +4,10 @@ using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
|||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.TrackPush;
|
namespace SJZY.Track.Application.Services.TrackPush;
|
||||||
|
|
||||||
public class TrackPushCacheService : ApplicationService, ITrackPushCacheService
|
public class TrackPushCacheService : ITrackPushCacheService
|
||||||
{
|
{
|
||||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
||||||
|
|
||||||
@ -20,80 +19,96 @@ public class TrackPushCacheService : ApplicationService, ITrackPushCacheService
|
|||||||
_trackPushConfigRepository = trackPushConfigRepository;
|
_trackPushConfigRepository = trackPushConfigRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
public async Task<List<TrackPushContentConfigDto>?> GetPushContentConfigsAsync(int subSystemId, int customId)
|
||||||
public async Task<List<TrackPushContentConfigDto>> GetPushContentConfigsAsync(int subSystemId, int customId)
|
|
||||||
{
|
{
|
||||||
var data = await GetPushConfigAsync(subSystemId, customId);
|
var data = await RedisHelper.Client.GetAsync<List<TrackPushContentConfigDto>>(
|
||||||
|
TrackPushContentKey(subSystemId, customId));
|
||||||
return data.ContentConfigs;
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public async Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId,
|
|
||||||
int trackContentId)
|
|
||||||
{
|
|
||||||
var data = await GetPushContentConfigsAsync(subSystemId, customId);
|
|
||||||
|
|
||||||
return data?.FirstOrDefault(x => x.TrackContentId == trackContentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public async Task<TrackPushContentConfigDto?> InferNextPushContentOrNullAsync(int subSystemId, int customId,
|
|
||||||
int? trackContentId)
|
|
||||||
{
|
|
||||||
var data = await GetPushConfigAsync(subSystemId, customId);
|
|
||||||
if (!data.IsAutoPush) return null;
|
|
||||||
|
|
||||||
if (trackContentId.HasValue)
|
|
||||||
{
|
|
||||||
if (data.ContentConfigs.Count > 1 && data.ContentConfigs.Any(x => x.TrackContentId == trackContentId))
|
|
||||||
{
|
|
||||||
int index = data.ContentConfigs.FindIndex(x => x.TrackContentId == trackContentId);
|
|
||||||
if (index == data.ContentConfigs.Count - 1) return null;
|
|
||||||
int nextIndex = (index + 1) % data.ContentConfigs.Count; // 计算下一个索引,处理最后一个元素的情况
|
|
||||||
|
|
||||||
return data.ContentConfigs[nextIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return data.ContentConfigs.FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public async Task<TrackPushConfigDto> SetPushContentConfigsAsync(int? id = null, int? subSystemId = null,
|
|
||||||
int? customId = null)
|
|
||||||
{
|
|
||||||
var data = new TrackPushConfigDto { ContentConfigs = new() };
|
|
||||||
|
|
||||||
Expression<Func<TrackPushConfigEntity, bool>> exp = x => true;
|
|
||||||
if (id.HasValue) exp = x => x.Id == id;
|
|
||||||
else if (subSystemId.HasValue && customId.HasValue)
|
|
||||||
exp = x => x.SubSystemId == subSystemId && x.CustomId == customId;
|
|
||||||
|
|
||||||
var trackPushConfigEntity = await _trackPushConfigRepository.GetFirstAsync(exp);
|
|
||||||
if (trackPushConfigEntity == null) return data;
|
|
||||||
|
|
||||||
var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfigEntity.Id);
|
|
||||||
if (trackPushContentList.Count == 0) return data;
|
|
||||||
|
|
||||||
data.IsAutoPush = trackPushConfigEntity.IsAutoPush;
|
|
||||||
data.ContentConfigs =
|
|
||||||
ObjectMapper.Map<List<TrackPushContentConfigVO>, List<TrackPushContentConfigDto>>(trackPushContentList);
|
|
||||||
;
|
|
||||||
await RedisHelper.Client.SetAsync(
|
|
||||||
TrackPushContentKey(trackPushConfigEntity.SubSystemId, trackPushConfigEntity.CustomId), data);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<TrackPushConfigDto> GetPushConfigAsync(int subSystemId, int customId)
|
|
||||||
{
|
|
||||||
var data = await RedisHelper.Client.GetAsync<TrackPushConfigDto>(TrackPushContentKey(subSystemId, customId));
|
|
||||||
|
|
||||||
data ??= await SetPushContentConfigsAsync(subSystemId: subSystemId, customId: customId);
|
data ??= await SetPushContentConfigsAsync(subSystemId: subSystemId, customId: customId);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId,
|
||||||
|
string trackConde)
|
||||||
|
{
|
||||||
|
var configs = await GetPushContentConfigsAsync(subSystemId, customId);
|
||||||
|
return configs?.FirstOrDefault(x => x.TrackCode == trackConde);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<TrackPushContentConfigDto?> IsValidPushAsync(int subSystemId, int customId,
|
||||||
|
string? latestPushTrackCode,
|
||||||
|
string? trackCode)
|
||||||
|
{
|
||||||
|
var cache = await GetPushContentConfigsAsync(subSystemId, customId);
|
||||||
|
if (cache == null || cache.Count < 1) return default;
|
||||||
|
|
||||||
|
TrackPushContentConfigDto? matched;
|
||||||
|
if (latestPushTrackCode == null)
|
||||||
|
{
|
||||||
|
matched = cache.First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var idx = cache.FindIndex(x => x.TrackCode == latestPushTrackCode);
|
||||||
|
|
||||||
|
if (idx == -1) return default; // 是否预警?
|
||||||
|
|
||||||
|
// find next
|
||||||
|
if (idx + 1 < cache.Count && cache[idx + 1].TrackCode == trackCode)
|
||||||
|
{
|
||||||
|
matched = cache[idx + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// find swap
|
||||||
|
matched = cache.FirstOrDefault(x => x.TrackCode == cache[idx].SwapTrackCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matched != null && matched.TrackCode == trackCode ? matched : default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<TrackPushContentConfigDto>?> SetPushContentConfigsAsync(int? id = null,
|
||||||
|
int? subSystemId = null,
|
||||||
|
int? customId = null)
|
||||||
|
{
|
||||||
|
Expression<Func<TrackPushConfigEntity, bool>> exp = x => true;
|
||||||
|
if (id.HasValue) exp = x => x.Id == id;
|
||||||
|
else if (subSystemId.HasValue && customId.HasValue)
|
||||||
|
exp = x => x.SubSystemId == subSystemId && x.CustomId == customId;
|
||||||
|
|
||||||
|
var trackPushConfig = await _trackPushConfigRepository.GetFirstAsync(exp, x => new
|
||||||
|
{
|
||||||
|
x.Id, x.IsAutoPush, x.IsAllPush, x.IsCanDelete, x.IsCanUpdate, x.SubSystemId, x.CustomId
|
||||||
|
});
|
||||||
|
if (trackPushConfig == null) return null;
|
||||||
|
|
||||||
|
var trackPushContentList = await _trackPushConfigRepository.GetContentListAsync(trackPushConfig.Id);
|
||||||
|
if (trackPushContentList.Count == 0) return null;
|
||||||
|
|
||||||
|
// tips:hot path,auto mapper性能不如原生
|
||||||
|
var res = trackPushContentList.Select(item => new TrackPushContentConfigDto
|
||||||
|
{
|
||||||
|
IsAutoPush = trackPushConfig.IsAutoPush,
|
||||||
|
IsCanUpdate = trackPushConfig.IsCanUpdate,
|
||||||
|
IsAllPush = trackPushConfig.IsAllPush,
|
||||||
|
IsCanDelete = trackPushConfig.IsCanDelete,
|
||||||
|
ServiceProviderCode = item.ServiceProviderCode,
|
||||||
|
OrderType = item.OrderType,
|
||||||
|
TrackCode = item.TrackCode,
|
||||||
|
SwapTrackCode = item.SwapTrackCode,
|
||||||
|
TrackStatusValue = item.TrackStatusValue,
|
||||||
|
TrackContentCodeValue = item.TrackContentCodeValue,
|
||||||
|
TrackContentValue = item.TrackContentValue,
|
||||||
|
TrackEnContentValue = item.TrackEnContentValue,
|
||||||
|
TrackTimeZone = item.TrackTimeZone,
|
||||||
|
ExpandFieldsValue = item.ExpandFieldsValue,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
await RedisHelper.Client.SetAsync(TrackPushContentKey(trackPushConfig.SubSystemId, trackPushConfig.CustomId),
|
||||||
|
res);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -106,18 +106,7 @@ public class TrackPushService : ApplicationService
|
|||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
{
|
{
|
||||||
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
|
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
|
||||||
var trackPushParamsEntity =
|
await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
|
||||||
ObjectMapper.Map<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(input);
|
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
|
||||||
int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
|
|
||||||
|
|
||||||
trackPushParamsEntity.PullOrPushConfigId = id;
|
|
||||||
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
|
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -126,22 +115,8 @@ public class TrackPushService : ApplicationService
|
|||||||
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
int oldCustomId = oldTrackPushEntity.CustomId;
|
|
||||||
|
|
||||||
var oldTrackPushParamsEntity =
|
|
||||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPushEntity);
|
ObjectMapper.Map(input, oldTrackPushEntity);
|
||||||
ObjectMapper.Map(input, oldTrackPushParamsEntity);
|
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
|
||||||
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
||||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
|
if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
|
||||||
}
|
}
|
||||||
@ -149,19 +124,15 @@ public class TrackPushService : ApplicationService
|
|||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
{
|
{
|
||||||
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
_ = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
using var ts = TransactionScopeHelper.Create();
|
||||||
{
|
|
||||||
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -43,10 +43,10 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
public bool IsCompleted { get; set; }
|
public bool IsCompleted { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最新推送轨迹内容id(异步维护)
|
/// 最新推送轨迹code(异步维护)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "LatestPushTrackContentId")]
|
[SugarColumn(ColumnName = "LatestPushTrackCode")]
|
||||||
public int? LatestPushTrackContentId { get; set; }
|
public string? LatestPushTrackCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最新推送时间(异步维护)
|
/// 最新推送时间(异步维护)
|
||||||
@ -54,6 +54,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
[SugarColumn(ColumnName = "LatestPushTime")]
|
[SugarColumn(ColumnName = "LatestPushTime")]
|
||||||
public DateTime? LatestPushTime { get; set; }
|
public DateTime? LatestPushTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送异常信息
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "LatestPushError")]
|
||||||
|
public string? LatestPushError { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最新轨迹内容(异步维护)
|
/// 最新轨迹内容(异步维护)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -120,12 +126,6 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
[SugarColumn(ColumnName = "QuestionType")]
|
[SugarColumn(ColumnName = "QuestionType")]
|
||||||
public int QuestionType { get; set; }
|
public int QuestionType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 问题描述
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "ProblemDescription")]
|
|
||||||
public string? ProblemDescription { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 起运港口
|
/// 起运港口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -47,10 +47,4 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "TrackStatusId")]
|
[SugarColumn(ColumnName = "TrackStatusId")]
|
||||||
public int TrackStatusId { get; set; }
|
public int TrackStatusId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "IsCompleted")]
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -6,7 +6,7 @@ public interface ITrackDetailsRepository
|
|||||||
{
|
{
|
||||||
Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, string trackCode);
|
Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, string trackCode);
|
||||||
|
|
||||||
Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, DateTime trackTime);
|
Task<bool> AnyAsync(int orderId, DateTime trackTime);
|
||||||
|
|
||||||
Task UpsertAsync(TrackDetailsIndex index);
|
Task UpsertAsync(TrackDetailsIndex index);
|
||||||
|
|
||||||
|
|||||||
@ -43,14 +43,9 @@ public class TrackDetailsIndex : IdBaseIndex
|
|||||||
public string TrackContent { get; set; } = null!;
|
public string TrackContent { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容Id
|
/// 服务商
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackContentId { get; set; }
|
public string? ServiceProviderName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 这条轨迹是否意味着完成
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 原轨迹内容
|
/// 原轨迹内容
|
||||||
|
|||||||
@ -65,4 +65,10 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "TrackTimeZone")]
|
[SugarColumn(ColumnName = "TrackTimeZone")]
|
||||||
public float? TrackTimeZone { get; set; }
|
public float? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "IsCompleted")]
|
||||||
|
public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -47,4 +47,10 @@ public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "IsCanDelete")]
|
[SugarColumn(ColumnName = "IsCanDelete")]
|
||||||
public bool IsCanDelete { get; set; }
|
public bool IsCanDelete { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否全量推送
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "IsAllPush")]
|
||||||
|
public bool IsAllPush { get; set; }
|
||||||
}
|
}
|
||||||
@ -12,18 +12,24 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
|||||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扩展字段参数值
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "ExpandFieldsValue")]
|
|
||||||
public string ExpandFieldsValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送单号类型(主数据枚举TrackOrderType)
|
/// 推送单号类型(主数据枚举TrackOrderType)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "OrderNoType")]
|
[SugarColumn(ColumnName = "OrderNoType")]
|
||||||
public int OrderNoType { get; set; }
|
public int OrderNoType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "TrackContentId")]
|
||||||
|
public int TrackContentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可交换顺序的轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "SwapTrackContentId")]
|
||||||
|
public int? SwapTrackContentId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹排序
|
/// 推送轨迹排序
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,12 +42,6 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
|||||||
[SugarColumn(ColumnName = "TrackContentCodeValue")]
|
[SugarColumn(ColumnName = "TrackContentCodeValue")]
|
||||||
public string TrackContentCodeValue { get; set; }
|
public string TrackContentCodeValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "TrackContentId")]
|
|
||||||
public int TrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容参数值
|
/// 轨迹内容参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -71,4 +71,10 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "TrackTimeZone")]
|
[SugarColumn(ColumnName = "TrackTimeZone")]
|
||||||
public double? TrackTimeZone { get; set; }
|
public double? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展字段参数值
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "ExpandFieldsValue")]
|
||||||
|
public string ExpandFieldsValue { get; set; }
|
||||||
}
|
}
|
||||||
@ -7,6 +7,11 @@ public partial class GlobalConst
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert";
|
public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 无法映射的轨迹新增
|
||||||
|
/// </summary>
|
||||||
|
public const string TrackInsertForNotMappedEventSubscribe = "SJZY.Track.TrackInsertForNotMapped";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹删除
|
/// 轨迹删除
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
public partial class GlobalConst
|
public partial class GlobalConst
|
||||||
{
|
{
|
||||||
|
public const string SystemUser = "系统";
|
||||||
public const string EmptyString = "--";
|
public const string EmptyString = "--";
|
||||||
}
|
}
|
||||||
@ -21,19 +21,4 @@ public class LinkedOrderVO
|
|||||||
/// 子系统id
|
/// 子系统id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最新推送轨迹内容id(异步维护)
|
|
||||||
/// </summary>
|
|
||||||
public int? LatestPushTrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 客户id
|
|
||||||
/// </summary>
|
|
||||||
public int CustomId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单是否完成
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ public class MatchTrackContentDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容id
|
/// 轨迹内容id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public string TrackCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容
|
/// 轨迹内容
|
||||||
@ -22,11 +22,6 @@ public class MatchTrackContentDto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Status { get; set; } = null!;
|
public string Status { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否意味着完成
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCompleted { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否可删
|
/// 是否可删
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -41,4 +41,9 @@ public class GetTrackPullContentListCacheVO
|
|||||||
/// 轨迹时区GMT
|
/// 轨迹时区GMT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float? TrackTimeZone { get; set; }
|
public float? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单是否完成(由轨迹刷新配置决定)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -12,15 +12,25 @@ public class TrackPushContentConfigVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsCanUpdate { get; set; }
|
public bool IsCanUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否全量推送
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAllPush { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商code
|
/// 服务商code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServiceProviderCode { get; set; } = null!;
|
public string ServiceProviderCode { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扩展字段参数值
|
/// 轨迹code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? ExpandFieldsValue { get; set; }
|
public string TrackCode { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可交换顺序的轨迹code
|
||||||
|
/// </summary>
|
||||||
|
public string? SwapTrackCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送单号类型(主数据枚举TrackOrderType)
|
/// 推送单号类型(主数据枚举TrackOrderType)
|
||||||
@ -32,11 +42,6 @@ public class TrackPushContentConfigVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackContentCodeValue { get; set; }
|
public string? TrackContentCodeValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹内容id
|
|
||||||
/// </summary>
|
|
||||||
public int TrackContentId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容参数值
|
/// 轨迹内容参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,4 +61,9 @@ public class TrackPushContentConfigVO
|
|||||||
/// 轨迹时区GMT
|
/// 轨迹时区GMT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double? TrackTimeZone { get; set; }
|
public double? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展字段参数值
|
||||||
|
/// </summary>
|
||||||
|
public string? ExpandFieldsValue { get; set; }
|
||||||
}
|
}
|
||||||
@ -71,11 +71,10 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
.Where((x, a, b) => x.OrderId == orderId && b.Code == code)
|
.Where((x, a, b) => x.OrderId == orderId && b.Code == code)
|
||||||
.Select((x, a, b, c) => new MatchTrackContentDto
|
.Select((x, a, b, c) => new MatchTrackContentDto
|
||||||
{
|
{
|
||||||
Id = b.Id,
|
TrackCode = b.Code,
|
||||||
Content = b.Content,
|
Content = b.Content,
|
||||||
EnContent = b.EnContent,
|
EnContent = b.EnContent,
|
||||||
Status = c.Status,
|
Status = c.Status,
|
||||||
IsCompleted = b.IsCompleted,
|
|
||||||
IsCanDelete = a.IsCanDelete
|
IsCanDelete = a.IsCanDelete
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|||||||
@ -84,10 +84,7 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
OrderId = b.Id,
|
OrderId = b.Id,
|
||||||
OrderType = b.OrderType,
|
OrderType = b.OrderType,
|
||||||
OrderNo = b.OrderNo,
|
OrderNo = b.OrderNo,
|
||||||
SubSystemId = b.SubSystemId,
|
SubSystemId = b.SubSystemId
|
||||||
LatestPushTrackContentId = b.LatestPushTrackContentId,
|
|
||||||
CustomId = b.CustomId,
|
|
||||||
IsCompleted = b.IsCompleted
|
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using System.Linq.Expressions;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
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.Aggregates.TrackTemplateAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||||
using SJZY.Track.Domain.VEntities;
|
using SJZY.Track.Domain.VEntities;
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
|
|
||||||
@ -39,8 +38,7 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
Content = a.Content,
|
Content = a.Content,
|
||||||
EnContent = a.EnContent,
|
EnContent = a.EnContent,
|
||||||
TrackFlagId = a.TrackFlagId,
|
TrackFlagId = a.TrackFlagId,
|
||||||
TrackFlag = c.Name,
|
TrackFlag = c.Name
|
||||||
IsFinish = a.IsCompleted
|
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
return detail;
|
return detail;
|
||||||
@ -66,7 +64,9 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
|| a.EnContent.Contains(input.Keywords))
|
|| a.EnContent.Contains(input.Keywords))
|
||||||
.WhereIF(input.TrackStatusId > 0, (a, b, c, d, e, f) => a.TrackStatusId == input.TrackStatusId)
|
.WhereIF(input.TrackStatusId > 0, (a, b, c, d, e, f) => a.TrackStatusId == input.TrackStatusId)
|
||||||
.OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => a.CreateTime, OrderByType.Desc)
|
.OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => a.CreateTime, OrderByType.Desc)
|
||||||
.OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc)
|
.OrderByIF(!input.SelectIds.IsNullOrEmpty(),
|
||||||
|
(a, b, c, d, e, f) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1),
|
||||||
|
a.CreateTime), OrderByType.Desc)
|
||||||
.Select((a, b, c, d, e, f) => new GetTrackContentListVO
|
.Select((a, b, c, d, e, f) => new GetTrackContentListVO
|
||||||
{
|
{
|
||||||
Id = a.Id,
|
Id = a.Id,
|
||||||
@ -75,7 +75,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
Content = a.Content,
|
Content = a.Content,
|
||||||
EnContent = a.EnContent,
|
EnContent = a.EnContent,
|
||||||
TrackStatus = b.Status,
|
TrackStatus = b.Status,
|
||||||
Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("清关").ElseIF(b.Node == 3).Return("干线")
|
Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("清关").ElseIF(b.Node == 3)
|
||||||
|
.Return("干线")
|
||||||
.ElseIF(b.Node == 4).Return("派送").ElseIF(b.Node == 5).Return("其他")
|
.ElseIF(b.Node == 4).Return("派送").ElseIF(b.Node == 5).Return("其他")
|
||||||
.End(""),
|
.End(""),
|
||||||
TrackFlag = c.Name,
|
TrackFlag = c.Name,
|
||||||
@ -83,7 +84,6 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
CreateUser = e.Name,
|
CreateUser = e.Name,
|
||||||
UpdateTime = a.UpdateTime,
|
UpdateTime = a.UpdateTime,
|
||||||
UpdateUser = f.Name,
|
UpdateUser = f.Name,
|
||||||
IsFinish = a.IsCompleted
|
|
||||||
})
|
})
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
|
|
||||||
@ -94,10 +94,12 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
/// 获取轨迹内容属性值
|
/// 获取轨迹内容属性值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<GetTemplateContentAttributeValueVO>> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input)
|
public async Task<List<GetTemplateContentAttributeValueVO>> GetTrackContentAttributeValue(
|
||||||
|
GetTemplateContentAttributeValueInputVO input)
|
||||||
{
|
{
|
||||||
var list = await Context.Queryable<TrackContentEntity>()
|
var list = await Context.Queryable<TrackContentEntity>()
|
||||||
.LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id == b.TrackContentId && b.TrackTemplateId > 0 && b.IsDeleted == false)
|
.LeftJoin<TrackTemplateContentEntity>((a, b) =>
|
||||||
|
a.Id == b.TrackContentId && b.TrackTemplateId > 0 && b.IsDeleted == false)
|
||||||
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
||||||
.WhereIF(!input.TrackCodes.IsNullOrEmpty(), (a, b, c) => input.TrackCodes!.Contains(a.Code))
|
.WhereIF(!input.TrackCodes.IsNullOrEmpty(), (a, b, c) => input.TrackCodes!.Contains(a.Code))
|
||||||
.WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId)
|
.WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId)
|
||||||
@ -125,7 +127,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
public async Task<bool> GetTemplateIsExist(int trackContentId)
|
public async Task<bool> GetTemplateIsExist(int trackContentId)
|
||||||
{
|
{
|
||||||
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
|
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
|
||||||
var trackContentEntities = await Context.Queryable<TrackContentEntity>().LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id == b.TrackContentId && b.IsDeleted == false)
|
var trackContentEntities = await Context.Queryable<TrackContentEntity>()
|
||||||
|
.LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id == b.TrackContentId && b.IsDeleted == false)
|
||||||
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
||||||
.Where((a, b, c) => a.Id == trackContentId)
|
.Where((a, b, c) => a.Id == trackContentId)
|
||||||
.Select((a, b, c) => new
|
.Select((a, b, c) => new
|
||||||
@ -144,23 +147,36 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(
|
||||||
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input)
|
GetTrackContentMapPageInputVO input)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<TrackContentMapEntity>()
|
return await Context.Queryable<TrackContentMapEntity>()
|
||||||
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) =>
|
||||||
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
||||||
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) =>
|
||||||
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
||||||
.LeftJoin<TrackStatusEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus) => sourceContent.TrackStatusId == sourceStatus.Id && !sourceStatus.IsDeleted)
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) =>
|
||||||
.LeftJoin<TrackStatusEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => targetContent.TrackStatusId == targetStatus.Id && !targetStatus.IsDeleted)
|
contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) =>
|
||||||
|
contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
||||||
|
.LeftJoin<TrackStatusEntity>(
|
||||||
|
(contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus) =>
|
||||||
|
sourceContent.TrackStatusId == sourceStatus.Id && !sourceStatus.IsDeleted)
|
||||||
|
.LeftJoin<TrackStatusEntity>(
|
||||||
|
(contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) =>
|
||||||
|
targetContent.TrackStatusId == targetStatus.Id && !targetStatus.IsDeleted)
|
||||||
.Filter(null, true)
|
.Filter(null, true)
|
||||||
.Where(contentMap => !contentMap.IsDeleted)
|
.Where(contentMap => !contentMap.IsDeleted)
|
||||||
.WhereIF(input.SubSystemId.HasValue, contentMap => contentMap.SubSystemId == input.SubSystemId)
|
.WhereIF(input.SubSystemId.HasValue, contentMap => contentMap.SubSystemId == input.SubSystemId)
|
||||||
.WhereIF(input.MapSubSystemId.HasValue, contentMap => contentMap.MapSubSystemId == input.MapSubSystemId)
|
.WhereIF(input.MapSubSystemId.HasValue, contentMap => contentMap.MapSubSystemId == input.MapSubSystemId)
|
||||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (contentMap, sourceContent) => sourceContent.Code.Contains(input.Keywords) || sourceContent.Content.Contains(input.Keywords) || sourceContent.EnContent.Contains(input.Keywords))
|
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||||
|
(contentMap, sourceContent) => sourceContent.Code.Contains(input.Keywords) ||
|
||||||
|
sourceContent.Content.Contains(input.Keywords) ||
|
||||||
|
sourceContent.EnContent.Contains(input.Keywords))
|
||||||
.OrderByDescending(contentMap => contentMap.CreateTime)
|
.OrderByDescending(contentMap => contentMap.CreateTime)
|
||||||
.Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => new GetTrackContentMapPageOutputVO
|
.Select(
|
||||||
|
(contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) =>
|
||||||
|
new GetTrackContentMapPageOutputVO
|
||||||
{
|
{
|
||||||
Id = contentMap.Id,
|
Id = contentMap.Id,
|
||||||
SubSystem = sourceSystem.CnName,
|
SubSystem = sourceSystem.CnName,
|
||||||
@ -180,13 +196,18 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<TrackContentMapEntity>()
|
return await Context.Queryable<TrackContentMapEntity>()
|
||||||
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) =>
|
||||||
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
||||||
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) =>
|
||||||
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) =>
|
||||||
|
contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) =>
|
||||||
|
contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
||||||
.Filter(null, true)
|
.Filter(null, true)
|
||||||
.Where(contentMap => contentMap.Id == id && !contentMap.IsDeleted)
|
.Where(contentMap => contentMap.Id == id && !contentMap.IsDeleted)
|
||||||
.Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => new GetTrackContentMapDetailOutputVO
|
.Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) =>
|
||||||
|
new GetTrackContentMapDetailOutputVO
|
||||||
{
|
{
|
||||||
Id = contentMap.Id,
|
Id = contentMap.Id,
|
||||||
SubSystemId = contentMap.SubSystemId,
|
SubSystemId = contentMap.SubSystemId,
|
||||||
@ -226,7 +247,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
.ExecuteCommandHasChangeAsync();
|
.ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
public async Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns,
|
||||||
|
Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
||||||
{
|
{
|
||||||
return await Context.Updateable<TrackContentMapEntity>().SetColumns(columns).Where(whereExpression)
|
return await Context.Updateable<TrackContentMapEntity>().SetColumns(columns).Where(whereExpression)
|
||||||
.ExecuteCommandAsync() > 0;
|
.ExecuteCommandAsync() > 0;
|
||||||
|
|||||||
@ -32,23 +32,17 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, DateTime trackTime)
|
public async Task<bool> AnyAsync(int orderId, DateTime trackTime)
|
||||||
{
|
{
|
||||||
var r = await Context.SearchAsync<TrackDetailsIndex>(s => s
|
var r = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
||||||
.Source()
|
.Source(s => s.Includes(fd => fd.Field(f => f.Id)))
|
||||||
.Query(q =>
|
.Query(q =>
|
||||||
q.Term(f => f.OrderId, orderId)
|
q.Term(f => f.OrderId, orderId)
|
||||||
&& q.Term(f => f.TrackTime, trackTime)
|
&& q.Term(f => f.TrackTime, trackTime)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var res = r.Documents.FirstOrDefault();
|
return r.Hits.Count > 0;
|
||||||
if (res != default && r.Hits.FirstOrDefault() != default)
|
|
||||||
{
|
|
||||||
res.Id = r.Hits.FirstOrDefault()!.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpsertAsync(TrackDetailsIndex index)
|
public async Task UpsertAsync(TrackDetailsIndex index)
|
||||||
@ -117,7 +111,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
.Field(f => f.TrackStatus)
|
.Field(f => f.TrackStatus)
|
||||||
.Field(f => f.TrackCode)
|
.Field(f => f.TrackCode)
|
||||||
.Field(f => f.TrackContent)
|
.Field(f => f.TrackContent)
|
||||||
.Field(f => f.TrackContentId)
|
|
||||||
.Field(f => f.TrackPlace)
|
.Field(f => f.TrackPlace)
|
||||||
.Field(f => f.TrackTime)
|
.Field(f => f.TrackTime)
|
||||||
.Field(f => f.TrackTimeZone)
|
.Field(f => f.TrackTimeZone)
|
||||||
@ -150,7 +143,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
{
|
{
|
||||||
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x
|
||||||
.Source(s => s.Includes(fd => fd
|
.Source(s => s.Includes(fd => fd
|
||||||
.Field(f => f.IsCompleted)
|
|
||||||
.Field(f => f.TrackEnContent)
|
.Field(f => f.TrackEnContent)
|
||||||
.Field(f => f.TrackContent)
|
.Field(f => f.TrackContent)
|
||||||
.Field(f => f.TrackPlace)
|
.Field(f => f.TrackPlace)
|
||||||
|
|||||||
@ -125,21 +125,25 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
return await Context.Queryable<TrackPushConfigEntity>()
|
return await Context.Queryable<TrackPushConfigEntity>()
|
||||||
.LeftJoin<TrackPushContentConfigEntity>((a, b) => a.Id == b.TrackPushConfigId)
|
.LeftJoin<TrackPushContentConfigEntity>((a, b) => a.Id == b.TrackPushConfigId)
|
||||||
.LeftJoin<VServiceProviderEntity>((a, b, c) => a.ServiceProviderId == c.Id)
|
.LeftJoin<VServiceProviderEntity>((a, b, c) => a.ServiceProviderId == c.Id)
|
||||||
|
.LeftJoin<TrackContentEntity>((a, b, c, d) => b.TrackContentId == d.Id)
|
||||||
|
.LeftJoin<TrackContentEntity>((a, b, c, d, e) => b.SwapTrackContentId == e.Id)
|
||||||
.Where(a => a.Id == configId)
|
.Where(a => a.Id == configId)
|
||||||
.OrderBy((a, b) => b.Sort)
|
.OrderBy((a, b) => b.Sort)
|
||||||
.Select((a, b, c) => new TrackPushContentConfigVO
|
.Select((a, b, c, d, e) => new TrackPushContentConfigVO
|
||||||
{
|
{
|
||||||
IsAutoPush = a.IsAutoPush,
|
IsAutoPush = a.IsAutoPush,
|
||||||
IsCanUpdate = a.IsCanUpdate,
|
IsCanUpdate = a.IsCanUpdate,
|
||||||
|
IsAllPush = a.IsAllPush,
|
||||||
ServiceProviderCode = c.Code,
|
ServiceProviderCode = c.Code,
|
||||||
ExpandFieldsValue = b.ExpandFieldsValue,
|
|
||||||
OrderType = b.OrderNoType,
|
OrderType = b.OrderNoType,
|
||||||
|
TrackCode = d.Code,
|
||||||
|
SwapTrackCode = e.Code,
|
||||||
TrackContentCodeValue = b.TrackContentCodeValue,
|
TrackContentCodeValue = b.TrackContentCodeValue,
|
||||||
TrackContentId = b.TrackContentId,
|
|
||||||
TrackContentValue = b.TrackContentValue,
|
TrackContentValue = b.TrackContentValue,
|
||||||
TrackEnContentValue = b.TrackEnContentValue,
|
TrackEnContentValue = b.TrackEnContentValue,
|
||||||
TrackStatusValue = b.TrackStatusValue,
|
TrackStatusValue = b.TrackStatusValue,
|
||||||
TrackTimeZone = b.TrackTimeZone
|
TrackTimeZone = b.TrackTimeZone,
|
||||||
|
ExpandFieldsValue = b.ExpandFieldsValue,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user