Merge branch 'S03-轨迹中台' into dev
# Conflicts: # src/SJZY.Track.Application/Services/ProvideServices/OrderService.Link.cs # src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
This commit is contained in:
commit
5c4b79fd0c
@ -5,9 +5,11 @@
|
|||||||
"Apollo": {
|
"Apollo": {
|
||||||
"AppId": "SJZY.Track.Configuration",
|
"AppId": "SJZY.Track.Configuration",
|
||||||
"Env": "DEV",
|
"Env": "DEV",
|
||||||
"Namespace": "Test",
|
"Namespace": "Dev",
|
||||||
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
|
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
|
||||||
"ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ]
|
"ConfigServer": [
|
||||||
|
"http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
|
|||||||
@ -1,100 +1,107 @@
|
|||||||
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>
|
||||||
{
|
/// 轨迹订单id
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// 轨迹订单id
|
public int OrderId { get; set; }
|
||||||
/// </summary>
|
|
||||||
public int OrderId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子系统id
|
/// 子系统id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹模板Id
|
/// 轨迹模板Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int>? TrackTemplateIds { get; set; } = new List<int>();
|
public List<int>? TrackTemplateIds { get; set; } = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrackOrderDetailDto
|
public class TrackOrderDetailDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id es主键
|
/// Id es主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public string Id { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹订单id
|
/// 轨迹订单id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OrderId { set; get; }
|
public int OrderId { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单类型(主数据枚举TrackOrderType)
|
/// 订单类型(主数据枚举TrackOrderType)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OrderType { get; set; }
|
public int OrderType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单号
|
/// 订单号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OrderNo { get; set; } = null!;
|
public string OrderNo { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码
|
/// 轨迹代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Code { get; set; }
|
public string? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容
|
/// 轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Content { get; set; }
|
public string? Content { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容英文
|
/// 轨迹内容英文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? EnContent { get; set; }
|
public string? EnContent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生地
|
/// 服务商
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackPlace { get; set; }
|
public string? ServiceProviderName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生时间
|
/// 原轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? TrackTime { get; set; }
|
public string? OriginTrackContent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹发生时区
|
/// 轨迹发生地
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackTimeZone { get; set; }
|
public string? TrackPlace { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 时区的值
|
/// 轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float TrackTimeZoneValue { get; set; }
|
public DateTime? TrackTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否可删
|
/// 轨迹发生时区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsCanDelete { get; set; }
|
public string? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否对外
|
/// 时区的值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExternal { get; set; }
|
public float TrackTimeZoneValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 是否可删
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime CreateTime { get; set; }
|
public bool IsCanDelete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建人
|
/// 是否对外
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? CreateUser { get; set; }
|
public bool IsExternal { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
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
|
||||||
@ -99,10 +94,5 @@
|
|||||||
/// 轨迹标记
|
/// 轨迹标记
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackFlag { get; set; }
|
public string TrackFlag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFinish { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选中的轨迹内容id
|
/// 选中的轨迹内容id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int>? SelectIds { get; set; }
|
public List<int>? SelectIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetTrackContentListDto
|
public class GetTrackContentListDto
|
||||||
@ -84,10 +84,5 @@
|
|||||||
/// 修改人
|
/// 修改人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpdateUser { get; set; }
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFinish { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,4 +53,9 @@ public class EditTrackPullContentInput
|
|||||||
/// 轨迹时区GMT
|
/// 轨迹时区GMT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double? TrackTimeZone { get; set; }
|
public double? TrackTimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
public class TrackRefreshAttach
|
public class TrackRefreshAttach
|
||||||
{
|
{
|
||||||
public TrackRefreshAttach(int serviceProviderId, string serviceProviderCode, int subSystemId, int orderType)
|
public TrackRefreshAttach(int serviceProviderId, string serviceProviderName, int subSystemId, int orderType)
|
||||||
{
|
{
|
||||||
ServiceProviderId = serviceProviderId;
|
ServiceProviderId = serviceProviderId;
|
||||||
ServiceProviderCode = serviceProviderCode;
|
ServiceProviderName = serviceProviderName;
|
||||||
SubSystemId = subSystemId;
|
SubSystemId = subSystemId;
|
||||||
OrderType = orderType;
|
OrderType = orderType;
|
||||||
}
|
}
|
||||||
@ -16,9 +16,9 @@ public class TrackRefreshAttach
|
|||||||
public int ServiceProviderId { get; set; }
|
public int ServiceProviderId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商code
|
/// 服务商name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServiceProviderCode { get; set; }
|
public string ServiceProviderName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单类型(主数据枚举TrackOrderType)
|
/// 订单类型(主数据枚举TrackOrderType)
|
||||||
|
|||||||
@ -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; }
|
||||||
}
|
}
|
||||||
@ -34,6 +34,11 @@ public class EditTrackPushContentInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackContentId { get; set; }
|
public int TrackContentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 可交换顺序的轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int? SwapTrackContentId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容参数值
|
/// 轨迹内容参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -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; }
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<Version>1.0.1</Version>
|
<Version>7.0.0</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -19,7 +19,8 @@ public interface ITrackPullCacheService
|
|||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="serviceProviderId">服务商id</param>
|
/// <param name="serviceProviderId">服务商id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TrackPullParamWithContentConfigDto> GetPullParamWithContentConfigAsync(int subSystemId, int serviceProviderId);
|
Task<TrackPullParamWithContentConfigDto?>
|
||||||
|
GetPullParamWithContentConfigAsync(int subSystemId, int serviceProviderId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置拉取配置缓存
|
/// 设置拉取配置缓存
|
||||||
@ -28,6 +29,6 @@ public interface ITrackPullCacheService
|
|||||||
/// <param name="subSystemId">子系统id</param>
|
/// <param name="subSystemId">子系统id</param>
|
||||||
/// <param name="serviceProviderId">服务商id</param>
|
/// <param name="serviceProviderId">服务商id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<TrackPullParamWithContentConfigDto> SetPullConfigAsync(int? id = null, int? subSystemId = null,
|
Task<TrackPullParamWithContentConfigDto?> SetPullConfigAsync(int? id = null, int? subSystemId = null,
|
||||||
int? serviceProviderId = null);
|
int? serviceProviderId = null);
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
@ -10,21 +10,21 @@ public interface ITrackService : IRemoteService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> UpsertTrackAsync(UpsertTrackInput input);
|
Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除轨迹
|
/// 删除轨迹
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> DeleteTrackAsync(DeleteTrackInput input);
|
Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批量删除轨迹
|
/// 批量删除轨迹
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input);
|
Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据订单号获取轨迹
|
/// 根据订单号获取轨迹
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -3,12 +3,13 @@ using DotNetCore.CAP.Filter;
|
|||||||
using SJZY.Expand.ABP.Core;
|
using SJZY.Expand.ABP.Core;
|
||||||
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.Domain.Consts;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.EventHandlers;
|
namespace SJZY.Track.Application.EventHandlers;
|
||||||
|
|
||||||
public class CAPFilter : SubscribeFilter
|
public class CapFilter : SubscribeFilter
|
||||||
{
|
{
|
||||||
const string _ERROR_CODE = "Error599";
|
const string ErrorCode = "Error599";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行前
|
/// 执行前
|
||||||
@ -17,9 +18,13 @@ public class CAPFilter : SubscribeFilter
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override Task OnSubscribeExecutingAsync(ExecutingContext context)
|
public override Task OnSubscribeExecutingAsync(ExecutingContext context)
|
||||||
{
|
{
|
||||||
var argumentJsonStr = context.Arguments.ToJson();
|
|
||||||
|
|
||||||
context.DeliverMessage.Headers["sjzy-receive-time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
|
context.DeliverMessage.Headers["sjzy-receive-time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff");
|
||||||
|
|
||||||
|
// 轨迹刷新不做幂等
|
||||||
|
if (context.DeliverMessage.Headers["cap-msg-name"]!.EndsWith(GlobalConst.TrackRefreshSubscribe))
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
var argumentJsonStr = context.Arguments.ToJson();
|
||||||
context.DeliverMessage.Headers["sjzy-arguments"] = argumentJsonStr;
|
context.DeliverMessage.Headers["sjzy-arguments"] = argumentJsonStr;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(argumentJsonStr))
|
if (!string.IsNullOrEmpty(argumentJsonStr))
|
||||||
@ -29,7 +34,7 @@ public class CAPFilter : SubscribeFilter
|
|||||||
{
|
{
|
||||||
var isSkip = !string.IsNullOrEmpty(RedisHelper.Client.Get($"CapExcuteFilter:{hash}"));
|
var isSkip = !string.IsNullOrEmpty(RedisHelper.Client.Get($"CapExcuteFilter:{hash}"));
|
||||||
if (isSkip)
|
if (isSkip)
|
||||||
throw new BusinessException(_ERROR_CODE, $"检测到重复消费,消费参数:{argumentJsonStr}");
|
throw new BusinessException(ErrorCode, $"检测到重复消费,消费参数:{argumentJsonStr}");
|
||||||
|
|
||||||
RedisHelper.Client.Set($"CapExcuteFilter:{hash}", 60 * 10,
|
RedisHelper.Client.Set($"CapExcuteFilter:{hash}", 60 * 10,
|
||||||
TimeSpan.FromHours(1).Seconds); // 1h内不允许一模一样的参数重复消费
|
TimeSpan.FromHours(1).Seconds); // 1h内不允许一模一样的参数重复消费
|
||||||
@ -51,7 +56,7 @@ public class CAPFilter : SubscribeFilter
|
|||||||
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments", out var arguments);
|
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments", out var arguments);
|
||||||
context.DeliverMessage.Headers.TryGetValue("cap-msg-id", out var messageId);
|
context.DeliverMessage.Headers.TryGetValue("cap-msg-id", out var messageId);
|
||||||
|
|
||||||
BuildLog(receiveTime, receiveName, arguments, false, messageId);
|
BuildLog(receiveTime!, receiveName!, arguments!, false, messageId!);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -67,7 +72,7 @@ public class CAPFilter : SubscribeFilter
|
|||||||
context.ExceptionHandled = true;
|
context.ExceptionHandled = true;
|
||||||
context.DeliverMessage.Headers.TryGetValue("cap-msg-id", out var messageId);
|
context.DeliverMessage.Headers.TryGetValue("cap-msg-id", out var messageId);
|
||||||
|
|
||||||
if (context.Exception is BusinessException ex && ex.Code == _ERROR_CODE)
|
if (context.Exception is BusinessException ex && ex.Code == ErrorCode)
|
||||||
LogHelper.Warn(ex.ToString());
|
LogHelper.Warn(ex.ToString());
|
||||||
else
|
else
|
||||||
LogHelper.Error($"cap-msg-id:{messageId}\n{context.Exception}");
|
LogHelper.Error($"cap-msg-id:{messageId}\n{context.Exception}");
|
||||||
@ -77,13 +82,13 @@ public class CAPFilter : SubscribeFilter
|
|||||||
context.DeliverMessage.Headers.TryGetValue("cap-msg-name", out var receiveName);
|
context.DeliverMessage.Headers.TryGetValue("cap-msg-name", out var receiveName);
|
||||||
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments", out var arguments);
|
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments", out var arguments);
|
||||||
|
|
||||||
BuildLog(receiveTime, receiveName, arguments, true, messageId);
|
BuildLog(receiveTime!, receiveName!, arguments, true, messageId!);
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void BuildLog(string receiveTime, string receiveName, string arguments, bool isFromExecptionFliter,
|
private void BuildLog(string receiveTime, string receiveName, string? arguments, bool isFromExecptionFliter,
|
||||||
string messageId)
|
string messageId)
|
||||||
{
|
{
|
||||||
var parsedDate = DateTime.ParseExact(receiveTime, "yyyy-MM-dd HH:mm:ss fff", CultureInfo.InvariantCulture);
|
var parsedDate = DateTime.ParseExact(receiveTime, "yyyy-MM-dd HH:mm:ss fff", CultureInfo.InvariantCulture);
|
||||||
|
|||||||
@ -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,14 @@
|
|||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
|
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.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,106 +18,175 @@ 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!;
|
||||||
switch (@event.OptionType)
|
|
||||||
|
var order = await _orderRepository.GetFirstAsync(x =>
|
||||||
|
x.Id == @event.OrderId, x => new
|
||||||
{
|
{
|
||||||
case OptionType.无:
|
x.SubSystemId, x.LatestPushTrackCode, x.CustomId
|
||||||
return;
|
});
|
||||||
case OptionType.新增:
|
if (order == null) return;
|
||||||
res = await PushAddAsync(@event);
|
|
||||||
break;
|
|
||||||
case OptionType.删除:
|
|
||||||
break;
|
|
||||||
case OptionType.修改:
|
|
||||||
res = await PushUpdateAsync(@event);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
var isSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
TrackPushContentConfigDto? config = null;
|
||||||
|
|
||||||
// 往es 写推送日志
|
var log = new TrackPushRecordIndex
|
||||||
await _trackPushRecordsRepository.AddAsync(new TrackPushRecordIndex
|
|
||||||
{
|
{
|
||||||
IndexName = $"{GlobalConst.TrackPushRecordsIndex}-{DateTime.Now:yyyy.MM.dd}",
|
IndexName = $"{GlobalConst.TrackPushRecordsIndex}-{DateTime.Now:yyyy.MM.dd}",
|
||||||
RequestId = res.RequestId,
|
RequestId = res.RequestId,
|
||||||
Message = res.Msg,
|
Message = res.Msg,
|
||||||
OptionType = @event.OptionType.ToString(),
|
OptionType = @event.OptionType.ToString(),
|
||||||
OrderId = @event.OrderId,
|
OrderId = @event.OrderId,
|
||||||
OrderType = @event.OrderType,
|
|
||||||
OrderNo = @event.OrderNo,
|
|
||||||
TrackStatus = @event.TrackStatus,
|
TrackStatus = @event.TrackStatus,
|
||||||
TrackCode = @event.TrackCode,
|
TrackCode = @event.TrackCode,
|
||||||
TrackContent = @event.TrackContent,
|
TrackContent = @event.TrackContent,
|
||||||
TrackPlace = @event.TrackPlace,
|
TrackPlace = @event.TrackPlace,
|
||||||
TrackTime = @event.TrackTime,
|
TrackTime = @event.TrackTime,
|
||||||
TrackTimeZone = @event.TrackTimeZone,
|
TrackTimeZone = @event.TrackTimeZone,
|
||||||
TrackContentCodeValue = @event.TrackContentCodeValue,
|
CreateUser = @event.OperationMan ?? GlobalConst.SystemUser,
|
||||||
TrackContentValue = @event.TrackContentValue,
|
|
||||||
TrackEnContentValue = @event.TrackEnContentValue,
|
|
||||||
TrackStatusValue = @event.TrackStatusValue,
|
|
||||||
ExpandFieldsValue = @event.ExpandFieldsValue,
|
|
||||||
IsSuccess = isSuccess,
|
|
||||||
CreateUser = @event.OperationMan ?? "系统",
|
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
});
|
|
||||||
|
|
||||||
// 更新订单主表(异步)
|
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackPushAfterUpdateOrderSubscribe,
|
|
||||||
new TrackPushAfterUpdateOrderEvent
|
|
||||||
{
|
|
||||||
OptionType = @event.OptionType,
|
|
||||||
OrderId = @event.OrderId,
|
|
||||||
TrackContentId = @event.TrackContentId,
|
|
||||||
IsSuccess = isSuccess,
|
|
||||||
Message = res.Msg
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<InterfaceRelayUnifyResultDto> PushAddAsync(TrackPushEvent @event)
|
|
||||||
{
|
|
||||||
var data = new
|
|
||||||
{
|
|
||||||
orderNo = @event.OrderNo,
|
|
||||||
data = new[]
|
|
||||||
{
|
|
||||||
new
|
|
||||||
{
|
|
||||||
// 推真实的发生地和发生时间(时间是计算后的)
|
|
||||||
location = @event.TrackPlace,
|
|
||||||
date = @event.TrackTime,
|
|
||||||
timeZone = @event.TrackTimeZone,
|
|
||||||
description = @event.TrackEnContentValue,
|
|
||||||
description_cn = @event.TrackContentValue,
|
|
||||||
code = @event.TrackContentCodeValue,
|
|
||||||
status = @event.TrackStatusValue,
|
|
||||||
extra = @event.ExpandFieldsValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var allPush = false;
|
||||||
|
switch (@event.OptionType)
|
||||||
|
{
|
||||||
|
case OptionType.无:
|
||||||
|
return;
|
||||||
|
case OptionType.新增:
|
||||||
|
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 is { IsAllPush: true })
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.PushTrackInterfaceCode,
|
if (config == null) return;
|
||||||
@event.ServiceProviderCode, data);
|
await DoAddAsync(@event, config, log, allPush);
|
||||||
|
break;
|
||||||
|
case OptionType.删除:
|
||||||
|
break;
|
||||||
|
case OptionType.修改:
|
||||||
|
config = await _trackPushCacheService.GetPushContentConfigAsync(order.SubSystemId, order.CustomId,
|
||||||
|
@event.TrackCode);
|
||||||
|
if (config == null || !config.IsCanUpdate) return;
|
||||||
|
await DoUpdateAsync(@event, config, log);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
if (config == null) return;
|
||||||
|
|
||||||
|
// 往es 写推送日志
|
||||||
|
await _trackPushRecordsRepository.AddAsync(log);
|
||||||
|
|
||||||
|
// 同步去更新订单主表
|
||||||
|
await TrackPushAfterUpdateOrderAsync(new TrackPushAfterUpdateOrderDto
|
||||||
|
{
|
||||||
|
OptionType = @event.OptionType,
|
||||||
|
OrderId = @event.OrderId,
|
||||||
|
TrackCode = @event.TrackCode,
|
||||||
|
IsSuccess = log.IsSuccess,
|
||||||
|
Message = res.Msg
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<InterfaceRelayUnifyResultDto> PushUpdateAsync(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 DoAddAsync(TrackPushEvent @event,
|
||||||
|
TrackPushContentConfigDto config, TrackPushRecordIndex log, bool allPush)
|
||||||
|
{
|
||||||
|
var track = new
|
||||||
|
{
|
||||||
|
// 推真实的发生地和发生时间(时间是计算后的)
|
||||||
|
location = @event.TrackPlace,
|
||||||
|
date = @event.TrackTime.AddHours(
|
||||||
|
config.TrackTimeZone ?? @event.TrackTimeZone - @event.TrackTimeZone),
|
||||||
|
timeZone = config.TrackTimeZone ?? @event.TrackTimeZone,
|
||||||
|
description = config.TrackEnContentValue,
|
||||||
|
description_cn = config.TrackContentValue,
|
||||||
|
code = config.TrackContentCodeValue,
|
||||||
|
status = config.TrackStatusValue,
|
||||||
|
extra = config.ExpandFieldsValue
|
||||||
|
};
|
||||||
|
|
||||||
|
JObject body = JObject.FromObject(new
|
||||||
|
{
|
||||||
|
orderNo = @event.OrderNo,
|
||||||
|
data = new[] { track }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (allPush)
|
||||||
|
{
|
||||||
|
var history = await _trackPushRecordsRepository.GetLatestTrackPushRecordAsync(@event.OrderId);
|
||||||
|
if (history != default)
|
||||||
|
{
|
||||||
|
body = JObject.Parse(history.PushContent);
|
||||||
|
((JArray)body["data"]!).Add(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = await _httpClientProxy.Service.ForwardWithSubscribeAsync(InterfaceRelayConst.PushTrackInterfaceCode,
|
||||||
|
config.ServiceProviderCode, body);
|
||||||
|
|
||||||
|
log.PushContent = body.ToJson();
|
||||||
|
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DoUpdateAsync(TrackPushEvent @event,
|
||||||
|
TrackPushContentConfigDto config, TrackPushRecordIndex log)
|
||||||
{
|
{
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
@ -122,21 +197,23 @@ 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;
|
log.PushContent = data.ToJson();
|
||||||
|
log.IsSuccess = res.Code == InterfaceRelayConst.SuccessCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,11 +3,11 @@ 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;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
using SJZY.Track.Application.Helpers;
|
||||||
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;
|
||||||
@ -32,70 +32,72 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
[CapSubscribe(GlobalConst.TrackRefreshSubscribe, Group = GlobalConst.TrackRefreshSubscribe)]
|
[CapSubscribe(GlobalConst.TrackRefreshSubscribe, Group = GlobalConst.TrackRefreshSubscribe)]
|
||||||
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
|
public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event)
|
||||||
{
|
{
|
||||||
var attach = JsonConvert.DeserializeObject<TrackRefreshAttach>(@event.Attach);
|
var attach = Base64Helper.DeSerialize<TrackRefreshAttach>(@event.Attach);
|
||||||
if (attach is null) return;
|
if (attach is null) return;
|
||||||
|
|
||||||
var config = await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
|
var config = await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
|
||||||
attach.ServiceProviderId);
|
attach.ServiceProviderId);
|
||||||
|
if (@event.Data == null || config == null) return;
|
||||||
|
|
||||||
var data = JObject.Parse(@event.Data.ToString()!);
|
var data = JObject.Parse(@event.Data);
|
||||||
var orderToken = data[config.ParamConfig.OrderPath];
|
var orderToken = data[config.ParamConfig.OrderPath];
|
||||||
if (orderToken is JArray orderTokens)
|
if (orderToken is JArray orderTokens)
|
||||||
{
|
{
|
||||||
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;
|
||||||
@ -124,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);
|
||||||
|
|
||||||
@ -158,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
|
||||||
@ -178,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 轨迹发生时间
|
// 轨迹发生时间
|
||||||
@ -190,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)]
|
||||||
@ -40,7 +35,6 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isUnProcessed = false;
|
|
||||||
// 不同子系统需要做内容映射
|
// 不同子系统需要做内容映射
|
||||||
if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId)
|
if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId)
|
||||||
{
|
{
|
||||||
@ -57,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; // 存在不让创建
|
||||||
@ -72,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,
|
||||||
@ -97,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);
|
||||||
}
|
}
|
||||||
@ -127,55 +130,34 @@ 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:刷新到无法匹配内容的轨迹引起的插入
|
//todo:可以优化
|
||||||
if (@event.TrackCode == GlobalConst.EmptyString)
|
// 根据轨迹code在订单模板内容中寻找匹配的
|
||||||
|
var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
|
||||||
|
if (trackContent == default)
|
||||||
{
|
{
|
||||||
track.TrackStatus = GlobalConst.EmptyString;
|
// 订单所绑定的模板,没有一条内容可以匹配发生的轨迹
|
||||||
track.TrackContent = GlobalConst.EmptyString;
|
return null;
|
||||||
track.TrackContentId = 0;
|
|
||||||
track.IsCompleted = false;
|
|
||||||
track.TrackEnContent = GlobalConst.EmptyString;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//todo:可以优化
|
|
||||||
// 根据轨迹code在订单模板内容中寻找匹配的
|
|
||||||
var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
|
|
||||||
if (trackContent == default)
|
|
||||||
{
|
|
||||||
// 订单所绑定的模板,没有一条内容可以匹配发生的轨迹
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
track = new TrackDetailsIndex
|
track.TrackStatus = trackContent.Status;
|
||||||
{
|
track.TrackCode = trackContent.TrackCode;
|
||||||
TrackStatus = trackContent.Status,
|
track.TrackContent = trackContent.Content;
|
||||||
TrackContent = trackContent.Content,
|
track.TrackEnContent = trackContent.EnContent;
|
||||||
TrackContentId = trackContent.Id,
|
track.IsCanDelete = trackContent.IsCanDelete;
|
||||||
IsCompleted = trackContent.IsCompleted,
|
track.ZeroTrackTime = track.TrackTime.Subtract(TimeSpan.FromHours(track.TrackTimeZone));
|
||||||
TrackEnContent = trackContent.EnContent,
|
|
||||||
IsCanDelete = trackContent.IsCanDelete
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
33
src/SJZY.Track.Application/Helpers/Base64Helper.cs
Normal file
33
src/SJZY.Track.Application/Helpers/Base64Helper.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System.Text;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Helpers;
|
||||||
|
|
||||||
|
public class Base64Helper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// json序列化base64
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string SerializeObject(object obj)
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(obj);
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(json);
|
||||||
|
|
||||||
|
return Convert.ToBase64String(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// json反序列化base64
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="json"></param>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T? DeSerialize<T>(string json)
|
||||||
|
{
|
||||||
|
byte[] bytes = Convert.FromBase64String(json);
|
||||||
|
|
||||||
|
return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(bytes));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,7 +12,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.6" />
|
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.8"/>
|
||||||
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
||||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||||
|
|||||||
@ -26,10 +26,10 @@ public partial class OrderService
|
|||||||
{
|
{
|
||||||
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
|
||||||
});
|
});
|
||||||
if (order == default)
|
if (order == default)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
|
throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
|
||||||
@ -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);
|
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)
|
||||||
@ -108,6 +114,6 @@ public partial class OrderService
|
|||||||
// real del
|
// real del
|
||||||
await _orderRepository.UnLinkByIdsAsync(unLinkIds);
|
await _orderRepository.UnLinkByIdsAsync(unLinkIds);
|
||||||
|
|
||||||
return new UnifyResultDto(true);
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public partial class OrderService : ApplicationService, IOrderService
|
|||||||
|
|
||||||
await _orderRepository.DeleteOrderAsync(orderId);
|
await _orderRepository.DeleteOrderAsync(orderId);
|
||||||
|
|
||||||
return new UnifyResultDto(true);
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using SJZY.Expand.ABP.Core;
|
using SJZY.Expand.ABP.Core;
|
||||||
using SJZY.InterfaceRelay.Application.Contracts;
|
using SJZY.InterfaceRelay.Application.Contracts;
|
||||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
|
using SJZY.Track.Application.Helpers;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
using Volo.Abp.Http.Client.DynamicProxying;
|
using Volo.Abp.Http.Client.DynamicProxying;
|
||||||
@ -51,18 +51,21 @@ public class TrackPullService : ApplicationService
|
|||||||
throw new BusinessException(message: "一个能更新的都没有");
|
throw new BusinessException(message: "一个能更新的都没有");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var group in orders.GroupBy(x =>
|
|
||||||
new TrackRefreshAttach(x.ServiceProviderId, x.ServiceProviderCode, x.SubSystemId, x.OrderType)))
|
foreach (var group in orders.GroupBy(x => new
|
||||||
|
{ x.ServiceProviderId, x.ServiceProviderName, x.SubSystemId, x.OrderType }))
|
||||||
{
|
{
|
||||||
var data = group.Select(x => new
|
var data = group.Select(x => new
|
||||||
{
|
{
|
||||||
x.OrderNo
|
x.OrderNo
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
var serviceProviderCode = group.FirstOrDefault()!.ServiceProviderCode;
|
||||||
|
|
||||||
|
var attach = Base64Helper.SerializeObject(group.Key);
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
"A012", group.Key.ServiceProviderCode, data,
|
"A012", serviceProviderCode, data, GlobalConst.TrackRefreshSubscribe, attach);
|
||||||
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -87,6 +90,7 @@ public class TrackPullService : ApplicationService
|
|||||||
|
|
||||||
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
|
var orders = await _provideQueries.FindOrderWithServiceProviderAsync(config.ServiceProviderId);
|
||||||
var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode;
|
var serviceProviderCode = orders.FirstOrDefault()?.ServiceProviderCode;
|
||||||
|
var serviceProviderName = orders.FirstOrDefault()?.ServiceProviderName;
|
||||||
|
|
||||||
foreach (var group in orders.GroupBy(x =>
|
foreach (var group in orders.GroupBy(x =>
|
||||||
new { x.SubSystemId, x.OrderType }))
|
new { x.SubSystemId, x.OrderType }))
|
||||||
@ -96,12 +100,13 @@ public class TrackPullService : ApplicationService
|
|||||||
x.OrderNo
|
x.OrderNo
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderId,
|
||||||
|
serviceProviderName!,
|
||||||
|
group.Key.SubSystemId, group.Key.OrderType));
|
||||||
// 批量获取轨迹
|
// 批量获取轨迹
|
||||||
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
|
||||||
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data,
|
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data,
|
||||||
GlobalConst.TrackRefreshSubscribe,
|
GlobalConst.TrackRefreshSubscribe, attach);
|
||||||
JsonConvert.SerializeObject(new TrackRefreshAttach(config.ServiceProviderId, serviceProviderCode!,
|
|
||||||
group.Key.SubSystemId, group.Key.OrderType)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.PullInterval < 60) config.PullInterval = 60;
|
if (config.PullInterval < 60) config.PullInterval = 60;
|
||||||
|
|||||||
@ -2,12 +2,10 @@
|
|||||||
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;
|
||||||
using SJZY.Track.Domain.Consts;
|
using SJZY.Track.Domain.Consts;
|
||||||
using SJZY.Track.Domain.Enums;
|
|
||||||
using SJZY.UserCenter.HttpApi.Services;
|
using SJZY.UserCenter.HttpApi.Services;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.ProvideServices;
|
namespace SJZY.Track.Application.Services.ProvideServices;
|
||||||
@ -21,17 +19,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 +63,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,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,20 +96,9 @@ public class TrackPushService : ApplicationService
|
|||||||
[HttpPost("Track/PushWarnForTask")]
|
[HttpPost("Track/PushWarnForTask")]
|
||||||
public async Task<string> PushWarnForTaskAsync()
|
public async Task<string> PushWarnForTaskAsync()
|
||||||
{
|
{
|
||||||
var orders = await _orderRepository.GetPushWarnOrdersAsync();
|
// todo:订单数据上来后一次性update是否会引发长时间X独占?
|
||||||
|
var count = await _orderRepository.PushWarnOrdersAsync();
|
||||||
var time = DateTime.Now.Subtract(TimeSpan.FromHours(12));
|
return $"本次预警扫描了:{count}个订单";
|
||||||
|
|
||||||
orders.ForEach(x =>
|
|
||||||
{
|
|
||||||
x.QuestionType = x.LatestPushTime == null || x.LatestPushTime < time
|
|
||||||
? (int)TrackProblemType.Warn
|
|
||||||
: (int)TrackProblemType.None;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _orderRepository.UpdateRangeAsync(orders, x => new { x.QuestionType });
|
|
||||||
|
|
||||||
return $"成功将:{orders.Count(x => x.QuestionType == (int)TrackProblemType.Warn)}个订单置为预警";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -144,6 +109,13 @@ public class TrackPushService : ApplicationService
|
|||||||
[HttpGet("Track/GetTrackPushRecords")]
|
[HttpGet("Track/GetTrackPushRecords")]
|
||||||
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(OrderNoInfo input)
|
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(OrderNoInfo input)
|
||||||
{
|
{
|
||||||
return await _trackPushRecordsRepository.GetTrackPushRecordsAsync(input.OrderNo, input.OrderType);
|
var orderId = await _orderRepository.GetFirstAsync(x =>
|
||||||
|
x.OrderType == input.OrderType && input.OrderNo == x.OrderNo, x => x.Id);
|
||||||
|
if (orderId == default)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: "订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,12 +38,12 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="BusinessException"></exception>
|
/// <exception cref="BusinessException"></exception>
|
||||||
[HttpPost("Track/Upsert")]
|
[HttpPost("Track/Upsert")]
|
||||||
public async Task<bool> UpsertTrackAsync(UpsertTrackInput input)
|
public async Task<UnifyResultDto> UpsertTrackAsync(UpsertTrackInput input)
|
||||||
{
|
{
|
||||||
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.SubSystemId, x.LatestPushTrackContentId, x.CustomId, x.IsCompleted
|
x.Id, x.SubSystemId
|
||||||
});
|
});
|
||||||
if (order == default)
|
if (order == default)
|
||||||
{
|
{
|
||||||
@ -54,12 +54,9 @@ 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 true;
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -69,7 +66,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="BusinessException"></exception>
|
/// <exception cref="BusinessException"></exception>
|
||||||
[HttpPost("Track/BatchUpsert")]
|
[HttpPost("Track/BatchUpsert")]
|
||||||
public async Task<bool> BatchUpsertTrackAsync(BatchUpsertTrackInput input)
|
public async Task<UnifyResultDto> BatchUpsertTrackAsync(BatchUpsertTrackInput input)
|
||||||
{
|
{
|
||||||
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
|
||||||
if (input.OrderNos.Count == 0)
|
if (input.OrderNos.Count == 0)
|
||||||
@ -80,7 +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.OrderNo, x.SubSystemId, x.LatestPushTrackContentId, x.CustomId, x.IsCompleted
|
x.Id, x.OrderNo, x.SubSystemId
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var order in orders)
|
foreach (var order in orders)
|
||||||
@ -97,15 +94,12 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -115,12 +109,13 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="BusinessException"></exception>
|
/// <exception cref="BusinessException"></exception>
|
||||||
[HttpPost("Track/Delete")]
|
[HttpPost("Track/Delete")]
|
||||||
public async Task<bool> DeleteTrackAsync(DeleteTrackInput input)
|
public async Task<UnifyResultDto> DeleteTrackAsync(DeleteTrackInput input)
|
||||||
{
|
{
|
||||||
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.SubSystemId
|
x.Id,
|
||||||
|
x.SubSystemId
|
||||||
});
|
});
|
||||||
if (order == default)
|
if (order == default)
|
||||||
{
|
{
|
||||||
@ -144,7 +139,7 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
};
|
};
|
||||||
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
|
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
|
||||||
|
|
||||||
return true;
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -154,13 +149,14 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="BusinessException"></exception>
|
/// <exception cref="BusinessException"></exception>
|
||||||
[HttpPost("Track/BatchDelete")]
|
[HttpPost("Track/BatchDelete")]
|
||||||
public async Task<bool> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
|
public async Task<UnifyResultDto> BatchDeleteTrackAsync(BatchDeleteTrackInput input)
|
||||||
{
|
{
|
||||||
var orders = await _orderRepository.GetListAsync(x =>
|
var orders = await _orderRepository.GetListAsync(x =>
|
||||||
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo)
|
x.OrderType == input.OrderType && input.OrderNos.Contains(x.OrderNo)
|
||||||
, x => new
|
, x => new
|
||||||
{
|
{
|
||||||
x.Id, x.SubSystemId
|
x.Id,
|
||||||
|
x.SubSystemId
|
||||||
});
|
});
|
||||||
|
|
||||||
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(
|
var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(
|
||||||
@ -185,6 +181,6 @@ public partial class TrackService : ApplicationService, ITrackService
|
|||||||
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
|
await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return new UnifyResultDto(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,297 +1,296 @@
|
|||||||
using Microsoft.Extensions.Localization;
|
using System.Linq.Expressions;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
using SJZY.Expand.ABP.Core.Localization;
|
using SJZY.Expand.ABP.Core.Localization;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Queries;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.TrackContents
|
namespace SJZY.Track.Application.Services.TrackContents;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容服务
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "轨迹内容")]
|
||||||
|
[Route("/Track/Content")]
|
||||||
|
public class TrackContentService : ApplicationService
|
||||||
{
|
{
|
||||||
/// <summary>
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
/// 轨迹内容服务
|
private readonly ITrackContentRepository _trackContentRepository;
|
||||||
/// </summary>
|
|
||||||
[ApiExplorerSettings(GroupName = "轨迹内容")]
|
public TrackContentService(
|
||||||
[Route("/Track/Content")]
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
public class TrackContentService : ApplicationService, ITransientDependency
|
ITrackContentRepository trackContentRepository
|
||||||
|
)
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
private readonly ITrackContentRepository _trackContentRepository;
|
_trackContentRepository = trackContentRepository;
|
||||||
private readonly IBasicQuery<TrackContentMapEntity> _trackContentMapBasicQuery;
|
}
|
||||||
private readonly IBasicQuery<TrackTemplateContentEntity> _trackTemplateContentBasicQuery;
|
|
||||||
|
|
||||||
public TrackContentService(
|
/// <summary>
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
/// 轨迹内容编辑
|
||||||
ITrackContentRepository trackContentRepository,
|
/// </summary>
|
||||||
IBasicQuery<TrackContentMapEntity> trackContentMapBasicQuery,
|
/// <returns></returns>
|
||||||
IBasicQuery<TrackTemplateContentEntity> trackTemplateContentBasicQuery
|
[HttpPost("Edit")]
|
||||||
)
|
public async Task<UnifyResultDto> EditAsync(EditTrackContentInput input)
|
||||||
|
{
|
||||||
|
return input.Options switch
|
||||||
{
|
{
|
||||||
this._stringLocalizer = stringLocalizer;
|
OptionType.新增 => await AddAsync(input),
|
||||||
this._trackContentRepository = trackContentRepository;
|
OptionType.修改 => await UpdateAsync(input),
|
||||||
this._trackContentMapBasicQuery = trackContentMapBasicQuery;
|
OptionType.删除 => await DeleteAsync(input),
|
||||||
this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery;
|
_ => throw new BusinessException(message: "当前操作动作不合法")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据内容id获取轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetDetail")]
|
||||||
|
public async Task<UnifyResultDto<GetTrackContentDetailDto>> GetDetailAsync(int id)
|
||||||
|
{
|
||||||
|
var detailInfo = await _trackContentRepository.GetDetailAsync(id);
|
||||||
|
if (detailInfo == null)
|
||||||
|
{
|
||||||
|
return new UnifyResultDto<GetTrackContentDetailDto>(false, null!, "未查询到轨迹状态");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
|
||||||
/// 轨迹内容编辑
|
return new UnifyResultDto<GetTrackContentDetailDto>("200", "", dto);
|
||||||
/// </summary>
|
}
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("Edit")]
|
|
||||||
public async Task<UnifyResultDto> EditAsync(EditTrackContentInput input)
|
|
||||||
{
|
|
||||||
return input.Options switch
|
|
||||||
{
|
|
||||||
OptionType.新增 => await AddAsync(input),
|
|
||||||
OptionType.修改 => await UpdateAsync(input),
|
|
||||||
OptionType.删除 => await DeleteAsync(input),
|
|
||||||
_ => throw new BusinessException(message: "当前操作动作不合法")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据内容id获取轨迹内容
|
/// 获取分页轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("GetDetail")]
|
[HttpPost("GetList")]
|
||||||
public async Task<UnifyResultDto<GetTrackContentDetailDto>> GetDetailAsync(int id)
|
public async Task<UnifyPageResultDto<GetTrackContentListDto>> GetPageTrackContent(
|
||||||
|
GetPageTrackContentInput input)
|
||||||
|
{
|
||||||
|
var vo = ObjectMapper.Map<GetPageTrackContentInput, GetPageTrackContentVO>(input);
|
||||||
|
var resultDto = await _trackContentRepository.GetPageTrackContent(vo);
|
||||||
|
var pageResultDto =
|
||||||
|
ObjectMapper.Map<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
||||||
|
resultDto);
|
||||||
|
|
||||||
|
return pageResultDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 私有方法
|
||||||
|
|
||||||
|
private async Task<UnifyResultDto> AddAsync(EditTrackContentInput input)
|
||||||
|
{
|
||||||
|
#region 业务逻辑校验
|
||||||
|
|
||||||
|
var trackContentEntitys = await _trackContentRepository.GetListAsync(a =>
|
||||||
|
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
||||||
|
a.Content == input.Content || a.EnContent == input.EnContent));
|
||||||
|
if (trackContentEntitys.Any())
|
||||||
{
|
{
|
||||||
var detailInfo = await _trackContentRepository.GetDetailAsync(id);
|
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||||
if (detailInfo == null)
|
var codes = trackContentEntitys.FirstOrDefault(a => a.Code == input.Code);
|
||||||
|
if (codes != null)
|
||||||
{
|
{
|
||||||
return new UnifyResultDto<GetTrackContentDetailDto>(false, null!, "未查询到轨迹状态");
|
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
var dto = ObjectMapper.Map<GetTrackContentDetailVO, GetTrackContentDetailDto>(detailInfo);
|
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
|
||||||
return new UnifyResultDto<GetTrackContentDetailDto>("200", "", dto);
|
if (contents != null)
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取分页轨迹内容
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("GetList")]
|
|
||||||
public async Task<UnifyPageResultDto<GetTrackContentListDto>> GetPageTrackContent(
|
|
||||||
GetPageTrackContentInput input)
|
|
||||||
{
|
|
||||||
var vo = ObjectMapper.Map<GetPageTrackContentInput, GetPageTrackContentVO>(input);
|
|
||||||
var resultDto = await _trackContentRepository.GetPageTrackContent(vo);
|
|
||||||
var pageResultDto =
|
|
||||||
ObjectMapper.Map<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
|
||||||
resultDto);
|
|
||||||
|
|
||||||
return pageResultDto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 私有方法
|
|
||||||
|
|
||||||
private async Task<UnifyResultDto> AddAsync(EditTrackContentInput input)
|
|
||||||
{
|
|
||||||
#region 业务逻辑校验
|
|
||||||
|
|
||||||
var trackContentEntitys = await _trackContentRepository.GetListAsync(a =>
|
|
||||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
|
||||||
a.Content == input.Content || a.EnContent == input.EnContent));
|
|
||||||
if (trackContentEntitys.Any())
|
|
||||||
{
|
{
|
||||||
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
||||||
var codes = trackContentEntitys.FirstOrDefault(a => a.Code == input.Code);
|
|
||||||
if (codes != null)
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
|
||||||
}
|
|
||||||
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
|
|
||||||
if (contents != null)
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
|
||||||
}
|
|
||||||
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
|
|
||||||
if (contentEns != null)
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
|
||||||
}
|
|
||||||
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 业务逻辑校验
|
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
|
||||||
|
if (contentEns != null)
|
||||||
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
{
|
||||||
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
||||||
|
}
|
||||||
return new UnifyResultDto("200", "新增成功", isTrue);
|
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
#endregion 业务逻辑校验
|
||||||
{
|
|
||||||
#region 业务逻辑校验
|
|
||||||
|
|
||||||
var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id &&
|
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
||||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
||||||
a.Content == input.Content || a.EnContent == input.EnContent));
|
|
||||||
if (trackContentEntitys.Any())
|
return new UnifyResultDto("200", "新增成功", isTrue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
||||||
|
{
|
||||||
|
#region 业务逻辑校验
|
||||||
|
|
||||||
|
var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id &&
|
||||||
|
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
||||||
|
a.Content == input.Content || a.EnContent == input.EnContent));
|
||||||
|
if (trackContentEntitys.Any())
|
||||||
|
{
|
||||||
|
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||||
|
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||||
|
var codes = trackContentEntitys.FirstOrDefault(a => a.Code == input.Code);
|
||||||
|
if (codes != null)
|
||||||
{
|
{
|
||||||
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
||||||
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
}
|
||||||
var codes = trackContentEntitys.FirstOrDefault(a => a.Code == input.Code);
|
|
||||||
if (codes != null)
|
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
|
||||||
|
if (contents != null)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
|
||||||
|
if (contentEns != null)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion 业务逻辑校验
|
||||||
|
|
||||||
|
//更新的时候需要覆盖内容映射轨迹代码
|
||||||
|
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||||
|
|
||||||
|
bool isTrue;
|
||||||
|
|
||||||
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
|
{
|
||||||
|
// 如果轨迹内容的子系统和code发生变化,同步到轨迹映射表
|
||||||
|
if (templateEntity.SubSystemId != input.SubSystemId || templateEntity.Code != input.Code)
|
||||||
|
{
|
||||||
|
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
SubSystemId = input.SubSystemId,
|
||||||
}
|
TrackContentCode = input.Code
|
||||||
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
|
}, x => x.TrackContentId == input.Id);
|
||||||
if (contents != null)
|
|
||||||
|
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
MapSubSystemId = input.SubSystemId,
|
||||||
}
|
MapTrackContentCode = input.Code
|
||||||
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
|
}, x => x.MapTrackContentId == input.Id);
|
||||||
if (contentEns != null)
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 业务逻辑校验
|
ObjectMapper.Map(input, templateEntity);
|
||||||
|
|
||||||
//更新的时候需要覆盖内容映射轨迹代码
|
isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
|
||||||
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
|
|
||||||
|
|
||||||
bool isTrue = false;
|
ts.Complete();
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
|
||||||
// 如果轨迹内容的子系统和code发生变化,同步到轨迹映射表
|
|
||||||
if (templateEntity.SubSystemId != input.SubSystemId || templateEntity.Code != input.Code)
|
|
||||||
{
|
|
||||||
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
|
||||||
{
|
|
||||||
SubSystemId = input.SubSystemId,
|
|
||||||
TrackContentCode = input.Code
|
|
||||||
}, x => x.TrackContentId == input.Id);
|
|
||||||
|
|
||||||
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
|
||||||
{
|
|
||||||
MapSubSystemId = input.SubSystemId,
|
|
||||||
MapTrackContentCode = input.Code
|
|
||||||
}, x => x.MapTrackContentId == input.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, templateEntity);
|
|
||||||
|
|
||||||
isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
|
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnifyResultDto("200", "修改成功", isTrue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
|
return new UnifyResultDto("200", "修改成功", isTrue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
|
||||||
|
{
|
||||||
|
#region 业务校验
|
||||||
|
|
||||||
|
//查询是否关联了轨迹模版内容
|
||||||
|
var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id);
|
||||||
|
if (isExistTemplate)
|
||||||
{
|
{
|
||||||
#region 业务校验
|
throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
||||||
//查询是否关联了轨迹模版内容
|
|
||||||
var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id);
|
|
||||||
if (isExistTemplate)
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
|
||||||
}
|
|
||||||
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
|
|
||||||
//if (trackTemplateContents.Any())
|
|
||||||
//{
|
|
||||||
// throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
|
||||||
//}
|
|
||||||
|
|
||||||
//需要加个判断,存在内容映射,则出提示
|
|
||||||
//var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id);
|
|
||||||
//if (trackContentMapEntities.Any())
|
|
||||||
//{
|
|
||||||
// throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
|
|
||||||
//}
|
|
||||||
#endregion 业务校验
|
|
||||||
|
|
||||||
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
|
||||||
|
|
||||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
|
||||||
}
|
}
|
||||||
|
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
|
||||||
|
//if (trackTemplateContents.Any())
|
||||||
|
//{
|
||||||
|
// throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
||||||
|
//}
|
||||||
|
|
||||||
#endregion 私有方法
|
//需要加个判断,存在内容映射,则出提示
|
||||||
|
//var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id);
|
||||||
|
//if (trackContentMapEntities.Any())
|
||||||
|
//{
|
||||||
|
// throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
#endregion 业务校验
|
||||||
/// 轨迹内容映射列表
|
|
||||||
/// </summary>
|
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||||
[HttpPost("GetMapPage")]
|
}
|
||||||
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input)
|
|
||||||
|
#endregion 私有方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetMapPage")]
|
||||||
|
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(
|
||||||
|
[FromBody] GetTrackContentMapPageInputVO input)
|
||||||
|
{
|
||||||
|
return await _trackContentRepository.GetMapPageAsync(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetMapDetail")]
|
||||||
|
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
||||||
|
{
|
||||||
|
return await _trackContentRepository.GetMapDetailAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射编辑
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("EditMap")]
|
||||||
|
public async Task<bool> EditMapAsync([FromBody] EditTrackContentMapInput input)
|
||||||
|
{
|
||||||
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
{
|
{
|
||||||
return await _trackContentRepository.GetMapPageAsync(input);
|
if (input.SubSystemId == input.MapSubSystemId)
|
||||||
|
throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]);
|
||||||
|
|
||||||
|
Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x =>
|
||||||
|
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
|
||||||
|
if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
|
if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
switch (input.Options)
|
||||||
/// 轨迹内容映射详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("GetMapDetail")]
|
|
||||||
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
|
||||||
{
|
{
|
||||||
return await _trackContentRepository.GetMapDetailAsync(id);
|
case OptionTypeNoNull.新增:
|
||||||
|
{
|
||||||
|
var trackContentMapEntity = ObjectMapper.Map<EditTrackContentMapInput, TrackContentMapEntity>(input);
|
||||||
|
|
||||||
|
await _trackContentRepository.InsertMapAsync(trackContentMapEntity);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OptionTypeNoNull.修改:
|
||||||
|
{
|
||||||
|
var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ??
|
||||||
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
|
ObjectMapper.Map(input, oldTrackContentMapEntity);
|
||||||
|
|
||||||
|
await _trackContentRepository.UpdateMapAsync(oldTrackContentMapEntity);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OptionTypeNoNull.删除:
|
||||||
|
await _trackContentRepository.SoftDeleteMapAsync(x => x.Id == input.Id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
|
nameof(EditTrackContentMapInput.Options)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
return true;
|
||||||
/// 轨迹内容映射编辑
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("EditMap")]
|
|
||||||
public async Task<bool> EditMapAsync([FromBody] EditTrackContentMapInput input)
|
|
||||||
{
|
|
||||||
if (input.Options != OptionTypeNoNull.删除)
|
|
||||||
{
|
|
||||||
if (input.SubSystemId == input.MapSubSystemId) throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]);
|
|
||||||
|
|
||||||
Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x =>
|
|
||||||
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
|
|
||||||
if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
|
|
||||||
|
|
||||||
if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (input.Options)
|
|
||||||
{
|
|
||||||
case OptionTypeNoNull.新增:
|
|
||||||
{
|
|
||||||
var trackContentMapEntity = ObjectMapper.Map<EditTrackContentMapInput, TrackContentMapEntity>(input);
|
|
||||||
|
|
||||||
await _trackContentRepository.InsertMapAsync(trackContentMapEntity);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
|
||||||
{
|
|
||||||
var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackContentMapEntity);
|
|
||||||
|
|
||||||
await _trackContentRepository.UpdateMapAsync(oldTrackContentMapEntity);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
|
||||||
await _trackContentRepository.SoftDeleteMapAsync(x => x.Id == input.Id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
|
||||||
nameof(EditTrackContentMapInput.Options)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<TrackPullParamWithContentConfigDto> GetPullParamWithContentConfigAsync(int subSystemId,
|
public async Task<TrackPullParamWithContentConfigDto?> GetPullParamWithContentConfigAsync(int subSystemId,
|
||||||
int serviceProviderId)
|
int serviceProviderId)
|
||||||
{
|
{
|
||||||
var data = await RedisHelper.Client.GetAsync<TrackPullParamWithContentConfigDto>(TrackPullContentKey(
|
var data = await RedisHelper.Client.GetAsync<TrackPullParamWithContentConfigDto>(TrackPullContentKey(
|
||||||
@ -48,23 +48,22 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<TrackPullParamWithContentConfigDto> SetPullConfigAsync(int? id = null, int? subSystemId = null,
|
public async Task<TrackPullParamWithContentConfigDto?> SetPullConfigAsync(int? id = null, int? subSystemId = null,
|
||||||
int? serviceProviderId = null)
|
int? serviceProviderId = null)
|
||||||
{
|
{
|
||||||
var data = new TrackPullParamWithContentConfigDto();
|
|
||||||
|
|
||||||
Expression<Func<TrackPullConfigEntity, bool>> exp = x => true;
|
Expression<Func<TrackPullConfigEntity, bool>> exp = x => true;
|
||||||
if (id.HasValue) exp = x => x.Id == id;
|
if (id.HasValue) exp = x => x.Id == id;
|
||||||
else if (subSystemId.HasValue && serviceProviderId.HasValue)
|
else if (subSystemId.HasValue && serviceProviderId.HasValue)
|
||||||
exp = x => x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId;
|
exp = x => x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId;
|
||||||
|
|
||||||
var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp);
|
var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp);
|
||||||
if (trackPullConfigEntity == null) return data;
|
if (trackPullConfigEntity == null) return null;
|
||||||
|
|
||||||
var trackPullConfigDetail = await _trackPullConfigRepository.GetDetailAsync(trackPullConfigEntity.Id);
|
var trackPullConfigDetail = await _trackPullConfigRepository.GetDetailAsync(trackPullConfigEntity.Id);
|
||||||
if (trackPullConfigDetail is null) return data;
|
|
||||||
var trackPullContentList = await _trackPullConfigRepository.GetContentListCacheAsync(trackPullConfigEntity.Id);
|
var trackPullContentList = await _trackPullConfigRepository.GetContentListCacheAsync(trackPullConfigEntity.Id);
|
||||||
if (trackPullContentList.Count == 0) return data;
|
if (trackPullContentList.Count == 0) return null;
|
||||||
|
|
||||||
|
var data = new TrackPullParamWithContentConfigDto();
|
||||||
|
|
||||||
data.ParamConfig =
|
data.ParamConfig =
|
||||||
ObjectMapper.Map<GetTrackPullConfigDetailOutputVO, TrackPullParamConfigDto>(trackPullConfigDetail);
|
ObjectMapper.Map<GetTrackPullConfigDetailOutputVO, TrackPullParamConfigDto>(trackPullConfigDetail);
|
||||||
|
|||||||
@ -152,6 +152,7 @@ public class TrackPullService : ApplicationService
|
|||||||
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
||||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
||||||
|
|
||||||
|
await _trackPullCacheService.SetPullConfigAsync(input.Id);
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,19 +183,19 @@ public class TrackPullService : ApplicationService
|
|||||||
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentId == input.TrackContentId)))
|
x.TrackContentId == input.TrackContentId)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
||||||
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
|
||||||
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackStatusValue == input.TrackStatusValue)))
|
x.TrackStatusValue == input.TrackStatusValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
|
||||||
else if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentValue == input.TrackContentValue)))
|
x.TrackContentValue == input.TrackContentValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
||||||
else if (!input.TrackKeywords.IsNullOrEmpty())
|
if (!input.TrackKeywords.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
|
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
|
||||||
input.TrackKeywords!.ForEach(item =>
|
input.TrackKeywords!.ForEach(item =>
|
||||||
|
|||||||
@ -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.IsAutoPush ? 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,9 +5,7 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
|||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Contract.Services;
|
using SJZY.Track.Application.Contract.Services;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
|
||||||
using SJZY.Track.Domain.Dtos.Common;
|
using SJZY.Track.Domain.Dtos.Common;
|
||||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||||
|
|
||||||
@ -22,19 +20,15 @@ public class TrackPushService : ApplicationService
|
|||||||
{
|
{
|
||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
||||||
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
|
|
||||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||||
|
|
||||||
public TrackPushService(
|
public TrackPushService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackPushConfigRepository trackPushConfigRepository,
|
ITrackPushConfigRepository trackPushConfigRepository,
|
||||||
ITrackTemplateRepository trackTemplateRepository,
|
|
||||||
ITrackPullConfigRepository trackPullConfigRepository,
|
|
||||||
ITrackPushCacheService trackPushCacheService)
|
ITrackPushCacheService trackPushCacheService)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackPushConfigRepository = trackPushConfigRepository;
|
_trackPushConfigRepository = trackPushConfigRepository;
|
||||||
_trackPullConfigRepository = trackPullConfigRepository;
|
|
||||||
_trackPushCacheService = trackPushCacheService;
|
_trackPushCacheService = trackPushCacheService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,64 +98,35 @@ public class TrackPushService : ApplicationService
|
|||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
case OptionTypeNoNull.修改:
|
||||||
{
|
{
|
||||||
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;
|
ObjectMapper.Map(input, oldTrackPushEntity);
|
||||||
|
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
||||||
|
|
||||||
var oldTrackPushParamsEntity =
|
if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
|
||||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
}
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPushEntity);
|
|
||||||
ObjectMapper.Map(input, oldTrackPushParamsEntity);
|
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
|
||||||
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
|
||||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.IsAutoPush!.Value) await _trackPushCacheService.SetPushContentConfigsAsync(input.Id);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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 _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
||||||
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -189,72 +154,72 @@ public class TrackPushService : ApplicationService
|
|||||||
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentId == input.TrackContentId)))
|
x.TrackContentId == input.TrackContentId)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
|
||||||
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]);
|
||||||
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackStatusValue == input.TrackStatusValue)))
|
x.TrackStatusValue == input.TrackStatusValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]);
|
||||||
else if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackContentValue == input.TrackContentValue)))
|
x.TrackContentValue == input.TrackContentValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]);
|
||||||
else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() &&
|
if (!input.TrackEnContentValue.IsNullOrWhiteSpace() &&
|
||||||
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
|
||||||
x.TrackEnContentValue == input.TrackEnContentValue)))
|
x.TrackEnContentValue == input.TrackEnContentValue)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
{
|
{
|
||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
{
|
{
|
||||||
int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort,
|
int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort,
|
||||||
x => x.TrackPushConfigId == input.TrackPushConfigId);
|
x => x.TrackPushConfigId == input.TrackPushConfigId);
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
||||||
entity.Sort = maxSort + 1;
|
entity.Sort = maxSort + 1;
|
||||||
|
|
||||||
await _trackPushConfigRepository.InsertContentAsync(entity);
|
await _trackPushConfigRepository.InsertContentAsync(entity);
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(input.TrackPushConfigId);
|
await _trackPushCacheService.SetPushContentConfigsAsync(input.TrackPushConfigId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
case OptionTypeNoNull.修改:
|
||||||
{
|
{
|
||||||
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
ObjectMapper.Map(input, entity);
|
ObjectMapper.Map(input, entity);
|
||||||
|
|
||||||
await _trackPushConfigRepository.UpdateContentAsync(entity);
|
await _trackPushConfigRepository.UpdateContentAsync(entity);
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
|
{
|
||||||
|
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
{
|
{
|
||||||
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1,
|
||||||
|
x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
ts.Complete();
|
||||||
{
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
|
||||||
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1,
|
|
||||||
x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
|
|
||||||
|
|
||||||
ts.Complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _trackPushCacheService.SetPushContentConfigsAsync(entity.TrackPushConfigId);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
nameof(EditTrackPushContentInput.Options)]);
|
nameof(EditTrackPushContentInput.Options)]);
|
||||||
|
|||||||
@ -85,8 +85,11 @@ namespace SJZY.Track.Application
|
|||||||
configure.Password = configuration["RabbitMQ:Password"]!;
|
configure.Password = configuration["RabbitMQ:Password"]!;
|
||||||
configure.Port = configuration.GetValue<int>("RabbitMQ:Port");
|
configure.Port = configuration.GetValue<int>("RabbitMQ:Port");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// options.TopicNamePrefix = "v1";
|
||||||
|
options.SucceedMessageExpiredAfter = 6 * 60 * 60;
|
||||||
options.FailedRetryInterval = 60;
|
options.FailedRetryInterval = 60;
|
||||||
options.FailedRetryCount = 10;
|
options.FailedRetryCount = 3;
|
||||||
options.UseDashboard(dashboardOptions =>
|
options.UseDashboard(dashboardOptions =>
|
||||||
{
|
{
|
||||||
dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached
|
dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached
|
||||||
@ -101,14 +104,14 @@ namespace SJZY.Track.Application
|
|||||||
|-CAP失败回调事件:
|
|-CAP失败回调事件:
|
||||||
|-处理类型:{(faileCalback.MessageType == DotNetCore.CAP.Messages.MessageType.Subscribe ? "消费消息达到最大重试次数,需要开发人员介入" : "生产消息推送失败")}
|
|-处理类型:{(faileCalback.MessageType == DotNetCore.CAP.Messages.MessageType.Subscribe ? "消费消息达到最大重试次数,需要开发人员介入" : "生产消息推送失败")}
|
||||||
|-头部信息:{faileCalback.Message.Headers.ToJson()}
|
|-头部信息:{faileCalback.Message.Headers.ToJson()}
|
||||||
|-消息内容:{((JsonElement?)faileCalback.Message.Value)?.GetRawText()}");
|
|-消息内容:{(faileCalback.Message.Value is string ? faileCalback.Message.Value : ((JsonElement?)faileCalback.Message.Value)?.GetRawText())}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.Error("【严重】CAP失败回调事件发生未处理异常" + ex);
|
LogHelper.Error("【严重】CAP失败回调事件发生未处理异常" + ex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).AddSubscribeFilter<CAPFilter>();
|
}).AddSubscribeFilter<CapFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||||
|
|||||||
@ -26,10 +26,10 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
|
|||||||
Task DeleteOrderAsync(int orderId);
|
Task DeleteOrderAsync(int orderId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取推送预警单
|
/// 更新推送预警单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<OrderEntity>> GetPushWarnOrdersAsync();
|
Task<int> PushWarnOrdersAsync();
|
||||||
|
|
||||||
#region 订单关联
|
#region 订单关联
|
||||||
|
|
||||||
|
|||||||
@ -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; }
|
||||||
}
|
}
|
||||||
@ -16,5 +16,10 @@ public interface ITrackPushRecordsRepository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(int orderId);
|
Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(int orderId);
|
||||||
|
|
||||||
Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(string inputOrderNo, int inputOrderType);
|
/// <summary>
|
||||||
|
/// 获取最新轨迹推送记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<TrackPushRecordIndex?> GetLatestTrackPushRecordAsync(int orderId);
|
||||||
}
|
}
|
||||||
@ -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; }
|
||||||
}
|
}
|
||||||
@ -17,16 +17,6 @@ public class TrackPushRecordIndex : IdBaseIndex
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单号
|
|
||||||
/// </summary>
|
|
||||||
public string OrderNo { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单类型(主数据枚举TrackOrderType)
|
|
||||||
/// </summary>
|
|
||||||
public int OrderType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 接口通请求Id
|
/// 接口通请求Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -78,29 +68,9 @@ public class TrackPushRecordIndex : IdBaseIndex
|
|||||||
public bool IsSuccess { get; set; }
|
public bool IsSuccess { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹代码参数值
|
/// 推送内容(json)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackContentCodeValue { get; set; }
|
public string PushContent { get; set; } = null!;
|
||||||
|
|
||||||
/// <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>
|
||||||
public string? CreateUser { get; set; }
|
public string? CreateUser { 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>
|
||||||
@ -30,7 +35,7 @@ public partial class GlobalConst
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹推送后触发更新订单主表
|
/// 轨迹推送后触发更新订单主表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackPushAfterUpdateOrderSubscribe = "SJZY.Traack.TrackPushAfterUpdateOrder";
|
public const string TrackPushAfterUpdateOrderSubscribe = "SJZY.Track.TrackPushAfterUpdateOrder";
|
||||||
|
|
||||||
/// <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; }
|
|
||||||
}
|
}
|
||||||
@ -16,6 +16,11 @@ public class OrderWithServiceProviderVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServiceProviderCode { get; set; } = null!;
|
public string ServiceProviderCode { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务商name
|
||||||
|
/// </summary>
|
||||||
|
public string ServiceProviderName { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子系统id
|
/// 子系统id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace SJZY.Track.Domain.Dtos.TrackContents
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Domain.Dtos.TrackContents
|
|
||||||
{
|
{
|
||||||
public class GetPageTrackContentVO : PageInfoInput
|
public class GetPageTrackContentVO : PageInfoInput
|
||||||
{
|
{
|
||||||
@ -90,10 +84,5 @@ namespace SJZY.Track.Domain.Dtos.TrackContents
|
|||||||
/// 修改人
|
/// 修改人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpdateUser { get; set; }
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFinish { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace SJZY.Track.Domain.Dtos.TrackContents
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Domain.Dtos.TrackContents
|
|
||||||
{
|
{
|
||||||
public class GetTrackContentDetailVO
|
public class GetTrackContentDetailVO
|
||||||
{
|
{
|
||||||
@ -57,10 +51,5 @@ namespace SJZY.Track.Domain.Dtos.TrackContents
|
|||||||
/// 轨迹标记
|
/// 轨迹标记
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackFlag { get; set; }
|
public string TrackFlag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否完结
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFinish { 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();
|
||||||
@ -120,6 +119,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
OrderType = a.OrderType,
|
OrderType = a.OrderType,
|
||||||
ServiceProviderId = b.ServiceProviderId,
|
ServiceProviderId = b.ServiceProviderId,
|
||||||
ServiceProviderCode = c.Code,
|
ServiceProviderCode = c.Code,
|
||||||
|
ServiceProviderName = c.Name,
|
||||||
SubSystemId = a.SubSystemId
|
SubSystemId = a.SubSystemId
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@ -137,6 +137,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
OrderType = a.OrderType,
|
OrderType = a.OrderType,
|
||||||
ServiceProviderId = b.ServiceProviderId,
|
ServiceProviderId = b.ServiceProviderId,
|
||||||
ServiceProviderCode = c.Code,
|
ServiceProviderCode = c.Code,
|
||||||
|
ServiceProviderName = c.Name,
|
||||||
SubSystemId = a.SubSystemId
|
SubSystemId = a.SubSystemId
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
using SJZY.Track.Domain;
|
using SJZY.Track.Domain;
|
||||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
|
||||||
using SJZY.Track.Domain.Dtos.Order;
|
using SJZY.Track.Domain.Dtos.Order;
|
||||||
using SJZY.Track.Domain.Enums;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
|
|
||||||
@ -55,21 +53,16 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
|
|||||||
tran.Complete();
|
tran.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<OrderEntity>> GetPushWarnOrdersAsync()
|
public async Task<int> PushWarnOrdersAsync()
|
||||||
{
|
{
|
||||||
var errorType = (int)TrackProblemType.Error;
|
return await Context.Ado.ExecuteCommandAsync(@"UPDATE `t_track_push_config` `a`
|
||||||
|
LEFT JOIN `t_order` `b` ON `a`.`SubSystemId` = `b`.`SubSystemId` AND `a`.`CustomId` = `b`.`CustomId`
|
||||||
return await Context.Queryable<TrackPushConfigEntity>()
|
SET `b`.`QuestionType` = CASE
|
||||||
.LeftJoin<OrderEntity>((a, b) => a.SubSystemId == b.SubSystemId && a.CustomId == b.CustomId)
|
WHEN `b`.`LatestPushTime` IS NULL THEN 2
|
||||||
.Where((a, b) => !b.IsCompleted && b.QuestionType != errorType)
|
WHEN `b`.`LatestPushTime` < DATE_SUB(NOW(), INTERVAL 12 HOUR) THEN 2
|
||||||
.Where("a.CreateTime < DATE_SUB(now(),INTERVAL 12 hour)") // 过滤掉创建时间不足12小时的
|
ELSE 0 END
|
||||||
.Select((a, b) => new OrderEntity
|
WHERE `b`.`IsCompleted` = 0 AND `b`.`QuestionType` != 1 AND `b`.`CreateTime` < DATE_SUB(NOW(), INTERVAL 12 HOUR)
|
||||||
{
|
AND `a`.`IsDeleted` = 0 AND `b`.`IsDeleted` = 0;");
|
||||||
Id = b.Id,
|
|
||||||
QuestionType = b.QuestionType,
|
|
||||||
LatestPushTime = b.LatestPushTime
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 订单关联
|
#region 订单关联
|
||||||
@ -84,10 +77,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;
|
||||||
@ -63,10 +61,12 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
.WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId)
|
.WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId)
|
||||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||||
(a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|
(a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|
||||||
|| 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,15 +75,15 @@ 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)
|
||||||
.ElseIF(b.Node == 4).Return("派送").ElseIF(b.Node == 5).Return("其他")
|
.Return("干线")
|
||||||
.End(""),
|
.ElseIF(b.Node == 4).Return("派送").ElseIF(b.Node == 5).Return("其他")
|
||||||
|
.End(""),
|
||||||
TrackFlag = c.Name,
|
TrackFlag = c.Name,
|
||||||
CreateTime = a.CreateTime,
|
CreateTime = a.CreateTime,
|
||||||
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,15 +127,16 @@ 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<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
.LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id == b.TrackContentId && b.IsDeleted == false)
|
||||||
.Where((a, b, c) => a.Id == trackContentId)
|
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false)
|
||||||
.Select((a, b, c) => new
|
.Where((a, b, c) => a.Id == trackContentId)
|
||||||
{
|
.Select((a, b, c) => new
|
||||||
TrackContentId = a.Id,
|
{
|
||||||
TemplateId = c.Id
|
TrackContentId = a.Id,
|
||||||
})
|
TemplateId = c.Id
|
||||||
.ToListAsync();
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
if (trackContentEntities.Any(a => a.TemplateId > 0))
|
if (trackContentEntities.Any(a => a.TemplateId > 0))
|
||||||
{
|
{
|
||||||
@ -144,57 +147,75 @@ 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) =>
|
||||||
Id = contentMap.Id,
|
new GetTrackContentMapPageOutputVO
|
||||||
SubSystem = sourceSystem.CnName,
|
{
|
||||||
Code = contentMap.TrackContentCode,
|
Id = contentMap.Id,
|
||||||
TrackStatus = sourceStatus.Status,
|
SubSystem = sourceSystem.CnName,
|
||||||
Content = sourceContent.Content,
|
Code = contentMap.TrackContentCode,
|
||||||
EnContent = sourceContent.EnContent,
|
TrackStatus = sourceStatus.Status,
|
||||||
MapSubSystem = targetSystem.CnName,
|
Content = sourceContent.Content,
|
||||||
MapCode = contentMap.MapTrackContentCode,
|
EnContent = sourceContent.EnContent,
|
||||||
MapTrackStatus = targetStatus.Status,
|
MapSubSystem = targetSystem.CnName,
|
||||||
MapContent = targetContent.Content,
|
MapCode = contentMap.MapTrackContentCode,
|
||||||
MapEnContent = targetContent.EnContent
|
MapTrackStatus = targetStatus.Status,
|
||||||
})
|
MapContent = targetContent.Content,
|
||||||
|
MapEnContent = targetContent.EnContent
|
||||||
|
})
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
{
|
||||||
SubSystemId = contentMap.SubSystemId,
|
Id = contentMap.Id,
|
||||||
SubSystem = sourceSystem.CnName,
|
SubSystemId = contentMap.SubSystemId,
|
||||||
TrackContent = contentMap.TrackContentCode + "-" + sourceContent.Content,
|
SubSystem = sourceSystem.CnName,
|
||||||
MapSubSystem = targetSystem.CnName,
|
TrackContent = contentMap.TrackContentCode + "-" + sourceContent.Content,
|
||||||
MapTrackContent = contentMap.MapTrackContentCode + "-" + targetContent.Content
|
MapSubSystem = targetSystem.CnName,
|
||||||
}, true)
|
MapTrackContent = contentMap.MapTrackContentCode + "-" + targetContent.Content
|
||||||
|
}, true)
|
||||||
.SingleAsync();
|
.SingleAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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)
|
||||||
@ -146,22 +139,10 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
|
|||||||
return data.Documents.ToList();
|
return data.Documents.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<TrackDetailsIndex>?> GetListAsync(List<int> orderIds)
|
|
||||||
{
|
|
||||||
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x.Query(q =>
|
|
||||||
q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds))
|
|
||||||
)
|
|
||||||
.Size(10000)
|
|
||||||
.Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending))
|
|
||||||
);
|
|
||||||
return data?.Documents?.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<TrackDetailsIndex?> GetLatestAsync(int orderId)
|
public async Task<TrackDetailsIndex?> GetLatestAsync(int orderId)
|
||||||
{
|
{
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,17 +41,16 @@ public class TrackPushRecordsRepository : ElasticSearchContextAbstract<TrackDeta
|
|||||||
return data.Documents.ToList();
|
return data.Documents.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(string orderNo, int orderType)
|
public async Task<TrackPushRecordIndex?> GetLatestTrackPushRecordAsync(int orderId)
|
||||||
{
|
{
|
||||||
var data = await Context.SearchAsync<TrackPushRecordIndex>(x => x
|
var data = await Context.SearchAsync<TrackPushRecordIndex>(x => x
|
||||||
.Index(GlobalConst.TrackPushRecordsIndex)
|
.Index(GlobalConst.TrackPushRecordsIndex)
|
||||||
.Query(q =>
|
.Query(q =>
|
||||||
q.Term(t => t.OrderNo.Suffix("keyword"), orderNo)
|
q.Term(t => t.OrderId, orderId)
|
||||||
&& q.Term(f => f.OrderType, orderType)
|
|
||||||
)
|
)
|
||||||
.Size(1000)
|
.Size(1000)
|
||||||
.Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)));
|
.Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)));
|
||||||
|
|
||||||
return data.Documents.ToList();
|
return data.Documents.FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user