diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningDetailsDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningDetailsDto.cs new file mode 100644 index 00000000..352e6f0c --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningDetailsDto.cs @@ -0,0 +1,106 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +/// +/// 完整预警 +/// +public class CompleteWarningDetailsDto // todo:需要根据状态排序 +{ + /// + /// 预警明细唯一id + /// + public string EsId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystemName { get; set; } // todo:id换名称 + + /// + /// 订单类型 + /// + public int OrderType { get; set; } + + /// + /// 订单类型名称 + /// + public string OrderTypeName { get; set; } // todo:type换名称 + + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } + + /// + /// 状态 (待处理样式标红) + /// 1:待处理,2:已处理,3:已关闭 + /// + public int Status { get; set; } + + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 客户简称 + /// + public int CustomName { get; set; } // todo:id换名称 + + /// + /// 缺失轨迹状态 + /// + public string MissingTrackStatus { get; set; } // todo:id换名称 + + + //视图属性 todo:可以从订单主表拿到 + + /// + /// 最新轨迹状态 + /// + public string LatestTrackStatus { get; set; } + + /// + /// 最新轨迹内容 + /// + public string LatestTrackContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string LatestTrackPlace { get; set; } + + /// + /// 最新轨迹发生时间 + /// + public DateTime LatestTrackTime { get; set; } + + /// + /// 最新轨迹发生时区 + /// + public float LatestTrackTimeZone { get; set; } + + /// + /// 通知对象 + /// + public string NotifyUserNames { get; set; } + + /// + /// 预警创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 预警处理时间 + /// + public DateTime? ProcessedTime { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningRuleItemDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningRuleItemDto.cs new file mode 100644 index 00000000..37a7a04b --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/CompleteWarningRuleItemDto.cs @@ -0,0 +1,72 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; +using Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +/// +/// 完整预警规则配置条目 +/// +public class CompleteWarningRuleItemDto +{ + /// + /// 配置条目唯一id + /// + public int Id { get; set; } + + /// + /// 预警规则主体id + /// + public int WarningId { get; set; } + + /// + /// 订单类型 e.g FBA订单、海运单 + /// + public List OrderType { get; set; } + + /// + /// 检查点轨迹状态id + /// + public int CheckPointTrackStatusId { get; set; } + + /// + /// 检查点轨迹状态 + /// + public string CheckPointTrackStatus { get; set; } + + /// + /// 要求的轨迹状态集合 e.g [揽收/入库中],[提交报关] + /// + public List RequireTrackStatus { get; set; } + + /// + /// 通知对象用户集合 + /// + public List NotifyUsers { get; set; } +} + +/// +/// 订单类型描述 +/// +public class OrderTypeDto +{ + /// + /// 订单类型 + /// + public int OrderType { get; set; } + + /// + /// 订单类型名称 + /// + public string OrderTypeName { get; set; } +} + +/// +/// 要求的轨迹状态项目(每个项目的状态为或关系) +/// +public class RequireTrackStatusItem +{ + /// + /// 轨迹状态集合 + /// + public List Statuses { get; set; } = new(); +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/EditCompleteWarningRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/EditCompleteWarningRuleItemInput.cs new file mode 100644 index 00000000..b3e4063d --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/EditCompleteWarningRuleItemInput.cs @@ -0,0 +1,60 @@ +using System.ComponentModel.DataAnnotations; +using Track.Warning.VNext.Application.Contract.DataAnnotations; +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +/// +/// 编辑完整预警配置 +/// +public class EditCompleteWarningRuleItemInput +{ + /// + /// 预警规主体id + /// + [IdRequired] + public int WarningId { get; set; } + + /// + /// 预警规则配置项目(列表内容传递) + /// + public List Items { get; set; } = new(); +} + +/// +/// 用于编辑的预警规则内容 +/// +public class EditCompleteWarningRuleItemDto +{ + /// + /// 规则项目唯一id(传0视为新增) + /// + public int Id { get; set; } + + /// + /// 订单类型集合(,分割) e.g. 1,2,3 + /// + [Required] + public string OrderTypes { get; set; } + + /// + /// 检查点轨迹状态id + /// + [IdRequired] + public int CheckPointTrackStatusId { get; set; } + + /// + /// 要求的轨迹状态id集合 e.g. [[1,3],[5,7]] + /// required: 集合元素(子集合)不要有交集! + /// + [Required] + [MinLength(1, ErrorMessage = "要求的轨迹状态id集合不能为空")] + public List> RequireTrackStatus { get; set; } + + /// + /// 通知对象用户集合 + /// + [Required] + [MinLength(1, ErrorMessage = "通知对象用户集合不能为空")] + public List NotifyUsers { get; set; } = new(); +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetCompleteWarningRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetCompleteWarningRuleItemInput.cs new file mode 100644 index 00000000..7cd44790 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetCompleteWarningRuleItemInput.cs @@ -0,0 +1,15 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +/// +/// 获取完整预警规则条目列表 +/// +public class GetCompleteWarningRuleItemInput +{ + /// + /// 规则主体id + /// + [IdRequired] + public int WarningId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetPageCompleteWarningDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetPageCompleteWarningDetailsInput.cs new file mode 100644 index 00000000..978e607a --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Complete/GetPageCompleteWarningDetailsInput.cs @@ -0,0 +1,65 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +/// +/// 分页获取完成预警详情 +/// +public class GetPageCompleteWarningDetailsInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 订单号,多个订单号(,分割) + /// + public string? OrderNos { get; set; } + + /// + /// 订单类型 + /// + public int? OrderType { get; set; } + + /// + /// 状态 + /// 1:待处理,2:已处理,3:已关闭 + /// + public int? Status { get; set; } + + /// + /// 客户id + /// + public int? CustomId { get; set; } + + /// + /// 缺失轨迹状态id + /// + public int? MissingTrackStatusId { get; set; } + + /// + /// 通知对象id + /// + public int? NotifyUserId { get; set; } + + /// + /// 预警创建时间开始 + /// + public DateTime? WarningCreateTimeStart { get; set; } + + /// + /// 预警创建时间截止 + /// + public DateTime? WarningCreateTimeEnd { get; set; } + + /// + /// 预警处理时间开始 + /// + public DateTime? WarningHandleTimeStart { get; set; } + + /// + /// 预警处理时间截止 + /// + public DateTime? WarningHandleTimeEnd { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/DataAnnotations/IdRequiredAttribute.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/DataAnnotations/IdRequiredAttribute.cs new file mode 100644 index 00000000..262de8ba --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/DataAnnotations/IdRequiredAttribute.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.DataAnnotations; + +/// +/// 要求id存在并且大于0 +/// +[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] +public sealed class IdRequiredAttribute : RangeAttribute +{ + public IdRequiredAttribute() + : base(1, int.MaxValue) + { + ErrorMessage = "{0} is required and must be greater than 0"; + } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs new file mode 100644 index 00000000..2b9b9d87 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/GetWarningRuleInput.cs @@ -0,0 +1,28 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning; + +/// +/// 获取预警规则主体 +/// +public class GetWarningRuleInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 关键字(kpi/客户名称 模糊) + /// + public string? KeyWord { get; set; } + + /// + /// 是否启用(留null查全部) + /// + public bool? IsEnabled { get; set; } + + /// + /// 预警类型(留null查所有类型) + /// 1:运输时效,2:回传时效,3:完整预警 + /// + public int? WarningType { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/NotifyUserDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/NotifyUserDto.cs new file mode 100644 index 00000000..214d1e71 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/NotifyUserDto.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Common; + +public sealed class NotifyUserDto +{ + /// + /// 用户id + /// + [IdRequired] + public int UserId { get; set; } + + /// + /// 用户名 + /// + [Required] + public string UserName { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/EditReturnWarningRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/EditReturnWarningRuleItemInput.cs new file mode 100644 index 00000000..99524d30 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/EditReturnWarningRuleItemInput.cs @@ -0,0 +1,51 @@ +using System.ComponentModel.DataAnnotations; +using Track.Warning.VNext.Application.Contract.DataAnnotations; +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 编辑回传时效配置 +/// +public class EditReturnWarningRuleItemInput +{ + /// + /// 预警规主体id + /// + [IdRequired] + public int WarningId { get; set; } + + /// + /// 预警规则配置项目(列表内容传递) + /// + public List Items { get; set; } = new(); +} + +/// +/// 用于编辑的预警规则配置项目 +/// +public class EditReturnWarningRuleItemDto +{ + /// + /// 唯一id(传0视为新增) + /// + public int Id { get; set; } + + /// + /// 轨迹状态Id集合(,分割) + /// + [Required] + public string TrackStatusIds { get; set; } + + /// + /// 时效(单位h) + /// + [Range(0.1, float.MaxValue, ErrorMessage = "时效必须大于0.1")] + public float ReturnTimeSpan { get; set; } + + /// + /// 通知对象用户集合 + /// + [MinLength(1, ErrorMessage = "通知对象用户集合不能为空")] + public List NotifyUsers { get; set; } = new(); +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetPageReturnWarningDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetPageReturnWarningDetailsInput.cs new file mode 100644 index 00000000..ad207d97 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetPageReturnWarningDetailsInput.cs @@ -0,0 +1,95 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 分页获取回传预警明细输入 +/// +public class GetPageReturnWarningDetailsInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 订单号,多个订单号(,分割) + /// + public string? OrderNos { get; set; } + + /// + /// 订单类型 + /// + public int? OrderType { get; set; } + + /// + /// 状态 + /// 1:人工介入 2:重试中 3:推送完成 4:已关闭 + /// + public int? Status { get; set; } + + /// + /// 客户id + /// + public int? CustomId { get; set; } + + /// + /// 轨迹状态id + /// + public int? TrackStatusId { get; set; } + + /// + /// 轨迹内容id + /// + public int? TrackContentId { get; set; } + + /// + /// 是否有Kpi考核 (传null为查全部) + /// + public bool? IsKpi { get; set; } + + /// + /// 通知对象用户id + /// + public int? NotifyUserId { get; set; } + + /// + /// 轨迹发生时间开始 + /// + public DateTime? TrackTimeStart { get; set; } + + /// + /// 轨迹发生时间截止 + /// + public DateTime? TrackTimeEnd { get; set; } + + /// + /// 轨迹创建时间开始 + /// + public DateTime? TrackCreateTimeStart { get; set; } + + /// + /// 轨迹创建时间截止 + /// + public DateTime? TrackCreateTimeEnd { get; set; } + + /// + /// 轨迹回传时间开始 + /// + public DateTime? TrackReturnTimeStart { get; set; } + + /// + /// 轨迹回传时间截止 + /// + public DateTime? TrackReturnTimeEnd { get; set; } + + /// + /// 预警创建时间开始 + /// + public DateTime? WarningCreateTimeStart { get; set; } + + /// + /// 预警创建时间截止 + /// + public DateTime? WarningCreateTimeEnd { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnMessageRecordInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnMessageRecordInput.cs new file mode 100644 index 00000000..a8249907 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnMessageRecordInput.cs @@ -0,0 +1,15 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 获取回传报文日志 +/// +public class GetReturnMessageRecordInput +{ + /// + /// 回传预警明细id + /// + [IdRequired] + public string WarningDetailsId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnWarningRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnWarningRuleItemInput.cs new file mode 100644 index 00000000..cf33c4bd --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/GetReturnWarningRuleItemInput.cs @@ -0,0 +1,15 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 获取回传预警规则项目列表 +/// +public class GetReturnWarningRuleItemInput +{ + /// + /// 规则主体id + /// + [IdRequired] + public int WarningId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnMessageRecordDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnMessageRecordDto.cs new file mode 100644 index 00000000..325d5067 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnMessageRecordDto.cs @@ -0,0 +1,32 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 回传报文日志 +/// +public sealed class ReturnMessageRecordDto +{ + /// + /// 回传报文唯一id + /// + public string EsId { get; set; } + + /// + /// 回传预警明细id + /// + public string ReturnWarningDetailsId { get; set; } + + /// + /// 是否成功 + /// + public bool IsSuccess { get; set; } + + /// + /// 报文内容 Json字符串 + /// + public string Message { get; set; } + + /// + /// 报文创建时间 + /// + public DateTime CreateTime { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningDetailsDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningDetailsDto.cs new file mode 100644 index 00000000..cda6d349 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningDetailsDto.cs @@ -0,0 +1,156 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +/// +/// 回传预警明细 +/// todo:需要根据状态排序 +/// +public sealed class ReturnWarningDetailsDto +{ + /// + /// 预警明细唯一id + /// + public string EsId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystemName { get; set; } // todo:id换名称 + + /// + /// 订单类型 + /// + public int OrderType { get; set; } + + /// + /// 订单类型名称 + /// + public string OrderTypeName { get; set; } // todo:type换名称 + + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } + + /// + /// 状态 1:人工介入 2:重试中 3:推送完成 4:已关闭 + /// + public int Status { get; set; } + + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 客户简称 + /// + public string CustomName { get; set; } // todo:id换名称 + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹代码 + /// + public string TrackCode { get; set; } + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } + + /// + /// 推送轨迹代码 + /// + public string PushTrackCode { get; set; } + + /// + /// 推送轨迹状态 + /// + public string PushTrackStatus { get; set; } + + /// + /// 推送轨迹内容 + /// + public string PushTrackContent { get; set; } + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public float TrackTimeZone { get; set; } + + /// + /// 轨迹创建时间 + /// + public DateTime TrackCreateTime { get; set; } + + /// + /// 轨迹回传时间 + /// + public DateTime? TrackReturnTime { get; set; } + + /// + /// 回传时效 + /// + public float? ReturnTimeSpan { get; set; } + + + // todo:计算属性 + + /// + /// 实际回传用时(单位毫秒) + /// + public long? ActualReturnTimeSpan { get; set; } + + /// + /// 系统回传用时(单位毫秒) + /// + public long? SystemReturnTimeSpan { get; set; } + + /// + /// 轨迹创建用时(单位毫秒) + /// + public long TrackCreateTimeSpan { get; set; } + + /// + /// 是否有KPI考核 + /// + public bool IsExistsKpi { get; set; } + + /// + /// 回传重试次数 + /// + public int RetryCount { get; set; } + + /// + /// 通知对象 (未命中kpi考核一定不存在通知人) + /// + public string? NotifyUserNames { get; set; } + + /// + /// 预警创建时间 + /// + public DateTime CreateTime { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningRuleItemDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningRuleItemDto.cs new file mode 100644 index 00000000..8bc133f8 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Return/ReturnWarningRuleItemDto.cs @@ -0,0 +1,39 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +public class ReturnWarningRuleItemDto +{ + /// + /// 规则项目唯一 id + /// + public int Id { get; set; } + + /// + /// 轨迹状态 + /// + public List TrackStatus { get; set; } + + /// + /// 时效(单位h) + /// + public float ReturnTimeSpan { get; set; } + + /// + /// 通知对象 + /// + public List NotifyUsers { get; set; } +} + +public class TrackStatusDto +{ + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 轨迹状态名称 + /// + public string TrackStatus { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/EditTransportWarningSceneRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/EditTransportWarningSceneRuleItemInput.cs new file mode 100644 index 00000000..5d6c5267 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/EditTransportWarningSceneRuleItemInput.cs @@ -0,0 +1,66 @@ +using System.ComponentModel.DataAnnotations; +using Track.Warning.VNext.Application.Contract.DataAnnotations; +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +public class EditTransportWarningSceneRuleItemInput +{ + /// + /// 预警规主体id + /// + [IdRequired] + public int WarningId { get; set; } + + /// + /// 运输预警场景id + /// + [IdRequired] + public int SceneId { get; set; } + + /// + /// 预警规则配置项目(列表内容传递) + /// + public List Items { get; set; } = new(); +} + +/// +/// 用于编辑的预警规则配置项目 +/// +public class EditTransportWarningSceneRuleItemDto +{ + /// + /// 规则项目id(传0视为新增) + /// + public int Id { get; set; } + + /// + /// 起始轨迹状态Id + /// + [IdRequired] + public int StartTrackStatusId { get; set; } + + /// + /// 截止轨迹状态Id + /// + [IdRequired] + public int EndTrackStatusId { get; set; } + + /// + /// 时效 (单位h) + /// + [Range(0.1, float.MaxValue, ErrorMessage = "时效必须大于0.1")] + public float TransportTimeSpan { get; set; } + + /// + /// 起始轨迹生成预警时间 (单位h) + /// + [Range(0.1, float.MaxValue, ErrorMessage = "起始轨迹生成预警时间必须大于0.1")] + public float StartTrackWarningTimeSpan { get; set; } + + /// + /// 通知对象用户集合 + /// + [MinLength(1, ErrorMessage = "通知对象用户集合不能为空")] + public List NotifyUsers { get; set; } = new(); +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetPageTransportWarningDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetPageTransportWarningDetailsInput.cs new file mode 100644 index 00000000..518695c3 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetPageTransportWarningDetailsInput.cs @@ -0,0 +1,54 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 分页获取运输预警明细 +/// +public class GetPageTransportWarningDetailsInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 订单号,多个订单号(,分割) + /// + public string? OrderNos { get; set; } + + /// + /// 订单类型 + /// + public int? OrderType { get; set; } + + /// + /// 状态 + /// + public int? Status { get; set; } + + /// + /// 客户Id + /// + public int? CustomId { get; set; } + + /// + /// 预警名称 + /// + public string? WarningName { get; set; } + + /// + /// 通知对象用户Id + /// + public int? NotifyUserId { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? CreateTimeEnd { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneInput.cs new file mode 100644 index 00000000..c4b95b18 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneInput.cs @@ -0,0 +1,15 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 获取运输时效预警规则场景 +/// +public class GetTransportWarningSceneInput +{ + /// + /// 预警主体id + /// + [IdRequired] + public int WarningId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneRuleItemInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneRuleItemInput.cs new file mode 100644 index 00000000..9636bcf0 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/GetTransportWarningSceneRuleItemInput.cs @@ -0,0 +1,21 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 获取运输时效预警场景规则条目列表 +/// +public class GetTransportWarningSceneRuleItemInput +{ + /// + /// 预警主体id + /// + [IdRequired] + public int WarningId { get; set; } + + /// + /// 运输预警场景id + /// + [IdRequired] + public int SceneId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningDetailsDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningDetailsDto.cs new file mode 100644 index 00000000..39e17621 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningDetailsDto.cs @@ -0,0 +1,149 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 运输时效预警明细 +/// +public sealed class TransportWarningDetailsDto // todo:需要根据状态排序 +{ + /// + /// 预警明细唯一id + /// + public string EsId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystemName { get; set; } // todo:id换名称 + + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 客户简称 + /// + public string CustomName { get; set; } // todo:id换名称 + + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } + + /// + /// 订单类型 + /// + public int OrderType { get; set; } + + /// + /// 订单类型名称 + /// + public string OrderTypeName { get; set; } // todo:type换名称 + + + // 实时属性 todo:从订单查询 + + /// + /// 最新轨迹内容 + /// + public string LatestTrackContent { get; set; } + + /// + /// 最新轨迹时间 + /// + public DateTime LatestTrackTime { get; set; } + + /// + /// 最新轨迹发生时区 + /// + public float LatestTrackTimeZone { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string LatestTrackPlace { get; set; } + + /// + /// 通知对象 + /// + public string NotifyUserNames { get; set; } + + /// + /// 起始轨迹状态 + /// + public string StartTrackStatus { get; set; } + + /// + /// 起始轨迹内容 + /// + public string StartTrackContent { get; set; } + + /// + /// 起始轨迹发生时间 + /// + public DateTime StartTrackTime { get; set; } + + /// + /// 起始轨迹时区 + /// + public float StartTrackTimeZone { get; set; } + + + /// + /// 截止轨迹状态 + /// + public string EndTrackStatus { get; set; } + + /// + /// 截止轨迹内容 + /// + public string? EndTrackContent { get; set; } + + /// + /// 截止轨迹发生时间 + /// + public DateTime? EndTrackTime { get; set; } + + /// + /// 截止轨迹时区 + /// + public float? EndTrackTimeZone { get; set; } + + + /// + /// 预警名称 (预警主体名称 如字节全程时效) + /// + public string WarningName { get; set; } + + /// + /// 预警规则描述(用于tooltip展示) + /// + public string WarningRuleDescription { get; set; } + + + /// + /// 累计运输时间 + /// + public string CumulativeTimeSpan { get; set; } // todo:需要转换为某个格式 + + /// + /// 预警状态 (根据key展示对应名称,即将超时需要标红) + /// 1:即将超时 2:已超时 3:已完成 4:超时完成 5:已关闭,初始为【即将超时】 + /// + public int Status { get; set; } + + /// + /// 预警创建时间 + /// + public DateTime CreateTime { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneDto.cs new file mode 100644 index 00000000..6254ab91 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneDto.cs @@ -0,0 +1,52 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 预警规则场景 +/// +public class TransportWarningSceneDto +{ + /// + /// 场景唯一id + /// + public int Id { get; set; } + + /// + /// 预警规则主体id + /// + public int WarningId { get; set; } + + /// + /// 场景摘要(用于展示场景tabs) + /// + public string Summary { get; set; } // todo:将规则场景一些列因素转换为一段描述 + + /// + /// 是否中转(单一) + /// + public bool? IsTransit { get; set; } + + /// + /// 货物类型(多个,分割) + /// + public string? CargoType { get; set; } + + /// + /// 起运港口(多个,分割) + /// + public string? LeavePort { get; set; } + + /// + /// 产品编码(多个,分割) + /// + public string? ProductCode { get; set; } + + /// + /// 月份(多个/分割) + /// + public string? Months { get; set; } + + /// + /// 区域Id(单一) + /// + public int? AreaId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneRuleItemDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneRuleItemDto.cs new file mode 100644 index 00000000..55bc7f7c --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/TransportWarningSceneRuleItemDto.cs @@ -0,0 +1,49 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Common; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 运输时效场景规则项目 +/// +public class TransportWarningSceneRuleItemDto +{ + /// + /// 规则项目唯一id + /// + public int Id { get; set; } + + /// + /// 起始轨迹状态Id + /// + public int StartTrackStatusId { get; set; } + + /// + /// 起始轨迹状态 + /// + public string StartTrackStatus { get; set; } + + /// + /// 截止轨迹状态Id + /// + public int EndTrackStatusId { get; set; } + + /// + /// 截止轨迹状态 + /// + public string EndTrackStatus { get; set; } + + /// + /// 时效 (单位h) + /// + public float TransportTimeSpan { get; set; } + + /// + /// 起始轨迹生成预警时间 (单位h) + /// + public float StartTrackWarningTimeSpan { get; set; } + + /// + /// 通知对象用户集合 + /// + public List NotifyUsers { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/UpsertTransportWarningSceneInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/UpsertTransportWarningSceneInput.cs new file mode 100644 index 00000000..3a5b55a7 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/Transport/UpsertTransportWarningSceneInput.cs @@ -0,0 +1,47 @@ +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +public class UpsertTransportWarningSceneInput +{ + /// + /// 场景唯一id (传0视为新增) + /// + public int Id { get; set; } + + /// + /// 预警规则主体id + /// + [IdRequired] + public int WarningId { get; set; } + + /// + /// 是否中转(单一) + /// + public bool? IsTransit { get; set; } + + /// + /// 货物类型(多个,分割) + /// + public string? CargoType { get; set; } + + /// + /// 起运港口(多个,分割) + /// + public string? LeavePort { get; set; } + + /// + /// 产品编码(多个,分割) + /// + public string? ProductCode { get; set; } + + /// + /// 月份(多个/分割) + /// + public string? Months { get; set; } + + /// + /// 区域Id(单一) + /// + public int? AreaId { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/UpsertWarningRuleInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/UpsertWarningRuleInput.cs new file mode 100644 index 00000000..0ed4597c --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/UpsertWarningRuleInput.cs @@ -0,0 +1,45 @@ +using System.ComponentModel.DataAnnotations; +using Track.Warning.VNext.Application.Contract.DataAnnotations; + +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning; + +/// +/// 更新或者新增预警规则主体 +/// +public class UpsertWarningRuleInput +{ + /// + /// 唯一id(传0视为新增) + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + [IdRequired] + public int SubSystemId { get; set; } //子系统id + + /// + /// 客户id + /// + [IdRequired] + public int CustomId { get; set; } //客户id + + /// + /// 预警规则名称 + /// + [Required] + public string Name { get; set; } + + /// + /// 是否启用 + /// + [Required] + public bool IsEnabled { get; set; } + + /// + /// 预警类型,1:运输时效,2:回传时效,3:完整预警 + /// + [Range(1, 3, ErrorMessage = "预警类型只能选取以下值,1:运输时效,2:回传时效,3:完整预警")] + public int WarningType { get; set; } +} diff --git a/src/SJZY.Track.Application.Contract/Dtos/Warning/WarningRuleDto.cs b/src/SJZY.Track.Application.Contract/Dtos/Warning/WarningRuleDto.cs new file mode 100644 index 00000000..889d6885 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Warning/WarningRuleDto.cs @@ -0,0 +1,52 @@ +namespace Track.Warning.VNext.Application.Contract.Dtos.Warning; + +/// +/// 预警规则主体 +/// +public sealed class WarningRuleDto +{ + /// + /// 规则主体唯一id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } //子系统id + + /// + /// 子系统名称 + /// + public int SubSystemName { get; set; } // todo:id换name + + /// + /// 客户id + /// + public int CustomId { get; set; } //客户id + + /// + /// 客户简称 + /// + public int CustomName { get; set; } // todo:id换name + + /// + /// 预警规则名称 + /// + public string Name { get; set; } + + /// + /// 是否启用 + /// + public bool IsEnabled { get; set; } + + /// + /// 预警类型,1:运输时效,2:回传时效,3:完整预警 + /// + public int WarningType { get; set; } + + /// + /// 规则版本,用于标识规则产物(如预警信息) + /// + public string Version { get; set; } +} diff --git a/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs b/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs new file mode 100644 index 00000000..f2483db9 --- /dev/null +++ b/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs @@ -0,0 +1,48 @@ +using Microsoft.AspNetCore.Mvc; +using Track.Warning.VNext.Application.Contract.Dtos.Common; +using Track.Warning.VNext.Application.Contract.Dtos.Warning.Complete; + +namespace Track.Warning.VNext.Controllers.Warning; + +/// +/// 完整预警服务 +/// +[ApiController] +[Route("Warning/Complete")] +public class CompleteWarningService : ControllerBase +{ + /// + /// 编辑完整预警规则列表 + /// + /// + /// + [HttpPost("EditCompleteWarningRuleItem")] + public Task EditCompleteWarningRuleItem(EditCompleteWarningRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto()); + } + + /// + /// 获取完整预警规则列表 + /// + /// + /// + [HttpPost("GetCompleteWarningRuleItem")] + public Task>> + GetCompleteWarningRuleItem(GetCompleteWarningRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto>()); + } + + /// + /// 分页获取完整预警详情 + /// + /// + /// + [HttpPost("GetPageCompleteWarningDetails")] + public Task> + GetPageCompleteWarningDetails(GetPageCompleteWarningDetailsInput input) + { + return Task.FromResult(new UnifyPageResultDto()); + } +} diff --git a/src/SJZY.Track.Application/Services/Warning/ReturnWarningService.cs b/src/SJZY.Track.Application/Services/Warning/ReturnWarningService.cs new file mode 100644 index 00000000..35900558 --- /dev/null +++ b/src/SJZY.Track.Application/Services/Warning/ReturnWarningService.cs @@ -0,0 +1,58 @@ +using Microsoft.AspNetCore.Mvc; +using Track.Warning.VNext.Application.Contract.Dtos.Common; +using Track.Warning.VNext.Application.Contract.Dtos.Warning.Return; + +namespace Track.Warning.VNext.Controllers.Warning; + +/// +/// 回传预警服务 +/// +[ApiController] +[Route("Warning/Return")] +public class ReturnWarningService : ControllerBase +{ + /// + /// 编辑回传预警规则列表 + /// + /// + /// + [HttpPost("EditReturnWarningRuleItem")] + public Task EditReturnWarningRuleItem(EditReturnWarningRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto()); + } + + /// + /// 分页获取回传预警明细 + /// + /// + /// + [HttpPost("GetPageReturnWarningDetails")] + public Task> + GetPageReturnWarningDetails(GetPageReturnWarningDetailsInput input) + { + return Task.FromResult(new UnifyPageResultDto()); + } + + /// + /// 获取回传报文日志 + /// + [HttpPost("GetReturnMessageRecord")] + public Task>> + GetReturnMessageRecord(GetReturnMessageRecordInput input) + { + return Task.FromResult(new UnifyResultDto>()); + } + + /// + /// 获取回传预警规则列表 + /// + /// + /// + [HttpPost("GetReturnWarningRuleItem")] + public Task>> + GetReturnWarningRuleItem(GetReturnWarningRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto>()); + } +} diff --git a/src/SJZY.Track.Application/Services/Warning/TransportWarningService.cs b/src/SJZY.Track.Application/Services/Warning/TransportWarningService.cs new file mode 100644 index 00000000..c2c0c829 --- /dev/null +++ b/src/SJZY.Track.Application/Services/Warning/TransportWarningService.cs @@ -0,0 +1,71 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Warning.Transport; + +/// +/// 运输时效预警服务 +/// +[ApiController] +[Route("Warning/Transport")] +public class TransportWarningService : ControllerBase +{ + + /// + /// 编辑预警规则项目(全量) + /// + /// + /// + [HttpPost("EditTransportWarningSceneRuleItem")] + public Task + EditTransportWarningSceneRuleItem(EditTransportWarningSceneRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto()); + } + + + /// + /// 分页获取运输时效预警明细 + /// + /// + /// + [HttpPost("GetPageTransportWarningDetails")] + public Task> + GetPageTransportWarningDetails(GetPageTransportWarningDetailsInput input) + { + return Task.FromResult(new UnifyPageResultDto()); + } + + /// + /// 获取预警规则场景 + /// + /// + /// + [HttpPost("GetTransportWarningScene")] + public Task>> + GetTransportWarningScene(GetTransportWarningSceneInput input) + { + return Task.FromResult(new UnifyResultDto>()); + } + + /// + /// 获取运输时效场景规则项目 + /// + /// + /// + [HttpPost("GetTransportWarningSceneRuleItem")] + public Task>> + GetTransportWarningSceneRuleItem(GetTransportWarningSceneRuleItemInput input) + { + return Task.FromResult(new UnifyResultDto>()); + } + + /// + /// 新增/更新 运输时效场景 + /// + /// + /// + [HttpPost("UpsertTransportWarningScene")] + public Task> + UpsertTransportWarningScene(UpsertTransportWarningSceneInput input) + { + return Task.FromResult(new UnifyResultDto()); + } +} diff --git a/src/SJZY.Track.Application/Services/Warning/WarningService.cs b/src/SJZY.Track.Application/Services/Warning/WarningService.cs new file mode 100644 index 00000000..d5d0a64e --- /dev/null +++ b/src/SJZY.Track.Application/Services/Warning/WarningService.cs @@ -0,0 +1,46 @@ +using Track.Warning.VNext.Application.Contract.Dtos.Warning; + +namespace Track.Warning.VNext.Controllers.Warning; + +/// +/// 预警规则主体 +/// +[ApiController] +[Route("Warning")] +public class WarningService : ControllerBase +{ + /// + /// 新增/修改预警规则主体 + /// + /// + /// + [HttpPost("UpsertWarningRule")] + public async Task> UpsertWarningRule(UpsertWarningRuleInput input) + { + // var id = await _warningRuleRepository.UpsertReturnIdAsync(new WarningRuleEntity( + // input.Id, + // input.Name, + // input.SubSystemId, + // input.CustomId, + // input.IsEnabled, + // input.WarningType) + // ); + + return new UnifyResultDto(true, new IdBaseDto + { + Id = input.Id + }); + } + + /// + /// 获取预警规则列表 + /// + /// + /// + [HttpPost("GetWarningRule")] + public Task>> GetWarningRule(GetWarningRuleInput input) + { + //var result = await _warningRuleRepository.GetWarningRuleListAsync(input.SubSystemId, input.KeyWord, input.IsEnabled, input.WarningType); + throw new NotImplementedException(); + } +} diff --git a/src/SJZY.Track.Domain/Consts/GlobalConst.ES.cs b/src/SJZY.Track.Domain/Consts/GlobalConst.ES.cs index 0a0a5d9c..2e2186ee 100644 --- a/src/SJZY.Track.Domain/Consts/GlobalConst.ES.cs +++ b/src/SJZY.Track.Domain/Consts/GlobalConst.ES.cs @@ -21,4 +21,25 @@ public partial class GlobalConst /// 订单操作记录 es索引名称(模板按天) /// public const string OrderOperationRecordIndex = "sjzy_track_order_operation_records"; + + // todo:以下为新增 + /// + /// 运输时效预警明细 es索引名称(模板按天) + /// + public const string TransportWarningDetailsIndex = "sjzy_track_transport_warning_details"; + + /// + /// 回传时效预警明细 es索引名称(模板按天) + /// + public const string ReturnWarningDetailsIndex = "sjzy_track_return_warning_details"; + + /// + /// 回传报文日志 es索引名称(模板按天) + /// + public const string ReturnMessageRecordIndex = "sjzy_track_return_message_records"; + + /// + /// 完整预警明细 es索引名称(模板按天) + /// + public const string CompleteWarningDetailsIndex = "sjzy_track_complete_warning_details"; } diff --git a/src/SJZY.Track.Domain/Enums/WarningRuleType.cs b/src/SJZY.Track.Domain/Enums/WarningRuleType.cs new file mode 100644 index 00000000..889de9c1 --- /dev/null +++ b/src/SJZY.Track.Domain/Enums/WarningRuleType.cs @@ -0,0 +1,8 @@ +namespace SJZY.Track.Domain.Enums; + +public enum WarningRuleType +{ + 运输时效预警 = 1, + 回传时效预警 = 2, + 完整预警 = 3 +}