diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index c1408517..0c457eb0 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -10,9 +10,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DAC93270-5A2 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.HttpApi", "src\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Application.Contract", "src\SJZY.Track.Application.Contract\SJZY.Track.Application.Contract.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Test", "test\SJZY.Track.Test\SJZY.Track.Test.csproj", "{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}" EndProject diff --git a/src/SJZY.Track.Api/Program.cs b/src/SJZY.Track.Api/Program.cs index 9d6d0ed4..db266046 100644 --- a/src/SJZY.Track.Api/Program.cs +++ b/src/SJZY.Track.Api/Program.cs @@ -10,10 +10,10 @@ try .AddConfigurationContainer() .AddOptionsFromConfiguration() .UseSerilogDefault() - .Host.AddAppSettingsSecretsJson() + .Host.AddAppSettingsSecretsJson() .UseAutofac(); - await builder.AddApplicationAsync(); + await builder.AddApplicationAsync(); var app = builder.Build(); await app.InitializeApplicationAsync(); diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index 0dd07648..be47c0cf 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -1,34 +1,26 @@  - - net7.0 - enable - enable - True - Linux - ..\.. - + - - - - - - + + net7.0 + True + Linux + ..\.. + - - - - - - - + + + + + + + + + + + + - - - - - - diff --git a/src/SJZY.Track.Api/SJZYTrackApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs similarity index 95% rename from src/SJZY.Track.Api/SJZYTrackApiModule.cs rename to src/SJZY.Track.Api/SjzyTrackApiModule.cs index 07bb3fee..13d9633a 100644 --- a/src/SJZY.Track.Api/SJZYTrackApiModule.cs +++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs @@ -9,7 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus; using SJZY.Expand.ABP.Core.Redis; using SJZY.Expand.ABP.Core.Swagger; using SJZY.Track.Application; -using SJZY.Track.Infrastructure; +using SJZY.Track.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; @@ -27,16 +27,17 @@ namespace SJZY.Track.Api typeof(SjzyAbpCodeModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), - typeof(ApplicationModule), - typeof(SJZYTrackInfrastructureModule) + typeof(SjzyTrackApplicationModule), + typeof(SjzyTrackRepositoryModule) )] - public class SJZYTrackApiModule : AbpModule + public class SjzyTrackApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var environment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); context.Services.AddSwagger(); + //过滤器相关配置 context.Services.AddMvc(options => { @@ -60,7 +61,6 @@ namespace SJZY.Track.Api Configure(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss"); Configure(options => { options.IsEnabled = false; }); - context.Services.AddRedis(); } diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 850809ba..17cba222 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -1,7 +1,7 @@ { "Configuration": { - "UseLocalConfiguration": true, // 是否使用本地配置文件 - "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启 UseLocalConfiguration 时生效 + "UseLocalConfiguration": true, //是否使用本地配置文件 + "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration时生效 "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs new file mode 100644 index 00000000..7d8d79c0 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class DeleteOrderInput : OrderNoInfo +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs similarity index 85% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index d1b7cb92..c82bf122 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.ProvideServices +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices { public class GetOrderDetailsInput { @@ -30,7 +24,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// 轨迹内容 /// public string Content { get; set; } - + /// /// 轨迹内容英文 /// @@ -51,4 +45,4 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// public string TrackTimeZone { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs new file mode 100644 index 00000000..be5dbb69 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -0,0 +1,100 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class GetPageTrackOrderInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 单号 + /// + public List? OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? CreateTimeEnd { get; set; } +} + +/// +/// 轨迹订单Dto +/// +public class TrackOrderDto +{ + /// + /// 轨迹订单id + /// + public int Id { get; set; } + + /// + /// 订单类型id + /// + public int OrderType { get; set; } + + /// + /// 订单名称 + /// + public string? OrderTypeName { get; set; } + + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } + + /// + /// 轨迹模版 + /// + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs similarity index 92% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs index d455a5b2..578c31b2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class GetTrackInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs similarity index 87% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs index b6b77862..eda7ecbc 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class GetTrackOutput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs similarity index 90% rename from src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs index ae3dfd9d..cf3e5b79 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class LinkOrderInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs similarity index 84% rename from src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs index 6f98fafc..b4283022 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class OrderNoInfo { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs similarity index 93% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs index d614db45..a6faf08b 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpdateOrderInput : OrderNoInfo { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs similarity index 91% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs index c03d2478..f6c7cb78 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpsertOrderInput : UpdateOrderInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs similarity index 69% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs index fa2112ee..ef0e67a4 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -1,16 +1,16 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpsertTrackInput : OrderNoInfo { /// /// 轨迹内容代码 /// - public string TrackCode { get; set; } + public string TrackCode { get; set; } = null!; /// /// 轨迹发生地 /// - public string TrackPlace { get; set; } + public string TrackPlace { get; set; } = null!; /// /// 轨迹发生时间 diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs similarity index 85% rename from src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs index 9879ffb8..d2a829ca 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackContents +namespace SJZY.Track.Application.Contract.Dtos.TrackContents { public class EditTrackContentInput { @@ -79,12 +73,12 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹内容代码 /// - public string Code { get; set; } + public string Code { get; set; } /// /// 轨迹内容 /// - public string Content { get; set; } + public string Content { get; set; } /// /// 轨迹内容英文 @@ -94,12 +88,11 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹标记id /// - public int TrackFlagId { get; set; } + public int TrackFlagId { get; set; } /// /// 轨迹标记 /// - public string TrackFlag { get; set; } + public string TrackFlag { get; set; } } -} - +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs new file mode 100644 index 00000000..e952cc62 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs @@ -0,0 +1,41 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackContents; + +public class EditTrackContentMapInput +{ + public int? Id { get; set; } + + /// + /// 映射子系统id + /// + public int MapSubSystemId { get; set; } + + /// + /// 映射轨迹内容代码 + /// + public string MapTrackContentCode { get; set; } + + /// + /// 映射轨迹内容id + /// + public int MapTrackContentId { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 源子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 源轨迹内容代码 + /// + public string TrackContentCode { get; set; } + + /// + /// 源轨迹内容id + /// + public int TrackContentId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs similarity index 87% rename from src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 7a009ccb..de3844b5 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackContents +namespace SJZY.Track.Application.Contract.Dtos.TrackContents { public class GetPageTrackContentInput : PageInfoInput { @@ -16,7 +10,12 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } } public class GetTrackContentListDto @@ -81,4 +80,4 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// public string UpdateUser { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs similarity index 86% rename from src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs index 901f5e5a..f4c1083e 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackFlags +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags { public class EditTrackFlagInput { @@ -54,7 +48,7 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// /// 子系统 /// - public string SubSystem { get; set; } + public string SubSystem { get; set; } /// /// 代码 @@ -71,4 +65,4 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// public bool IsFinish { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs similarity index 87% rename from src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs index 714203f2..4280f8d2 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackFlags +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags { public class GetTrackFlagListDto { @@ -61,9 +55,14 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// //public string Keywords { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs similarity index 77% rename from src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs index 71fe55cf..0b69d4a5 100644 --- a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackPull; +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; public class EditTrackPullConfigInput { @@ -37,27 +37,27 @@ public class EditTrackPullConfigInput /// /// 拉取轨迹时区 /// - public string TackTimeZoneName { get; set; } + public string? TackTimeZoneName { get; set; } /// /// 拉取轨迹内容代码 /// - public string TrackContentCodeName { get; set; } + public string? TrackContentCodeName { get; set; } /// /// 拉取轨迹内容 /// - public string TrackContentName { get; set; } + public string? TrackContentName { get; set; } /// /// 拉取轨迹发生地 /// - public string TrackPlaceName { get; set; } + public string? TrackPlaceName { get; set; } /// /// 拉取轨迹状态 /// - public string TrackStatusName { get; set; } + public string? TrackStatusName { get; set; } /// /// 轨迹模板id @@ -67,5 +67,5 @@ public class EditTrackPullConfigInput /// /// 拉取轨迹发生时间 /// - public string TrackTimeName { get; set; } + public string? TrackTimeName { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs similarity index 91% rename from src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs index 74a54567..077f8e0a 100644 --- a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackPull; +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; public class UpdateTrackPullContentInput { @@ -47,5 +47,5 @@ public class UpdateTrackPullContentInput /// /// 轨迹时区GMT /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs new file mode 100644 index 00000000..cf3cb8ee --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs @@ -0,0 +1,81 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; + +public class EditTrackPushConfigInput +{ + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsName { get; set; } + + public int? Id { get; set; } + + /// + /// 是否自动推送 + /// + public bool IsAutoPush { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 推送轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 推送轨迹时区 + /// + public string TackTimeZoneName { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentName { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentName { get; set; } + + /// + /// 推送轨迹发生地 + /// + public string TrackPlaceName { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板id + /// + public List TrackTemplateIds { get; set; } + + /// + /// 推送轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs new file mode 100644 index 00000000..ef22fc85 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs @@ -0,0 +1,61 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; + +public class EditTrackPushContentInput +{ + /// + /// 扩展字段参数值 + /// + public string ExpandFieldsValue { get; set; } + + public int? Id { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 推送单号类型 + /// + public int OrderNoType { get; set; } + + /// + /// 推送轨迹排序 + /// + public int Sort { get; set; } + + /// + /// 轨迹代码参数值 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 轨迹内容参数值 + /// + public string TrackContentValue { get; set; } + + /// + /// 轨迹内容英文参数值 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 轨迹推送配置id + /// + public int TrackPushConfigId { get; set; } + + /// + /// 轨迹状态参数值 + /// + public string TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + public double? TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs new file mode 100644 index 00000000..f4ecab4c --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; + +public class SortTrackPushContentInput +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs similarity index 83% rename from src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs index ce9a0ebf..61a9d98e 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class EditTrackStatusInput { @@ -43,4 +37,4 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// public string? EntrackStatus { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs similarity index 61% rename from src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs index 6779d6da..fe39c418 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class GetTrackStatusDetailDto { @@ -21,26 +15,26 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 子系统 /// - public string SubSystem { get; set; } + public string SubSystem { get; set; } /// /// 节点id /// - public int NodeId { get; set; } + public int NodeId { get; set; } /// /// 所属轨迹状态 /// - public string TrackStatus { get; set; } + public string TrackStatus { get; set; } /// /// 轨迹状态代码 /// - public string Code { get; set; } + public string Code { get; set; } /// /// 轨迹内容英文 /// - public string EntrackStatus { get; set; } + public string EntrackStatus { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs similarity index 86% rename from src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs index ecdb123d..c505aa72 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class GetTrackStatusListDto { @@ -70,6 +64,11 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; } + + /// + /// 选中的轨迹状态id + /// + public List? SelectIds { get; set;} } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs similarity index 91% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs index bb45dc74..0c7144fc 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates; +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates; /// public class EditTrackTemplateContentInput diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs similarity index 51% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index 3be009ac..27d3dfc3 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates { /// /// 获取轨迹模版分页输入 @@ -13,11 +13,16 @@ /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; } + + ///// + ///// 轨迹模版id,轨迹映射的查询使用 + ///// + //public int TrackTemplateId { get; set; } /// - /// 轨迹模版id,轨迹映射的查询使用 + /// 选中的轨迹模版id /// - public int TrackTemplateId { get; set; } + public List? SelectIds { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs similarity index 96% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs index f4ac73d8..86e5db45 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates { /// /// 获取轨迹模版详情 @@ -92,4 +92,4 @@ /// public string? Code { set; get; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs new file mode 100644 index 00000000..ad0fe356 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -0,0 +1,21 @@ +using SJZY.Track.Application.Contract.Dtos.ProvideServices; + +namespace SJZY.Track.Application.Contract.Events; + +public class TrackUpsertEvent : UpsertTrackInput +{ + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 上游子系统id + /// + public int UpSubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/GlobalUsings.cs b/src/SJZY.Track.Application.Contract/GlobalUsings.cs new file mode 100644 index 00000000..99b0e5e1 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/GlobalUsings.cs @@ -0,0 +1,4 @@ +// Global using directives + +global using SJZY.Expand.ABP.Common.Enums; +global using SJZY.Expand.ABP.Core.Common.Dto; \ No newline at end of file diff --git a/src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj similarity index 81% rename from src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj rename to src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj index 1d376964..de5d1421 100644 --- a/src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj +++ b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj @@ -1,9 +1,9 @@ + + net7.0 - enable - enable 0.0.2 diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs new file mode 100644 index 00000000..08ce5194 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackContentService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs new file mode 100644 index 00000000..a7d780b9 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackFlagService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs new file mode 100644 index 00000000..b350cb93 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackStatusService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs b/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs new file mode 100644 index 00000000..0da04423 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Modularity; + +namespace SJZY.Track.Application.Contract; + +public class SjzyTrackApplicationContractModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs deleted file mode 100644 index b315446d..00000000 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ /dev/null @@ -1,33 +0,0 @@ -using AutoMapper; -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Domain.Aggregates.DemoAggregate; -using SJZY.Track.Domain.Dtos.Demo; - -namespace SJZY.Track.Application.AutoMapper; - -internal class AutoMapperProfile : Profile -{ - public AutoMapperProfile() - { - CreateMap, UnifyPageResultDto>(MemberList.None); - - CreateMap(MemberList.None).ReverseMap(); - CreateMap, UnifyPageResultDto>(MemberList.None) - .ReverseMap(); - /* - 代码说明: - MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员) - .ReverseMap()的意思是配置双向调用关系,既一行代码既支持从 GetDemoListByPageInput -> DemoValueObject 的映射,同时也支持从 DemoValueObject -> GetDemoListByPageInput 的映射 - - - 如果对一对模型多次配置规则,会以最后一次为准,配置了这样规则后,最终执行结果是 Name + 444 - CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "22")); - CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "444")); - - */ - - CreateMap(MemberList.None).ReverseMap(); - CreateMap(MemberList.None); - CreateMap(MemberList.None).ReverseMap(); - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs deleted file mode 100644 index 8e04d1ce..00000000 --- a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs +++ /dev/null @@ -1,43 +0,0 @@ -using AutoMapper; -using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Dtos.Demo; - - -namespace SJZY.Track.Application.AutoMapper -{ - /// - /// 稍复杂的配置类 - /// - internal class DemoAutoMapperProfile : Profile - { - public DemoAutoMapperProfile() - { - CreateMap(MemberList.None) - //层级不一致的场景 - .ForMember(dest => dest.QQ, opt => opt.MapFrom(source => source.UserInfo.QQ)) - //数据类型不一致的场景,这里如果不指定映射规则会直接取枚举的key值 - .ForMember(dest => dest.Gender, opt => opt.MapFrom(source => source.Gender.GetDescription())) - //一些简单计算的场景,酌情使用... - .ForMember(dest => dest.Age, opt => opt.MapFrom(source => GetAgeByBirthdate(source.UserInfo.BirthDay))) - //结构不一致的场景 - .ForMember(dest => dest.RoleIds, opt => opt.MapFrom(source => source.UserRoleInputList.Select(m => m.Id).ToArray())) - //条件映射(这里只是举例,日常开发时sqlsugar在新增时会避开自增主键) - .ForMember(dest => dest.Id, opt => - { - opt.Condition(src => src.OptionType == OptionType.删除 || src.OptionType == OptionType.修改); - }); - } - - public int GetAgeByBirthdate(DateTime birthdate) - { - DateTime now = DateTime.Now; - int age = now.Year - birthdate.Year; - if (now.Month < birthdate.Month || (now.Month == birthdate.Month && now.Day < birthdate.Day)) - { - age--; - } - return age < 0 ? 0 : age; - } - - } -} diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index a8d93386..d0ead552 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,7 +1,8 @@ using AutoMapper; using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; using System.Diagnostics; @@ -21,6 +22,7 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs new file mode 100644 index 00000000..b9c185d7 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs @@ -0,0 +1,13 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Events; + +namespace SJZY.Track.Application.AutoMapper; + +public class TrackAutoMapperProfile:Profile +{ + public TrackAutoMapperProfile() + { + CreateMap(MemberList.None); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs index e9346eff..bf20809b 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -1,16 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackContents; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackTemplate; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -22,7 +13,9 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>( + MemberList.None); + CreateMap(MemberList.None); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs index acc0102a..a08aa0a0 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -1,16 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -18,10 +9,9 @@ namespace SJZY.Track.Application.AutoMapper { public TrackFlagAutoMapperProfile() { - CreateMap(MemberList.None) - .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) - .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); + .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) + .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); @@ -32,4 +22,4 @@ namespace SJZY.Track.Application.AutoMapper // resultDto); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index da6207a5..2af35a86 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using Volo.Abp.AutoMapper; diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs index 420b0e23..3a42d0e4 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -1,4 +1,8 @@ using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackPush; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using Volo.Abp.AutoMapper; namespace SJZY.Track.Application.AutoMapper; @@ -6,5 +10,10 @@ public class TrackPushAutoMapperProfile : Profile { public TrackPushAutoMapperProfile() { + CreateMap(MemberList.None) + .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(source => string.Join(',', source.TrackTemplateIds))); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true)); + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs index c66d09e7..49796f47 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs @@ -1,15 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -18,14 +10,15 @@ namespace SJZY.Track.Application.AutoMapper public TrackStatusAutoMapperProfile() { CreateMap(MemberList.None) - //层级不一致的场景 - .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus)) - .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus)) - .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId)); + //层级不一致的场景 + .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus)) + .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus)) + .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList + .None); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index cec240ac..36f0e498 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,9 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper; @@ -19,6 +17,7 @@ public class TrackTemplateAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList + .None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs deleted file mode 100644 index de4bc495..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs +++ /dev/null @@ -1,89 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - /// - /// automapper 复杂转换样例 - /// - public class ComplexAutomapperDemoInput - { - /// - /// 编号 - /// - public int Id { get; set; } - - /// - /// 操作类型 - /// - public OptionType OptionType { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - /// - /// 性别 - /// - public Gender Gender { get; set; } - - /// - /// 用户信息 - /// - public UserInfoInput UserInfo { get; set; } - - /// - /// 用户角色 - /// - public List UserRoleInputList { get; set; } - - /// - /// 拓展演示,目前大家共同约定,暂时不使用充血模型 - /// - /// - public string GetAddress() - { - return "辽宁省沈阳市..."; - } - - } - - public class ComplexAutomapperDemoOutput - { - /// - /// 编号 - /// - public int Id { get; set; } - - /// - /// 性别 - /// - public string Gender { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - /// - /// 年龄 - /// - public int Age { get; set; } - - /// - /// qq号码 - /// - public string QQ { get; set; } - - /// - /// 地址 - /// - public string Address { get; set; } - - /// - /// 角色编号 - /// - public int[] RoleIds { get; set; } - } - - - -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs b/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs deleted file mode 100644 index 30da5896..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class DemoDetailSaveInput - { - /// - /// - /// - public int Id { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 年龄 - /// - public int Age { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - /// - /// 详情合集 - /// - public List DemoDetailList { get; set; } - } - - public class DemoDetailInput - { - /// - /// Id - /// - public int Id { get; set; } - - /// - /// t_demo.id - /// - public int DemoId { get; set; } - - /// - /// 一些说明.. - /// - public string OtherInfo { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs deleted file mode 100644 index 1b46a3e1..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class DemoInput - { - /// - /// 操作类型 - /// - public OptionType Option { get; set; } - - /// - /// - /// - public int Id { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 年龄 - /// - public int Age { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - //以下两个属性用来说明类型转换 - - /// - /// 创建人id - /// - public string CreateUserId { get; set; } - - /// - /// 创建时间 - /// - public string CreateTime { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs b/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs deleted file mode 100644 index 46ef9d04..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class ExcelImportOuput - { - [MiniExcelLibs.Attributes.ExcelColumnName("姓名")] - public string Name { get; set; } - - [MiniExcelLibs.Attributes.ExcelColumnName("年龄")] - public int Age { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs b/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs deleted file mode 100644 index 55d86e2c..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class GetDemoListByPageInput : PageInfoInput - { - /// - /// 姓名 - /// - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs deleted file mode 100644 index 3c5bd96d..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class GetDemoListByPageOutput - { - /// - /// - /// - public int Id { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 年龄 - /// - public int Age { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - public DateTime CreateTime { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs deleted file mode 100644 index 8d6896ac..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class MyCustomerResultOutput - { - public string Code { get; set; } - - public string Message { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs deleted file mode 100644 index 367d2c54..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class OssUploadOutput - { - /// - /// 文件key - /// - public string Key { get; set; } - - /// - /// 文件路径 - /// - public string Url { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs deleted file mode 100644 index f521c50e..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.ComponentModel; -using System.Text.Json.Serialization; - -namespace SJZY.Track.Application.Dtos.Demo -{ - public class SwaggerDemoInput - { - /// - /// 年龄 - /// - /// 18 这里可以写一些初始值 - public int Age { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 性别(枚举的展示样例) - /// - public Gender Gender { get; set; } - - /// - /// 隐藏属性 - /// - [JsonIgnore] - public int MyProperty { get; set; } - } - - public enum Gender - { - [Description("纯爷们")] - 男 = 2, - - [Description("大姑娘")] - 女 = 5, - - [Description("你憋问")] - 未知 = 8 - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs b/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs deleted file mode 100644 index f1c3fc45..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs +++ /dev/null @@ -1,98 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class ValidateExecuteInput - { - /// - /// 操作类型 - /// - public OptionType Option { get; set; } - - /// - /// 主键编号 - /// - public int Id { get; set; } - - /// - /// 雪花ID - /// - public long SnowId { get; set; } - - /// - /// 登录账号 - /// - public string LoginName { get; set; } - - /// - /// 登录密码 - /// - public string? PassWord { get; set; } - - /// - /// 登录密码确认 - /// - public string PassWordAgain { get; set; } - - /// - /// 最大金额额度 - /// - public decimal TotalQuota { get; set; } - - /// - /// 最大数量 - /// - public int MaxCount { get; set; } - - /// - /// 最小数量 - /// - public int MiniCount { get; set; } - - /// - /// 用户信息 - /// - public UserInfoInput UserInfoInput { get; set; } - - /// - /// 用户角色 - /// - public List UserRoleInputList { get; set; } - - } - - public class UserInfoInput - { - /// - /// 生日 - /// - public DateTime BirthDay { get; set; } - - /// - /// qq号码 - /// - public string QQ { get; set; } - - /// - /// 电子邮箱 - /// - public string Email { get; set; } - - /// - /// 用户姓名 - /// - public string UserName { get; set; } - } - - - public class UserRoleInput - { - /// - /// 角色编号 - /// - public int Id { get; set; } - - /// - /// 角色名称 - /// - public string Name { get; set; } - } -} diff --git a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs deleted file mode 100644 index 13cede57..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class ValidateExecuteOutput - { - } -} diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs deleted file mode 100644 index c4fba2a8..00000000 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; - -public class DeleteOrderInput : OrderNoInfo -{ -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs deleted file mode 100644 index 06335e34..00000000 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.ProvideServices -{ - public class GetPageTrackOrderInput : PageInfoInput - { - /// - /// 子系统id - /// - public int SubSystemId { get; set; } - - /// - /// 单号 - /// - public List? OrderNos { get; set; } - - /// - /// 创建时间开始 - /// - public DateTime? CreateTimeStart { get; set; } - - /// - /// 创建时间截止 - /// - public DateTime? CreateTimeEnd { get; set; } - } - - /// - /// 轨迹订单Dto - /// - public class TrackOrderDto - { - /// - /// 轨迹订单id - /// - public int Id { get; set; } - - /// - /// 订单类型id - /// - public int OrderType { get; set; } - - /// - /// 订单号 - /// - public string? OrderNumber { get; set; } - - /// - /// 轨迹模版 - /// - public string? TrackTemplateNames { get; set; } - - /// - /// 客户简称 - /// - public string? CustomerShortName { get; set; } - - /// - /// 客户代码 - /// - public string? CustomerCode { get; set; } - - /// - /// 订单明细(json) - /// - public string? OrderDetails { get; set; } - - /// - /// 最新轨迹内容 - /// - public string? NewestTrackContent { get; set; } - - /// - /// 最新轨迹内容英文 - /// - public string? NewestTrackEnContent { get; set; } - - /// - /// 最新轨迹发生地 - /// - public string? NewestTrackPlace { get; set; } - - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } - - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } - - /// - /// 子系统 - /// - public string SubSystem { get; set; } - } -} diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs new file mode 100644 index 00000000..220607ab --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -0,0 +1,108 @@ +using DotNetCore.CAP; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using SJZY.UserCenter.HttpApi.Services; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.EventHandlers; + +public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe +{ + private readonly IOrderRepository _orderRepository; + private readonly ITrackQueries _trackQueries; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ICapPublisher _capPublisher; + + public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher, + ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository) + { + _orderRepository = orderRepository; + _capPublisher = capPublisher; + _trackQueries = trackQueries; + _trackDetailsRepository = trackDetailsRepository; + } + + [NonAction] + [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] + public async Task ConsumerAsync(TrackUpsertEvent @event) + { + // 不同子系统需要做内容映射 + if (@event.UpSubSystemId != @event.SubSystemId) + { + var mapCode = await _trackQueries.MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); + + if (mapCode == default) + { + throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + } + + @event.TrackCode = mapCode; + } + + await UpsertTrackAsync(@event); + } + + internal async Task UpsertTrackAsync(TrackUpsertEvent @event) + { + // 不存在则新增轨迹,存在则更新 + var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode); + + var isPush = false; // 推送只做新增的,更新和删除的不做先 + if (track == default) + { + // 根据轨迹code在订单模板内容中寻找匹配的 + var trackContent = await _trackQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); + if (trackContent == default) + { + throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); + } + + track = new TrackDetailsIndex + { + OrderId = @event.OrderId, + OrderNo = @event.OrderNo, + OrderType = @event.OrderType, + TrackStatus = trackContent.Status, + TrackCode = @event.TrackCode, + TrackContent = trackContent.Content, + TrackEnContent = trackContent.EnContent, + TrackPlace = @event.TrackPlace, + TrackTime = @event.TrackTime, + TraceTimeZone = @event.TraceTimeZone, + CreateUserId = CurrentUserRequest.CurrentUser.UserId, + CreateTime = DateTime.Now + }; + + isPush = true; + } + else + { + track.TrackPlace = @event.TrackPlace; + track.TrackTime = @event.TrackTime; + track.TraceTimeZone = @event.TraceTimeZone; + track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; + track.UpdateTime = DateTime.Now; + } + + await _trackDetailsRepository.UpsertAsync(track); + + // 根据订单关联关系异步向下刷 + var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); + foreach (var linkedOrder in linkedOrders) + { + var nextEvent = @event.DeepCopy(); + nextEvent.OrderId = linkedOrder.OrderId; + nextEvent.SubSystemId = linkedOrder.SubSystemId; + nextEvent.UpSubSystemId = @event.SubSystemId; + await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent); + } + + if (isPush) + { + //await PushTrack(); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs index e21f1746..e4968bf8 100644 --- a/src/SJZY.Track.Application/GlobalUsing.cs +++ b/src/SJZY.Track.Application/GlobalUsing.cs @@ -5,3 +5,4 @@ global using SJZY.Expand.ABP.Core.Common.Dto; global using Volo.Abp; global using Volo.Abp.Application.Services; global using Volo.Abp.Validation; +global using SJZY.Track.Domain; \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsings.cs b/src/SJZY.Track.Application/GlobalUsings.cs deleted file mode 100644 index 63eef9f8..00000000 --- a/src/SJZY.Track.Application/GlobalUsings.cs +++ /dev/null @@ -1,3 +0,0 @@ -// Global using directives - -global using SJZY.Track.Domain; \ No newline at end of file diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 9e31fad8..c7d369bc 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -7,6 +7,9 @@ "TemplateExist": "The template code already exists under the currently selected subsystem", "TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English", "TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem", - "TrackFlagExist": "Duplicate code or flag in the current subsystem" + "TrackFlagExist": "Duplicate code or flag in the current subsystem", + "IsExistTrackPullConfig": "Track Pull The template has been bound. Delete the track pull before deleting the template", + "IsExistTrackStatus": "The trajectory content has been bound to the trajectory status. Delete the trajectory content before deleting the trajectory status", + "IsExistTrackFlag": "The track content has been bound to the track mark. Delete the track content before deleting the track mark" } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Localization/Resources/zh.json b/src/SJZY.Track.Application/Localization/Resources/zh.json index 24a80165..38db9ebb 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -7,6 +7,9 @@ "TemplateExist": "模板代码已存在于当前选择的子系统下", "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复", - "TrackFlagExist": "当前子系统下代码或标记重复" + "TrackFlagExist": "当前子系统下代码或标记重复", + "IsExistTrackPullConfig": "轨迹拉取已绑定了该模版,请先删除轨迹拉取再删除该模版", + "IsExistTrackStatus": "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态", + "IsExistTrackFlag": "轨迹内容已经绑定了该轨迹标记,请先删除轨迹内容后再删除该轨迹标记" } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index ccc853da..cb744d89 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -1,32 +1,21 @@  - - - - net7.0 - True - + - - - - - - - - + + net7.0 + True + - - - - - - - - + + + + + + - - - - + + + + diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs deleted file mode 100644 index 6402f596..00000000 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ /dev/null @@ -1,251 +0,0 @@ -using SJZY.Expand.ABP.Core.Common; -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Domain.Aggregates.DemoAggregate; -using SJZY.Track.Domain.Dtos.Demo; - -namespace SJZY.Track.Application.Services.Demo; - -/// -/// 接口请求完整样例 -/// -[ApiExplorerSettings(GroupName = "Demo")] -public class InterFaceDemoService : ApplicationService -{ - #region 构造函数 - - private readonly IDemoRepository _demoRepository; - - public InterFaceDemoService(IDemoRepository demoRepository) - { - _demoRepository = demoRepository; - } - - #endregion - - #region 增删改 - - /// - /// 增删改 - /// - /// - /// - [HttpPost("InterFace/Edit")] - public async Task Edit(DemoInput input) - { - var res = new LongIdBaseDto(); - - if (input.Option == OptionType.新增) - { - var entity = ObjectMapper.Map(input); - res.Id = await _demoRepository.InsertReturnIdentityAsync(entity); - } - else if (input.Option == OptionType.修改 || input.Option == OptionType.删除) - { - var demoInfo = await _demoRepository.GetById1(input.Id); - if (demoInfo == null) - { - //校验数据是否存在... - throw new BusinessException(message: "未找到指定编号下的数据"); - } - - res.Id = demoInfo.Id; - if (input.Option == OptionType.删除) - { - //await _demoRepository.DeleteAsync(demoInfo); //真删除 - - //软删除 - demoInfo.IsDeleted = true; - await _demoRepository.UpdateAsync(demoInfo); - } - else - { - var entity = ObjectMapper.Map(input, demoInfo); - await _demoRepository.UpdateAsync(entity); - } - } - - return res; - } - - #endregion - - #region 局部更新最佳实践 - - /// - /// 局部更新最佳实践 - /// - /// - /// - /// - [HttpPost("InterFace/UpdatePartColumns")] - public async Task UpdatePartColumns(DemoInput input) - { - var demoInfo = await _demoRepository.GetById1(input.Id); - if (demoInfo == null) - { - //校验数据是否存在... - throw new BusinessException(message: "未找到指定编号下的数据"); - } - - //更新同时忽略某几项参数 - await _demoRepository.UpdatePartColumns(demoInfo); - - return new IdBaseDto() { Id = input.Id }; - } - - #endregion - - #region 分页查询接口 - - /// - /// 分页查询 - /// - /// - /// - [HttpPost("InterFace/GetListByPage")] - public async Task> GetListByPage(GetDemoListByPageInput input) - { - //分页时返回值统一用 PageResultDto<> 类型 - var list = await _demoRepository.GetListByPage(input.PageSize, input.PageIndex, input.Name); - - var res = ObjectMapper.Map, UnifyPageResultDto>(list); - - return res; - } - - #endregion - - #region 入参转换 - - /// - /// 入参转换 - /// - /// - /// - [HttpPost("InterFace/InputToValueObject")] - public async Task> InputToValueObject(GetDemoListByPageInput input) - { - var obj = ObjectMapper.Map(input); - var list = await _demoRepository.InputToValueObject(obj); - - var res = ObjectMapper.Map, List>(list); - return res; - } - - #endregion - - #region 原生sql - - /// - /// 原生sql - /// - /// - /// - [HttpPost("InterFace/OriginalSql")] - public async Task> OriginalSql(DemoValueObject obj) - { - var list = await _demoRepository.OriginalSql(obj); - return list; - } - - #endregion - - #region 自定义返回结果格式 - - /// - /// 自定义返回结果格式 - /// - /// - /// - [HttpPost("Demo/CustomerResult")] - [CustomerResult] - public async Task GetListAsync() - { - /* - 说明: - 理论上我们有全公司级别的返回值约定,不管是前端调后端,还是后端微服务间的调用,都应完全遵循该规范。 - 但不排除有些特殊情况下,必须要返回自定义格式的场景。 - */ - - var res = new MyCustomerResultOutput(); - res.Code = "200"; - res.Message = "这是一个自定义返回结果"; - - return res; - } - - #endregion - - #region 约定类型下返回null - - /// - /// 约定类型下返回null - /// - /// - /// - [HttpPost("Demo/ReturnNull")] - public async Task ReturnNull() - { - MyCustomerResultOutput res = null; - return res; - } - - #endregion - - #region - - /// - /// 没有返回值 - /// - /// - /// - [HttpPost("Demo/WithoutReturnObject")] - public async Task WithoutReturnObject() - { - return null; - } - - #endregion - - #region 主从关系实体存储 - - /// - /// 主从关系实体存储 - /// - /// - /// - [HttpPost("InterFace/EntityRelationSave")] - public async Task EntityRelationSave(DemoDetailSaveInput input) - { - var obj = ObjectMapper.Map(input); - var res = await _demoRepository.EntityRelationSave(obj); - - return new UnifyResultDto(res); - } - - #endregion - - #region 数据缓存 - - /// - /// 数据缓存 - /// - /// - /// - [HttpPost("InterFace/GetDataCache")] - public async Task GetDataCache(IdBaseDto input) - { - var res = await _demoRepository.GetDataCache(input.Id); - return res; - } - - #endregion - - //[HttpPost("InterFace/AAAA")] - //public async Task AAAA() - //{ - // var result = await _httpClientProxy.Service.GetSystemTokenAsync("Track"); - - // return result; - //} -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index e21ca538..f0261697 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Queries; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 8b6b8e19..0f5fa583 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,7 +1,8 @@ -using SJZY.Expand.ABP.Core.Common.Dto; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; +using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.Services.ProvideServices; @@ -12,10 +13,14 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class OrderService : ApplicationService { private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; - public OrderService(IOrderRepository orderRepository) + public OrderService(IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository + ) { _orderRepository = orderRepository; + this._trackDetailsRepository=trackDetailsRepository; } /// @@ -76,7 +81,14 @@ public class OrderService : ApplicationService [HttpPost("/Order/GetDetails")] public async Task> GetOrderDetails(GetOrderDetailsInput input) { - return null; + var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); + if (!trackDetails.IsNullOrEmpty()) + { + var list = ObjectMapper.Map, List>(trackDetails); + return list; + } + + return new List(); } #endregion @@ -93,7 +105,8 @@ public class OrderService : ApplicationService { var vo = ObjectMapper.Map(input); var pageList = await _orderRepository.GetPageTrackOrder(vo); - var pageResultDto = ObjectMapper.Map, UnifyPageResultDto>(pageList); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs new file mode 100644 index 00000000..5474a9be --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs @@ -0,0 +1,10 @@ +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹推送服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class TrackPushService: ApplicationService +{ + +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 587c316b..79f0cb2e 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Queries; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 7077cfb3..d7cc59e3 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,9 +1,7 @@ -using DotNetCore.CAP; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Application.EventHandlers; using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -using SJZY.Track.Domain.Queries; -using SJZY.UserCenter.HttpApi.Services; namespace SJZY.Track.Application.Services.ProvideServices; @@ -14,17 +12,12 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackService : ApplicationService { private readonly IOrderRepository _orderRepository; - private readonly ITrackDetailsRepository _trackDetailsRepository; - private readonly ITrackQueries _trackQueries; - private readonly ICapPublisher _capPublisher; + private readonly TrackUpsertEventHandler _trackUpsertEventHandler; - public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher) + public TrackService(IOrderRepository orderRepository, TrackUpsertEventHandler trackUpsertEventHandler) { - _trackQueries = trackQueries; _orderRepository = orderRepository; - _trackDetailsRepository = trackDetailsRepository; - _capPublisher = capPublisher; + _trackUpsertEventHandler = trackUpsertEventHandler; } /// @@ -36,53 +29,21 @@ public class TrackService : ApplicationService [HttpPost("Track/Upsert")] public async Task UpsertTrackAsync(UpsertTrackInput input) { - var orderId = await _orderRepository.GetFirstAsync(x => - x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); - if (orderId == default) + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new + { + x.Id, x.SubSystemId, x.IsPushCompleted + }); + if (order == default) { throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); } - // 不存在则新增轨迹,存在则更新 - var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode); - if (track == default) - { - var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode); - if (trackContent == default) - { - throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}"); - } - - track = new TrackDetailsIndex - { - OrderId = orderId, - OrderNo = input.OrderNo, - OrderType = input.OrderType, - TrackStatus = trackContent.Status, - TrackCode = input.TrackCode, - TrackContent = trackContent.Content, - TrackEnContent = trackContent.EnContent, - TrackPlace = input.TrackPlace, - TrackTime = input.TrackTime, - TraceTimeZone = input.TraceTimeZone, - CreateUserId = CurrentUserRequest.CurrentUser.UserId, - CreateTime = DateTime.Now - }; - await _trackDetailsRepository.CreateAsync(track); - } - else - { - track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; - track.UpdateTime = DateTime.Now; - track.TrackPlace = input.TrackPlace; - track.TrackTime = input.TrackTime; - track.TraceTimeZone = input.TraceTimeZone; - await _trackDetailsRepository.UpdateAsync(track); - } - - // 根据订单关联关系向下刷,不同子系统还需要做内容映射 - - // 推送 + // 新增/更新轨迹 + var @event = ObjectMapper.Map(input); + @event.OrderId = order.Id; + @event.SubSystemId = order.SubSystemId; + await _trackUpsertEventHandler.UpsertTrackAsync(@event); return true; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs deleted file mode 100644 index 8747af44..00000000 --- a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackContents -{ - public interface ITrackContentService - { - - } -} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 3245d2ce..b746323f 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,16 +1,14 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackContents; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackContents @@ -28,10 +26,11 @@ namespace SJZY.Track.Application.Services.TrackContents public TrackContentService( IStringLocalizer stringLocalizer, ITrackContentRepository trackContentRepository - ) + + ) { - this._stringLocalizer=stringLocalizer; - this._trackContentRepository=trackContentRepository; + this._stringLocalizer = stringLocalizer; + this._trackContentRepository = trackContentRepository; } /// @@ -74,7 +73,8 @@ namespace SJZY.Track.Application.Services.TrackContents /// /// [HttpPost("GetList")] - public async Task> GetPageTrackContent(GetPageTrackContentInput input) + public async Task> GetPageTrackContent( + GetPageTrackContentInput input) { var vo = ObjectMapper.Map(input); var resultDto = await _trackContentRepository.GetPageTrackContent(vo); @@ -86,16 +86,20 @@ namespace SJZY.Track.Application.Services.TrackContents } #region 私有方法 + private async Task AddAsync(EditTrackContentInput input) { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&&(a.Code==input.Code || - a.Content==input.Content || a.EnContent==input.EnContent)); + + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); if (trackContentEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - #endregion + + #endregion 业务逻辑校验 var entity = ObjectMapper.Map(input); var isTrue = await _trackContentRepository.InsertAsync(entity); @@ -106,27 +110,135 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task UpdateAsync(EditTrackContentInput input) { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId==input.SubSystemId && (a.Code==input.Code || - a.Content==input.Content || a.EnContent==input.EnContent)); + + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); if (trackContentEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - #endregion + #endregion 业务逻辑校验 + + //更新的时候需要覆盖内容映射轨迹代码 var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); - ObjectMapper.Map(input, templateEntity); - var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); + + bool isTrue = false; + + 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 DeleteAsync(EditTrackContentInput input) { + #region 业务校验 + + //需要加个判断,存在内容映射,则出提示 + + #endregion 业务校验 + var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); } - #endregion + + #endregion 私有方法 + + /// + /// 轨迹内容映射列表 + /// + /// + /// + [HttpPost("GetMapPage")] + public async Task> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input) + { + return await _trackContentRepository.GetMapPageAsync(input); + } + + /// + /// 轨迹内容映射详情 + /// + /// + /// + [HttpGet("GetMapDetail")] + public async Task GetMapDetailAsync(int id) + { + return await _trackContentRepository.GetMapDetailAsync(id); + } + + /// + /// 轨迹内容映射编辑 + /// + /// + /// + [HttpPost("EditMap")] + public async Task EditMapAsync([FromBody] EditTrackContentMapInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> 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(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; + } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs deleted file mode 100644 index 1e745341..00000000 --- a/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackFlags -{ - public interface ITrackFlagService - { - } -} diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index 112345e2..01e9acd4 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -1,16 +1,9 @@ using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; -using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackFlags @@ -24,14 +17,17 @@ namespace SJZY.Track.Application.Services.TrackFlags { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackFlagRepository _trackFlagRepository; + private readonly ITrackContentRepository _trackContentRepository; public TrackFlagService( IStringLocalizer stringLocalizer, - ITrackFlagRepository trackFlagRepository - ) + ITrackFlagRepository trackFlagRepository, + ITrackContentRepository trackContentRepository + ) { - this._stringLocalizer=stringLocalizer; - this._trackFlagRepository=trackFlagRepository; + this._stringLocalizer = stringLocalizer; + this._trackFlagRepository = trackFlagRepository; + this._trackContentRepository=trackContentRepository; } /// @@ -86,14 +82,18 @@ namespace SJZY.Track.Application.Services.TrackFlags } #region 私有方法 + private async Task AddAsync(EditTrackFlagInput input) { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || a.Name==input.Flag)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -105,12 +105,15 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task UpdateAsync(EditTrackFlagInput input) { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Name ==input.Flag)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Name == input.Flag)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); } + #endregion var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id); @@ -122,10 +125,18 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task DeleteAsync(EditTrackFlagInput input) { + #region 业务校验 + var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id); + if (isExistContent!=null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]); + } + #endregion var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); } + #endregion } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index fcd56e92..7f1ad2de 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -1,13 +1,13 @@ -using Microsoft.Extensions.Localization; +using System.Linq.Expressions; +using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; -using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPull; @@ -50,7 +50,8 @@ public class TrackPullService : ApplicationService, ITransientDependency /// /// [HttpPost("GetContentPage")] - public async Task> GetContentPageAsync([FromBody] GetTrackPullContentPageInputVO input) + public async Task> GetContentPageAsync( + [FromBody] GetTrackPullContentPageInputVO input) { return await _trackPullConfigRepository.GetContentPageAsync(input); } @@ -88,7 +89,8 @@ public class TrackPullService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isAnyExp = x => - x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; + x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && + x.ServiceProviderId == input.ServiceProviderId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) @@ -100,9 +102,11 @@ public class TrackPullService : ApplicationService, ITransientDependency case OptionTypeNoNull.新增: { var trackPullEntity = ObjectMapper.Map(input); - var trackPullParamsEntity = ObjectMapper.Map(input); + var trackPullParamsEntity = + ObjectMapper.Map(input); - var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); var trackPullContentEntities = new List(); @@ -121,6 +125,7 @@ public class TrackPullService : ApplicationService, ITransientDependency TrackContentId = item.TrackContentId }); } + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); ts.Complete(); @@ -130,15 +135,20 @@ public class TrackPullService : ApplicationService, ITransientDependency case OptionTypeNoNull.修改: { - var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); - var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); + var oldTrackPullParamsEntity = + await _trackPullConfigRepository.GetParamsSingleAsync(x => + x.PullOrPushConfigId == input.Id && !x.IsPush); var trackPullContentEntities = new List(); if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) { - var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => + x.TrackTemplateId == input.TrackTemplateId); foreach (var item in trackTemplateContentEntities) { @@ -173,11 +183,13 @@ public class TrackPullService : ApplicationService, ITransientDependency using (var ts = TransactionScopeHelper.Create()) { await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id); - await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); + await _trackPullConfigRepository.SoftDeleteParamsAsync(x => + x.PullOrPushConfigId == input.Id && !x.IsPush); await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); ts.Complete(); } + break; default: @@ -196,7 +208,8 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { - var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); ObjectMapper.Map(input, oldTrackPullContentEntity); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index f303cc4c..cbb9a835 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -1,8 +1,17 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.DemoAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; +using SqlSugar; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPush; @@ -16,13 +25,19 @@ public class TrackPushService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackPushConfigRepository _trackPushConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; public TrackPushService( IStringLocalizer stringLocalizer, - ITrackPushConfigRepository trackPushConfigRepository) + ITrackPushConfigRepository trackPushConfigRepository, + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository) { _stringLocalizer = stringLocalizer; _trackPushConfigRepository = trackPushConfigRepository; + _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository = trackPullConfigRepository; } /// @@ -55,6 +70,182 @@ public class TrackPushService : ApplicationService, ITransientDependency [HttpGet("GetDetail")] public async Task GetDetailAsync(int id) { - return await _trackPushConfigRepository.GetDetailAsync(id); + var res = await _trackPushConfigRepository.GetDetailAsync(id); + if (res is null) return null; + + List trackTemplateIds = res.TrackTemplateId.Split(',').Select(int.Parse).ToList(); + + var trackTemplateEntities = await _trackTemplateRepository.GetListAsync(x => trackTemplateIds.Contains(x.Id)); + + trackTemplateEntities.ForEach(item => { (res.TrackTemplate ??= new()).Add(new() { Value = item.Id, Key = item.Name }); }); + + return res; + } + + /// + /// 轨迹推送配置内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackPushConfigRepository.GetContentDetailAsync(id); + } + + /// + /// 轨迹推送配置编辑 + /// + /// + /// + [HttpPost("Edit")] + public async Task EditAsync([FromBody] EditTrackPushConfigInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isAnyExp = x => + x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; + if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + + var trackTemplateIdExp = Expressionable.Create(); + foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); } + + if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp.And(trackTemplateIdExp.ToExpression()))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPushEntity = ObjectMapper.Map(input); + var trackPushParamsEntity = ObjectMapper.Map(input); + + using (var ts = TransactionScopeHelper.Create()) + { + int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity); + + trackPushParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity); + + if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.修改: + { + var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + int oldCustomId = oldTrackPushEntity.CustomId; + + var oldTrackPushParamsEntity = + await _trackPullConfigRepository.GetParamsSingleAsync(x => + x.PullOrPushConfigId == input.Id && x.IsPush); + + ObjectMapper.Map(input, oldTrackPushEntity); + ObjectMapper.Map(input, oldTrackPushParamsEntity); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity); + await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity); + + await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldCustomId); + if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.删除: + { + var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id); + await _trackPullConfigRepository.SoftDeleteParamsAsync(x => + x.PullOrPushConfigId == input.Id && x.IsPush); + await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id); + + await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId); + + ts.Complete(); + } + } + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPushConfigInput.Options)]); + } + + return true; + } + + /// + /// 轨迹推送配置内容编辑 + /// + /// + /// + [HttpPost("EditContent")] + public async Task EditContentAsync([FromBody] EditTrackPushContentInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isContentAnyExp = x => + x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId; + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); + + if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPushContentEntity = ObjectMapper.Map(input); + + await _trackPushConfigRepository.InsertContentAsync(trackPushContentEntity); + } + break; + + case OptionTypeNoNull.修改: + { + var oldTrackPushContentEntity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldTrackPushContentEntity); + + await _trackPushConfigRepository.UpdateContentAsync(oldTrackPushContentEntity); + } + break; + + case OptionTypeNoNull.删除: + await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id); + + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPushContentInput.Options)]); + } + + return true; + } + + /// + /// 轨迹推送配置内容排序 + /// + /// + /// + [HttpPost("SortContent")] + public async Task SortContentAsync([FromBody] SortTrackPushContentInput input) + { + return true; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs deleted file mode 100644 index eef632b7..00000000 --- a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackStatus -{ - public interface ITrackStatusService - { - } -} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index bd58470f..686854db 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using Volo.Abp.DependencyInjection; @@ -17,14 +17,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackStatusRepository _trackStatusRepository; + private readonly ITrackContentRepository _trackContentRepository; public TrackStatusService( IStringLocalizer stringLocalizer, - ITrackStatusRepository trackStatusRepository + ITrackStatusRepository trackStatusRepository, + ITrackContentRepository trackContentRepository ) { - this._stringLocalizer=stringLocalizer; + this._stringLocalizer = stringLocalizer; this._trackStatusRepository = trackStatusRepository; + this._trackContentRepository=trackContentRepository; } /// @@ -79,15 +82,19 @@ public class TrackStatusService : ApplicationService, ITransientDependency } #region 私有方法 + private async Task AddAsync(EditTrackStatusInput input) { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId && + (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -99,12 +106,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackStatusInput input) { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); } + #endregion var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id); @@ -116,9 +126,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackStatusInput input) { + #region 业务校验 + var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id); + if (isExistStatus!=null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + } + #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); } + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index e77a574d..78a5401d 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,9 +1,9 @@ using System.Linq.Expressions; -using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; using Volo.Abp.DependencyInjection; @@ -19,14 +19,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; /// public TrackTemplateService( IStringLocalizer stringLocalizer, - ITrackTemplateRepository trackTemplateRepository) + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository + ) { _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository = trackPullConfigRepository; } /// @@ -85,13 +89,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task AddAsync(EditTrackTemplateInput input) { #region 业务校验 + //校验模版代码唯一性 - var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + var templateEntity = + await _trackTemplateRepository.GetFirstAsync( + a => a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (templateEntity != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } - #endregion + + #endregion 业务校验 var entity = ObjectMapper.Map(input); var isTrue = await _trackTemplateRepository.InsertAsync(entity); @@ -102,12 +110,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackTemplateInput input) { #region 业务校验 - var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + + var isExist = await _trackTemplateRepository.GetFirstAsync(a => + a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } - #endregion + + #endregion 业务校验 var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); @@ -119,8 +130,16 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackTemplateInput input) { #region 业务校验 - //到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示 - #endregion + + //查询看看在轨迹拉取里面有没有被占用 + var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id); + if (isExisistTrackPullConfig != null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + } + + #endregion 业务校验 + var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs similarity index 83% rename from src/SJZY.Track.Application/ApplicationModule.cs rename to src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 94127ff2..97b9337f 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -1,4 +1,5 @@ using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract; using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; @@ -19,25 +20,26 @@ namespace SJZY.Track.Application typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), - typeof(SJZYTrackDomainModule), - typeof(SjzyUserCenterHttpApiModule) + typeof(SjzyUserCenterHttpApiModule), + typeof(SjzyTrackDomainModule), + typeof(SjzyTrackApplicationContractModule) )] - public class ApplicationModule : AbpModule + public class SjzyTrackApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); - Configure(options => { options.AddMaps(true); }); + Configure(options => { options.AddMaps(true); }); Configure(options => { - options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly); //创建动态api + options.ConventionalControllers.Create(typeof(SjzyTrackApplicationModule).Assembly); //创建动态api }); //添加虚拟文件系统 Configure(options => { - options.FileSets.AddEmbedded("SJZY.Track.Application"); + options.FileSets.AddEmbedded("SJZY.Track.Application"); }); //添加多语言 diff --git a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs deleted file mode 100644 index db26be85..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs +++ /dev/null @@ -1,68 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; - -namespace SJZY.Track.Application.Validations.Demo -{ - - public class SimpleValidateInputValidation : AbstractValidator, IValidationEnabled - { - public SimpleValidateInputValidation() - { - /* - 非空校验 - NotNull 和 NotEmpty 的区别? - NotNull:请求中没找到指定参数 - NotEmpty:请求中没找到指定参数 或 参数值为初始值(0/"") - 关于字符串的最佳实践: - 参数定义成可空字符串 string?,校验规则只用isempty - - */ - RuleFor(x => x.PassWord).NotNull().WithMessage("操作密码为必填参数!").NotEmpty().WithMessage("操作密码不能为空!"); - - //雪花id - RuleFor(x => x.SnowId).NotNull().WithMessage("雪花ID为必填参数!").NotEmpty().WithMessage("雪花ID不能为空!"); - - //枚举校验 - RuleFor(x => x.Option).IsInEnum().WithMessage("操作类型不在可选范围!"); - - //字符串长度校验,长度不分中文、字符、数值 - RuleFor(x => x.LoginName).Length(6, 10).WithMessage("登录账号必须在6-10位之间!"); - RuleFor(x => x.LoginName).MaximumLength(10).WithMessage("登录账号不能超过10个字符!"); - RuleFor(x => x.LoginName).MinimumLength(6).WithMessage("登录账号不能小于6个字符!"); - - //正则表达式 - RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\\%\\^\\&\\*\\(\\)])[0-9a-zA-Z!@#$\\%\\^\\&\\*\\(\\)]{6,10}") - .WithMessage("密码必须同时包含数字、英文字母、特殊字符,且长度必须在6-10位之间"); - - //自定义校验规则,注意这里的校验仅限于模型参数级的校验,更复杂的业务校验应在业务层完成 - RuleFor(x => x.PassWordAgain).Must((data, context) => - { - return data.PassWord == data.PassWordAgain; - }).WithMessage("两次输入密码不一致!"); - - //数字类型校验 - RuleFor(x => x.MiniCount).LessThan(100).WithMessage("最小数量必须小于100"); - RuleFor(x => x.MiniCount).LessThanOrEqualTo(100).WithMessage("最小数量必须小于或等于100"); - RuleFor(x => x.MaxCount).GreaterThan(100).WithMessage("最大数量必须大于100"); - RuleFor(x => x.MaxCount).GreaterThanOrEqualTo(100).WithMessage("最大数量必须大于或等于100"); - - //小数类型校验,10.56 - RuleFor(x => x.TotalQuota).ScalePrecision(2, 4, true).WithMessage("最大额度金额【整数位+小数位】不能超过4位,且小数位不能超过2位"); - - //条件分支 - When(x => x.Option == OptionType.修改 || x.Option == OptionType.删除, () => - { - RuleFor(x => x.Id).NotNull().WithMessage("修改或删除时Id为必填参数!").GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); - - //单个实体校验 - RuleFor(x => x.UserInfoInput).NotNull().WithMessage("用户信息为必填参数!").SetValidator(new UserInfoInputValidation()); - - //集合校验 - RuleForEach(x => x.UserRoleInputList).SetValidator(new UserRoleInputValidation()); - } - - } - - -} diff --git a/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs deleted file mode 100644 index b8e5268f..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs +++ /dev/null @@ -1,15 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; - - -namespace SJZY.Track.Application.Validations.Demo -{ - public class UserInfoInputValidation : AbstractValidator, IValidationEnabled - { - public UserInfoInputValidation() - { - RuleFor(x => x.QQ).NotNull().WithMessage("QQ号码不能为空"); - } - - } -} diff --git a/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs deleted file mode 100644 index fa0307a2..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs +++ /dev/null @@ -1,13 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; - -namespace SJZY.Track.Application.Validations.Demo -{ - public class UserRoleInputValidation : AbstractValidator, IValidationEnabled - { - public UserRoleInputValidation() - { - RuleFor(m => m.Id).GreaterThan(0).WithMessage("角色ID必须大于0!"); - } - } -} diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs index 0faf7a0c..af97fc37 100644 --- a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackTemplates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackContents; namespace SJZY.Track.Application.Validations.TrackContents { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackContents public EditTrackContentInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -33,6 +22,5 @@ namespace SJZY.Track.Application.Validations.TrackContents RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!"); }); } - } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs index da5faec2..6a06da65 100644 --- a/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; namespace SJZY.Track.Application.Validations.TrackFlags { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackFlags public EditTrackFlagInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -32,4 +21,4 @@ namespace SJZY.Track.Application.Validations.TrackFlags }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs index beb1df54..e492a542 100644 --- a/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; namespace SJZY.Track.Application.Validations.TrackStatus { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackStatus public EditTrackStatusInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -34,4 +23,4 @@ namespace SJZY.Track.Application.Validations.TrackStatus }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs index 8768b688..aa4bdad8 100644 --- a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -1,5 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; namespace SJZY.Track.Application.Validations.TrackTemplates { @@ -11,16 +11,10 @@ namespace SJZY.Track.Application.Validations.TrackTemplates public EditTrackTemplateInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -30,4 +24,4 @@ namespace SJZY.Track.Application.Validations.TrackTemplates }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 93d162e2..225605cc 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -11,7 +11,7 @@ public interface IOrderRepository : IBasicRepository /// Task CreateOrderAsync(OrderEntity order); - Task> GetOrderDetails(GetOrderDetailsInputVO input); + //Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 获取分页的轨迹订单 @@ -20,6 +20,30 @@ public interface IOrderRepository : IBasicRepository /// Task> GetPageTrackOrder(GetPageTrackOrderInputVO input); + /// + /// 更新订单 + /// + /// + /// + Task UpdateOrderAsync(OrderEntity order); + + /// + /// 删除订单 + /// + /// + /// + Task DeleteOrderAsync(int orderId); + + + #region 订单关联 + + /// + /// 根据订单id,获取关联的订单集合 + /// + /// + /// + Task> GetLinkedOrdersAsync(int orderId); + /// /// 关联订单 /// @@ -34,17 +58,5 @@ public interface IOrderRepository : IBasicRepository /// Task UnLinkByIdsAsync(List linkIds); - /// - /// 更新订单 - /// - /// - /// - Task UpdateOrderAsync(OrderEntity order); - - /// - /// 删除订单 - /// - /// - /// - Task DeleteOrderAsync(int orderId); + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index 33e44303..88de3765 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -41,6 +41,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot /// [SugarColumn(ColumnName = "IsCompleted")] public bool IsCompleted { get; set; } + + /// + /// 订单是否推送完成(异步维护) + /// + [SugarColumn(ColumnName = "IsPushCompleted")] + public bool IsPushCompleted { get; set; } /// /// 最新轨迹内容(异步维护) diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs index 112fc472..71231e99 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -12,6 +12,18 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 关联的订单id + /// + [SugarColumn(ColumnName = "LinkOrderId")] + public int LinkOrderId { get; set; } + /// /// 订单类型 /// @@ -24,6 +36,7 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit [SugarColumn(ColumnName = "OrderNo")] public string OrderNo { get; set; } = null!; + /// /// 关联的订单类型 /// diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index fbd0e412..cc7a54e9 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -1,10 +1,26 @@ using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackStatus; namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; public interface ITrackContentRepository : IBasicRepository { Task GetDetailAsync(int id); + Task> GetPageTrackContent(GetPageTrackContentVO input); + + Task> GetMapPageAsync(GetTrackContentMapPageInputVO input); + + Task GetMapDetailAsync(int id); + + Task IsMapAnyAsync(Expression> whereExpression); + + Task InsertMapAsync(TrackContentMapEntity insertObj); + + Task GetMapByIdAsync(int id); + + Task UpdateMapAsync(TrackContentMapEntity updateObj); + + Task SoftDeleteMapAsync(Expression> whereExpression); + + Task UpdateMapAsync(Expression> columns, Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs index fbeb2e9c..1c20048f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs @@ -13,14 +13,38 @@ public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity public int Id { get; set; } /// - /// 映射轨迹内容id + /// 源子系统id /// - [SugarColumn(ColumnName = "MapTrackContentId")] - public int MapTrackContentId { get; set; } + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } /// /// 源轨迹内容id /// [SugarColumn(ColumnName = "TrackContentId")] public int TrackContentId { get; set; } + + /// + /// 源轨迹内容code + /// + [SugarColumn(ColumnName = "TrackContentCode")] + public string TrackContentCode { get; set; } = null!; + + /// + /// 映射子系统id + /// + [SugarColumn(ColumnName = "MapSubSystemId")] + public int MapSubSystemId { get; set; } + + /// + /// 映射轨迹内容id + /// + [SugarColumn(ColumnName = "MapTrackContentId")] + public int MapTrackContentId { get; set; } + + /// + /// 映射轨迹内容code + /// + [SugarColumn(ColumnName = "MapTrackContentCode")] + public string MapTrackContentCode { get; set; } = null!; } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 444dd072..3ab152d1 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -6,11 +6,10 @@ public interface ITrackDetailsRepository { Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode); - Task UpdateAsync(TrackDetailsIndex index); - - Task CreateAsync(TrackDetailsIndex index); + Task UpsertAsync(TrackDetailsIndex index); Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); + Task> GetListAsync(int orderId); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index a8160da6..35857507 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -3,11 +3,9 @@ using SJZY.Expand.ElasticSearch; namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -[ElasticsearchType(RelationName = IndexName)] +[ElasticsearchType(RelationName = GlobalConst.TrackIndex)] public class TrackDetailsIndex : IdBaseIndex { - public const string IndexName = "sjzy_track_details"; - /// /// 订单Id /// @@ -16,7 +14,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 订单号 /// - public string OrderNo { get; set; } + public string OrderNo { get; set; } = null!; /// /// 订单类型(主数据枚举TrackOrderType) @@ -26,42 +24,42 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 轨迹状态 /// - public string TrackStatus { get; set; } + public string TrackStatus { get; set; } = null!; /// /// 原轨迹状态 /// - public string OriginTrackStatus { get; set; } + public string? OriginTrackStatus { get; set; } /// /// 轨迹内容代码 /// - public string TrackCode { get; set; } + public string TrackCode { get; set; } = null!; /// /// 轨迹内容 /// - public string TrackContent { get; set; } + public string TrackContent { get; set; } = null!; /// /// 原轨迹内容 /// - public string OriginTrackContent { get; set; } + public string? OriginTrackContent { get; set; } /// /// 原轨迹报文 /// - public string OriginTrackData { get; set; } + public string? OriginTrackData { get; set; } /// /// 轨迹内容英文 /// - public string TrackEnContent { get; set; } + public string TrackEnContent { get; set; } = null!; /// /// 轨迹发生地 /// - public string TrackPlace { get; set; } + public string? TrackPlace { get; set; } /// /// 轨迹发生时间 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs index f9de867c..2a9d53ab 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -64,5 +64,5 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 轨迹时区GMT /// [SugarColumn(ColumnName = "TrackTimeZone")] - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 9050f090..808cc3ac 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -10,4 +10,16 @@ public interface ITrackPushConfigRepository : IBasicRepository> GetContentPageAsync(GetTrackPushContentPageInputVO input); Task GetDetailAsync(int id); + + Task GetContentDetailAsync(int id); + + Task SoftDeleteContentAsync(Expression> whereExpression); + + Task IsContentAnyAsync(Expression> whereExpression); + + Task InsertContentAsync(TrackPushContentConfigEntity insertObj); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPushContentConfigEntity updateObj); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs index a1223bb0..1c392d52 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs @@ -70,5 +70,5 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 轨迹时区GMT /// [SugarColumn(ColumnName = "TrackTimeZone")] - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs index 9cf11c60..f46e3c41 100644 --- a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -10,10 +10,10 @@ public class KeywordsInputVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } /// /// 选中项 /// - public int? SelectedId { get; set; } + public List? SelectedId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index c95fae3e..44567900 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -16,7 +16,7 @@ namespace SJZY.Track.Domain.Dtos.Order /// /// 单号 /// - public List OrderNos { get; set; } + public List? OrderNos { get; set; } /// /// 创建时间开始 @@ -26,7 +26,7 @@ namespace SJZY.Track.Domain.Dtos.Order /// /// 创建时间截止 /// - public DateTime? createTimeEnd { get; set; } + public DateTime? CreateTimeEnd { get; set; } } /// @@ -44,6 +44,11 @@ namespace SJZY.Track.Domain.Dtos.Order /// public int OrderType { get; set; } + /// + /// 订单名称 + /// + public string OrderTypeName { get; set; } + /// /// 订单号 /// @@ -64,10 +69,10 @@ namespace SJZY.Track.Domain.Dtos.Order /// public string? CustomerCode { get; set; } - /// - /// 订单明细(json) - /// - public string? OrderDetails { get; set; } + ///// + ///// 订单明细(json) + ///// + //public string? OrderDetails { get; set; } /// /// 最新轨迹内容 diff --git a/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs new file mode 100644 index 00000000..5d1c7327 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class LinkedOrderVO +{ + /// + /// 关联订单id + /// + public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs index f093836d..f4b3c65c 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -16,7 +16,12 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } } public class GetTrackContentListVO diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs new file mode 100644 index 00000000..dce4eff9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs @@ -0,0 +1,56 @@ +namespace SJZY.Track.Domain.Dtos.TrackContents; + +public class GetTrackContentMapDetailOutputVO +{ + public int Id { get; set; } + + /// + /// 映射子系统 + /// + public string MapSubSystem { get; set; } + + /// + /// 映射子系统id + /// + public int MapSubSystemId { get; set; } + + /// + /// 映射轨迹内容 + /// + public string MapTrackContent { get; set; } + + /// + /// 映射轨迹内容id + /// + public int MapTrackContentId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 源轨迹内容 + /// + public string TrackContent { get; set; } + + /// + /// 源轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 源轨迹内容代码 + /// + public string TrackContentCode { get; set; } + + /// + /// 映射轨迹内容代码 + /// + public string MapTrackContentCode { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageInputVO.cs new file mode 100644 index 00000000..e6cd19e6 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageInputVO.cs @@ -0,0 +1,11 @@ +using SJZY.Track.Domain.Dtos.Common; + +namespace SJZY.Track.Domain.Dtos.TrackContents; + +public class GetTrackContentMapPageInputVO : KeywordsInputVO +{ + /// + /// 映射子系统id + /// + public int? MapSubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageOutputVO.cs new file mode 100644 index 00000000..e291b71f --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageOutputVO.cs @@ -0,0 +1,56 @@ +namespace SJZY.Track.Domain.Dtos.TrackContents; + +public class GetTrackContentMapPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + public int Id { get; set; } + + /// + /// 映射轨迹内容代码 + /// + public string MapCode { get; set; } + + /// + /// 映射内容 + /// + public string MapContent { get; set; } + + /// + /// 映射内容英文 + /// + public string MapEnContent { get; set; } + + /// + /// 映射子系统 + /// + public string MapSubSystem { get; set; } + + /// + /// 映射轨迹状态 + /// + public string MapTrackStatus { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs index c6e07352..ced59e19 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -5,15 +5,15 @@ public class MatchTrackContentDto /// /// 轨迹内容 /// - public string Content { get; set; } + public string Content { get; set; } = null!; /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string EnContent { get; set; } = null!; /// /// 轨迹状态 /// - public string Status { get; set; } + public string Status { get; set; } = null!; } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs index 20f7c40f..d3699b75 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -13,6 +13,11 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs index af51f0cf..f29ab75f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -52,5 +52,5 @@ public class GetTrackPullContentDetailOutputVO /// /// 拉取轨迹时区 /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs index 6e9cd961..ced23f75 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -89,7 +89,12 @@ public class GetTrackPushConfigDetailOutputVO /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public string TrackTemplateId { get; set; } + + /// + /// 轨迹模板ids + /// + public List TrackTemplateIds { get; set; } /// /// 推送轨迹发生时间 diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs index 9b2e3a83..e0095b23 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -23,4 +23,14 @@ public class GetTrackPushConfigPageOutputVO /// 模板名称 /// public string TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public string TrackTemplateId { get; set; } + + /// + /// 轨迹模板ids + /// + public List TrackTemplateIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs new file mode 100644 index 00000000..f0980524 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs @@ -0,0 +1,61 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentDetailOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsValue { get; set; } + + public int Id { get; set; } + + /// + /// 推送单号类型 + /// + public int OrderNoType { get; set; } + + /// + /// 推送轨迹排序 + /// + public int Sort { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 轨迹推送配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusValue { get; set; } + + /// + /// 推送轨迹时区 + /// + public double? TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs index 6c5d3b46..f19fb8c5 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs @@ -10,5 +10,10 @@ public class GetPageTrackStatusVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } + + /// + /// 选中的轨迹状态id + /// + public List? SelectIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs index e4fa7963..35c4fe8a 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs @@ -10,15 +10,9 @@ public class GetPageTrackTemplateVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } - ///// - ///// 是否置顶 - ///// - //public bool IsTop { get; set; }=false; - - /// - /// 轨迹模版id + /// 选中的轨迹模版id /// - public int TrackTemplateId { get; set; } + public List? SelectIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs index d08ad492..09e8f51f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -5,5 +5,5 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public List TrackTemplateIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs index dd3a27d4..18d6ddcc 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs @@ -68,4 +68,9 @@ public class GetTrackTemplateContentPageOutputVO /// 修改人 /// public string UpdateUser { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs new file mode 100644 index 00000000..8db2300c --- /dev/null +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain; + +public class GlobalConst +{ + /// + /// 轨迹明细es索引名称 + /// + public const string TrackIndex = "sjzy_track_details"; + + /// + /// 轨迹新增/更新cap订阅名称 + /// + public const string TrackUpsertSubscribe = "SJZY.Track.Upsert"; + + /// + /// 自动推送名单RedisKey + /// + public const string AutoPushRosterRedisKey = "AutoPushRoster"; +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index 8e9baed2..3824c2eb 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -10,7 +10,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要忽略更新的列 /// - Task UpdateAsync(T entity, Expression> ignoreColumns); + Task UpdateAsync(T entity, Expression>? ignoreColumns); /// /// update @@ -18,7 +18,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要更新的列 /// - Task UpdateColumnAsync(T entity, Expression> updateColumns); + Task UpdateColumnAsync(T entity, Expression>? updateColumns); /// /// update diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs index df41882c..53a9720e 100644 --- a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs +++ b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs @@ -31,4 +31,13 @@ public interface ITrackQueries /// 轨迹代码 /// Task MatchTrackContentAsync(int orderId, string code); + + /// + /// 根据子系统内容映射,得到映射后的轨迹code + /// + /// + /// + /// + /// + Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..b1f4dc63 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -10,9 +10,5 @@ - - - - diff --git a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs index e9c743d8..792e7844 100644 --- a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs +++ b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs @@ -2,6 +2,6 @@ namespace SJZY.Track.Domain; -public class SJZYTrackDomainModule : AbpModule +public class SjzyTrackDomainModule : AbpModule { } \ No newline at end of file diff --git a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs b/src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs deleted file mode 100644 index b010b6bd..00000000 --- a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SJZY.Track.HttpApi.Dtos -{ - public class RemoteDemoInput - { - /// - /// 当前时间 - /// - public DateTime CurrentTime { get; set; } - } -} diff --git a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs b/src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs deleted file mode 100644 index 44cd1f41..00000000 --- a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SJZY.Track.HttpApi.Dtos -{ - public class RemoteDemoOutput - { - public string Context { get; set; } - } -} diff --git a/src/SJZY.Track.HttpApi/Services/IRemoteDemoService.cs b/src/SJZY.Track.HttpApi/Services/IRemoteDemoService.cs deleted file mode 100644 index 6ea693bf..00000000 --- a/src/SJZY.Track.HttpApi/Services/IRemoteDemoService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using SJZY.Expand.ABP.Core.Common.Dto; -using SJZY.Track.HttpApi.Dtos; -using Volo.Abp; -using Volo.Abp.DependencyInjection; - -namespace SJZY.Track.HttpApi.Services -{ - /// - /// 客户端连接测试接口 - /// - public interface IRemoteDemoService : IRemoteService, IScopedDependency - { - Task> ConnectionTest(RemoteDemoInput input); - } -} diff --git a/src/SJZY.Track.HttpApi/TrackHttpApiModule.cs b/src/SJZY.Track.HttpApi/TrackHttpApiModule.cs deleted file mode 100644 index 522c4cf8..00000000 --- a/src/SJZY.Track.HttpApi/TrackHttpApiModule.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp.Modularity; - -namespace SJZY.Track.HttpApi -{ - public class TrackHttpApiModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs deleted file mode 100644 index 9b556ecb..00000000 --- a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs +++ /dev/null @@ -1,132 +0,0 @@ -using Nest; -using SJZY.Track.Domain; -using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; -using SJZY.Track.Domain.Dtos.Order; -using SJZY.Track.Domain.VEntities; -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Infrastructure.Repositories; - -public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency -{ - public async Task CreateOrderAsync(OrderEntity order) - { - return await Context.InsertNav(order) - .Include(x => x.OrderFlights) - .Include(x => x.OrderTemplates) - .ExecuteCommandAsync(); - } - - public async Task LinkOrderAsync(List orderLinkEntities) - { - await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); - } - - public async Task UnLinkByIdsAsync(List linkIds) - { - await Context.Deleteable(linkIds).ExecuteCommandAsync(); - } - - public async Task UpdateOrderAsync(OrderEntity order) - { - using var tran = TransactionHelper.GetReadCommitted(); - - // 更新订单主表 - await UpdateAsync(order, x => new { x.CustomId, x.SubSystemId }); - - // 更新订单模板 - await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); - order.OrderTemplates.ForEach(x => x.OrderId = order.Id); - await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync(); - - // 更新订单航班 - await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); - order.OrderFlights.ForEach(x => x.OrderId = order.Id); - await Context.Insertable(order.OrderFlights).ExecuteCommandAsync(); - - tran.Complete(); - } - - public async Task DeleteOrderAsync(int orderId) - { - using var tran = TransactionHelper.GetReadCommitted(); - - // 软删订单主表 - await SoftDeleteAsync(x => x.Id == orderId); - - // 软删订单模板 - // 软删订单航班 - // 软删订单关联关系 - - tran.Complete(); - } - - #region 轨迹订单明细 - - /// - /// 根据轨迹订单id获取轨迹明细列表 - /// - /// - /// - public async Task> GetOrderDetails(GetOrderDetailsInputVO input) - { - return null; - } - - #endregion - - #region 轨迹订单分页 - - /// - /// 获取分页的轨迹订单 - /// - /// - /// - public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) - { - var pageList = await Context.Queryable() - .LeftJoin((a, b) => a.CustomId==b.Id) - .LeftJoin((a, b, c) => a.SubSystemId==c.Id) - .Select((a, b, c) => new TrackOrderVO - { - Id = a.Id, - OrderNumber= a.OrderNo, - OrderType = a.OrderType, - CustomerShortName= b.Abbreviation, - CustomerCode= b.Code, - TrackTemplateNames = "", - OrderDetails="", - NewestTrackContent= a.LatestTrackContent, - NewestTrackEnContent= a.LatestTrackEnContent, - NewestTrackPlace= a.LatestTrackPlace, - IsFinish=a.IsCompleted, - CreateTime=a.CreateTime, - SubSystem= c.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); - - if (pageList.List.Any()) - { - var orderIds = pageList.List.Select(a => a.Id); - //查询轨迹模版 - - - var trackTemplateList = await Context.Queryable() - .LeftJoin((a, b) => a.TrackTemplateId==b.Id) - .Where((a, b) => orderIds.Contains(a.OrderId)) - .Select((a, b) => new { OrderId = a.OrderId, Name = b.Name }) - .ToListAsync(); - - pageList.List.ForEach(a => - { - var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id); - a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(","); - }); - } - - return pageList; - } - - #endregion -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs deleted file mode 100644 index eac2265f..00000000 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs +++ /dev/null @@ -1,86 +0,0 @@ -using SJZY.Track.Domain.Aggregates.TrackContentAggregate; -using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; -using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; -using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.VEntities; - -namespace SJZY.Track.Infrastructure.Repositories; - -public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency -{ - - public TrackContentRepository() - { - - } - - /// - /// 获取轨迹内容明细 - /// - /// - /// - public async Task GetDetailAsync(int id) - { - var detail = await Context.Queryable() - .LeftJoin((a, b) => a.TrackStatusId==b.Id) - .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) - .Where((a, b, c, d) => a.Id == id) - .Select((a, b, c, d) => new GetTrackContentDetailVO - { - Id = a.Id, - SubSystemId = a.SubSystemId, - SubSystem = d.CnName, - TrackStatusId=a.TrackStatusId, - TrackStatus= b.Status, - Code = a.Code, - Content = a.Content, - EnContent = a.EnContent, - TrackFlagId=a.TrackFlagId, - TrackFlag=c.Name - }) - .FirstAsync(); - return detail; - } - - /// - /// 分页获取轨迹内容 - /// - /// - /// - public async Task> GetPageTrackContent(GetPageTrackContentVO input) - { - UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.TrackStatusId==b.Id) - .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) - .LeftJoin((a, b, c, d, e) => a.CreateUserId == e.Id) - .LeftJoin((a, b, c, d, e, f) => a.UpdateUserId == f.Id) - .WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId) - .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), - (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) - || a.EnContent.Contains(input.Keywords) - ) - .Select((a, b, c, d, e, f) => new GetTrackContentListVO - { - Id = a.Id, - SubSystem = d.CnName, - Code = a.Code, - Content = a.Content, - EnContent = a.EnContent, - TrackStatus= b.Status, - Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关") - .ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送") - .End(""), - TrackFlag= c.Name, - CreateTime = a.CreateTime, - CreateUser = e.Name, - UpdateTime = a.UpdateTime, - UpdateUser = f.Name - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); - - return pagedList; - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj deleted file mode 100644 index f1e677f8..00000000 --- a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - net7.0 - True - preview - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs deleted file mode 100644 index 7b2e515e..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs +++ /dev/null @@ -1,8 +0,0 @@ -using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecord.Services -{ - public interface ITrackPushRecordRepository : ISimpleClient - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs deleted file mode 100644 index 22529060..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SJZY.Track.Infrastructure.Repositories; -using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecord.Services -{ - public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs deleted file mode 100644 index 6f29bbc3..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,8 +0,0 @@ -using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services -{ - public interface ITrackPushRecordDetailsRepository : ISimpleClient - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs deleted file mode 100644 index 157dc8bd..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SJZY.Track.Infrastructure.Repositories; -using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services -{ - public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Infrastructure/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/DataBaseContext.cs rename to src/SJZY.Track.Repository/DataBaseContext.cs index 9fbb7d44..88539836 100644 --- a/src/SJZY.Track.Infrastructure/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -2,7 +2,7 @@ #pragma warning disable 1591 -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Repository; /// /// Sqlsugar 上下文对象 diff --git a/src/SJZY.Track.Infrastructure/GlobalUsing.cs b/src/SJZY.Track.Repository/GlobalUsing.cs similarity index 100% rename from src/SJZY.Track.Infrastructure/GlobalUsing.cs rename to src/SJZY.Track.Repository/GlobalUsing.cs diff --git a/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs b/src/SJZY.Track.Repository/Queries/BasicQuery.cs similarity index 95% rename from src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs rename to src/SJZY.Track.Repository/Queries/BasicQuery.cs index fbb511c7..60a234ef 100644 --- a/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs +++ b/src/SJZY.Track.Repository/Queries/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.Queries; +namespace SJZY.Track.Repository.Queries; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs similarity index 86% rename from src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs rename to src/SJZY.Track.Repository/Queries/TrackQueries.cs index 413c38fe..a1e5168a 100644 --- a/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -7,7 +7,7 @@ using SJZY.Track.Domain.Dtos.TrackDetails; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Queries; -namespace SJZY.Track.Infrastructure.Queries; +namespace SJZY.Track.Repository.Queries; public class TrackQueries : ISugarRepository, ITrackQueries, ITransientDependency @@ -75,4 +75,13 @@ public class TrackQueries : ISugarRepository, ITrackQueries, }) .FirstAsync(); } + + public async Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode) + { + return await Context.Queryable() + .Where(x => x.SubSystemId == upSubSystemId && x.MapSubSystemId == subSystemId && + x.TrackContentCode == trackCode) + .Select(x => x.MapTrackContentCode) + .FirstAsync(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs similarity index 89% rename from src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs rename to src/SJZY.Track.Repository/Repositories/BasicRepository.cs index a776fd88..965bd5d7 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs @@ -1,10 +1,10 @@ using System.Linq.Expressions; using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; -using SJZY.Track.Infrastructure.Queries; +using SJZY.Track.Repository.Queries; using Volo.Abp; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; /// /// 仓储基类实现 @@ -12,14 +12,14 @@ namespace SJZY.Track.Infrastructure.Repositories; /// public class BasicRepository : BasicQuery, IBasicRepository where T : class, IAggregateRoot, new() { - public async Task UpdateAsync(T entity, Expression> ignoreColumns) + public async Task UpdateAsync(T entity, Expression>? ignoreColumns) { return await Context.Updateable(entity) .IgnoreColumnsIF(ignoreColumns != null, ignoreColumns) .ExecuteCommandHasChangeAsync(); } - public async Task UpdateColumnAsync(T entity, Expression> updateColumns) + public async Task UpdateColumnAsync(T entity, Expression>? updateColumns) { return await Context.Updateable(entity) .UpdateColumnsIF(updateColumns != null, updateColumns) @@ -40,15 +40,13 @@ public class BasicRepository : BasicQuery, IBasicRepository where T : c .ExecuteCommandHasChangeAsync(); } + // tips: required where public async Task SoftDeleteAsync(Expression> where) { if (!typeof(T).IsAssignableTo()) throw new BusinessException( message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}"); - // tips: required where - if (where == default) return false; - return await Context.Updateable() .Where(where) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) diff --git a/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs rename to src/SJZY.Track.Repository/Repositories/DemoRepository.cs index 9acceca7..8334ea44 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs new file mode 100644 index 00000000..05fc2db1 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -0,0 +1,163 @@ +using SJZY.Track.Domain; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.Repositories; + +public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency +{ + public async Task CreateOrderAsync(OrderEntity order) + { + return await Context.InsertNav(order) + .Include(x => x.OrderFlights) + .Include(x => x.OrderTemplates) + .ExecuteCommandAsync(); + } + + public async Task UpdateOrderAsync(OrderEntity order) + { + using var tran = TransactionHelper.GetReadCommitted(); + + // 更新订单主表 + await UpdateAsync(order, x => new { x.CustomId, x.SubSystemId }); + + // 更新订单模板 + await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderTemplates.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync(); + + // 更新订单航班 + await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderFlights.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderFlights).ExecuteCommandAsync(); + + tran.Complete(); + } + + public async Task DeleteOrderAsync(int orderId) + { + using var tran = TransactionHelper.GetReadCommitted(); + + // 软删订单主表 + await SoftDeleteAsync(x => x.Id == orderId); + + // 软删订单模板 + // 软删订单航班 + // 软删订单关联关系 + + tran.Complete(); + } + + #region 订单关联 + + public async Task> GetLinkedOrdersAsync(int orderId) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.Id == orderId) + .Select((a, b) => new LinkedOrderVO + { + OrderId = b.LinkOrderId, + SubSystemId = a.SubSystemId + }) + .ToListAsync(); + } + + public async Task LinkOrderAsync(List orderLinkEntities) + { + await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); + } + + public async Task UnLinkByIdsAsync(List linkIds) + { + await Context.Deleteable(linkIds).ExecuteCommandAsync(); + } + + #endregion + + #region 轨迹订单明细 + + ///// + ///// 根据轨迹订单id获取轨迹明细列表 + ///// + ///// + ///// + //public async Task> GetOrderDetails(GetOrderDetailsInputVO input) + //{ + // return null; + //} + + #endregion + + #region 轨迹订单分页 + + /// + /// 获取分页的轨迹订单 + /// + /// + /// + public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) + { + var pageList = await Context.Queryable() + .LeftJoin((a, b) => a.CustomId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.SubSystemId == c.Id && c.IsDeleted == false) + .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) + .WhereIF(input.CreateTimeStart.HasValue && input.CreateTimeEnd.HasValue, + (a, b, c) => a.CreateTime >= input.CreateTimeStart && a.CreateTime <= input.CreateTimeEnd) + .WhereIF(input.CreateTimeStart.HasValue && (!input.CreateTimeEnd.HasValue), + (a, b, c) => a.CreateTime >= input.CreateTimeStart) + .WhereIF((!input.CreateTimeStart.HasValue) && input.CreateTimeEnd.HasValue, + (a, b, c) => a.CreateTime <= input.CreateTimeEnd) + .Select((a, b, c) => new TrackOrderVO + { + Id = a.Id, + OrderNumber = a.OrderNo, + OrderType = a.OrderType, + OrderTypeName = SqlFunc.IF(a.OrderType == 1).Return("干线提单").ElseIF(a.OrderType == 2).Return("小包运单").ElseIF(a.OrderType == 3) + .Return("箱/袋单").ElseIF(a.OrderType == 4).Return("FBA订单").End(""), + CustomerShortName = b.Abbreviation, + CustomerCode = b.Code, + TrackTemplateNames = SqlFunc.Subqueryable() + .LeftJoin((aa, bb) => aa.TrackTemplateId == bb.Id) + .Where((aa, bb) => a.Id == aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","), + NewestTrackContent = a.LatestTrackContent, + NewestTrackEnContent = a.LatestTrackEnContent, + NewestTrackPlace = a.LatestTrackPlace, + IsFinish = a.IsCompleted, + CreateTime = a.CreateTime, + SubSystem = c.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + #region 暂时注释 + + //if (pageList.List.Any()) + //{ + // var orderIds = pageList.List.Select(a => a.Id); + // //查询轨迹模版 + + + // var trackTemplateList = await Context.Queryable() + // .LeftJoin((a, b) => a.TrackTemplateId==b.Id) + // .Where((a, b) => orderIds.Contains(a.OrderId)) + // .Select((a, b) => new { OrderId = a.OrderId, Name = b.Name }) + // .ToListAsync(); + + // pageList.List.ForEach(a => + // { + // var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id); + // a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(","); + // }); + //} + + #endregion + + return pageList; + } + + #endregion +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs new file mode 100644 index 00000000..6946391e --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -0,0 +1,177 @@ +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.VEntities; +using System.Linq; +using System.Linq.Expressions; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency +{ + public TrackContentRepository() + { + } + + /// + /// 获取轨迹内容明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false) + .Where((a, b, c, d) => a.Id == id) + .Select((a, b, c, d) => new GetTrackContentDetailVO + { + Id = a.Id, + SubSystemId = a.SubSystemId, + SubSystem = d.CnName, + TrackStatusId = a.TrackStatusId, + TrackStatus = b.Status, + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackFlagId = a.TrackFlagId, + TrackFlag = c.Name + }) + .FirstAsync(); + return detail; + } + + /// + /// 分页获取轨迹内容 + /// + /// + /// + public async Task> GetPageTrackContent(GetPageTrackContentVO input) + { + UnifyPageResultDto pagedList = new UnifyPageResultDto(); + pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false) + .LeftJoin((a, b, c, d, e) => a.CreateUserId == e.Id && e.IsDeleted == false) + .LeftJoin((a, b, c, d, e, f) => a.UpdateUserId == f.Id && f.IsDeleted == false) + .WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), + (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) + || a.EnContent.Contains(input.Keywords) + ) + .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) + .Select((a, b, c, d, e, f) => new GetTrackContentListVO + { + Id = a.Id, + SubSystem = d.CnName, + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackStatus = b.Status, + Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关") + .ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送") + .End(""), + TrackFlag = c.Name, + CreateTime = a.CreateTime, + CreateUser = e.Name, + UpdateTime = a.UpdateTime, + UpdateUser = f.Name + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + var ff = await Context.Queryable().Where(a => 1 == 1).ToListAsync(); + + return pagedList; + } + + public async Task> GetMapPageAsync(GetTrackContentMapPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted) + .InnerJoin((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus) => sourceContent.TrackStatusId == sourceStatus.Id && !sourceStatus.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => targetContent.TrackStatusId == targetStatus.Id && !targetStatus.IsDeleted) + .Filter(null, true) + .Where(contentMap => !contentMap.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, contentMap => contentMap.SubSystemId == input.SubSystemId) + .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)) + .OrderByDescending(contentMap => contentMap.CreateTime) + .Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => new GetTrackContentMapPageOutputVO + { + Id = contentMap.Id, + SubSystem = sourceSystem.CnName, + Code = contentMap.TrackContentCode, + TrackStatus = sourceStatus.Status, + Content = sourceContent.Content, + EnContent = sourceContent.EnContent, + MapSubSystem = targetSystem.CnName, + MapCode = contentMap.MapTrackContentCode, + MapTrackStatus = targetStatus.Status, + MapContent = targetContent.Content, + MapEnContent = targetContent.EnContent + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + public async Task GetMapDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted) + .InnerJoin((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted) + .Filter(null, true) + .Where(contentMap => !contentMap.IsDeleted) + .Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => new GetTrackContentMapDetailOutputVO + { + Id = contentMap.Id, + SubSystemId = contentMap.SubSystemId, + SubSystem = sourceSystem.CnName, + TrackContent = contentMap.TrackContentCode + "-" + sourceContent.Content, + MapSubSystem = targetSystem.CnName, + MapTrackContent = contentMap.MapTrackContentCode + "-" + targetContent.Content + }, true) + .SingleAsync(); + } + + public async Task IsMapAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } + + public async Task InsertMapAsync(TrackContentMapEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + public async Task GetMapByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateMapAsync(TrackContentMapEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } + + public async Task SoftDeleteMapAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task UpdateMapAsync(Expression> columns, Expression> whereExpression) + { + return await Context.Updateable().SetColumns(columns).Where(whereExpression) + .ExecuteCommandAsync() > 0; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs similarity index 75% rename from src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 2737c39d..c0ca92e4 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -1,14 +1,15 @@ using Nest; using SJZY.Expand.ElasticSearch.Services; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency { - public string IndexName => $"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}"; + public string IndexName => $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}"; public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) { @@ -17,7 +18,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract GetFirstOrDefaultAsync(int orderId, string trackCode) { var r = await Context.SearchAsync(s => s - .Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}") + .Index(IndexName) .Query(q => q.Term(t => t.Field(f => f.OrderId).Value(orderId)) && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) @@ -32,24 +33,18 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + .DocAsUpsert() + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!response.IsValid) throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); } - public async Task CreateAsync(TrackDetailsIndex index) - { - var response = await Context.IndexAsync(index, request => request.Index(IndexName)); - if (!response.IsValid) - throw new Exception($"数据添加失败,原因:{response.DebugInformation}"); - } - public async Task> GetListAsync(int orderType, List orderNos) { if (orderNos.Count < 1) return new List(); @@ -73,6 +68,21 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract> GetListAsync(int orderId) + { + var data = await Context.SearchAsync(x => x + .Source(s => s.Includes(fd => fd + .Field(f => f.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TraceTimeZone) + )).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)))); + + return data?.Documents?.ToList(); + } + public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) { if (input.OrderNos.Count < 1) return default; diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs similarity index 81% rename from src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index 12c29447..eb6b8ca1 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Dtos.TrackFlags; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency { @@ -18,7 +18,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackFlagDetailVO { @@ -42,10 +42,12 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR { UnifyPageResultDto pagedList = new UnifyPageResultDto(); pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId == c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id && d.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b, c, d) => new GetTrackFlagListVO { Id = a.Id, @@ -56,8 +58,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, - UpdateUser = d.Name, - + UpdateUser = d.Name }) .ToPagedListAsync(input.PageIndex, input.PageSize); diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index 796e6778..076671d5 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -6,7 +6,7 @@ using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs similarity index 67% rename from src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index d5180da1..472a8908 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -6,8 +6,9 @@ using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.VData.Entitys; +using System.Linq.Expressions; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency @@ -31,9 +32,11 @@ public class TrackPushConfigRepository : BasicRepository, TrackTemplate = SqlFunc.Subqueryable() .Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) .SelectStringJoin(template => template.Name, ","), + TrackTemplateId = trackPush.TrackTemplateId, CreateTime = trackPush.CreateTime }) .Distinct() + .Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } @@ -67,6 +70,48 @@ public class TrackPushConfigRepository : BasicRepository, CustomName = externalSubject.Abbreviation, ServiceProvider = service.Name, }, true) + .Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); }) .SingleAsync(); } + + public async Task GetContentDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) + .Where(pushContent => pushContent.Id == id) + .Select((pushContent, trackContent) => new GetTrackPushContentDetailOutputVO + { + Id = pushContent.Id, + Code = trackContent.Code + "-" + trackContent.Content, + }, true) + .SingleAsync(); + } + + public async Task SoftDeleteContentAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task IsContentAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } + + public async Task InsertContentAsync(TrackPushContentConfigEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateContentAsync(TrackPushContentConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs similarity index 74% rename from src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index a9218613..7279e1e1 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -2,14 +2,10 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { - public TrackStatusRepository() - { - } - /// /// 获取轨迹状态明细 /// @@ -18,7 +14,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackStatusDetailVO { @@ -35,21 +31,22 @@ public class TrackStatusRepository : BasicRepository, ITrackS } /// - /// 分页获取轨迹模版 + /// 分页获取轨迹状态 /// /// /// public async Task> GetPageTrackStatus(GetPageTrackStatusVO input) { - UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId == c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + UnifyPageResultDto pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id && d.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b, c, d) => a.Status.Contains(input.Keywords) || a.EnStatus.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b, c, d) => new GetTrackStatusListVO { Id = a.Id, @@ -57,9 +54,10 @@ public class TrackStatusRepository : BasicRepository, ITrackS EntrackStatus = a.EnStatus, TrackStatus = a.Status, NodeId = a.Node, - Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3).Return("清关") - .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") - .End(""), + Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3) + .Return("清关") + .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") + .End(""), CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs similarity index 87% rename from src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d4ae27a6..af67ce40 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -8,7 +8,7 @@ using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Enums; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { @@ -20,17 +20,17 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -43,13 +43,12 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { UnifyPageResultDto pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId > 0, - (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), - a.CreateTime), OrderByType.Desc) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -59,7 +58,9 @@ public class TrackTemplateRepository : BasicRepository, ITr SubSystem = b.CnName }) .ToPagedListAsync(input.PageIndex, input.PageSize); - + //.OrderByIF(input.TrackTemplateId > 0, + // (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), + //a.CreateTime), OrderByType.Desc) return pagedList; } @@ -83,8 +84,7 @@ public class TrackTemplateRepository : BasicRepository, ITr (templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) .Filter(null, true) - .Where(templateContent => - templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) + .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) .OrderByDescending(templateContent => templateContent.CreateTime) .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj new file mode 100644 index 00000000..b2285e0b --- /dev/null +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -0,0 +1,20 @@ + + + + net7.0 + True + preview + + + + + + + + + + + + + + diff --git a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs similarity index 83% rename from src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs rename to src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs index c412b69c..546d80d9 100644 --- a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs +++ b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs @@ -4,19 +4,19 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; -using SJZY.Track.Infrastructure.Queries; -using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Repository.Queries; +using SJZY.Track.Repository.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Repository; /// /// 仓储模块 /// [DependsOn(typeof(AbpAutofacModule))] -[DependsOn(typeof(SJZYTrackDomainModule))] -public class SJZYTrackInfrastructureModule : AbpModule +[DependsOn(typeof(SjzyTrackDomainModule))] +public class SjzyTrackRepositoryModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { @@ -28,7 +28,7 @@ public class SJZYTrackInfrastructureModule : AbpModule { new() { - ConnectionString = configuration["ConnectionStrings:DefaultConnection"], + ConnectionString = configuration["ConnectionStrings:DefaultConnection"]!, DbType = DbType.MySql, IsAutoCloseConnection = true, ConfigId = "default", OpenSqlLog = true @@ -39,10 +39,10 @@ public class SJZYTrackInfrastructureModule : AbpModule context.Services.AddElasticSearch(options => { - options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>(); - options.LoginName = configuration["ElasticSearch:LoginName"]; - options.Password = configuration["ElasticSearch:Password"]; - options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]; + options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>()!; + options.LoginName = configuration["ElasticSearch:LoginName"]!; + options.Password = configuration["ElasticSearch:Password"]!; + options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]!; }); } diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs similarity index 87% rename from src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs rename to src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs index 32615bba..b3c2ff5b 100644 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys +namespace SJZY.Track.Repository.TrackPushRecord.Entitys { /// /// 轨迹推送记录 @@ -36,13 +36,13 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys /// 推送内容 /// [SugarColumn(ColumnName = "PushContent")] - public string PushContent { get; set; } + public string PushContent { get; set; } = null!; /// /// 接口通请求id /// [SugarColumn(ColumnName = "RequestId")] - public string RequestId { get; set; } + public string RequestId { get; set; } = null!; /// /// 服务商id @@ -54,6 +54,6 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys /// 推送轨迹总数 /// [SugarColumn(ColumnName = "TrackTotal")] - public string TrackTotal { get; set; } + public int TrackTotal { get; set; } } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs new file mode 100644 index 00000000..686a3402 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Repository.TrackPushRecord.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecord.Services +{ + public interface ITrackPushRecordRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs new file mode 100644 index 00000000..e8e16ab9 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Repository.Repositories; +using SJZY.Track.Repository.TrackPushRecord.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecord.Services +{ + public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs similarity index 94% rename from src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs rename to src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs index 796e3e47..64208102 100644 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys +namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys { /// /// 轨迹推送明细表 diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..f84fafa7 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public interface ITrackPushRecordDetailsRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..3a8c025b --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Repository.Repositories; +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency + { + + } +} diff --git a/test/SJZY.Track.Test/Demo/DemoTest.cs b/test/SJZY.Track.Test/Demo/DemoTest.cs deleted file mode 100644 index da9cd4f2..00000000 --- a/test/SJZY.Track.Test/Demo/DemoTest.cs +++ /dev/null @@ -1,28 +0,0 @@ - -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Application.Services.Demo; - -namespace SJZY.OpenApi.Test.Demo -{ - public class DemoTest : TestModuleTestBase - { - #region 构造函数 - private InterFaceDemoService _interFaceDemoService; - public DemoTest() - { - _interFaceDemoService = GetRequiredService(); - } - #endregion - - [Fact] - public async Task Test() - { - var data = new DemoInput(); - - var res = await _interFaceDemoService.Edit(data); - - Assert.NotNull(res); - } - - } -} diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs index 43bc8f71..aa5f8d90 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using SJZY.Track.Api; using SJZY.Track.Application; -using SJZY.Track.Infrastructure; +using SJZY.Track.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Authorization; @@ -13,22 +13,21 @@ using Volo.Abp.Modularity; using Volo.Abp.Threading; [assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] + namespace SJZY.Track.Test; [DependsOn( typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAutofacModule), typeof(AbpAuthorizationModule), - typeof(SJZYTrackInfrastructureModule), - typeof(ApplicationModule), - typeof(SJZYTrackApiModule), + typeof(SjzyTrackRepositoryModule), + typeof(SjzyTrackApplicationModule), + typeof(SjzyTrackApiModule), typeof(AbpHttpClientModule) //添加abp的http代理模块 )] - [assembly: HostingStartup(typeof(Expand.ABP.Core.HostingStartup))] public class TestModule : AbpModule { - public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAlwaysAllowAuthorization();