diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index 45fdba01..0c457eb0 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -12,10 +12,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6 EndProject 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 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SJZY.Track.Domain", "src\SJZY.Track.Domain\SJZY.Track.Domain.csproj", "{073EB297-E752-49AC-BED8-B4AEBAB518F6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution items", "{086C7812-46F9-49FD-B490-A769E2C0729E}" + ProjectSection(SolutionItems) = preProject + common.props = common.props + NuGet.Config = NuGet.Config + .gitignore = .gitignore + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,6 +51,10 @@ Global {3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Release|Any CPU.Build.0 = Release|Any CPU + {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -52,9 +65,10 @@ Global {D9CF5706-1972-414F-821E-AA32C13B8570} = {DAC93270-5A25-40E5-B851-E7CA398DBC31} {390A44FB-0DB5-4B66-86AB-7712DC3030F5} = {DAC93270-5A25-40E5-B851-E7CA398DBC31} {3A53539C-4A85-4E5D-A071-7B4B193AB0E0} = {0E2537C3-6EF3-4085-9BD2-CF923E53F82A} + {073EB297-E752-49AC-BED8-B4AEBAB518F6} = {DAC93270-5A25-40E5-B851-E7CA398DBC31} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = { 8289A516 - 787C - 4D9D - B972 - E7047BDD206B} + SolutionGuid = { 8289A516 - 787C - 4D9D - B972 - E7047BDD206B} SolutionGuid = {C8AD8123-683D-406E-A8FB-1D0184C19472} EndGlobalSection EndGlobal diff --git a/SJZY.Track.Api.sln.DotSettings b/SJZY.Track.Api.sln.DotSettings new file mode 100644 index 00000000..2363a683 --- /dev/null +++ b/SJZY.Track.Api.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/common.props b/common.props new file mode 100644 index 00000000..492bcb09 --- /dev/null +++ b/common.props @@ -0,0 +1,9 @@ + + + latest + enable + enable + $(NoWarn);CS1591;CS0436;NU1803 + + + diff --git a/src/SJZY.Track.Api/Program.cs b/src/SJZY.Track.Api/Program.cs index a9d373a7..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(); @@ -21,5 +21,5 @@ try } catch (Exception ex) { - Console.WriteLine($"ÏîĿÆô¶¯ʧ°ܣ¬Ò쳣ÐÅϢ£º{ex}"); + Console.WriteLine($"项目启动失败,异常信息:{ex}"); } \ No newline at end of file diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index 0d485cec..be47c0cf 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -1,32 +1,26 @@  - - net7.0 - enable - enable - True - Linux - ..\.. - + - - - - - - + + net7.0 + True + Linux + ..\.. + - - - - - - + + + + + + + + + + + + - - - - - diff --git a/src/SJZY.Track.Api/ApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs similarity index 87% rename from src/SJZY.Track.Api/ApiModule.cs rename to src/SJZY.Track.Api/SjzyTrackApiModule.cs index f679135d..13d9633a 100644 --- a/src/SJZY.Track.Api/ApiModule.cs +++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs @@ -9,6 +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.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; @@ -17,23 +18,26 @@ using Volo.Abp.Autofac; using Volo.Abp.Json; using Volo.Abp.Modularity; -[assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] +[assembly: HostingStartup(typeof(HostingStartup))] + namespace SJZY.Track.Api { [DependsOn( typeof(AbpAutofacModule), typeof(SjzyAbpCodeModule), - typeof(ApplicationModule), typeof(AbpAspNetCoreMvcModule), - typeof(AbpAspNetCoreSerilogModule) + typeof(AbpAspNetCoreSerilogModule), + typeof(SjzyTrackApplicationModule), + typeof(SjzyTrackRepositoryModule) )] - public class ApiModule : 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 => { @@ -47,7 +51,9 @@ namespace SJZY.Track.Api //Json格式化全局处理 context.Services.Configure(options => { - options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();//.DefaultContractResolver(); + options.SerializerSettings.ContractResolver = + new Newtonsoft.Json.Serialization. + CamelCasePropertyNamesContractResolver(); //.DefaultContractResolver(); options.SerializerSettings.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); options.SerializerSettings.Converters.Add(new LongJsonConverter()); }); @@ -55,9 +61,7 @@ namespace SJZY.Track.Api Configure(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss"); Configure(options => { options.IsEnabled = false; }); - context.Services.AddRedis(); - } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -77,6 +81,7 @@ namespace SJZY.Track.Api app.UsePrometheus(); #region 启动提示 + Console.WriteLine($@" +-------------------------------------------------------+ | | @@ -87,8 +92,8 @@ namespace SJZY.Track.Api | | +-------------------------------------------------------+ "); + #endregion } } - -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Api/appsettings.Development.json b/src/SJZY.Track.Api/appsettings.Development.json index 0856dfd7..671ae998 100644 --- a/src/SJZY.Track.Api/appsettings.Development.json +++ b/src/SJZY.Track.Api/appsettings.Development.json @@ -2,13 +2,12 @@ "Environment": "Dev", "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Debug", "Microsoft.AspNetCore": "Warning" } }, "ConnectionStrings": { - "DefaultConnection": "server=mysql-dev.default.svc.cluster.local;Database=sjzy_openapi;Uid=sjzy_dev_user;Pwd=818f83e5;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", - "BICenterConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_bi_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" + "DefaultConnection": "server=mysql-dev.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_dev_user;Pwd=818f83e5;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", }, "Redis": { "Host": "redis-dev.default.svc.cluster.local:6379", @@ -60,9 +59,20 @@ "BucketName": "cams3", "ReturnHttpsUrl": true }, + "ElasticSearch": { + "NodeUrls": [ "http://elasticsearch-dev.default.svc.cluster.local:9200" ], + "LoginName": "elastic", + "Password": "afyTgmVb8jq6", + "Base64PassPassword": "Basic ZWxhc3RpYzphZnlUZ21WYjhqcTY=" + }, "RemoteServices": { "UserCenter": { "BaseUrl": "http://192.168.80.55:5020/" + }, + "InterfaceForward": { + "BaseUrl": "http://192.168.80.55:5041/", //开发环境80.55,测试环境80.57 + "AppKey": "从接口通应用获取", + "AppSecret": "从接口通应用获取" } } } diff --git a/src/SJZY.Track.Api/appsettings.Test.json b/src/SJZY.Track.Api/appsettings.Test.json index 825693ce..c62fc382 100644 --- a/src/SJZY.Track.Api/appsettings.Test.json +++ b/src/SJZY.Track.Api/appsettings.Test.json @@ -7,8 +7,8 @@ } }, "ConnectionStrings": { - "DefaultConnection": "server=192.168.80.84;Database=sjzy_package_setting;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", - "canalView": "server=192.168.80.84;Database=sjzy_data_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" + "DefaultConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", + "canalView": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" }, "Redis": { "ConnectionString": "192.168.80.58:6379,abortConnect=false", diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 850809ba..d69cb0c1 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -1,20 +1,20 @@ { "Configuration": { - "UseLocalConfiguration": true, // 是否使用本地配置文件 - "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启 UseLocalConfiguration 时生效 + "UseLocalConfiguration": false, //是否使用本地配置文件 + "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration时生效 "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", - "Namespace": "Dev", + "Namespace": "Test", "MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080", "ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ] } - }, - "Kestrel": { - "EndPoints": { - "Http": { - "Url": "http://*:5056" - } + }, + "Kestrel": { + "EndPoints": { + "Http": { + "Url": "http://*:5056" } } } +} \ No newline at end of file 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..0e318811 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs @@ -0,0 +1,13 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class DeleteOrderInput : OrderNoInfo +{ +} + +public class DeleteTrackInput : OrderNoInfo +{ + /// + /// 轨迹code + /// + public List TrackCodes { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs new file mode 100644 index 00000000..3920f5c1 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -0,0 +1,90 @@ +using System.Reflection.Metadata.Ecma335; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices +{ + public class GetOrderDetailsInput + { + /// + /// 轨迹订单id + /// + public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 轨迹模板Id + /// + public List? TrackTemplateIds { get; set; } = new List(); + } + + public class TrackOrderDetailDto + { + /// + /// Id es主键 + /// + public int Id { get; set; } + + /// + /// 轨迹订单id + /// + public int OrderId { set; get; } + + /// + /// 轨迹代码 + /// + public string? Code { get; set; } + + /// + /// 轨迹内容 + /// + public string? Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string? EnContent { get; set; } + + /// + /// 轨迹发生地 + /// + public string? TrackPlace { get; set; } + + /// + /// 轨迹发生时间 + /// + public DateTime? TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public string? TrackTimeZone { get; set; } + + /// + /// 时区的值 + /// + public float TrackTimeZoneValue { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public string? CreateUser { 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..81aa553e --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -0,0 +1,117 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class GetPageTrackOrderInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + ///// + ///// 单号 + ///// + //public List? OrderNos { get; set; } + + /// + /// 单号 + /// + public string? 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; } + + /// + /// 轨迹模板Id数组 + /// + public List? TrackTemplateIds { 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 DateTime? NewestTrackTime { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + public int SubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs new file mode 100644 index 00000000..598ee759 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -0,0 +1,54 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class GetTrackInput +{ + /// + /// 订单类型 + /// + [Required] + [Range(1, int.MaxValue)] + public int OrderType { get; set; } + + /// + /// 订单号 + /// + public List OrderNos { get; set; } = new(); + + /// + /// 时区 +8 +8.25 -8.5 -9 + /// 不传默认+8 + /// + private float? _timeZone; + + public float? TimeZone + { + get => _timeZone ?? 8; + set => _timeZone = value; + } + + /// + /// 排序方式 + /// + [Required] + public SortMethod SortMethod { get; set; } +} + +public enum SortMethod +{ + /// + /// 按轨迹发生时间排序 + /// + ByTrackTime, + + /// + /// 按轨迹发生时间降序 + /// + ByTrackTimeDesc, + + /// + /// 按订单模板排序 + /// + ByTemplate +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs new file mode 100644 index 00000000..eda7ecbc --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs @@ -0,0 +1,21 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class GetTrackOutput +{ + /// + /// 订单号 + /// + public string OrderNo { get; set; } + + public List TrackDetails { get; set; } +} + +public class TrackDetail +{ + public string Code { get; set; } + public string Status { get; set; } + public string Content { get; set; } + public string Location { get; set; } + public DateTime Time { get; set; } + public float TimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs new file mode 100644 index 00000000..cf3e5b79 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs @@ -0,0 +1,31 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class LinkOrderInput +{ + /// + /// false解绑,true关联 + /// + [Required] + public bool IsLink { get; set; } + + /// + /// 订单类型,必填 + /// + [Required] + public int OrderType { get; set; } + + /// + /// 订单号,必填 + /// + [Required] + public string OrderNo { get; set; } + + [Required] public int LinkOrderType { get; set; } + + /// + /// 关联的单号 + /// + public List LinkOrderNos { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs new file mode 100644 index 00000000..eda65e4a --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class OrderNoInfo +{ + /// + /// 订单类型,必填 + /// + [Required] + [Range(1, int.MaxValue)] + public int OrderType { get; set; } + + /// + /// 订单号,必填 + /// + [Required] + [MaxLength(100)] + public string OrderNo { get; set; } = null!; +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs new file mode 100644 index 00000000..4e6e2955 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class RefreshTrackInput +{ + /// + /// 订单号 + /// + public List OrderNos { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs new file mode 100644 index 00000000..69ad9a0b --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -0,0 +1,54 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class UpdateOrderInput : OrderNoInfo +{ + /// + /// 目的港口 + /// + public string? ArrivalPort { get; set; } + + /// + /// 起运港口 + /// + public string? LeavePort { get; set; } + + /// + /// 目的国家,必填 + /// + [Required] + [MaxLength(200)] + public string ArrivalCountry { get; set; } = null!; + + /// + /// 起运国家,必填 + /// + [Required] + [MaxLength(200)] + public string LeaveCountry { get; set; } = null!; + + /// + /// 目的城市,必填 + /// + [Required] + [MaxLength(200)] + public string ArrivalCity { get; set; } = null!; + + /// + /// 起运城市,必填 + /// + [Required] + [MaxLength(200)] + public string LeaveCity { get; set; } = null!; + + /// + /// 订单模板(传全量) + /// + public List? Templates { get; set; } = new(); + + /// + /// 订单航班信息 + /// + public List? FlightInfos { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs new file mode 100644 index 00000000..91ae6d11 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class UpsertOrderInput : UpdateOrderInput +{ + /// + /// 客户id + /// + [Required] + public int CustomId { get; set; } +} + +public class OrderTemplateInfo +{ + /// + /// 模板id + /// + [Required] + public int TemplateId { get; set; } + + /// + /// 服务商id + /// + public int? ServiceProviderId { get; set; } +} + +public class OrderFlightInfo +{ + /// + /// 航班号 + /// + [Required] + [MaxLength(50)] + public string FlightNo { get; set; } + + /// + /// 班期 + /// + [Required] + public DateTime FlightDate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs new file mode 100644 index 00000000..b62cf77b --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -0,0 +1,47 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class UpsertTrackInput : OrderNoInfo +{ + /// + /// 轨迹内容代码 + /// + [Required] + [MaxLength(50)] + public string TrackCode { get; set; } = null!; + + /// + /// 轨迹发生地 + /// + [Required] + [MaxLength(200)] + public string TrackPlace { get; set; } = null!; + + /// + /// 轨迹发生时间 + /// + [Required] + public DateTime? TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + [Required] + [Range(-12, 12)] + public float? TrackTimeZone { get; set; } +} + +public class NotNullAttribute : ValidationAttribute +{ + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (value == null) + { + return new ValidationResult(ErrorMessage ?? "The field is required.", + new[] { validationContext.MemberName }); + } + + return ValidationResult.Success; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs new file mode 100644 index 00000000..f13eac46 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs @@ -0,0 +1,108 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackContents +{ + public class EditTrackContentInput + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 操作类型 + /// + public OptionType Options { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 轨迹内容代码 + /// + public string? Code { get; set; } + + /// + /// 轨迹内容 + /// + public string? Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string? EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + } + + public class GetTrackContentDetailDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { 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..e207654d --- /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.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs new file mode 100644 index 00000000..8c0b6b05 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -0,0 +1,93 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackContents +{ + public class GetPageTrackContentInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string? Keywords { get; set; } + + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } + } + + public class GetTrackContentListDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs new file mode 100644 index 00000000..49bb942a --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -0,0 +1,68 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags +{ + public class EditTrackFlagInput + { + /// + /// 操作类型 + /// + public OptionType Options { get; set; } + + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 标记 + /// + public string? Flag { get; set; } + + /// + /// 代码 + /// + public string? Code { get; set; } + + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } + } + + public class GetTrackFlagDetailDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 代码 + /// + public string Code { get; set; } + + /// + /// + /// + public string Flag { get; set; } + + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs new file mode 100644 index 00000000..3964caea --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -0,0 +1,68 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags +{ + public class GetTrackFlagListDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 代码 + /// + public string Code { get; set; } + + /// + /// 标记 + /// + public string Flag { get; set; } + + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + } + + public class GetPageTrackFlagInput : PageInfoInput + { + /// + /// 子系统id + /// + 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.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs new file mode 100644 index 00000000..2803a4b3 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -0,0 +1,71 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; + +public class EditTrackPullConfigInput +{ + public int? Id { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 拉取轨迹订单号 + /// + public string? OrderNoName { get; set; } + + /// + /// 返参解析对象 + /// + public int? ParseMethod { get; set; } + + /// + /// 定时任务(分钟) + /// + public int? PullInterval { 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? TrackPlaceName { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string? TrackStatusName { get; set; } + + /// + /// 轨迹模板id + /// + public int? TrackTemplateId { get; set; } + + /// + /// 拉取轨迹发生时间 + /// + public string? TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs new file mode 100644 index 00000000..6f3c76dd --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -0,0 +1,51 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; + +public class UpdateTrackPullContentInput +{ + public int Id { get; set; } + + /// + /// 服务商轨迹代码参数值 + /// + public string? TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 服务商轨迹内容参数值 + /// + public string? TrackContentValue { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public List? TrackKeywords { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public List? TrackKeywordReverses { get; set; } + + /// + /// 轨迹发生地参数值 + /// + public int? TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { 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/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs new file mode 100644 index 00000000..b462f6a4 --- /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..ec85498a --- /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..ed095f3e --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -0,0 +1,11 @@ +using SJZY.Expand.ABP.Core.PublicMethords; + +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; + +public class SortTrackPushContentInput +{ + /// + /// 排序信息 + /// + public List SortInfo { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs new file mode 100644 index 00000000..61a9d98e --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -0,0 +1,40 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus +{ + public class EditTrackStatusInput + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 操作类型 + /// + public OptionType Options { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 所属节点id + /// + public int NodeId { get; set; } + + /// + /// 轨迹状态代码 + /// + public string? Code { get; set; } + + /// + /// 轨迹状态 + /// + public string? TrackStatus { get; set; } + + /// + /// 轨迹状态英文 + /// + public string? EntrackStatus { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs new file mode 100644 index 00000000..fe39c418 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs @@ -0,0 +1,40 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus +{ + public class GetTrackStatusDetailDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 节点id + /// + public int NodeId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs new file mode 100644 index 00000000..c505aa72 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -0,0 +1,74 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus +{ + public class GetTrackStatusListDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + } + + + public class GetPageTrackStatusInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { 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.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs new file mode 100644 index 00000000..62ae5922 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs @@ -0,0 +1,33 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates; + +/// +public class EditTrackTemplateContentInput +{ + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + public int? Id { get; set; } + + /// + /// 是否可删 + /// + public bool? IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool? IsExternal { get; set; } + + /// + /// 轨迹内容id + /// + public int? TrackContentId { get; set; } + + /// + /// 轨迹模板id + /// + public int? TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs new file mode 100644 index 00000000..27d3dfc3 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -0,0 +1,28 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates +{ + /// + /// 获取轨迹模版分页输入 + /// + public class GetPageTrackTemplateInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string? Keywords { get; set; } + + ///// + ///// 轨迹模版id,轨迹映射的查询使用 + ///// + //public int TrackTemplateId { get; set; } + + /// + /// 选中的轨迹模版id + /// + public List? SelectIds { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs new file mode 100644 index 00000000..08f7824d --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -0,0 +1,100 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates +{ + /// + /// 获取轨迹模版详情 + /// + public class GetTrackTemplateDetailDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 模版名称 + /// + public string Name { get; set; } + + /// + /// 模版代码 + /// + public string Code { get; set; } + } + + /// + /// 获取轨迹模版列表 + /// + public class GetTrackTemplateListDto + { + /// + /// 轨迹模版id + /// + public int Id { get; set; } + + /// + /// 模板名称 + /// + public string Name { set; get; } + + /// + /// 模版代码 + /// + public string Code { get; set; } + + /// + /// 所属子系统 + /// + public string SubSystem { set; get; } + + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + } + + /// + /// 编辑轨迹模版 + /// + public class EditTrackTemplateInput + { + /// + /// Id + /// + public int Id { set; get; } + + /// + /// 操作类型 + /// + public OptionType Options { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + + /// + /// 模板名称 + /// + public string? Name { set; get; } + + /// + /// 模板代码 + /// + public string? Code { set; get; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs new file mode 100644 index 00000000..0dbd5155 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs @@ -0,0 +1,11 @@ +using SJZY.Expand.ABP.Core.PublicMethords; + +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates; + +public class SortTrackTemplateContentInput +{ + /// + /// 排序信息 + /// + public List SortInfo { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs new file mode 100644 index 00000000..eccbe955 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs @@ -0,0 +1,29 @@ +namespace SJZY.Track.Application.Contract.Events; + +public class TrackDeleteEvent +{ + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 轨迹代码 + /// + public List TrackCodes { get; set; } = null!; + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 上游子系统id + /// + public int UpSubSystemId { get; set; } + + /// + /// 已经处理过的订单 + /// + public List Visited { get; set; } = new(); +} \ 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..04f91415 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -0,0 +1,36 @@ +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 CustomId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 订单是否推送完成(异步维护) + /// + public bool IsPushCompleted { get; set; } + + /// + /// 上游子系统id + /// + public int UpSubSystemId { get; set; } + + /// + /// 已经处理过的订单 + /// + public List Visited { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs new file mode 100644 index 00000000..f04cd86c --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs @@ -0,0 +1,39 @@ +namespace SJZY.Track.Application.Contract.Events; + +public class UpdateOrderTrackEvent +{ + /// + /// 订单Id + /// + public int OrderId { get; set; } + + /// + /// 此次发生的轨迹是否意味完成 + /// + public bool IsCompleted { get; set; } + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } = null!; + + /// + /// 轨迹内容英文 + /// + public string TrackEnContent { get; set; } = null!; + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } = null!; + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹时区 + /// + public float TrackTimeZone { 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/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs new file mode 100644 index 00000000..04369975 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs @@ -0,0 +1,18 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackPushCacheService +{ + /// + /// 判断客户是否需要推送 + /// + /// + /// + Task IsPushAsync(int customId); + + /// + /// 更新缓存 + /// + /// + /// + Task UpdateAsync(int customId, bool isPush); +} \ 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/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs deleted file mode 100644 index 0fa79af5..00000000 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ /dev/null @@ -1,81 +0,0 @@ -using SJZY.Expand.ABP.Core.Localization; -using SJZY.LoggerCenter.HttpApi; -using SJZY.Track.Application.Localization; -using SJZY.UserCenter.Contracts; -using SJZY.UserCenter.SharedModel; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AutoMapper; -using Volo.Abp.FluentValidation; -using Volo.Abp.Http.Client; -using Volo.Abp.Localization; -using Volo.Abp.Modularity; -using Volo.Abp.VirtualFileSystem; - -namespace SJZY.Track.Application -{ - [DependsOn( - typeof(AbpAutoMapperModule), - typeof(RepositoryModule), - typeof(AbpFluentValidationModule), - typeof(AbpLocalizationModule), - typeof(AbpVirtualFileSystemModule), - typeof(AbpHttpClientModule), - typeof(LoggerCenterHttpApiModule) - )] - public class ApplicationModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - Configure(options => - { - options.AddMaps(true); - }); - - Configure(options => - { - options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly);//创建动态api - }); - - - - //添加虚拟文件系统 - Configure(options => - { - options.FileSets.AddEmbedded("SJZY.Track.Application"); - }); - - //添加多语言 - Configure(options => - { - options.Resources - .Add("zh") - .AddBaseTypes(typeof(SjzyBasicLocalization)) - .AddVirtualJson("/Localization/Resources"); - }); - - //日志中心 - context.Services.AddHttpClientProxies(typeof(LoggerCenterHttpApiModule).Assembly, "LoggerCenter", false); - - //用户中心 - context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); - } - - public override void PreConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - PreConfigure(options => - { - - options.ProxyClientActions.Add(async (remoteName, serviceProvider, httpClient) => - { - //如果设置Token,前端需要传入Token 否则引发异常 - httpClient.SetTokenHeader(); - httpClient.Timeout = TimeSpan.FromMinutes(3); - await Task.CompletedTask; - }); - }); - } - - } -} diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs deleted file mode 100644 index 563fc396..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.Repository.Demo.ValueObjects; - -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 new file mode 100644 index 00000000..25cb3b57 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -0,0 +1,32 @@ +using AutoMapper; +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.AutoMapper; + +namespace SJZY.Track.Application.AutoMapper; + +public class OrderAutoMapperProfile : Profile +{ + public OrderAutoMapperProfile() + { + CreateMap(MemberList.None); + CreateMap(MemberList.None); + + CreateMap(MemberList.None) + .ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0)) + .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId)); + CreateMap(MemberList.None); + + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.TrackTimeZone) + .ForMember(dest => dest.Id, opt => opt.Ignore()) + .ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode)) + .ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent)) + .ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent)) + .ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone)); + } +} \ 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 new file mode 100644 index 00000000..77b0c47d --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -0,0 +1,22 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackContents; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; + +namespace SJZY.Track.Application.AutoMapper +{ + public class TrackContentAutoMapperProfile : Profile + { + public TrackContentAutoMapperProfile() + { + CreateMap(MemberList.None) + .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(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 new file mode 100644 index 00000000..bf72f035 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -0,0 +1,21 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Dtos.TrackFlags; + +namespace SJZY.Track.Application.AutoMapper +{ + public class TrackFlagAutoMapperProfile : Profile + { + 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)); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap(MemberList.None); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs new file mode 100644 index 00000000..d8dad310 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -0,0 +1,19 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackPull; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using Volo.Abp.AutoMapper; + +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPullAutoMapperProfile : Profile +{ + public TrackPullAutoMapperProfile() + { + CreateMap(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None) + .ForMember(dest => dest.TrackKeyword, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywords))) + .ForMember(dest => dest.TrackKeywordReverse, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses))); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs new file mode 100644 index 00000000..3a42d0e4 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -0,0 +1,19 @@ +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; + +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 new file mode 100644 index 00000000..49796f47 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs @@ -0,0 +1,24 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackStatus; + +namespace SJZY.Track.Application.AutoMapper +{ + public class TrackStatusAutoMapperProfile : Profile + { + 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)); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(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 new file mode 100644 index 00000000..36f0e498 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -0,0 +1,23 @@ +using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackTemplate; + +namespace SJZY.Track.Application.AutoMapper; + +/// +/// 轨迹模版自动映射 +/// +public class TrackTemplateAutoMapperProfile : Profile +{ + public TrackTemplateAutoMapperProfile() + { + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(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 13f63049..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; } - } -} 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/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs new file mode 100644 index 00000000..099b1b99 --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs @@ -0,0 +1,35 @@ +using DotNetCore.CAP; +using Newtonsoft.Json; +using SJZY.InterfaceRelay.Application.Contracts; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.EventHandlers; + +public class InterfaceRelayTrackRefreshEventHandler : ITransientDependency, ICapSubscribe +{ + private readonly IOrderRepository _orderRepository; + private readonly IProvideQueries _provideQueries; + + public InterfaceRelayTrackRefreshEventHandler(IOrderRepository orderRepository, IProvideQueries provideQueries) + { + _orderRepository = orderRepository; + _provideQueries = provideQueries; + } + + [CapSubscribe(GlobalConst.InterfaceRelayTrackRefreshSubscribe)] + public async Task ConsumerAsync(InterfaceRelayTrackRefreshEvent @event) + { + if (@event.RequestParams is List requestParams) + { + var orderNos = requestParams.Select(x => x.OrderNo).ToList(); + + // tips:attach返回的是服务商id,必有 + var pullContentConfigs = await _provideQueries.GetPullContentConfigsAsync(int.Parse(@event.Attach)); + + // 轨迹清洗入库 + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs new file mode 100644 index 00000000..55bb5b1d --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs @@ -0,0 +1,76 @@ +using DotNetCore.CAP; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.EventHandlers; + +public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe +{ + private readonly IOrderRepository _orderRepository; + private readonly IProvideQueries _provideQueries; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ICapPublisher _capPublisher; + + public TrackDeleteEventHandler(IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository, + IOrderRepository orderRepository, ICapPublisher capPublisher) + { + _provideQueries = provideQueries; + _trackDetailsRepository = trackDetailsRepository; + _orderRepository = orderRepository; + _capPublisher = capPublisher; + } + + [CapSubscribe(GlobalConst.TrackDeleteSubscribe)] + public async Task ConsumerAsync(TrackDeleteEvent @event) + { + if (@event.Visited.Contains(@event.OrderId)) + { + LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}"); + return; + } + + @event.Visited.Add(@event.OrderId); + + // 不同子系统需要做内容映射 + if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId) + { + var mapCodes = await _provideQueries + .MapTrackCodesAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCodes.ToArray()); + + if (mapCodes.Count == 0) + { + //throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + return; + } + + @event.TrackCodes = mapCodes; + } + + await DeleteTrackAsync(@event); + } + + private async Task DeleteTrackAsync(TrackDeleteEvent @event) + { + // 删除轨迹 + await _trackDetailsRepository.DeleteTrackAsync(@event.OrderId, @event.TrackCodes); + + // 根据订单关联关系异步向下刷 + var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); + foreach (var linkedOrder in linkedOrders) + { + var nextEvent = new TrackDeleteEvent + { + OrderId = linkedOrder.OrderId, + TrackCodes = @event.TrackCodes, + SubSystemId = linkedOrder.SubSystemId, + UpSubSystemId = @event.SubSystemId + }; + + await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, nextEvent); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs new file mode 100644 index 00000000..29e14bc2 --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -0,0 +1,143 @@ +using DotNetCore.CAP; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Application.Contract.Services; +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 IProvideQueries _provideQueries; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackPushCacheService _trackPushCacheService; + private readonly ICapPublisher _capPublisher; + + public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher, + IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository, + ITrackPushCacheService trackPushCacheService) + { + _orderRepository = orderRepository; + _capPublisher = capPublisher; + _provideQueries = provideQueries; + _trackDetailsRepository = trackDetailsRepository; + _trackPushCacheService = trackPushCacheService; + } + + [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] + public async Task ConsumerAsync(TrackUpsertEvent @event) + { + if (@event.Visited.Contains(@event.OrderId)) + { + LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}"); + return; + } + + @event.Visited.Add(@event.OrderId); + + // 不同子系统需要做内容映射 + if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId) + { + var mapCode = (await _provideQueries + .MapTrackCodesAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode)) + .FirstOrDefault(); + + if (mapCode == default) + { + // 跨子系统没做映射的轨迹不处理 + return; + } + + @event.TrackCode = mapCode; + } + + await UpsertTrackAsync(@event); + } + + private async Task UpsertTrackAsync(TrackUpsertEvent @event) + { + // 不存在则新增轨迹,存在则更新 + var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode); + + var orderIsCompleted = false; + if (track == default) + { + // 根据轨迹code在订单模板内容中寻找匹配的 + var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); + if (trackContent == default) + { + //throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); + return; + } + + orderIsCompleted = trackContent.IsCompleted; + + track = new TrackDetailsIndex + { + IndexName = $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}", + 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!.Value, + TrackTimeZone = @event.TrackTimeZone!.Value, + IsCanDelete = trackContent.IsCanDelete, + CreateUser = CurrentUserRequest.CurrentUser.Name, + CreateTime = DateTime.Now + }; + + // todo:推送只做新增的,更新和删除的不做先 + if (!@event.IsPushCompleted && await _trackPushCacheService.IsPushAsync(@event.CustomId)) + { + //await PushTrack(); + } + } + else + { + track.TrackPlace = @event.TrackPlace; + track.TrackTime = @event.TrackTime!.Value; + track.TrackTimeZone = @event.TrackTimeZone!.Value; + track.UpdateUser = CurrentUserRequest.CurrentUser.Name; + track.UpdateTime = DateTime.Now; + } + + await _trackDetailsRepository.UpsertAsync(track); + + // 触发订单主表更新事件 + await _capPublisher.PublishAsync(GlobalConst.UpdateOrderTrackSubscribe, new UpdateOrderTrackEvent + { + OrderId = track.OrderId, + IsCompleted = orderIsCompleted, + TrackContent = track.TrackContent, + TrackEnContent = track.TrackEnContent, + TrackPlace = track.TrackPlace, + TrackTime = track.TrackTime, + TrackTimeZone = track.TrackTimeZone + }); + + // 根据订单关联关系异步向下刷 + var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); + foreach (var linkedOrder in linkedOrders) + { + var nextEvent = @event.DeepCopy(); + nextEvent.OrderId = linkedOrder.OrderId; + nextEvent.OrderType = linkedOrder.OrderType; + nextEvent.OrderNo = linkedOrder.OrderNo; + nextEvent.SubSystemId = linkedOrder.SubSystemId; + nextEvent.IsPushCompleted = linkedOrder.IsPushCompleted; + nextEvent.CustomId = linkedOrder.CustomId; + nextEvent.UpSubSystemId = @event.SubSystemId; + await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs new file mode 100644 index 00000000..0901b2a0 --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs @@ -0,0 +1,40 @@ +using DotNetCore.CAP; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.EventHandlers; + +public class UpdateOrderTrackEventHandler : ITransientDependency, ICapSubscribe +{ + private readonly IOrderRepository _orderRepository; + + public UpdateOrderTrackEventHandler(IOrderRepository orderRepository) + { + _orderRepository = orderRepository; + } + + [CapSubscribe(GlobalConst.UpdateOrderTrackSubscribe)] + public async Task ConsumerAsync(UpdateOrderTrackEvent @event) + { + var order = await _orderRepository.GetFirstAsync(x => x.Id == @event.OrderId); + if (order == default) return; + + if (order.IsCompleted) return; + order.LatestTrackContent = @event.TrackContent; + order.LatestTrackEnContent = @event.TrackEnContent; + order.LatestTrackPlace = @event.TrackPlace; + order.LatestTrackTime = @event.TrackTime; + order.LatestTrackTimeZone = @event.TrackTimeZone; + if (@event.IsCompleted) order.IsCompleted = true; + else if (order.LatestTrackTime != null && + order.LatestTrackTime.Value.Subtract(TimeSpan.FromHours(order.LatestTrackTimeZone ?? 0)) > + @event.TrackTime.Subtract(TimeSpan.FromHours(@event.TrackTimeZone))) return; + + await _orderRepository.UpdateColumnAsync(order, x => new + { + x.IsCompleted, x.LatestTrackContent, x.LatestTrackEnContent, x.LatestTrackPlace, x.LatestTrackTime, + x.LatestTrackTimeZone + }); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs index 23e3b927..e4968bf8 100644 --- a/src/SJZY.Track.Application/GlobalUsing.cs +++ b/src/SJZY.Track.Application/GlobalUsing.cs @@ -2,8 +2,7 @@ global using Microsoft.Extensions.DependencyInjection; global using SJZY.Expand.ABP.Common.Enums; global using SJZY.Expand.ABP.Core.Common.Dto; -global using SJZY.Track.Repository; -global using SJZY.Track.Repository.Demo.Entitys; 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/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 5994b511..c7d369bc 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -3,6 +3,13 @@ "texts": { "NotNull1": "{0} is not null", "NotFindData": "No data found under the specified number", - "ParameterDemo1": "{0} in {1} to do {2}" + "ParameterDemo1": "{0} in {1} to do {2}", + "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", + "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 48af2570..38db9ebb 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -3,6 +3,13 @@ "texts": { "NotFindData": "未找到指定编号下的任何数据!", "ParameterDemo": "{0}在{1}地方做了{2}动作", - "ParameterDemo1": "{0}在{1}地方做了{2}动作" + "ParameterDemo1": "{0}在{1}地方做了{2}动作", + "TemplateExist": "模板代码已存在于当前选择的子系统下", + "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", + "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复", + "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 37c0357f..d2b2eafd 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -1,33 +1,26 @@  - - net7.0 - enable - 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 145322ac..00000000 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ /dev/null @@ -1,234 +0,0 @@ -using SJZY.Expand.ABP.Core.Common; -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Repository.Demo.Services; -using SJZY.Track.Repository.Demo.ValueObjects; -using Volo.Abp.Http.Client.DynamicProxying; - -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 new file mode 100644 index 00000000..c4a6d1db --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -0,0 +1,100 @@ +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 订单关联服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +public class OrderLinkService : ApplicationService +{ + private readonly IOrderRepository _orderRepository; + private readonly IBasicQuery _orderLinkQuery; + + public OrderLinkService(IBasicQuery orderLinkQuery, IOrderRepository orderRepository) + { + _orderLinkQuery = orderLinkQuery; + _orderRepository = orderRepository; + } + + /// + /// 关联订单 + /// + /// + /// + [HttpPost("Order/Link")] + public async Task LinkOrderAsync(LinkOrderInput input) + { + var orderId = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); + if (orderId == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + //todo:循环关联? + if (input.OrderType == input.LinkOrderType) + { + throw new BusinessException(message: "不能同级关联"); + } + + if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; + + // 单号去重,去空,去自己 + input.LinkOrderNos = input.LinkOrderNos + .Where(x => !x.IsNullOrWhiteSpace() && x != input.OrderNo) + .Distinct().ToList(); + + // 解绑 + if (!input.IsLink) return await UnLinkOrderAsync(input); + + // 关联订单 + return await DoLinkOrderAsync(input, orderId); + } + + private async Task DoLinkOrderAsync(LinkOrderInput input, int orderId) + { + // 获取已关联的订单 + var linkOrderNos = await _orderLinkQuery.GetListAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo && x.LinkOrderType == input.LinkOrderType, + x => x.LinkOrderNo); + + // 计算出未关联的订单 + var noLinkOrderNos = input.LinkOrderNos.Except(linkOrderNos); + + // 过滤掉不存在的订单 + var canLinkOrders = await _orderRepository.GetListAsync(x => + x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo), + x => new { x.Id, x.OrderNo }); + + await _orderRepository.LinkOrderAsync(canLinkOrders.Select(x => new OrderLinkEntity + { + OrderId = orderId, + OrderNo = input.OrderNo, + OrderType = input.OrderType, + LinkOrderId = x.Id, + LinkOrderNo = x.OrderNo, + LinkOrderType = input.LinkOrderType + }).ToList()); + + // todo:补轨迹 + + return true; + } + + private async Task UnLinkOrderAsync(LinkOrderInput input) + { + var unLinkIds = await _orderLinkQuery.GetListAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo && + x.LinkOrderType == input.LinkOrderType && input.LinkOrderNos.Contains(x.LinkOrderNo), + x => x.Id); + + // real del + await _orderRepository.UnLinkByIdsAsync(unLinkIds); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs new file mode 100644 index 00000000..a021cd41 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -0,0 +1,82 @@ +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 SJZY.UserCenter.HttpApi.Services; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 订单服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +public class OrderService : ApplicationService +{ + private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; + + public OrderService(IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository + ) + { + _orderRepository = orderRepository; + _trackDetailsRepository = trackDetailsRepository; + } + + /// + /// 创建订单,订单已存在则视为更新 + /// + /// + /// + /// + [HttpPost("Order/Upsert")] + public async Task UpsertAsync(UpsertOrderInput input) + { + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo); + if (order != default) + { + // 订单已存在则视为更新 + await UpdateOrderAsync(input, order); + return "更新成功"; + } + + order = ObjectMapper.Map(input); + order.SubSystemId = CurrentUserRequest.SubSystemId; + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); + + await _orderRepository.CreateOrderAsync(order); + return "创建成功"; + } + + /// + /// 删除订单 + /// + /// + /// + /// + [HttpPost("Order/Delete")] + public async Task DeleteOrderAsync(DeleteOrderInput input) + { + var orderId = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); + if (orderId == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + await _orderRepository.DeleteOrderAsync(orderId); + + return true; + } + + private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) + { + order = ObjectMapper.Map(input, order); + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); + await _orderRepository.UpdateOrderAsync(order); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs new file mode 100644 index 00000000..53cdfd57 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs @@ -0,0 +1,57 @@ +using SJZY.InterfaceRelay.Application.Contracts; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using Volo.Abp.Http.Client.DynamicProxying; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹拉取服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +public class TrackPullService : ApplicationService +{ + private readonly IOrderRepository _orderRepository; + private readonly IHttpClientProxy _httpClientProxy; + + public TrackPullService(IOrderRepository orderRepository, + IHttpClientProxy httpClientProxy) + { + _orderRepository = orderRepository; + _httpClientProxy = httpClientProxy; + } + + /// + /// 刷新轨迹 + /// + /// + /// + [HttpPost("Track/Refresh")] + public async Task RefreshTrackAsync(RefreshTrackInput input) + { + if (input.OrderNos.Count == 0) + { + throw new BusinessException(message: "订单号数组不能为空"); + } + + input.OrderNos = input.OrderNos.Distinct().ToList(); + + var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderNos); + + foreach (var group in orderTemplates.GroupBy(x => x.ServiceProviderId)) + { + var data = group.Select(x => new OrderNoInfo + { + OrderType = x.OrderType, + OrderNo = x.OrderNo + }).ToList(); + + await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( + "A012", "yicang", 42, data, GlobalConst.InterfaceRelayTrackRefreshSubscribe + , group.Key.ToString()); + } + + return true; + } +} \ No newline at end of file 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..f2b5320f --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs @@ -0,0 +1,11 @@ +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹推送服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +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 new file mode 100644 index 00000000..241d9030 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -0,0 +1,108 @@ +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹查询服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +public class TrackQueryService : ApplicationService +{ + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly IOrderRepository _orderRepository; + private readonly IProvideQueries _provideQueries; + + public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, + IOrderRepository orderRepository, + IProvideQueries provideQueries) + { + _trackDetailsRepository = trackDetailsRepository; + _orderRepository = orderRepository; + _provideQueries = provideQueries; + } + + /// + /// 根据订单号获取轨迹 + /// + /// + /// + /// + [HttpPost("Track/Query")] + public async Task> QueryAsync(GetTrackInput input) + { + if (input.OrderNos.Count > 500) + { + throw new BusinessException(message: "最多只能查询500单"); + } + + var res = new List(); + input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空 + var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos); + + foreach (var group in details.GroupBy(x => x.OrderId)) + { + var item = new GetTrackOutput(); + var trackDetails = group.ToList(); + item.OrderNo = trackDetails.First().OrderNo; + + item.TrackDetails = trackDetails.Select(x => new TrackDetail + { + Code = x.TrackCode, + Status = x.TrackStatus, + Content = x.TrackContent, + Location = x.TrackPlace, + Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone), + TimeZone = input.TimeZone ?? 8 + }).ToList(); + + res.Add(item); + } + + await TrackDetailSort(res, input); + + return res; + } + + private async Task TrackDetailSort(List list, GetTrackInput input) + { + switch (input.SortMethod) + { + case SortMethod.ByTrackTime: + // tips:quick-sort 直接修改原list + list.ForEach(item => item.TrackDetails.Sort((a, b) => a.Time.CompareTo(b.Time))); + break; + case SortMethod.ByTrackTimeDesc: + list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time))); + break; + case SortMethod.ByTemplate: + var orderTemplates = await _provideQueries + .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos); + var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList(); + var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds); + list.ForEach(item => + { + var codes = new List(); + // 多模板拼接显示 + foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo)) + { + codes.AddRange(templateContent + .Where(t => t.TemplateId == orderTemplate.TemplateId) // 按模板 + .Where(t => t.IsExternal) // 过滤不对外的 + .Select(t => t.Code)); + } + + item.TrackDetails = item.TrackDetails + .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素 + .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序 + .ToList(); + }); + break; + default: + throw new ArgumentOutOfRangeException(nameof(input.SortMethod), input.SortMethod, "不支持的排序方式"); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs new file mode 100644 index 00000000..18adf7fa --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -0,0 +1,93 @@ +using DotNetCore.CAP; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] +public class TrackService : ApplicationService +{ + private readonly IOrderRepository _orderRepository; + private readonly IProvideQueries _provideQueries; + private readonly ICapPublisher _capPublisher; + + public TrackService(IOrderRepository orderRepository, IProvideQueries provideQueries, ICapPublisher capPublisher) + { + _orderRepository = orderRepository; + _provideQueries = provideQueries; + _capPublisher = capPublisher; + } + + /// + /// 新增/更新订单轨迹接口 + /// + /// + /// + /// + [HttpPost("Track/Upsert")] + public async Task UpsertTrackAsync(UpsertTrackInput input) + { + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new + { + x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId + }); + if (order == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + // 新增/更新轨迹 + var @event = ObjectMapper.Map(input); + @event.OrderId = order.Id; + @event.SubSystemId = order.SubSystemId; + @event.IsPushCompleted = order.IsPushCompleted; + @event.CustomId = order.CustomId; + await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event); + return true; + } + + /// + /// 删除轨迹 + /// + /// + /// + /// + [HttpPost("Track/Delete")] + public async Task DeleteTrackAsync(DeleteTrackInput input) + { + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new + { + x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId + }); + if (order == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(order.Id, input.TrackCodes); + + if (codes.Count == 0) + { + throw new BusinessException(message: "没有一个轨迹代码是可删的"); + } + + // 删除轨迹 + var @event = new TrackDeleteEvent + { + OrderId = order.Id, + TrackCodes = codes, + SubSystemId = order.SubSystemId, + }; + await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs new file mode 100644 index 00000000..f4946435 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -0,0 +1,297 @@ +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackContents; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Queries; +using System.Linq.Expressions; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackContents +{ + /// + /// 轨迹内容服务 + /// + [ApiExplorerSettings(GroupName = "轨迹内容")] + [Route("/Track/Content")] + public class TrackContentService : ApplicationService, ITransientDependency + { + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackContentRepository _trackContentRepository; + private readonly IBasicQuery _trackContentMapBasicQuery; + private readonly IBasicQuery _trackTemplateContentBasicQuery; + + public TrackContentService( + IStringLocalizer stringLocalizer, + ITrackContentRepository trackContentRepository, + IBasicQuery trackContentMapBasicQuery, + IBasicQuery trackTemplateContentBasicQuery + ) + { + this._stringLocalizer = stringLocalizer; + this._trackContentRepository = trackContentRepository; + this._trackContentMapBasicQuery = trackContentMapBasicQuery; + this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery; + } + + /// + /// 轨迹内容编辑 + /// + /// + [HttpPost("Edit")] + public async Task EditAsync(EditTrackContentInput input) + { + return input.Options switch + { + OptionType.新增 => await AddAsync(input), + OptionType.修改 => await UpdateAsync(input), + OptionType.删除 => await DeleteAsync(input), + _ => throw new BusinessException(message: "当前操作动作不合法") + }; + } + + /// + /// 根据内容id获取轨迹内容 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackContentRepository.GetDetailAsync(id); + if (detailInfo == null) + { + return new UnifyResultDto(false, null, "未查询到轨迹状态"); + } + + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } + + /// + /// 获取分页轨迹内容 + /// + /// + /// + [HttpPost("GetList")] + public async Task> GetPageTrackContent( + GetPageTrackContentInput input) + { + var vo = ObjectMapper.Map(input); + var resultDto = await _trackContentRepository.GetPageTrackContent(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>( + resultDto); + + return pageResultDto; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackContentInput input) + { + #region 业务逻辑校验 + + var trackContentEntitys = await _trackContentRepository.GetListAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); + if (trackContentEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code); + if (codes!=null) + { + throw new BusinessException(message: "该子系统下轨迹代码已存在"); + } + var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content); + if (contents!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容已存在"); + } + var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent); + if (contentEns!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容英文已存在"); + } + //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); + } + + #endregion 业务逻辑校验 + + var entity = ObjectMapper.Map(input); + var isTrue = await _trackContentRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackContentInput input) + { + #region 业务逻辑校验 + + var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); + if (trackContentEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); + var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code); + if (codes!=null) + { + throw new BusinessException(message: "该子系统下轨迹代码已存在"); + } + var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content); + if (contents!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容已存在"); + } + var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent); + if (contentEns!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容英文已存在"); + } + } + + #endregion 业务逻辑校验 + + //更新的时候需要覆盖内容映射轨迹代码 + var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); + + bool isTrue = 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 业务校验 + //查询是否关联了轨迹模版内容 + var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id); + if (isExistTemplate) + { + throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除"); + } + //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); + //if (trackTemplateContents.Any()) + //{ + // throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除"); + //} + + //需要加个判断,存在内容映射,则出提示 + //var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id); + //if (trackContentMapEntities.Any()) + //{ + // throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查"); + //} + #endregion 业务校验 + + var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + + #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.删除) + { + if (input.SubSystemId == input.MapSubSystemId) throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]); + + 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/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs new file mode 100644 index 00000000..9e7d4056 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -0,0 +1,163 @@ +using Microsoft.Extensions.Localization; +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.Dtos.TrackFlags; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackFlags +{ + /// + /// 轨迹标记服务 + /// + [ApiExplorerSettings(GroupName = "轨迹标记")] + [Route("/Track/Flag")] + public class TrackFlagService : ApplicationService, ITransientDependency + { + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackFlagRepository _trackFlagRepository; + private readonly ITrackContentRepository _trackContentRepository; + + public TrackFlagService( + IStringLocalizer stringLocalizer, + ITrackFlagRepository trackFlagRepository, + ITrackContentRepository trackContentRepository + ) + { + this._stringLocalizer = stringLocalizer; + this._trackFlagRepository = trackFlagRepository; + this._trackContentRepository=trackContentRepository; + } + + /// + /// 轨迹标记编辑 + /// + /// + [HttpPost("Edit")] + public async Task EditAsync(EditTrackFlagInput input) + { + return input.Options switch + { + OptionType.新增 => await AddAsync(input), + OptionType.修改 => await UpdateAsync(input), + OptionType.删除 => await DeleteAsync(input), + _ => throw new BusinessException(message: "当前操作动作不合法") + }; + } + + /// + /// 根据标记id获取轨迹标记 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackFlagRepository.GetDetailAsync(id); + if (detailInfo == null) + { + return new UnifyResultDto(false, null, "未查询到轨迹状态"); + } + + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } + + /// + /// 获取分页轨迹标记 + /// + /// + /// + [HttpPost("GetList")] + public async Task> GetPageTrackFlag(GetPageTrackFlagInput input) + { + var vo = ObjectMapper.Map(input); + var resultDto = await _trackFlagRepository.GetPageTrackFlag(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>( + resultDto); + + return pageResultDto; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackFlagInput input) + { + #region 业务校验 + var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); + if (trackFlagsEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); + var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code); + if (trackFlagCode!=null) + { + throw new BusinessException(message: "该子系统下代码已存在"); + } + var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag); + if (trackFlagName!=null) + { + throw new BusinessException(message: "该子系统下标记已存在"); + } + } + #endregion + + var entity = ObjectMapper.Map(input); + var isTrue = await _trackFlagRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackFlagInput input) + { + #region 业务校验 + + var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Name == input.Flag)); + if (trackFlagsEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); + var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code); + if (trackFlagCode!=null) + { + throw new BusinessException(message: "该子系统下代码已存在"); + } + var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag); + if (trackFlagName!=null) + { + throw new BusinessException(message: "该子系统下标记已存在"); + } + } + + #endregion + + var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackFlagRepository.UpdateAsync(templateEntity); + + return new UnifyResultDto("200", "修改成功", isTrue); + } + + 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"]); + throw new BusinessException(message: "该标记关联轨迹内容,禁止删除"); + } + #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/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs new file mode 100644 index 00000000..908d7227 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -0,0 +1,115 @@ +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Dtos.Order; +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.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackOrders +{ + [ApiExplorerSettings(GroupName = "轨迹订单")] + [Route("/Track/Order")] + public class TrackOrderService : ApplicationService, ITransientDependency + { + private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackContentRepository _trackContentRepository; + + public TrackOrderService( + IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository, + ITrackContentRepository trackContentRepository + ) + { + this._orderRepository=orderRepository; + this._trackDetailsRepository=trackDetailsRepository; + this._trackContentRepository=trackContentRepository; + } + + #region 轨迹订单明细 + /// + /// 根据轨迹订单id获取轨迹订单明细列表 + /// + /// + /// + [HttpPost("GetDetails")] + public async Task> GetOrderDetails(GetOrderDetailsInput input) + { + var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); + if (!trackDetails.IsNullOrEmpty()) + { + var list = ObjectMapper.Map, List>(trackDetails); + var trackCodes = list.Where(a => !a.Code.IsNullOrWhiteSpace()).Select(a => a.Code).Distinct().ToList(); + + var trackContents = await _trackContentRepository.GetTrackContentAttributeValue(new GetTemplateContentAttributeValueInputVO + { + SubSystemId =input.SubSystemId, + TrackTemplateIds = input.TrackTemplateIds, + TrackCodes=trackCodes + }); + input.TrackTemplateIds =input.TrackTemplateIds.Where(a => a>0).ToList(); + int id = 1; + list.ForEach(a => + { + a.Id = id++; + + var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId==input.SubSystemId && b.TrackCode==a.Code + && input.TrackTemplateIds.Contains(b.TrackTemplateId)); + GetTemplateContentAttributeValueVO trackContent = null; + var insertData = input.TrackTemplateIds.Intersect(trackContentsOfTemplates.Select(aa => aa.TrackTemplateId)).ToList(); + if (!insertData.IsNullOrEmpty()) + { + trackContent =trackContentsOfTemplates.FirstOrDefault(a => a.TrackTemplateId==insertData.FirstOrDefault()); + } + + if (trackContent!=null) + { + a.IsCanDelete=trackContent.IsCanDelete; + a.IsExternal = trackContent.IsExternal; + } + if (a.TrackTimeZoneValue==0f) + { + a.TrackTimeZone=$"GTM{" "}+00:00"; + } + else + { + // 将小数形式的小时转换为时区偏移量 + int hours = (int)a.TrackTimeZoneValue; // 提取整数部分作为小时 + int minutes = (int)((a.TrackTimeZoneValue - hours) * 60); // 将小数部分乘以 60 转换为分钟 + TimeSpan offset = new TimeSpan(hours, minutes, 0); + string timeZoneStr = offset.ToString(); + string flag = a.TrackTimeZoneValue>0f ? "+" : ""; + a.TrackTimeZone = $"GTM{" "}{flag}{timeZoneStr.RemovePostFix(":00")}"; + } + }); + return list; + } + + return new List(); + } + #endregion + + #region 轨迹订单列表 + /// + /// 获取分页的轨迹订单 + /// + /// + /// + [HttpPost("GetTrackOrderList")] + public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) + { + var vo = ObjectMapper.Map(input); + var pageList = await _orderRepository.GetPageTrackOrder(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>(pageList); + return pageResultDto; + } + #endregion + } +} diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs new file mode 100644 index 00000000..34998b29 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -0,0 +1,241 @@ +using System; +using System.Linq.Expressions; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +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 SqlSugar; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackPull; + +/// +/// 轨迹拉取 +/// +[ApiExplorerSettings(GroupName = "轨迹拉取")] +[Route("/Track/PullConfig")] +public class TrackPullService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; + + public TrackPullService( + IStringLocalizer stringLocalizer, + ITrackPullConfigRepository trackPullConfigRepository, + ITrackTemplateRepository trackTemplateRepository) + { + _stringLocalizer = stringLocalizer; + _trackPullConfigRepository = trackPullConfigRepository; + _trackTemplateRepository = trackTemplateRepository; + } + + /// + /// 轨迹拉取配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPullConfigRepository.GetPageAsync(input); + } + + /// + /// 轨迹拉取配置内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync( + [FromBody] GetTrackPullContentPageInputVO input) + { + return await _trackPullConfigRepository.GetContentPageAsync(input); + } + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int id) + { + return await _trackPullConfigRepository.GetDetailAsync(id); + } + + /// + /// 轨迹拉取配置内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackPullConfigRepository.GetContentDetailAsync(id); + } + + /// + /// 轨迹拉取配置编辑 + /// + /// + /// + [HttpPost("Edit")] + public async Task EditAsync([FromBody] EditTrackPullConfigInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isAnyExp = x => + x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && + x.ServiceProviderId == input.ServiceProviderId; + if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); + + if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPullEntity = ObjectMapper.Map(input); + var trackPullParamsEntity = + ObjectMapper.Map(input); + + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + + var trackPullContentEntities = new List(); + + using (var ts = TransactionScopeHelper.Create()) + { + int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); + + trackPullParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); + + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = id, + TrackContentId = item.TrackContentId + }); + } + + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.修改: + { + 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 trackPullContentEntities = new List(); + + if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + { + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => + x.TrackTemplateId == input.TrackTemplateId); + + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = oldTrackPullEntity.Id, + TrackContentId = item.TrackContentId + }); + } + } + + ObjectMapper.Map(input, oldTrackPullEntity); + ObjectMapper.Map(input, oldTrackPullParamsEntity); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); + await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); + + if (trackPullContentEntities.Count > 0) + { + await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + } + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.删除: + 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.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + + ts.Complete(); + } + + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPullConfigInput.Options)]); + } + + return true; + } + + /// + /// 轨迹拉取配置内容修改 + /// + /// + /// + [HttpPost("UpdateContent")] + public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) + { + Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId; + + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]); + else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]); + else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]); + else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]); + else if (!input.TrackKeywords.IsNullOrEmpty()) + { + Expression> trackKeywordExp = _ => false; + input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); + + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]); + } + + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldTrackPullContentEntity); + + await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs new file mode 100644 index 00000000..62df4046 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs @@ -0,0 +1,39 @@ +using SJZY.Expand.ABP.Core; +using SJZY.Track.Application.Contract.Services; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Queries; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackPush; + +public class TrackPushCacheService : ITrackPushCacheService, ITransientDependency +{ + private readonly IBasicQuery _trackPushConfigQuery; + + private string RedisKey(int customId) => GlobalConst.TrackPushKeyPrefix + customId; + + public TrackPushCacheService(IBasicQuery trackPushConfigQuery) + { + _trackPushConfigQuery = trackPushConfigQuery; + } + + public async Task IsPushAsync(int customId) + { + var isPush = + await RedisHelper.Client.GetAsync(RedisKey(customId)); + + if (isPush == null) + { + isPush = await _trackPushConfigQuery.GetFirstAsync(x => x.CustomId == customId, + x => x.IsAutoPush); + await RedisHelper.Client.SetAsync(RedisKey(customId), isPush); + } + + return (bool)isPush; + } + + public async Task UpdateAsync(int customId, bool isPush) + { + await RedisHelper.Client.SetAsync(RedisKey(customId), isPush); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs new file mode 100644 index 00000000..1b009a95 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -0,0 +1,290 @@ +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.Contract.Services; +using SJZY.Track.Application.Localization; +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; + +/// +/// 轨迹推送 +/// +[ApiExplorerSettings(GroupName = "轨迹推送")] +[Route("/Track/PushConfig")] +public class TrackPushService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackPushConfigRepository _trackPushConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackPushCacheService _trackPushCacheService; + + public TrackPushService( + IStringLocalizer stringLocalizer, + ITrackPushConfigRepository trackPushConfigRepository, + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository, + ITrackPushCacheService trackPushCacheService) + { + _stringLocalizer = stringLocalizer; + _trackPushConfigRepository = trackPushConfigRepository; + _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository = trackPullConfigRepository; + _trackPushCacheService = trackPushCacheService; + } + + /// + /// 轨迹推送配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPushConfigRepository.GetPageAsync(input); + } + + /// + /// 轨迹推送配置内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync([FromBody] GetTrackPushContentPageInputVO input) + { + return await _trackPushConfigRepository.GetContentPageAsync(input); + } + + /// + /// 轨迹推送配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int 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 = isAnyExp.And(x => x.Id != input.Id); + + var trackTemplateIdExp = Expressionable.Create(); + input.TrackTemplateIds?.ForEach(item => { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, item.ToString())); }); + + isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression()); + + if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp)) + 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 _trackPushCacheService.IsPushAsync(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 _trackPushCacheService.UpdateAsync(oldCustomId, false); + if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(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 _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false); + + 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; + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); + + if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); + else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]); + else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]); + else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]); + else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort, x => x.TrackPushConfigId == input.TrackPushConfigId); + + var entity = ObjectMapper.Map(input); + entity.Sort = maxSort + 1; + + await _trackPushConfigRepository.InsertContentAsync(entity); + + break; + } + + case OptionTypeNoNull.修改: + { + var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, entity); + + await _trackPushConfigRepository.UpdateContentAsync(entity); + + break; + } + + case OptionTypeNoNull.删除: + { + var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id); + + await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort); + + ts.Complete(); + } + + break; + } + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPushContentInput.Options)]); + } + + return true; + } + + /// + /// 轨迹推送配置内容排序 + /// + /// + /// + [HttpPost("SortContent")] + public async Task SortContentAsync([FromBody] SortTrackPushContentInput input) + { + List ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList(); + + var trackPushContentEntities = await _trackPushConfigRepository.GetContentListAsync(x => ids.Contains(x.Id)); + + trackPushContentEntities.ForEach(item => + { + item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value; + }); + + await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs new file mode 100644 index 00000000..979d412d --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -0,0 +1,175 @@ +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; + +namespace SJZY.Track.Application.Services.TrackStatus; + +/// +/// 轨迹状态 +/// +[ApiExplorerSettings(GroupName = "轨迹状态")] +[Route("/Track/Status")] +public class TrackStatusService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackStatusRepository _trackStatusRepository; + private readonly ITrackContentRepository _trackContentRepository; + + public TrackStatusService( + IStringLocalizer stringLocalizer, + ITrackStatusRepository trackStatusRepository, + ITrackContentRepository trackContentRepository + ) + { + this._stringLocalizer = stringLocalizer; + this._trackStatusRepository = trackStatusRepository; + this._trackContentRepository=trackContentRepository; + } + + /// + /// 轨迹状态编辑 + /// + /// + [HttpPost("Edit")] + public async Task EditAsync(EditTrackStatusInput input) + { + return input.Options switch + { + OptionType.新增 => await AddAsync(input), + OptionType.修改 => await UpdateAsync(input), + OptionType.删除 => await DeleteAsync(input), + _ => throw new BusinessException(message: "当前操作动作不合法") + }; + } + + /// + /// 根据状态id获取轨迹状态 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackStatusRepository.GetDetailAsync(id); + if (detailInfo == null) + { + return new UnifyResultDto(false, null, "未查询到轨迹状态"); + } + + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } + + /// + /// 获取分页轨迹状态 + /// + /// + /// + [HttpPost("GetList")] + public async Task> GetPageTrackStatus(GetPageTrackStatusInput input) + { + var vo = ObjectMapper.Map(input); + var resultDto = await _trackStatusRepository.GetPageTrackStatus(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>( + resultDto); + + return pageResultDto; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackStatusInput input) + { + #region 业务校验 + + var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && + (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code); + if (trackStatusCode!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态代码已存在"); + } + var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus); + if (trackStatusName!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态已存在"); + } + var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus); + if (trackStatusEnName!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态英文已存在"); + } + } + + #endregion + + var entity = ObjectMapper.Map(input); + var isTrue = await _trackStatusRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackStatusInput input) + { + #region 业务校验 + + var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code); + if (trackStatusCode!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态代码已存在"); + } + var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus); + if (trackStatusName!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态已存在"); + } + var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus); + if (trackStatusEnName!=null) + { + throw new BusinessException(message: "该子系统下轨迹状态英文已存在"); + } + } + + #endregion + + var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity); + + return new UnifyResultDto("200", "修改成功", isTrue); + } + + 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"]); + throw new BusinessException(message: "该状态关联轨迹内容,禁止删除"); + } + #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/ITrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs new file mode 100644 index 00000000..f6e29107 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs @@ -0,0 +1,7 @@ +namespace SJZY.Track.Application.Services.TrackTemplates +{ + public interface ITrackTemplateService + { + + } +} diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs new file mode 100644 index 00000000..525add23 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -0,0 +1,308 @@ +using System.Linq.Expressions; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackTemplate; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackTemplates; + +/// +/// 轨迹模版 +/// +[ApiExplorerSettings(GroupName = "轨迹模版")] +[Route("/Track/Template")] +public class TrackTemplateService : ApplicationService, ITransientDependency +{ + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackPushConfigRepository _trackPushConfigRepository; + + /// + public TrackTemplateService( + IStringLocalizer stringLocalizer, + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository, + ITrackPushConfigRepository trackPushConfigRepository + ) + { + _stringLocalizer = stringLocalizer; + _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository = trackPullConfigRepository; + _trackPushConfigRepository = trackPushConfigRepository; + } + + /// + /// 轨迹模版编辑 + /// + /// + [HttpPost("Edit")] + public async Task EditAsync(EditTrackTemplateInput input) + { + return input.Options switch + { + OptionType.新增 => await AddAsync(input), + OptionType.修改 => await UpdateAsync(input), + OptionType.删除 => await DeleteAsync(input), + _ => throw new BusinessException(message: "当前操作动作不合法") + }; + } + + /// + /// 根据模版id获取轨迹模版 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackTemplateRepository.GetDetailAsync(id); + if (detailInfo == null) + { + return new UnifyResultDto(false, null, "未查询到轨迹模版"); + } + + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } + + /// + /// 获取分页轨迹模版 + /// + /// + /// + [HttpPost("GetList")] + public async Task> GetPageTrackTemplate(GetPageTrackTemplateInput input) + { + var vo = ObjectMapper.Map(input); + var resultDto = await _trackTemplateRepository.GetPageTrackTemplate(vo); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>( + resultDto); + + return pageResultDto; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackTemplateInput input) + { + #region 业务校验 + + //校验模版代码唯一性 + //var templateEntity = + // await _trackTemplateRepository.GetFirstAsync( + // a => a.SubSystemId == input.SubSystemId && a.Code == input.Code); + var templateEntitys = await _trackTemplateRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code|| a.Name==input.Name)); + if (templateEntitys.Any()) + { + //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + //throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); + var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code); + if (trackTemplateCode!=null) + { + throw new BusinessException(message: "该子系统下模板代码已存在"); + } + var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name); + if (trackTemplateName!=null) + { + throw new BusinessException(message: "该子系统下模板名称已存在"); + } + } + + #endregion 业务校验 + + var entity = ObjectMapper.Map(input); + var isTrue = await _trackTemplateRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackTemplateInput input) + { + #region 业务校验 + + var templateEntitys = await _trackTemplateRepository.GetListAsync(a => + a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name==input.Name)); + if (templateEntitys.Any()) + { + //throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); + var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code); + if (trackTemplateCode!=null) + { + throw new BusinessException(message: "该子系统下模板代码已存在"); + } + var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name); + if (trackTemplateName!=null) + { + throw new BusinessException(message: "该子系统下模板名称已存在"); + } + } + + #endregion 业务校验 + + var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity); + + return new UnifyResultDto("200", "修改成功", isTrue); + } + + private async Task DeleteAsync(EditTrackTemplateInput input) + { + #region 业务校验 + + //查询看看在轨迹拉取里面有没有被占用 + var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); + if (isExisistTrackPullConfigs.Any()) + { + //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + throw new BusinessException(message: "该模板存在映射,禁止删除"); + } + //轨迹推送里看看是否被占用 + var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); + if (isExisistTrackPushConfigs.Any()) + { + throw new BusinessException(message: "该模板存在映射,禁止删除"); + } + + #endregion 业务校验 + + var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + + #endregion 私有方法 + + /// + /// 轨迹模板内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync( + [FromBody] GetTrackTemplateContentPageInputVO input) + { + return await _trackTemplateRepository.GetContentPageAsync(input); + } + + /// + /// 轨迹模板内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackTemplateRepository.GetContentDetailAsync(id); + } + + /// + /// 轨迹模板内容下拉框 + /// + /// + /// + [HttpPost("GetContentDropDownList")] + public async Task> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input) + { + return await _trackTemplateRepository.GetContentDropDownListAsync(input); + } + + /// + /// 轨迹模板内容编辑 + /// + /// + /// + [HttpPost("EditContent")] + public async Task EditContentAsync([FromBody] EditTrackTemplateContentInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isContentAnyExp = x => + x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); + + if (await _trackTemplateRepository.IsContentAnyAsync(isContentAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + int maxSort = await _trackTemplateRepository.ContentMaxAsync(x => x.Sort, x => x.TrackTemplateId == input.TrackTemplateId); + + var entity = ObjectMapper.Map(input); + entity.Sort = maxSort + 1; + + await _trackTemplateRepository.InsertContentAsync(entity); + + break; + } + + case OptionTypeNoNull.修改: + { + var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, entity); + + await _trackTemplateRepository.UpdateContentAsync(entity); + + break; + } + + case OptionTypeNoNull.删除: + { + var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value); + + await _trackTemplateRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackTemplateId == entity.TrackTemplateId && x.Sort > entity.Sort); + + ts.Complete(); + } + + break; + } + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackTemplateContentInput.Options)]); + } + + return true; + } + + /// + /// 轨迹模板内容排序 + /// + /// + /// + [HttpPost("SortContent")] + public async Task SortContentAsync([FromBody] SortTrackTemplateContentInput input) + { + List ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList(); + + var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => ids.Contains(x.Id)); + + trackTemplateContentEntities.ForEach(item => + { + item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value; + }); + + await _trackTemplateRepository.UpdateContentRangeAsync(trackTemplateContentEntities); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs new file mode 100644 index 00000000..ba706085 --- /dev/null +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -0,0 +1,127 @@ +using System.Text.Json; +using DotNetCore.CAP; +using Microsoft.Extensions.Configuration; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.InterfaceRelay.Application.Contracts; +using SJZY.Track.Application.Contract; +using SJZY.Track.Application.Localization; +using SJZY.UserCenter.Contracts; +using SJZY.UserCenter.SharedModel; +using SJZY.UserCenter.SharedModel.Pub; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AutoMapper; +using Volo.Abp.FluentValidation; +using Volo.Abp.Http.Client; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace SJZY.Track.Application +{ + [DependsOn( + typeof(AbpAutoMapperModule), + typeof(AbpFluentValidationModule), + typeof(AbpLocalizationModule), + typeof(AbpVirtualFileSystemModule), + typeof(AbpHttpClientModule), + typeof(SjzyUserCenterHttpApiModule), + typeof(SJZYInterfaceRelayApplicationContractsModule), + typeof(SjzyTrackDomainModule), + typeof(SjzyTrackApplicationContractModule) + )] + public class SjzyTrackApplicationModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(options => { options.AddMaps(true); }); + + Configure(options => + { + options.ConventionalControllers.Create(typeof(SjzyTrackApplicationModule).Assembly); //创建动态api + }); + + //添加虚拟文件系统 + Configure(options => + { + options.FileSets.AddEmbedded("SJZY.Track.Application"); + }); + + //添加多语言 + var languageConfig = configuration.GetSection("Language"); + Configure(options => + { + options.Resources + .Add("zh") + .AddBaseTypes(typeof(SjzyBasicLocalization)) + .AddRedisResource(languageConfig) + .AddVirtualJson("/Localization/Resources"); + }); + //授权拦截提示 + context.Services.Configure(options => + { + options.Filters.Add(new ApiAsyncAuthorizationFilter()); + }); + + //用户中心 + context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); + context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler(); + context.Services.AddHttpClientProxy( + remoteServiceConfigurationName: "InterfaceForward", + asDefaultService: false + ); + + //CAP + context.Services.AddCapTableNameService(); + context.Services.AddCap(options => + { + options.UseMySql(configuration["ConnectionStrings:DefaultConnection"]!); + options.UseRabbitMQ(configure => + { + configure.HostName = configuration["RabbitMQ:HostName"]!; + configure.UserName = configuration["RabbitMQ:UserName"]!; + configure.Password = configuration["RabbitMQ:Password"]!; + configure.Port = configuration.GetValue("RabbitMQ:Port"); + }); + options.FailedRetryInterval = 60; + options.FailedRetryCount = 10; + options.UseDashboard(dashboardOptions => + { + dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached + ? "" + : configuration["Swagger:JsonUrlPrefix"]; + }); + options.FailedThresholdCallback = faileCalback => + { + try + { + LogHelper.Error($@" + |-CAP失败回调事件: + |-处理类型:{(faileCalback.MessageType == DotNetCore.CAP.Messages.MessageType.Subscribe ? "消费消息达到最大重试次数,需要开发人员介入" : "生产消息推送失败")} + |-头部信息:{faileCalback?.Message?.Headers?.ToJson()} + |-消息内容:{((JsonElement)faileCalback?.Message?.Value).GetRawText()}"); + } + catch (Exception ex) + { + LogHelper.Error("【严重】CAP失败回调事件发生未处理异常" + ex); + } + }; + }); + } + + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(options => + { + options.ProxyClientActions.Add((_, _, httpClient) => + { + //如果设置Token,前端需要传入Token 否则引发异常 + httpClient.SetTokenHeader(); + httpClient.Timeout = TimeSpan.FromMinutes(3); + }); + }); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..af97fc37 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs @@ -0,0 +1,26 @@ +using FluentValidation; +using SJZY.Track.Application.Contract.Dtos.TrackContents; + +namespace SJZY.Track.Application.Validations.TrackContents +{ + public class EditTrackContentInputValidation : AbstractValidator, IValidationEnabled + { + public EditTrackContentInputValidation() + { + //条件分支 + 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.修改 || x.Options == OptionType.新增, () => + { + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!"); + RuleFor(x => x.TrackStatusId).GreaterThan(0).WithMessage("所属状态的id必须大于0!"); + RuleFor(x => x.Code).NotNull().WithMessage("轨迹内容代码必填!").NotEmpty().WithMessage("轨迹内容代码不能为空!"); + RuleFor(x => x.Content).NotNull().WithMessage("轨迹内容必填!").NotEmpty().WithMessage("轨迹内容不能为空!"); + RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!"); + }); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs new file mode 100644 index 00000000..b4cf3ed8 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs @@ -0,0 +1,45 @@ +using FluentValidation; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackContents; +using SJZY.Track.Application.Localization; + +namespace SJZY.Track.Application.Validations.TrackContents; + +public class EditTrackContentMapInputValidation : AbstractValidator, IValidationEnabled +{ + public EditTrackContentMapInputValidation(IStringLocalizer stringLocalizer) + { + RuleFor(x => x.Options).IsInEnum().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackContentMapInput.Options)]); + + RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.Id), 0]); + + RuleFor(x => x.MapSubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.MapSubSystemId), 0]); + + RuleFor(x => x.MapTrackContentId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.MapTrackContentId), 0]); + + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.SubSystemId), 0]); + + RuleFor(x => x.TrackContentId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.TrackContentId), 0]); + + When(x => x.Options != OptionTypeNoNull.新增, () => + { + RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.Id)]); + }); + + When(x => x.Options != OptionTypeNoNull.删除, () => + { + RuleFor(x => x.MapSubSystemId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.MapSubSystemId)]); + + RuleFor(x => x.MapTrackContentCode).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackContentMapInput.MapTrackContentCode)]); + + RuleFor(x => x.MapTrackContentId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.MapTrackContentId)]); + + RuleFor(x => x.SubSystemId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.SubSystemId)]); + + RuleFor(x => x.TrackContentCode).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackContentMapInput.TrackContentCode)]); + + RuleFor(x => x.TrackContentId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.TrackContentId)]); + }); + } +} \ 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 new file mode 100644 index 00000000..6a06da65 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs @@ -0,0 +1,24 @@ +using FluentValidation; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; + +namespace SJZY.Track.Application.Validations.TrackFlags +{ + public class EditTrackFlagInputValidation : AbstractValidator, IValidationEnabled + { + public EditTrackFlagInputValidation() + { + //条件分支 + 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.修改 || x.Options == OptionType.新增, () => + { + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!"); + RuleFor(x => x.Code).NotNull().WithMessage("轨迹标记代码必填!").NotEmpty().WithMessage("轨迹标记代码不能为空!"); + RuleFor(x => x.Flag).NotNull().WithMessage("轨迹标记必填!").NotEmpty().WithMessage("轨迹标记不能为空!"); + }); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs new file mode 100644 index 00000000..9b0a4503 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs @@ -0,0 +1,65 @@ +using FluentValidation; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackPull; +using SJZY.Track.Application.Localization; + +namespace SJZY.Track.Application.Validations.TrackPull; + +public class EditTrackPullConfigInputValidation : AbstractValidator, IValidationEnabled +{ + public EditTrackPullConfigInputValidation(IStringLocalizer stringLocalizer) + { + RuleFor(x => x.Options).IsInEnum().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackPullConfigInput.Options)]); + + RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.Id), 0]); + + RuleFor(x => x.ParseMethod).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.ParseMethod), 0]); + + RuleFor(x => x.PullInterval) + .GreaterThanOrEqualTo(30).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThanOrEqualTo, nameof(EditTrackPullConfigInput.PullInterval), 30]); + + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.SubSystemId), 0]); + + RuleFor(x => x.ServiceProviderId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.ServiceProviderId), 0]); + + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.SubSystemId), 0]); + + RuleFor(x => x.TrackTemplateId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.TrackTemplateId), 0]); + + When(x => x.Options != OptionTypeNoNull.新增, () => + { + RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.Id)]); + }); + + When(x => x.Options != OptionTypeNoNull.删除, () => + { + RuleFor(x => x.SubSystemId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.SubSystemId)]); + + RuleFor(x => x.ServiceProviderId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ServiceProviderId)]); + + RuleFor(x => x.TrackTemplateId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.TrackTemplateId)]); + + RuleFor(x => x.PullInterval).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.PullInterval)]); + + RuleFor(x => x.ParseMethod).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ParseMethod)]); + + RuleFor(x => x.OrderNoName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.OrderNoName)]); + + When(x => x.ParseMethod == 1, () => + { + RuleFor(x => x.TackTimeZoneName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TackTimeZoneName)]); + + RuleFor(x => x.TrackContentCodeName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TrackContentCodeName)]); + + RuleFor(x => x.TrackContentName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TrackContentName)]); + + RuleFor(x => x.TrackPlaceName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TrackPlaceName)]); + + RuleFor(x => x.TrackStatusName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TrackStatusName)]); + + RuleFor(x => x.TrackTimeName).NotEmpty().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotEmpty, nameof(EditTrackPullConfigInput.TrackTimeName)]); + }); + }); + } +} \ 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 new file mode 100644 index 00000000..e492a542 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs @@ -0,0 +1,26 @@ +using FluentValidation; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; + +namespace SJZY.Track.Application.Validations.TrackStatus +{ + public class EditTrackStatusInputValidation : AbstractValidator, IValidationEnabled + { + public EditTrackStatusInputValidation() + { + //条件分支 + 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.修改 || x.Options == OptionType.新增, () => + { + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!"); + RuleFor(x => x.NodeId).GreaterThan(0).WithMessage("所属节点的id必须大于0!"); + RuleFor(x => x.Code).NotNull().WithMessage("轨迹状态代码必填!").NotEmpty().WithMessage("轨迹状态代码不能为空!"); + RuleFor(x => x.TrackStatus).NotNull().WithMessage("轨迹状态必填!").NotEmpty().WithMessage("轨迹状态不能为空!"); + RuleFor(x => x.EntrackStatus).NotNull().WithMessage("轨迹状态英文必填!").NotEmpty().WithMessage("轨迹状态英文不能为空!"); + }); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateContentInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateContentInputValidation.cs new file mode 100644 index 00000000..c23984d4 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateContentInputValidation.cs @@ -0,0 +1,37 @@ +using FluentValidation; +using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; +using SJZY.Track.Application.Localization; + +namespace SJZY.Track.Application.Validations.TrackTemplates; + +public class EditTrackTemplateContentInputValidation : AbstractValidator, IValidationEnabled +{ + public EditTrackTemplateContentInputValidation(IStringLocalizer stringLocalizer) + { + RuleFor(x => x.Options).IsInEnum().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackTemplateContentInput.Options)]); + + RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackTemplateContentInput.Id), 0]); + + RuleFor(x => x.TrackContentId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackTemplateContentInput.TrackContentId), 0]); + + RuleFor(x => x.TrackTemplateId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackTemplateContentInput.TrackTemplateId), 0]); + + When(x => x.Options != OptionTypeNoNull.新增, () => + { + RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackTemplateContentInput.Id)]); + }); + + When(x => x.Options != OptionTypeNoNull.删除, () => + { + RuleFor(x => x.IsCanDelete).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackTemplateContentInput.IsCanDelete)]); + + RuleFor(x => x.IsExternal).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackTemplateContentInput.IsExternal)]); + + RuleFor(x => x.TrackContentId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackTemplateContentInput.TrackContentId)]); + + RuleFor(x => x.TrackTemplateId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackTemplateContentInput.TrackTemplateId)]); + }); + } +} \ 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 new file mode 100644 index 00000000..aa4bdad8 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -0,0 +1,27 @@ +using FluentValidation; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; + +namespace SJZY.Track.Application.Validations.TrackTemplates +{ + /// + /// 轨迹模版编辑校验 + /// + public class EditTrackTemplateInputValidation : AbstractValidator, IValidationEnabled + { + public EditTrackTemplateInputValidation() + { + //条件分支 + 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.修改 || x.Options == OptionType.新增, () => + { + RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!"); + RuleFor(x => x.Name).NotNull().WithMessage("模版名称必填!").NotEmpty().WithMessage("模版名称不能为空!"); + RuleFor(x => x.Code).NotNull().WithMessage("模版代码必填!").NotEmpty().WithMessage("模版代码不能为空!"); + }); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs new file mode 100644 index 00000000..65734437 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs @@ -0,0 +1,23 @@ +namespace SJZY.Track.Domain.Aggregates.DemoAggregate; + +[SugarTable("t_demo_detail")] +public class DemoDetailEntity : IEntity +{ + /// + /// Id + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public long Id { get; set; } + + /// + /// t_demo.id + /// + [SugarColumn(ColumnName = "DemoId")] + public long DemoId { get; set; } + + /// + /// 一些说明.. + /// + [SugarColumn(ColumnName = "OtherInfo")] + public string OtherInfo { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs new file mode 100644 index 00000000..44d7d6eb --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs @@ -0,0 +1,36 @@ +namespace SJZY.Track.Domain.Aggregates.DemoAggregate; + +/// +/// 测试表 +/// +[SugarTable("t_demo")] +public class DemoEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// Id + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] + public long Id { get; set; } + + /// + /// 姓名 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 年龄 + /// + [SugarColumn(ColumnName = "Age")] + public int Age { get; set; } + + /// + /// 描述 + /// + [SugarColumn(ColumnName = "Description")] + public string Description { get; set; } + + + [Navigate(NavigateType.OneToMany, nameof(DemoDetailEntity.DemoId))] + public List DemoDetailList { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs similarity index 85% rename from src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs rename to src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs index bf3a2083..207cc3b3 100644 --- a/src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs @@ -1,7 +1,6 @@ -using SJZY.Track.Repository.Demo.Entitys; -using SJZY.Track.Repository.Demo.ValueObjects; +using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Repository.Demo.Services +namespace SJZY.Track.Domain.Aggregates.DemoAggregate { public interface IDemoRepository { diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs new file mode 100644 index 00000000..9e8d59eb --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -0,0 +1,68 @@ +using SJZY.Track.Domain.Dtos.Order; + +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +public interface IOrderRepository : IBasicRepository +{ + /// + /// 创建订单 + /// + /// + /// + Task CreateOrderAsync(OrderEntity order); + + /// + /// 获取分页的轨迹订单 + /// + /// + /// + Task> GetPageTrackOrder(GetPageTrackOrderInputVO input); + + /// + /// 更新订单 + /// + /// + /// + Task UpdateOrderAsync(OrderEntity order); + + /// + /// 删除订单 + /// + /// + /// + Task DeleteOrderAsync(int orderId); + + + #region 订单关联 + + /// + /// 根据订单id,获取关联的订单集合 + /// + /// + /// + Task> GetLinkedOrdersAsync(int orderId); + + /// + /// 关联订单 + /// + /// + /// + Task LinkOrderAsync(List orderLinkEntities); + + /// + /// 解除订单关联关系 + /// + /// + /// + Task UnLinkByIdsAsync(List linkIds); + + #endregion + + + /// + /// 获取订单模板列表 + /// + /// + /// + Task> GetOrderTemplatesAsync(List orderNos); +} \ 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 new file mode 100644 index 00000000..04432d30 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -0,0 +1,121 @@ +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +/// +/// 轨迹订单主表 +/// +[SugarTable("t_order")] +public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 订单号 + /// + [SugarColumn(ColumnName = "OrderNo")] + public string OrderNo { get; set; } = null!; + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + [SugarColumn(ColumnName = "OrderType")] + public int OrderType { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + /// + /// 客户id(外部主体id) + /// + [SugarColumn(ColumnName = "CustomId")] + public int CustomId { get; set; } + + /// + /// 订单是否完结(异步维护) + /// + [SugarColumn(ColumnName = "IsCompleted")] + public bool IsCompleted { get; set; } + + /// + /// 订单是否推送完成(异步维护) + /// + [SugarColumn(ColumnName = "IsPushCompleted")] + public bool IsPushCompleted { get; set; } + + /// + /// 最新轨迹内容(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackContent")] + public string? LatestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackEnContent")] + public string? LatestTrackEnContent { get; set; } + + /// + /// 最新轨迹时间(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackTime")] + public DateTime? LatestTrackTime { get; set; } + + /// + /// 最新轨迹时区(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackTimeZone")] + public float? LatestTrackTimeZone { get; set; } + + /// + /// 最新轨迹发生地(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackPlace")] + public string? LatestTrackPlace { get; set; } + + /// + /// 目的城市 + /// + [SugarColumn(ColumnName = "ArrivalCity")] + public string ArrivalCity { get; set; } = null!; + + /// + /// 目的国家 + /// + [SugarColumn(ColumnName = "ArrivalCountry")] + public string ArrivalCountry { get; set; } = null!; + + /// + /// 目的港口 + /// + [SugarColumn(ColumnName = "ArrivalPort")] + public string? ArrivalPort { get; set; } + + /// + /// 起运城市 + /// + [SugarColumn(ColumnName = "LeaveCity")] + public string LeaveCity { get; set; } = null!; + + /// + /// 起运国家 + /// + [SugarColumn(ColumnName = "LeaveCountry")] + public string LeaveCountry { get; set; } = null!; + + /// + /// 起运港口 + /// + [SugarColumn(ColumnName = "LeavePort")] + public string? LeavePort { get; set; } + + [SugarColumn(IsIgnore = true)] + public List OrderFlights { get; set; } + [SugarColumn(IsIgnore = true)] + public List OrderTemplates { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs new file mode 100644 index 00000000..4e5f2017 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs @@ -0,0 +1,50 @@ +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +/// +/// 订单航班表(1:N) +/// +[SugarTable("t_order_flight")] +public class OrderFlightEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 班期 + /// + [SugarColumn(ColumnName = "FlightDate")] + public DateTime FlightDate { get; set; } + + /// + /// 航班号 + /// + [SugarColumn(ColumnName = "FlightNo")] + public string FlightNo { get; set; } = null!; + + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CreateUserId")] + public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs new file mode 100644 index 00000000..71231e99 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -0,0 +1,69 @@ +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +/// +/// 轨迹订单关联表(1:N) +/// +[SugarTable("t_order_link")] +public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity +{ + /// + /// 自增主键 + /// + [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; } + + /// + /// 订单类型 + /// + [SugarColumn(ColumnName = "OrderType")] + public int OrderType { get; set; } + + /// + /// 订单号 + /// + [SugarColumn(ColumnName = "OrderNo")] + public string OrderNo { get; set; } = null!; + + + /// + /// 关联的订单类型 + /// + [SugarColumn(ColumnName = "LinkOrderType")] + public int LinkOrderType { get; set; } + + /// + /// 关联的订单号 + /// + [SugarColumn(ColumnName = "LinkOrderNo")] + public string LinkOrderNo { get; set; } = null!; + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CreateUserId")] + public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs new file mode 100644 index 00000000..88559ae6 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs @@ -0,0 +1,50 @@ +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +/// +/// 轨迹订单模板表(1:N) +/// +[SugarTable("t_order_template")] +public class OrderTemplateEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 服务商id + /// + [SugarColumn(ColumnName = "ServiceProviderId")] + public int ServiceProviderId { get; set; } + + /// + /// 模板id + /// + [SugarColumn(ColumnName = "TrackTemplateId")] + public int TrackTemplateId { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CreateUserId")] + public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime? CreateTime { get; set; } + + /// + /// 是否删除 + /// + [SugarColumn(ColumnName = "IsDeleted")] + public bool IsDeleted { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs new file mode 100644 index 00000000..400b7363 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -0,0 +1,29 @@ +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackTemplate; + +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); + Task GetTemplateIsExist(int trackContentId); + Task> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs new file mode 100644 index 00000000..44d00b9d --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs @@ -0,0 +1,56 @@ +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; + +/// +/// 轨迹内容 +/// +[SugarTable("t_track_content")] +public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹内容代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } = null!; + + /// + /// 轨迹内容 + /// + [SugarColumn(ColumnName = "Content")] + public string Content { get; set; } = null!; + + /// + /// 轨迹内容英文 + /// + [SugarColumn(ColumnName = "EnContent")] + public string EnContent { get; set; } = null!; + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + /// + /// 轨迹标记id + /// + [SugarColumn(ColumnName = "TrackFlagId")] + public int TrackFlagId { get; set; } + + /// + /// 所属轨迹状态id + /// + [SugarColumn(ColumnName = "TrackStatusId")] + public int TrackStatusId { get; set; } + + /// + /// 是否完结 + /// + [SugarColumn(ColumnName = "IsCompleted")] + public bool IsCompleted { get; set; } +} \ 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 new file mode 100644 index 00000000..1c20048f --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs @@ -0,0 +1,50 @@ +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; + +/// +/// 轨迹内容映射表 +/// +[SugarTable("t_track_content_map")] +public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 源子系统id + /// + [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 new file mode 100644 index 00000000..f6578023 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -0,0 +1,24 @@ +using SJZY.Track.Domain.Dtos.TrackDetails; + +namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; + +public interface ITrackDetailsRepository +{ + Task GetFirstOrDefaultAsync(int orderId, string trackCode); + + Task UpsertAsync(TrackDetailsIndex index); + + Task> GetListAsync(int orderType, List orderNos); + + Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); + Task?> GetListAsync(int orderId); + + /// + /// 删除轨迹 + /// + /// + /// + /// + Task DeleteTrackAsync(int orderId, List trackCodes); + Task?> GetListAsync(List orderIds); +} \ 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 new file mode 100644 index 00000000..d4f5c9e1 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -0,0 +1,93 @@ +using Nest; +using SJZY.Expand.ElasticSearch; + +namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; + +[ElasticsearchType(RelationName = GlobalConst.TrackIndex)] +public class TrackDetailsIndex : IdBaseIndex +{ + /// + /// 订单Id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } = null!; + + /// + /// 索引名称 + /// + public string IndexName { get; set; } = null!; + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + public int OrderType { get; set; } + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } = null!; + + /// + /// 原轨迹状态 + /// + public string? OriginTrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string TrackCode { get; set; } = null!; + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } = null!; + + /// + /// 原轨迹内容 + /// + public string? OriginTrackContent { get; set; } + + /// + /// 原轨迹报文 + /// + public string? OriginTrackData { get; set; } + + /// + /// 轨迹内容英文 + /// + public string TrackEnContent { get; set; } = null!; + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } = null!; + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public float TrackTimeZone { get; set; } + + /// 是否可删 + public bool IsCanDelete { get; set; } + + /// 创建人 + public string? CreateUser { get; set; } + + /// 创建时间 + public DateTime CreateTime { get; set; } + + /// 修改人 + public string? UpdateUser { get; set; } + + /// 修改时间 + public DateTime? UpdateTime { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs new file mode 100644 index 00000000..12ba3bc6 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Domain.Dtos.TrackFlags; + +namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate; + +public interface ITrackFlagRepository : IBasicRepository +{ + Task GetDetailAsync(int id); + Task> GetPageTrackFlag(GetPageTrackFlagVO input); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs new file mode 100644 index 00000000..225c8f85 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs @@ -0,0 +1,38 @@ +namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate; + +/// +/// 轨迹标记表 +/// +[SugarTable("t_track_flag")] +public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 标记代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 标记名称 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + ///// + ///// 是否完结 + ///// + //[SugarColumn(ColumnName = "IsCompleted")] + //public bool IsCompleted { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs new file mode 100644 index 00000000..7b7dec1f --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -0,0 +1,53 @@ +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPull; + +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; + +public interface ITrackPullConfigRepository : IBasicRepository +{ + /// + /// 轨迹拉取配置列表 + /// + /// + /// + Task> GetPageAsync(KeywordsInputVO input); + + /// + /// 轨迹拉取配置内容列表 + /// + /// + /// + Task> GetContentPageAsync(GetTrackPullContentPageInputVO input); + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + Task GetDetailAsync(int id); + + /// + /// 轨迹拉取配置内容详情 + /// + /// + /// + Task GetContentDetailAsync(int id); + + Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj); + + Task InsertContentRangeAsync(List insertObjs); + + Task GetParamsSingleAsync(Expression> whereExpression); + + Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj); + + Task SoftDeleteContentAsync(Expression> whereExpression); + + Task SoftDeleteParamsAsync(Expression> whereExpression); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPullContentConfigEntity updateObj); + + Task IsContentAnyAsync(Expression> whereExpression); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs new file mode 100644 index 00000000..1a672799 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; + +/// +/// 轨迹拉取配置表 +/// +[SugarTable("t_track_pull_config")] +public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 解析方式,1取接口通返参映射后的,2取服务商原返参 + /// + [SugarColumn(ColumnName = "ParseMethod")] + public int ParseMethod { get; set; } + + /// + /// 服务商拉取频率(分钟) + /// + [SugarColumn(ColumnName = "PullInterval")] + public int PullInterval { get; set; } + + /// + /// 服务商id + /// + [SugarColumn(ColumnName = "ServiceProviderId")] + public int ServiceProviderId { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + /// + /// 模板id + /// + [SugarColumn(ColumnName = "TrackTemplateId")] + public int TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs new file mode 100644 index 00000000..13d74a83 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -0,0 +1,68 @@ +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; + +/// +/// 轨迹拉取内容配置表 +/// +[SugarTable("t_track_pull_content_config")] +public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 服务商轨迹代码参数值 + /// + [SugarColumn(ColumnName = "TrackContentCodeValue")] + public string? TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + [SugarColumn(ColumnName = "TrackContentId")] + public int TrackContentId { get; set; } + + /// + /// 服务商轨迹内容参数值 + /// + [SugarColumn(ColumnName = "TrackContentValue")] + public string? TrackContentValue { get; set; } + + /// + /// 轨迹关键词(正向),多个逗分隔 + /// + [SugarColumn(ColumnName = "TrackKeyword")] + public string? TrackKeyword { get; set; } + + /// + /// 轨迹关键词(反向),多个逗分隔 + /// + [SugarColumn(ColumnName = "TrackKeywordReverse")] + public string? TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地参数值(主数据枚举) + /// + [SugarColumn(ColumnName = "TrackPlaceValue")] + public int? TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + [SugarColumn(ColumnName = "TrackPullConfigId")] + public int TrackPullConfigId { get; set; } + + /// + /// 服务商轨迹状态参数值 + /// + [SugarColumn(ColumnName = "TrackStatusValue")] + public string? TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + [SugarColumn(ColumnName = "TrackTimeZone")] + public float? TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs new file mode 100644 index 00000000..8187c651 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs @@ -0,0 +1,80 @@ +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; + +/// +/// 轨迹拉取/推送参数配置 +/// +[SugarTable("t_track_push_pull_params_config")] +public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 扩展字段参数名 + /// + [SugarColumn(ColumnName = "ExpandFieldsName")] + public string ExpandFieldsName { get; set; } + + /// + /// 推拉模式,0拉取,1推送 + /// + [SugarColumn(ColumnName = "IsPush")] + public bool IsPush { get; set; } + + /// + /// 单号参数名 + /// + [SugarColumn(ColumnName = "OrderNoName")] + public string OrderNoName { get; set; } + + /// + /// 推拉配置id + /// + [SugarColumn(ColumnName = "PullOrPushConfigId")] + public int PullOrPushConfigId { get; set; } + + /// + /// 轨迹时区参数名 + /// + [SugarColumn(ColumnName = "TackTimeZoneName")] + public string TackTimeZoneName { get; set; } + + /// + /// 轨迹代码参数名 + /// + [SugarColumn(ColumnName = "TrackContentCodeName")] + public string TrackContentCodeName { get; set; } + + /// + /// 轨迹内容参数名 + /// + [SugarColumn(ColumnName = "TrackContentName")] + public string TrackContentName { get; set; } + + /// + /// 轨迹内容英文参数名 + /// + [SugarColumn(ColumnName = "TrackEnContentName")] + public string TrackEnContentName { get; set; } + + /// + /// 轨迹发生地参数名 + /// + [SugarColumn(ColumnName = "TrackPlaceName")] + public string TrackPlaceName { get; set; } + + /// + /// 轨迹状态参数名 + /// + [SugarColumn(ColumnName = "TrackStatusName")] + public string TrackStatusName { get; set; } + + /// + /// 轨迹发生时间参数名 + /// + [SugarColumn(ColumnName = "TrackTimeName")] + public string TrackTimeName { 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 new file mode 100644 index 00000000..80013967 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -0,0 +1,33 @@ +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; + +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; + +public interface ITrackPushConfigRepository : IBasicRepository +{ + Task> GetPageAsync(KeywordsInputVO input); + + Task> 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); + + Task> GetContentListAsync(Expression> whereExpression); + + Task UpdateContentRangeAsync(List updateObjs); + + Task ContentMaxAsync(Expression> columns, Expression> whereExpression); + + Task UpdateContentAsync(Expression> columns, Expression> whereExpression); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs new file mode 100644 index 00000000..00088ccd --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; + +/// +/// 轨迹推送配置表 +/// +[SugarTable("t_track_push_config")] +public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 客户id(外部主体id) + /// + [SugarColumn(ColumnName = "CustomId")] + public int CustomId { get; set; } + + /// + /// 是否自动推送 + /// + [SugarColumn(ColumnName = "IsAutoPush")] + public bool IsAutoPush { get; set; } + + /// + /// 服务商id(客户:服务商 1:1) + /// + [SugarColumn(ColumnName = "ServiceProviderId")] + public int ServiceProviderId { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + /// + /// 模板id(多个之间英文逗号分隔) + /// + [SugarColumn(ColumnName = "TrackTemplateId")] + public string TrackTemplateId { get; set; } +} \ 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 new file mode 100644 index 00000000..1c392d52 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs @@ -0,0 +1,74 @@ +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; + +/// +/// 轨迹推送内容配置表 +/// +[SugarTable("t_track_push_content_config")] +public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 扩展字段参数值 + /// + [SugarColumn(ColumnName = "ExpandFieldsValue")] + public string ExpandFieldsValue { get; set; } + + /// + /// 推送单号类型(主数据枚举TrackOrderType) + /// + [SugarColumn(ColumnName = "OrderNoType")] + public int OrderNoType { get; set; } + + /// + /// 推送轨迹排序 + /// + [SugarColumn(ColumnName = "Sort")] + public int Sort { get; set; } + + /// + /// 轨迹代码参数值 + /// + [SugarColumn(ColumnName = "TrackContentCodeValue")] + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + [SugarColumn(ColumnName = "TrackContentId")] + public int TrackContentId { get; set; } + + /// + /// 轨迹内容参数值 + /// + [SugarColumn(ColumnName = "TrackContentValue")] + public string TrackContentValue { get; set; } + + /// + /// 轨迹内容英文参数值 + /// + [SugarColumn(ColumnName = "TrackEnContentValue")] + public string TrackEnContentValue { get; set; } + + /// + /// 轨迹推送配置id + /// + [SugarColumn(ColumnName = "TrackPushConfigId")] + public int TrackPushConfigId { get; set; } + + /// + /// 轨迹状态参数值 + /// + [SugarColumn(ColumnName = "TrackStatusValue")] + public string TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + [SugarColumn(ColumnName = "TrackTimeZone")] + public double? TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs new file mode 100644 index 00000000..5123bd2b --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Domain.Dtos.TrackStatus; + +namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate; + +public interface ITrackStatusRepository : IBasicRepository +{ + Task GetDetailAsync(int id); + Task> GetPageTrackStatus(GetPageTrackStatusVO input); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs new file mode 100644 index 00000000..dd98a21d --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate; + +/// +/// 轨迹状态表 +/// +[SugarTable("t_track_status")] +public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹状态代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } = null!; + + /// + /// 轨迹状态英文 + /// + [SugarColumn(ColumnName = "EnStatus")] + public string EnStatus { get; set; } = null!; + + /// + /// 所属节点(主数据枚举ServiceNode) + /// + [SugarColumn(ColumnName = "Node")] + public int Node { get; set; } + + /// + /// 轨迹状态 + /// + [SugarColumn(ColumnName = "Status")] + public string Status { get; set; } = null!; + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs new file mode 100644 index 00000000..e6ab4b0b --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -0,0 +1,47 @@ +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.Dtos.TrackTemplate; + +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; + +public interface ITrackTemplateRepository : IBasicRepository +{ + Task GetDetailAsync(int id); + + Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); + + /// + /// 轨迹模板内容列表 + /// + /// + /// + Task> GetContentPageAsync( + GetTrackTemplateContentPageInputVO input); + + /// + /// 轨迹模板内容详情 + /// + /// + /// + Task GetContentDetailAsync(int id); + + Task IsContentAnyAsync(Expression> whereExpression); + + Task InsertContentAsync(TrackTemplateContentEntity insertObj); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackTemplateContentEntity updateObj); + + Task SoftDeleteContentAsync(int id); + + Task> GetContentListAsync( + Expression> whereExpression); + + Task UpdateContentRangeAsync(List updateObjs); + + Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input); + + Task ContentMaxAsync(Expression> columns, Expression> whereExpression); + + Task UpdateContentAsync(Expression> columns, Expression> whereExpression); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs new file mode 100644 index 00000000..3d8ba38a --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; + +/// +/// 轨迹模板内容表(1:N) +/// +[SugarTable("t_track_template_content")] +public class TrackTemplateContentEntity : IFullAuditedBasicEntitys, IEntity +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 是否可删 + /// + [SugarColumn(ColumnName = "IsCanDelete")] + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + [SugarColumn(ColumnName = "IsExternal")] + public bool IsExternal { get; set; } + + /// + /// 排序 + /// + [SugarColumn(ColumnName = "Sort")] + public int Sort { get; set; } + + /// + /// 轨迹内容id + /// + [SugarColumn(ColumnName = "TrackContentId")] + public int TrackContentId { get; set; } + + /// + /// 模板id + /// + [SugarColumn(ColumnName = "TrackTemplateId")] + public int TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs new file mode 100644 index 00000000..ce861050 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs @@ -0,0 +1,32 @@ +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; + +/// +/// 轨迹模板表 +/// +[SugarTable("t_track_template")] +public class TrackTemplateEntity : IFullAuditedBasicEntitys, IAggregateRoot +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 模板代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 模板名称 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { 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 new file mode 100644 index 00000000..8cbe4413 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.Common; + +public class KeywordsInputVO : PageInfoInput +{ + /// + /// 子系统id + /// + public int? SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string? Keywords { get; set; } + + /// + /// 选中项 + /// + public List? SelectedIds { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs b/src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs new file mode 100644 index 00000000..aa5db1e2 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs @@ -0,0 +1,16 @@ +namespace SJZY.Track.Domain.Dtos.Demo; + +public class DemoValueObject +{ + public string Name { get; set; } + + /// + /// 当前页码 + /// + public int PageIndex { get; set; } + + /// + /// 每页大小 + /// + public int PageSize { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs new file mode 100644 index 00000000..082b245a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.Order +{ + public class GetOrderDetailsInputVO + { + + } + + public class TrackOrderDetailVO + { + + } +} diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs new file mode 100644 index 00000000..c1b97cc5 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.Order +{ + public class GetPageTrackOrderInputVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + ///// + ///// 单号 + ///// + //public List? OrderNos { get; set; } + + + /// + /// 单号 + /// + public string? OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? CreateTimeEnd { get; set; } + } + + /// + /// 轨迹订单VO + /// + public class TrackOrderVO + { + /// + /// 轨迹订单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 DateTime? NewestTrackTime { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 轨迹模板Id数组 + /// + public List? TrackTemplateIds { 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..c0344880 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs @@ -0,0 +1,34 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class LinkedOrderVO +{ + /// + /// 关联订单id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } = null!; + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + public int OrderType { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 订单是否推送完成(异步维护) + /// + public bool IsPushCompleted { get; set; } + + /// + /// 客户id + /// + public int CustomId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs new file mode 100644 index 00000000..248ec7e9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs @@ -0,0 +1,23 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +/// +/// 订单标识符 +/// +public readonly struct OrderIdentifier +{ + public OrderIdentifier(int orderType, string orderNo) + { + OrderType = orderType; + OrderNo = orderNo; + } + + /// + /// 订单类型 + /// + public int OrderType { get; } + + /// + /// 订单号 + /// + public string OrderNo { get; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs new file mode 100644 index 00000000..6ca82ed3 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class OrderTemplateLinkDto +{ + /// + /// 订单号 + /// + public string OrderNo { get; set; } = null!; + + /// + /// 模板id + /// + public int TemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateVO.cs new file mode 100644 index 00000000..9360db40 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateVO.cs @@ -0,0 +1,15 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class OrderTemplateVO +{ + public string OrderNo { get; set; } = null!; + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + public int OrderType { get; set; } + + public int TemplateId { get; set; } + + public int ServiceProviderId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/TrackPullContentConfigVO.cs b/src/SJZY.Track.Domain/Dtos/Order/TrackPullContentConfigVO.cs new file mode 100644 index 00000000..1f82cbe6 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/TrackPullContentConfigVO.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class TrackPullContentConfigVO +{ + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 服务商轨迹代码参数值 + /// + public string? TrackContentCodeValue { get; set; } + + /// + /// 服务商轨迹内容参数值 + /// + public string? TrackContentValue { get; set; } + + /// + /// 轨迹关键词(正向),多个逗分隔 + /// + public string? TrackKeyword { get; set; } + + /// + /// 轨迹关键词(反向),多个逗分隔 + /// + public string? TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地参数值(主数据枚举) + /// + public int? TrackPlaceValue { 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.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs new file mode 100644 index 00000000..4fff79ed --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackContents +{ + public class GetPageTrackContentVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string? Keywords { get; set; } + + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } + } + + public class GetTrackContentListVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs new file mode 100644 index 00000000..eb5a22b9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackContents +{ + public class GetTrackContentDetailVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 所属轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹标记id + /// + public int TrackFlagId { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + } +} 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 new file mode 100644 index 00000000..adb51944 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -0,0 +1,29 @@ +namespace SJZY.Track.Domain.Dtos.TrackDetails; + +public class MatchTrackContentDto +{ + /// + /// 轨迹内容 + /// + public string Content { get; set; } = null!; + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } = null!; + + /// + /// 轨迹状态 + /// + public string Status { get; set; } = null!; + + /// + /// 是否意味着完成 + /// + public bool IsCompleted { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentsDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentsDto.cs new file mode 100644 index 00000000..14441bc6 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentsDto.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.TrackDetails; + +public class MatchTrackContentsDto +{ + /// + /// 轨迹代码 + /// + public string TrackCode { get; set; } = null!; + + /// + /// 是否支持删除 + /// + public bool IsCanDelete { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs new file mode 100644 index 00000000..3a7b4d0d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.Dtos.TrackDetails; + +public class TrackDetailsQueryInput : PageInfoInput +{ + /// + /// 单号 + /// + public List OrderNos { get; set; } = new(); +} \ 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 new file mode 100644 index 00000000..adbf1a5d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackFlags +{ + public class GetPageTrackFlagVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + + ///// + ///// 关键字 + ///// + //public string Keywords { get; set; } + } + + public class GetTrackFlagListVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 代码 + /// + public string Code { get; set; } + + /// + /// 标记 + /// + public string Flag { get; set; } + + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs new file mode 100644 index 00000000..d2984d4a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackFlags +{ + public class GetTrackFlagDetailVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 代码 + /// + public string Code { get; set; } + + /// + /// + /// + public string Flag { get; set; } + + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs new file mode 100644 index 00000000..c424e5a6 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs @@ -0,0 +1,81 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullConfigDetailOutputVO +{ + public int Id { get; set; } + + /// + /// 拉取轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 返参解析对象 + /// + public int ParseMethod { get; set; } + + /// + /// 定时任务(分钟) + /// + public int PullInterval { get; set; } + + /// + /// 服务商 + /// + public string ServiceProvider { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { 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 TrackPlaceName { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板 + /// + public string TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } + + /// + /// 拉取轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs new file mode 100644 index 00000000..15d25401 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs @@ -0,0 +1,26 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullConfigPageOutputVO +{ + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + public int Id { get; set; } + + /// + /// 服务商名称 + /// + public string ServiceProvider { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystem { get; set; } + + /// + /// 模板名称 + /// + public string TrackTemplate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs new file mode 100644 index 00000000..f9bbdaba --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -0,0 +1,66 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullContentDetailOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + public int Id { get; set; } + + /// + /// 拉取轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 拉取轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public string TrackKeyword { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public List? TrackKeywords { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public string TrackKeywordReverse { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public List? TrackKeywordReverses { get; set; } + + /// + /// 拉取轨迹发生地 + /// + public int? TrackPlaceValue { 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/TrackPull/GetTrackPullContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageInputVO.cs new file mode 100644 index 00000000..ca31153a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageInputVO.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullContentPageInputVO : PageInfoInput +{ + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs new file mode 100644 index 00000000..a1c52026 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs @@ -0,0 +1,51 @@ +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullContentPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + public int? Id { get; set; } + + /// + /// 拉取轨迹内容代码 + /// + public string? TrackContentCodeValue { get; set; } + + /// + /// 拉取轨迹内容 + /// + public string? TrackContentValue { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public string? TrackKeyword { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public string? TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地 + /// + public string? TrackPlaceValue { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string? TrackStatusValue { 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 new file mode 100644 index 00000000..ced23f75 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -0,0 +1,103 @@ +using SJZY.Expand.ABP.Core.PublicMethords; + +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushConfigDetailOutputVO +{ + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 客户 + /// + public string CustomName { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsName { get; set; } + + public int Id { get; set; } + + /// + /// 是否自动推送 + /// + public bool IsAutoPush { get; set; } + + /// + /// 推送轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 服务商 + /// + public string ServiceProvider { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { 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; } + + /// + /// 轨迹模板 + /// + public List TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public string TrackTemplateId { get; set; } + + /// + /// 轨迹模板ids + /// + public List TrackTemplateIds { get; set; } + + /// + /// 推送轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs new file mode 100644 index 00000000..e0095b23 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -0,0 +1,36 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushConfigPageOutputVO +{ + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 客户名称 + /// + public string CustomName { get; set; } + + public int Id { get; set; } + + /// + /// 子系统名称 + /// + public string SubSystem { get; set; } + + /// + /// 模板名称 + /// + 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..ace2b3df --- /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 TrackPushConfigId { 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/TrackPush/GetTrackPushContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs new file mode 100644 index 00000000..f0558e95 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentPageInputVO : PageInfoInput +{ + /// + /// 轨迹推送配置id + /// + public int TrackPushConfigId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs new file mode 100644 index 00000000..b3ae2d3f --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs @@ -0,0 +1,56 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsValue { get; set; } + + public int Id { get; set; } + + /// + /// 推送单号类型 + /// + public string OrderNoType { get; set; } + + /// + /// 推送排序 + /// + public int Sort { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusValue { 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 new file mode 100644 index 00000000..f19fb8c5 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.TrackStatus; + +public class GetPageTrackStatusVO : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { 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/TrackStatus/GetTrackStatusDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusDetailVO.cs new file mode 100644 index 00000000..66de23a9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusDetailVO.cs @@ -0,0 +1,39 @@ +namespace SJZY.Track.Domain.Dtos.TrackStatus; + +public class GetTrackStatusDetailVO +{ + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 节点id + /// + public int NodeId { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs new file mode 100644 index 00000000..ff570fc0 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs @@ -0,0 +1,67 @@ +using SJZY.Expand.ABP.Core.PublicMethords; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackStatus +{ + public class GetTrackStatusListVO + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 节点id + /// + public int NodeId { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs new file mode 100644 index 00000000..35c4fe8a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs @@ -0,0 +1,18 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class GetPageTrackTemplateVO : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { 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/GetTemplateContentAttributeValueInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs new file mode 100644 index 00000000..d8b295a9 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.Dtos.TrackTemplate +{ + public class GetTemplateContentAttributeValueInputVO + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 轨迹代码 + /// + public List? TrackCodes { get; set; } + + /// + /// 轨迹模板Id + /// + public List? TrackTemplateIds { get; set; } + + ///// + ///// 订单id + ///// + //public int OrderId { get; set; } + } + + public class GetTemplateContentAttributeValueVO + { + /// + /// 轨迹内容id + /// + public int TrackContenId { get; set; } + + /// + /// 模版id + /// + public int TrackTemplateId { get; set; } + + /// + /// 轨迹内容代码 + /// + public string TrackCode { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs new file mode 100644 index 00000000..c4474ba2 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs @@ -0,0 +1,46 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class GetTrackTemplateContentDetailOutputVO +{ + public int Id { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs new file mode 100644 index 00000000..ab4a6f8c --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class GetTrackTemplateContentDropDownListVO : PageInfoInput +{ + /// + /// 轨迹模板id + /// + public List TrackTemplateIds { get; set; } + + /// + /// 选中项 + /// + public List? SelectedIds { 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 new file mode 100644 index 00000000..09e8f51f --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class GetTrackTemplateContentPageInputVO : PageInfoInput +{ + /// + /// 轨迹模板id + /// + 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 new file mode 100644 index 00000000..b6d43291 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs @@ -0,0 +1,76 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class GetTrackTemplateContentPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + public int Id { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs new file mode 100644 index 00000000..46677e0e --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs @@ -0,0 +1,68 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +/// +/// 获取轨迹模版明细 +/// +public class GetTrackTemplateDetailVO +{ + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } + + /// + /// 模版名称 + /// + public string Name { get; set; } + + /// + /// 模版代码 + /// + public string Code { get; set; } +} + +/// +/// 获取轨迹模版列表 +/// +public class GetTrackTemplateListVO +{ + /// + /// 轨迹模版id + /// + public int Id { get; set; } + + /// + /// 模板名称 + /// + public string Name { set; get; } + + /// + /// 模版代码 + /// + public string Code { get; set; } + + /// + /// 所属子系统 + /// + public string SubSystem { set; get; } + + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs new file mode 100644 index 00000000..cb31744d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class OrderedTrackCodeDto +{ + /// + /// 模板id + /// + public int TemplateId { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } = null!; + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs new file mode 100644 index 00000000..a0b74b22 --- /dev/null +++ b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs @@ -0,0 +1,19 @@ +using System.ComponentModel; + +namespace SJZY.Track.Domain.Enums; + +/// +/// 枚举属性 +/// +public enum EnumPropertyEnums +{ + /// + /// 节点 + /// + [Description("ServiceNode")] 节点, + + /// + /// 单号类型 + /// + [Description("TrackOrderType")] 单号类型 +} \ 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..92545ea9 --- /dev/null +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -0,0 +1,34 @@ +namespace SJZY.Track.Domain; + +public class GlobalConst +{ + /// + /// 轨迹明细 es索引名称 + /// + public const string TrackIndex = "sjzy_track_details"; + + /// + /// 轨迹新增/更新 mq订阅名称 + /// + public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert"; + + /// + /// 轨迹删除 mq订阅名称 + /// + public const string TrackDeleteSubscribe = "SJZY.Track.TrackDelete"; + + /// + /// 接口通批量轨迹刷新订阅 + /// + public const string InterfaceRelayTrackRefreshSubscribe = "SJZY.Track.TrackRefresh"; + + /// + /// 轨迹新增/更新后触发更新订单轨迹 mq订阅名称 + /// + public const string UpdateOrderTrackSubscribe = "SJZY.Track.UpdateOrderTrack"; + + /// + /// 轨迹要推送的客户redis key前缀 + /// + public const string TrackPushKeyPrefix = "TrackPush:"; +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/GlobalUsings.cs b/src/SJZY.Track.Domain/GlobalUsings.cs new file mode 100644 index 00000000..deaf0047 --- /dev/null +++ b/src/SJZY.Track.Domain/GlobalUsings.cs @@ -0,0 +1,10 @@ +// Global using directives + +global using SJZY.Expand.ABP.Core.Common.Dto; +global using SJZY.Expand.ABP.Core.SqlSugar.Entitys; +global using SqlSugar; +global using System; +global using System.Collections.Generic; +global using System.Linq.Expressions; +global using System.Threading.Tasks; +global using SJZY.Track.Domain.SeedWork; \ No newline at end of file diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs new file mode 100644 index 00000000..3824c2eb --- /dev/null +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -0,0 +1,67 @@ +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Domain; + +public interface IBasicRepository : IBasicQuery where T : IAggregateRoot +{ + /// + /// update + /// + /// + /// 要忽略更新的列 + /// + Task UpdateAsync(T entity, Expression>? ignoreColumns); + + /// + /// update + /// + /// + /// 要更新的列 + /// + Task UpdateColumnAsync(T entity, Expression>? updateColumns); + + /// + /// update + /// + /// + /// 不更新null值列 + /// 不更新默认值列 + /// + Task UpdateAsync(T entity, bool ignoreAllNullColumns = false, bool ignoreAllDefaultValue = false); + + /// + /// 批量更新 + /// + /// + /// 要更新的列 + /// + Task UpdateRangeAsync(List entities, Expression>? updateColumns = null); + + /// + /// 软删 + /// + /// + /// + Task SoftDeleteAsync(Expression> where); + + /// + /// insert + /// + /// + /// + Task InsertAsync(T insertObj); + + /// + /// 新增返回id + /// + /// + /// + Task InsertReturnIdentityAsync(T insertObj); + + /// + /// 批量insert + /// + /// + /// + Task InsertRangeAsync(List entities); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Queries/IBasicQuery.cs b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs new file mode 100644 index 00000000..894e72a9 --- /dev/null +++ b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs @@ -0,0 +1,38 @@ +namespace SJZY.Track.Domain.Queries; + +public interface IBasicQuery where T : IEntity +{ + /// + /// top 1 + /// + /// + /// + Task GetFirstAsync(Expression> whereExpression); + + Task GetFirstAsync(Expression> whereExpression, + Expression> resultExpression); + + /// + /// get list + /// + /// + /// + Task> GetListAsync(Expression> whereExpression); + + Task> GetListAsync(Expression> whereExpression, + Expression> resultExpression); + + /// + /// count + /// + /// + /// + Task CountAsync(Expression> exp); + + /// + /// exists + /// + /// + /// + Task IsAnyAsync(Expression> exp); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Queries/IProvideQueries.cs b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs new file mode 100644 index 00000000..9c17d1d4 --- /dev/null +++ b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs @@ -0,0 +1,59 @@ +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.Dtos.TrackDetails; +using SJZY.Track.Domain.Dtos.TrackTemplate; + +namespace SJZY.Track.Domain.Queries; + +/// +/// 提供接口专用查询 +/// +public interface IProvideQueries +{ + /// + /// 根据订单号,获取订单模板 + /// + /// 订单类型 + /// 订单号 + /// + Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers); + + /// + /// 根据订单模板,获取有序的轨迹code + /// + /// 模板id + /// + Task> GetOrderedTrackCodesAsync(List templateIds); + + /// + /// 根据订单id找到订单模板,匹配模板命中的轨迹内容 + /// + /// 订单id + /// 轨迹代码 + /// + Task MatchTrackContentAsync(int orderId, string code); + + /// + /// 获取可删除的订单轨迹代码 + /// + /// + /// + /// + Task> GetCanDeleteTrackCodesAsync(int orderId, List trackCodes); + + /// + /// 根据子系统内容映射,得到映射后的轨迹code + /// + /// + /// + /// + /// + Task> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes); + + /// + /// 获取服务商模板配置 + /// + /// + /// + Task> GetPullContentConfigsAsync(int serviceProviderId); +} \ 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 new file mode 100644 index 00000000..b1f4dc63 --- /dev/null +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -0,0 +1,14 @@ + + + + + + net7.0 + + + + + + + + diff --git a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs new file mode 100644 index 00000000..792e7844 --- /dev/null +++ b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Modularity; + +namespace SJZY.Track.Domain; + +public class SjzyTrackDomainModule : AbpModule +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs b/src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs new file mode 100644 index 00000000..613c8055 --- /dev/null +++ b/src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.SeedWork; + +public interface IAggregateRoot : IEntity +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/SeedWork/IEntity.cs b/src/SJZY.Track.Domain/SeedWork/IEntity.cs new file mode 100644 index 00000000..06cf92fc --- /dev/null +++ b/src/SJZY.Track.Domain/SeedWork/IEntity.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.SeedWork; + +public interface IEntity +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TransactionHelper.cs b/src/SJZY.Track.Domain/TransactionHelper.cs new file mode 100644 index 00000000..fa8baac4 --- /dev/null +++ b/src/SJZY.Track.Domain/TransactionHelper.cs @@ -0,0 +1,17 @@ +using System.Transactions; + +namespace SJZY.Track.Domain; + +public class TransactionHelper +{ + /// + /// 获取读已提交级别的事务,记得要释放 + /// + /// + public static TransactionScope GetReadCommitted() + { + return new TransactionScope(TransactionScopeOption.Required, + new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }, + TransactionScopeAsyncFlowOption.Enabled); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/VEntities/VEnumValueInfo.cs b/src/SJZY.Track.Domain/VEntities/VEnumValueInfo.cs new file mode 100644 index 00000000..cfefa5c6 --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VEnumValueInfo.cs @@ -0,0 +1,50 @@ +namespace SJZY.Track.Domain.VEntities; + +/// +/// 主数据枚举 +/// +[SugarTable("v_enum_value_info")] +public class VEnumValueInfoEntity : IFullAuditedBasicEntitys +{ + /// + /// + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// '属性 开发人员设定,禁止用户修改' + /// + [SugarColumn(ColumnName = "Property")] + public string Property { get; set; } + + /// + /// '关键字;外部使用:系统自动生成 同一个Property的Enumkey 自动排序递增 内部使用:开发人员设定' + /// + [SugarColumn(ColumnName = "Enumkey")] + public int Enumkey { get; set; } + + /// + /// 描述 + /// + [SugarColumn(ColumnName = "Disp")] + public string Disp { get; set; } + + /// + /// 描述英文名 + /// + [SugarColumn(ColumnName = "EnDisp")] + public string EnDisp { get; set; } + + /// + /// 是否内部使用, 1是 0不是,外部使用,无需设置此值. + /// + [SugarColumn(ColumnName = "IsInside")] + public int IsInside { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remark")] + public string Remark { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs b/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs new file mode 100644 index 00000000..51bea216 --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs @@ -0,0 +1,128 @@ +namespace SJZY.Track.Repository.VData.Entitys; + +/// +/// 外部主体 +/// +[SugarTable("v_external_subject")] +public class VExternalSubjectEntity : IFullAuditedBasicEntitys +{ + /// + /// + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 公司简称 + /// + [SugarColumn(ColumnName = "Abbreviation")] + public string Abbreviation { get; set; } + + /// + /// 所属网络(主数据枚举表 (属性=AffiliatedNetwork)WCA,WEB,Atlas,CCA,CTN,CLN,GLN,PCN,SCN,WPA,EGLN,Other) + /// + [SugarColumn(ColumnName = "AffiliatedNetwork")] + public int? AffiliatedNetwork { get; set; } + + /// + /// 公司代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// (主数据枚举表 (属性=CustomerQuality)国内同行,国外同行,国内直客,国外直客,海外代理,国内贸易公司,国外贸易公司,仅供应商,内部子公司,个人,内部子部门) + /// + [SugarColumn(ColumnName = "CooperationNature")] + public int? CooperationNature { get; set; } + + /// + /// 公司英文名 + /// + [SugarColumn(ColumnName = "EnName")] + public string EnName { get; set; } + + /// + /// 是否核准 + /// + [SugarColumn(ColumnName = "IsApprove")] + public bool IsApprove { get; set; } + + /// + /// 是否黑名单 + /// + [SugarColumn(ColumnName = "IsBlacklist")] + public bool IsBlacklist { get; set; } + + /// + /// 是否订香港 + /// + [SugarColumn(ColumnName = "IsBookingHongKong")] + public bool? IsBookingHongKong { get; set; } + + /// + /// 是否海外代理 + /// + [SugarColumn(ColumnName = "IsOverseasAgent")] + public bool IsOverseasAgent { get; set; } + + /// + /// 是否自行结算 + /// + [SugarColumn(ColumnName = "IsSelfSettlement")] + public bool IsSelfSettlement { get; set; } + + /// + /// 是否结算主体 + /// + [SugarColumn(ColumnName = "IsSettlementSubject")] + public bool IsSettlementSubject { get; set; } + + /// + /// 主网络,从多选的所属网络中选其中一个 + /// + [SugarColumn(ColumnName = "MainNetwork")] + public int? MainNetwork { get; set; } + + /// + /// 公司名称 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 性质,t_enum_value_info表Property="CompanyQuality;1 国有企业,2 国有控股企业,3 外资企业,4 合资企业,5 股份企业,6 私营企业,7 个体户 + /// + [SugarColumn(ColumnName = "Nature")] + public int? Nature { get; set; } + + /// + /// 内部组织id + /// + [SugarColumn(ColumnName = "OrgId")] + public int? OrgId { get; set; } + + /// + /// 母公司id + /// + [SugarColumn(ColumnName = "ParentId")] + public int? ParentId { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remark")] + public string Remark { get; set; } + + /// + /// 类型,位运算存储;t_enum_value_info表Property="SubjectType;1客户,2供应商,4内部子公司 + /// + [SugarColumn(ColumnName = "Type")] + public int Type { get; set; } + + /// + /// 已验证公司名称 + /// + [SugarColumn(ColumnName = "VerifiedName")] + public string VerifiedName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs b/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs new file mode 100644 index 00000000..737fbb0f --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs @@ -0,0 +1,74 @@ +namespace SJZY.Track.Domain.VEntities; + +/// +/// 服务商主表 +/// +[SugarTable("v_service_provider")] +public class VServiceProviderEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 授权接口Code + /// + [SugarColumn(ColumnName = "AuthInterfaceCode")] + public string AuthInterfaceCode { get; set; } + + /// + /// 服务商代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 描述 + /// + [SugarColumn(ColumnName = "Description")] + public string Description { get; set; } + + /// + /// 流程代码 + /// + [SugarColumn(ColumnName = "FlowCode")] + public string FlowCode { get; set; } + + /// + /// 是否禁用账户验证 + /// + [SugarColumn(ColumnName = "IsDisableAuth")] + public bool IsDisableAuth { get; set; } + + /// + /// 服务商名称 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 请求超时(s) + /// + [SugarColumn(ColumnName = "Timeout")] + public int? Timeout { get; set; } + + /// + /// 轨迹时区 + /// + [SugarColumn(ColumnName = "TraceTimeZone")] + public string TraceTimeZone { get; set; } + + /// + /// 服务商类型(弃用) + /// + [SugarColumn(ColumnName = "Type")] + public int Type { get; set; } + + /// + /// 服务商类型(多选) + /// + [SugarColumn(ColumnName = "Types")] + public string Types { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs b/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs new file mode 100644 index 00000000..eb0030be --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs @@ -0,0 +1,152 @@ +namespace SJZY.Track.Domain.VEntities; + +/// +/// +/// +[SugarTable("v_system")] +public class VSystemEntity : IFullAuditedBasicEntitys +{ + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 关联的内部子系统 + /// + [SugarColumn(ColumnName = "AssociatedInternalSubsystem")] + public int? AssociatedInternalSubsystem { get; set; } + + /// + /// 子系统授权类型(1.标准 2.因素) + /// + [SugarColumn(ColumnName = "AuthType")] + public bool AuthType { get; set; } + + /// + /// 中文名 + /// + [SugarColumn(ColumnName = "CnName")] + public string CnName { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Comment")] + public string Comment { get; set; } + + /// + /// 安装包下载链接,当类型为安装包时,必填 + /// + [SugarColumn(ColumnName = "DownloadUrl")] + public string DownloadUrl { get; set; } + + /// + /// 英文名 + /// + [SugarColumn(ColumnName = "EnName")] + public string EnName { get; set; } + + /// + /// 飞书应用ID + /// + [SugarColumn(ColumnName = "FsAppId")] + public string FsAppId { get; set; } + + /// + /// 欠费允许下单(默认为是) + /// + [SugarColumn(ColumnName = "IsAllowPlaceOrder")] + public bool? IsAllowPlaceOrder { get; set; } + + /// + /// 是否开通授信 + /// + [SugarColumn(ColumnName = "IsCredit")] + public bool? IsCredit { get; set; } + + /// + /// 是否启用 + /// + [SugarColumn(ColumnName = "IsEnable")] + public bool IsEnable { get; set; } + + /// + /// 是否启用业务主体(判断登录是否选择业务主体) + /// + [SugarColumn(ColumnName = "IsEnableBusiness")] + public bool? IsEnableBusiness { get; set; } + + /// + /// 是否结束初始化 + /// + [SugarColumn(ColumnName = "IsEndInit")] + public bool IsEndInit { get; set; } + + /// + /// 是否开通余额 + /// + [SugarColumn(ColumnName = "IsOpenBalance")] + public bool IsOpenBalance { get; set; } + + /// + /// 子系统唯一值 + /// + [SugarColumn(ColumnName = "Key")] + public string Key { get; set; } + + /// + /// 子系统Logo图标 + /// + [SugarColumn(ColumnName = "LogoIcon")] + public string LogoIcon { get; set; } + + /// + /// 主账号Id + /// + [SugarColumn(ColumnName = "MainUserId")] + public int? MainUserId { get; set; } + + /// + /// 移动端链接 + /// + [SugarColumn(ColumnName = "MobileUrl")] + public string MobileUrl { get; set; } + + /// + /// 运营主体 + /// + [SugarColumn(ColumnName = "OperatingSubject")] + public int? OperatingSubject { get; set; } + + /// + /// 排序值 + /// + [SugarColumn(ColumnName = "Sort")] + public int? Sort { get; set; } + + /// + /// 跨境电商物流1 干线物流2 国内代理贸易3 非业务类4 + /// + [SugarColumn(ColumnName = "SysBusinessType")] + public int? SysBusinessType { get; set; } + + /// + /// 系统所属1:内部 2:外部 + /// + [SugarColumn(ColumnName = "SystemProperty")] + public int SystemProperty { get; set; } + + /// + /// 子系统类型:1-Web、2-安装包exe + /// + [SugarColumn(ColumnName = "SystemType")] + public int? SystemType { get; set; } + + /// + /// 子系统token + /// + [SugarColumn(ColumnName = "Token")] + public string Token { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/VEntities/VUserEntity.cs b/src/SJZY.Track.Domain/VEntities/VUserEntity.cs new file mode 100644 index 00000000..71a52664 --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VUserEntity.cs @@ -0,0 +1,104 @@ +namespace SJZY.Track.Domain.VEntities; + +/// +/// 用户信息表 +/// +[SugarTable("v_user")] +public class VUserEntity : IFullAuditedBasicEntitys +{ + /// + /// 用户id + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 账号 + /// + [SugarColumn(ColumnName = "Account")] + public string Account { get; set; } + + /// + /// 公司Id + /// + [SugarColumn(ColumnName = "CompanyId")] + public int? CompanyId { get; set; } + + /// + /// 国际区号 + /// + [SugarColumn(ColumnName = "CountryCode")] + public string CountryCode { get; set; } + + /// + /// 默认语言枚举 + /// + [SugarColumn(ColumnName = "DefaultLang")] + public bool? DefaultLang { get; set; } + + /// + /// 部门Id + /// + [SugarColumn(ColumnName = "DeptId")] + public int? DeptId { get; set; } + + /// + /// 员工id + /// + [SugarColumn(ColumnName = "EmployeeId")] + public int? EmployeeId { get; set; } + + /// + /// 英文名 + /// + [SugarColumn(ColumnName = "EnName")] + public string EnName { get; set; } + + /// + /// 是否业务员 + /// + [SugarColumn(ColumnName = "IsBusiness")] + public bool? IsBusiness { get; set; } + + /// + /// 是否启用 + /// + [SugarColumn(ColumnName = "IsEnable")] + public bool IsEnable { get; set; } + + /// + /// 固定电话(座机号码) + /// + [SugarColumn(ColumnName = "LandlinePhone")] + public string LandlinePhone { get; set; } + + /// + /// 姓名 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { get; set; } + + /// + /// 用户直接组织节点Id + /// + [SugarColumn(ColumnName = "OrgId")] + public int? OrgId { get; set; } + + /// + /// 密码 + /// + [SugarColumn(ColumnName = "PassWord")] + public string PassWord { get; set; } + + /// + /// 绑定手机号 + /// + [SugarColumn(ColumnName = "TelPhone")] + public string TelPhone { get; set; } + + /// + /// 用户来源(1.员工入职 2.手动添加 3.其他) + /// + [SugarColumn(ColumnName = "UserOrigin")] + public bool? UserOrigin { get; set; } +} \ 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.Repository/BasicRepository.cs b/src/SJZY.Track.Repository/BasicRepository.cs deleted file mode 100644 index 380b3256..00000000 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ /dev/null @@ -1,15 +0,0 @@ -#pragma warning disable 1591 -namespace SJZY.Track.Repository -{ - /// - /// 仓储基类 - /// - /// - public class BasicRepository : SimpleClient where T : class, new() - { - public BasicRepository() - { - Context = SqlsugarScopeBasic.GetContextSafely("default"); - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs index b9712ab1..88539836 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -1,53 +1,77 @@ -#pragma warning disable 1591 -namespace SJZY.Track.Repository +using SJZY.UserCenter.HttpApi.Services; + +#pragma warning disable 1591 + +namespace SJZY.Track.Repository; + +/// +/// Sqlsugar 上下文对象 +/// +public class DataBaseContext { - /// - /// Sqlsugar 上下文对象 - /// - public class DataBaseContext + #region 审计属性自动赋值 + + public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo) { + //过滤掉 "v_" 开头的表 + if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase)) + throw new Exception("非法的操作,不允许编辑映射表"); - #region 审计属性自动赋值 - - public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo) + //新增 + if (entityInfo.OperationType == DataFilterType.InsertByObject) { - //过滤掉 "v_" 开头的表 - if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase)) - throw new Exception("非法的操作,不允许编辑映射表"); - - //新增 - if (entityInfo.OperationType == DataFilterType.InsertByObject) + if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime)) + entityInfo.SetValue(DateTime.Now); + if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) { - if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime)) - entityInfo.SetValue(DateTime.Now); - if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) + if (oldValue == null || (int)oldValue == 0) { - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); - } - } - //修改 - else if (entityInfo.OperationType == DataFilterType.UpdateByObject) - { - if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) - entityInfo.SetValue(DateTime.Now); - else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) - { - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); - } - //删除 - else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted)) - { - var currentType = entityInfo.EntityValue.GetType(); - bool.TryParse(currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(), out bool isdelete); - if (isdelete) + try { - //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5); - currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime))?.SetValue(entityInfo.EntityValue, DateTime.Now); + entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); } + catch + { + } + } + //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + } + //修改 + else if (entityInfo.OperationType == DataFilterType.UpdateByObject) + { + if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) + entityInfo.SetValue(DateTime.Now); + else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) + { + if (oldValue == null || (int)oldValue == 1) + { + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + catch + { + } + } + //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + //删除 + else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted)) + { + var currentType = entityInfo.EntityValue.GetType(); + bool.TryParse( + currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(), + out bool isdelete); + if (isdelete) + { + //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5); + currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime)) + ?.SetValue(entityInfo.EntityValue, DateTime.Now); } } } - - #endregion 审计属性自动赋值 } + + #endregion 审计属性自动赋值 } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Demo/Entitys/DemoDetailEntity.cs b/src/SJZY.Track.Repository/Demo/Entitys/DemoDetailEntity.cs deleted file mode 100644 index a0f865f9..00000000 --- a/src/SJZY.Track.Repository/Demo/Entitys/DemoDetailEntity.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace SJZY.Track.Repository.Demo.Entitys -{ - [SugarTable("t_demo_detail")] - public class DemoDetailEntity - { - /// - /// Id - /// - [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] - public long Id { get; set; } - - /// - /// t_demo.id - /// - [SugarColumn(ColumnName = "DemoId")] - public long DemoId { get; set; } - - /// - /// 一些说明.. - /// - [SugarColumn(ColumnName = "OtherInfo")] - public string OtherInfo { get; set; } - } -} diff --git a/src/SJZY.Track.Repository/Demo/Entitys/DemoEntity.cs b/src/SJZY.Track.Repository/Demo/Entitys/DemoEntity.cs deleted file mode 100644 index c82bd5cb..00000000 --- a/src/SJZY.Track.Repository/Demo/Entitys/DemoEntity.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace SJZY.Track.Repository.Demo.Entitys -{ - - /// - /// 测试表 - /// - [SugarTable("t_demo")] - public class DemoEntity : IFullAuditedBasicEntitys - { - /// - /// Id - /// - [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] - public long Id { get; set; } - - /// - /// 姓名 - /// - [SugarColumn(ColumnName = "Name")] - public string Name { get; set; } - - /// - /// 年龄 - /// - [SugarColumn(ColumnName = "Age")] - public int Age { get; set; } - - /// - /// 描述 - /// - [SugarColumn(ColumnName = "Description")] - public string Description { get; set; } - - - [Navigate(NavigateType.OneToMany, nameof(DemoDetailEntity.DemoId))] - public List DemoDetailList { get; set; } - - } - -} diff --git a/src/SJZY.Track.Repository/Demo/Services/DemoRepository.cs b/src/SJZY.Track.Repository/Demo/Services/DemoRepository.cs deleted file mode 100644 index 4bb01002..00000000 --- a/src/SJZY.Track.Repository/Demo/Services/DemoRepository.cs +++ /dev/null @@ -1,198 +0,0 @@ -using SJZY.Track.Repository.Demo.Entitys; -using SJZY.Track.Repository.Demo.ValueObjects; -using System.Transactions; - -namespace SJZY.Track.Repository.Demo.Services -{ - public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency - { - /* - 一般情况下常规的增删改方法不需要自己实现,只需要按照 BasicRepository 中的格式原封不动的暴露出去即可, - 比如这里接口 只声明了 UpdateAsync 和 InsertReturnIdentityAsync 接口的定义,但是这两个方法的实现我们不用写,直接交给父类实现即可 - */ - - #region 根据主键获取单条数据 - - /// - /// 根据主键获取单条数据 - /// - /// - /// - public Task GetById1(int id) - { - /* - - //以下两种方法都不会因为没找到数据而抛异常 - var model1 = base.GetFirst(m => m.Id == 0); - var model = base.GetSingle(m => m.Id == 0); - - - - //同样的写法在linq下,如果不加 OrDefault 一定会报错 - var model = base.GetList().Single(m => m.Id == 0); - var model1 = base.GetList().First(m => m.Id == 0); - - */ - return base.GetSingleAsync(it => it.Id == id); - } - - #endregion - - #region 分页获取 - - /// - /// 分页获取 - /// - /// - /// - public async Task> GetListByPage(int pageSize, int pageindex, string name) - { - var list = await AsQueryable() - .WhereIF(!string.IsNullOrEmpty(name), a => a.Name.Contains(name)) - .ToPagedListAsync(pageindex, pageSize); - - return list; - } - #endregion - - #region 参数为实体 - - /// - /// 参数很多的时候,定义模型接受参数 - /// - /// - /// - public async Task> InputToValueObject(DemoValueObject obj) - { - var list = await AsQueryable().ToListAsync(); - return list; - } - #endregion - - #region 执行原生sql语句 - /// - /// 执行原生sql语句 - /// - /// - /// - public async Task> OriginalSql(DemoValueObject obj) - { - var parameters = new List(); - var sql = @$" - select - a.id, - a.Name, - a.Age, - a.Description - from t_demo a - where 1=1 - {" and a.Name like @Name ".WhereIF(!string.IsNullOrEmpty(obj.Name), obj.Name, ref parameters)} - order by a.id desc "; - - var list = await Context.SqlQueryable(sql) - .AddParameters(parameters) - .ToPagedListAsync(obj.PageIndex, obj.PageSize); - - return list; - } - - #endregion - - #region 简单事务 - public async Task Transaction() - { - - using (var ts = new TransactionScope()) - { - - await base.InsertAsync(new DemoEntity { Name = "1111" }); - await base.InsertAsync(new DemoEntity { Name = "222" }); - await base.InsertAsync(new DemoEntity { Name = "3333" }); - - //throw new BusinessException("E05632","手动抛异常"); - await base.InsertAsync(new DemoEntity { Name = "4444" }); - - ts.Complete(); - } - } - #endregion - - #region 夸方法事务 - public async Task MultipleMethodTrans1() - { - await base.InsertAsync(new DemoEntity { Name = "---" }); - await base.InsertAsync(new DemoEntity { Name = "+++" }); - } - - public async Task MultipleMethodTrans2() - { - - //throw new BusinessException(message: "手动抛出异常"); - await base.InsertAsync(new DemoEntity { Name = "xxx" }); - } - #endregion - - #region 事务嵌套 - public async Task InternalTrans() - { - using (var ts = new TransactionScope()) - { - await Transaction(); - await MultipleMethodTrans1(); - //throw new BusinessException(message: "手动抛出异常"); - await base.InsertAsync(new DemoEntity { Name = "xxx" }); - - ts.Complete(); - } - } - #endregion - - #region 局部更新 - public async Task UpdatePartColumns(DemoEntity entity) - { - Context.Updateable(entity).UpdateColumns(m => new { m.Description, m.Name }).ExecuteCommand(); - // UPDATE `test` SET `Name`= 'string',`Description`= 'string' WHERE `id`= 5 - - Context.Updateable(entity).IgnoreColumns(m => new { m.CreateUserId, m.Age }).ExecuteCommand(); - // UPDATE `test` SET`IsDeleted`= 0,`Name`= 'string',`Description`= 'string',`EnabledMark`= 0,`DeleteUserId`= 0,`DeleteTime`= '2022/8/13 23:42:36',`CreateTime`= '2015/5/12 0:00:00',`UpdateUserId`= 0,`UpdateTime`= '2022/8/13 23:55:27' WHERE `id`= 5 - } - #endregion - - #region 导航属性 - /// - /// 导航属性 - /// - /// - /// - /// - public async Task EntityRelationSave(DemoEntity entity) - { - var res = await Context.InsertNav(entity).Include(m => m.DemoDetailList).ExecuteCommandAsync(); - return res; - } - #endregion - - #region 缓存 - /// - /// 获取数据包含缓存 - /// - /// - /// - public async Task GetDataCache(int id) - { - var redisKey = $"Demo:Endity:{id}"; - var demo = await RedisHelper.Client.GetAsync(redisKey); - if (demo != null) - return demo; - - var aa = Context.Ado.Connection; - demo = await base.GetSingleAsync(m => m.Id == id); - - await RedisHelper.Client.SetAsync(redisKey, demo, 60 * 20); - - return demo; - } - #endregion - - } -} diff --git a/src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs b/src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs deleted file mode 100644 index 782554e1..00000000 --- a/src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace SJZY.Track.Repository.Demo.ValueObjects -{ - public class DemoValueObject - { - - public string Name { get; set; } - - /// - /// 当前页码 - /// - public int PageIndex { get; set; } - - /// - /// 每页大小 - /// - public int PageSize { get; set; } - } -} diff --git a/src/SJZY.Track.Repository/GlobalUsing.cs b/src/SJZY.Track.Repository/GlobalUsing.cs index dc581267..bb8c080a 100644 --- a/src/SJZY.Track.Repository/GlobalUsing.cs +++ b/src/SJZY.Track.Repository/GlobalUsing.cs @@ -4,4 +4,4 @@ global using SJZY.Expand.ABP.Core.SqlSugar; global using SJZY.Expand.ABP.Core.SqlSugar.Entitys; global using SJZY.Expand.ABP.Core.SqlSugar.Tools; global using SqlSugar; -global using Volo.Abp.DependencyInjection; +global using Volo.Abp.DependencyInjection; \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/BasicQuery.cs b/src/SJZY.Track.Repository/Queries/BasicQuery.cs new file mode 100644 index 00000000..60a234ef --- /dev/null +++ b/src/SJZY.Track.Repository/Queries/BasicQuery.cs @@ -0,0 +1,27 @@ +using System.Linq.Expressions; +using SJZY.Track.Domain.Queries; +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository.Queries; + +#pragma warning disable CS8613 +public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() +#pragma warning restore CS8613 +{ + public BasicQuery() + { + Context = SqlsugarScopeBasic.GetContextSafely("default"); + } + + public async Task GetFirstAsync(Expression> whereExpression, + Expression> resultExpression) + { + return await Context.Queryable().Where(whereExpression).Select(resultExpression).FirstAsync(); + } + + public async Task> GetListAsync(Expression> whereExpression, + Expression> resultExpression) + { + return await Context.Queryable().Where(whereExpression).Select(resultExpression).ToListAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs new file mode 100644 index 00000000..526d5e3d --- /dev/null +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -0,0 +1,121 @@ +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.Dtos.TrackDetails; +using SJZY.Track.Domain.Dtos.TrackTemplate; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Repository.Queries; + +public class ProvideQueries : ISugarRepository, IProvideQueries, + ITransientDependency +{ + public ISqlSugarClient Context { get; set; } + + public ProvideQueries() + { + Context = SqlsugarScopeBasic.GetContextSafely("default"); + } + + public async Task> GetOrderTemplateLinksAsync(int orderType, + params string[] orderNumbers) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateLinkDto + { + OrderNo = a.OrderNo, + TemplateId = b.TrackTemplateId + }) + .ToListAsync(); + } + + public async Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateLinkDto + { + OrderNo = a.OrderNo, + TemplateId = b.TrackTemplateId + }) + .ToListAsync(); + } + + public async Task> GetOrderedTrackCodesAsync(List templateIds) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.TrackContentId == b.Id) + .Where(a => templateIds.Contains(a.TrackTemplateId)) + .OrderBy(a => a.Sort) + .Select((a, b) => new OrderedTrackCodeDto + { + TemplateId = a.TrackTemplateId, + Code = b.Code, + IsExternal = a.IsExternal + }) + .ToListAsync(); + } + + public async Task MatchTrackContentAsync(int orderId, string code) + { + return await Context.Queryable() + .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId) + .LeftJoin((x, a, b) => a.TrackContentId == b.Id) + .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id) + .Where((x, a, b) => x.OrderId == orderId && b.Code == code) + .Select((x, a, b, c) => new MatchTrackContentDto + { + Content = b.Content, + EnContent = b.EnContent, + Status = c.Status, + IsCompleted = b.IsCompleted, + IsCanDelete = a.IsCanDelete + }) + .FirstAsync(); + } + + public async Task> GetCanDeleteTrackCodesAsync(int orderId, List trackCodes) + { + return await Context.Queryable() + .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId && a.IsCanDelete) + .LeftJoin((x, a, b) => a.TrackContentId == b.Id) + .Where((x, a, b) => x.OrderId == orderId + && trackCodes.Contains(b.Code) && a.IsCanDelete) + .Select((x, a, b) => b.Code) + .ToListAsync(); + } + + public async Task> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes) + { + // 根据上游code得到下游code + return await Context.Queryable() + .Where(x => x.SubSystemId == subSystemId && x.MapSubSystemId == upSubSystemId && + trackCodes.Contains(x.MapTrackContentCode)) + .Select(x => x.TrackContentCode) + .ToListAsync(); + } + + public async Task> GetPullContentConfigsAsync(int serviceProviderId) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.TrackPullConfigId) + .Where(a => a.ServiceProviderId == serviceProviderId) + .Select(x => new TrackPullContentConfigVO + { + TrackContentId = 0, + TrackContentCodeValue = null, + TrackContentValue = null, + TrackKeyword = null, + TrackKeywordReverse = null, + TrackPlaceValue = null, + TrackStatusValue = null, + TrackTimeZone = null + }).ToListAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/BasicRepository.cs b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs new file mode 100644 index 00000000..965bd5d7 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs @@ -0,0 +1,55 @@ +using System.Linq.Expressions; +using SJZY.Track.Domain; +using SJZY.Track.Domain.SeedWork; +using SJZY.Track.Repository.Queries; +using Volo.Abp; + +namespace SJZY.Track.Repository.Repositories; + +/// +/// 仓储基类实现 +/// +/// +public class BasicRepository : BasicQuery, IBasicRepository where T : class, IAggregateRoot, new() +{ + 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) + { + return await Context.Updateable(entity) + .UpdateColumnsIF(updateColumns != null, updateColumns) + .ExecuteCommandHasChangeAsync(); + } + + public async Task UpdateAsync(T entity, bool ignoreAllNullColumns = false, bool ignoreAllDefaultValue = false) + { + return await Context.Updateable(entity) + .IgnoreColumns(ignoreAllNullColumns: ignoreAllNullColumns, ignoreAllDefaultValue: ignoreAllDefaultValue) + .ExecuteCommandHasChangeAsync(); + } + + public async Task UpdateRangeAsync(List entities, Expression>? columns = null) + { + return await Context.Updateable(entities) + .UpdateColumnsIF(columns != null, columns) + .ExecuteCommandHasChangeAsync(); + } + + // tips: required where + public async Task SoftDeleteAsync(Expression> where) + { + if (!typeof(T).IsAssignableTo()) + throw new BusinessException( + message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}"); + + return await Context.Updateable() + .Where(where) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) + .ExecuteCommandHasChangeAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/DemoRepository.cs b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs new file mode 100644 index 00000000..8334ea44 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs @@ -0,0 +1,208 @@ +using System.Transactions; +using SJZY.Track.Domain.Aggregates.DemoAggregate; +using SJZY.Track.Domain.Dtos.Demo; + +namespace SJZY.Track.Repository.Repositories; + +public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency +{ + /* + 一般情况下常规的增删改方法不需要自己实现,只需要按照 BasicRepository 中的格式原封不动的暴露出去即可, + 比如这里接口 只声明了 UpdateAsync 和 InsertReturnIdentityAsync 接口的定义,但是这两个方法的实现我们不用写,直接交给父类实现即可 + */ + + #region 根据主键获取单条数据 + + /// + /// 根据主键获取单条数据 + /// + /// + /// + public Task GetById1(int id) + { + /* + + //以下两种方法都不会因为没找到数据而抛异常 + var model1 = base.GetFirst(m => m.Id == 0); + var model = base.GetSingle(m => m.Id == 0); + + + + //同样的写法在linq下,如果不加 OrDefault 一定会报错 + var model = base.GetList().Single(m => m.Id == 0); + var model1 = base.GetList().First(m => m.Id == 0); + + */ + return base.GetSingleAsync(it => it.Id == id); + } + + #endregion + + #region 分页获取 + + /// + /// 分页获取 + /// + /// + /// + public async Task> GetListByPage(int pageSize, int pageindex, string name) + { + var list = await AsQueryable() + .WhereIF(!string.IsNullOrEmpty(name), a => a.Name.Contains(name)) + .ToPagedListAsync(pageindex, pageSize); + + return list; + } + + #endregion + + #region 参数为实体 + + /// + /// 参数很多的时候,定义模型接受参数 + /// + /// + /// + public async Task> InputToValueObject(DemoValueObject obj) + { + var list = await AsQueryable().ToListAsync(); + return list; + } + + #endregion + + #region 执行原生sql语句 + + /// + /// 执行原生sql语句 + /// + /// + /// + public async Task> OriginalSql(DemoValueObject obj) + { + var parameters = new List(); + var sql = @$" + select + a.id, + a.Name, + a.Age, + a.Description + from t_demo a + where 1=1 + {" and a.Name like @Name ".WhereIF(!string.IsNullOrEmpty(obj.Name), obj.Name, ref parameters)} + order by a.id desc "; + + var list = await Context.SqlQueryable(sql) + .AddParameters(parameters) + .ToPagedListAsync(obj.PageIndex, obj.PageSize); + + return list; + } + + #endregion + + #region 简单事务 + + public async Task Transaction() + { + using (var ts = new TransactionScope()) + { + await base.InsertAsync(new DemoEntity { Name = "1111" }); + await base.InsertAsync(new DemoEntity { Name = "222" }); + await base.InsertAsync(new DemoEntity { Name = "3333" }); + + //throw new BusinessException("E05632","手动抛异常"); + await base.InsertAsync(new DemoEntity { Name = "4444" }); + + ts.Complete(); + } + } + + #endregion + + #region 夸方法事务 + + public async Task MultipleMethodTrans1() + { + await base.InsertAsync(new DemoEntity { Name = "---" }); + await base.InsertAsync(new DemoEntity { Name = "+++" }); + } + + public async Task MultipleMethodTrans2() + { + //throw new BusinessException(message: "手动抛出异常"); + await base.InsertAsync(new DemoEntity { Name = "xxx" }); + } + + #endregion + + #region 事务嵌套 + + public async Task InternalTrans() + { + using (var ts = new TransactionScope()) + { + await Transaction(); + await MultipleMethodTrans1(); + //throw new BusinessException(message: "手动抛出异常"); + await base.InsertAsync(new DemoEntity { Name = "xxx" }); + + ts.Complete(); + } + } + + #endregion + + #region 局部更新 + + public async Task UpdatePartColumns(DemoEntity entity) + { + Context.Updateable(entity).UpdateColumns(m => new { m.Description, m.Name }).ExecuteCommand(); + // UPDATE `test` SET `Name`= 'string',`Description`= 'string' WHERE `id`= 5 + + Context.Updateable(entity).IgnoreColumns(m => new { m.CreateUserId, m.Age }).ExecuteCommand(); + // UPDATE `test` SET`IsDeleted`= 0,`Name`= 'string',`Description`= 'string',`EnabledMark`= 0,`DeleteUserId`= 0,`DeleteTime`= '2022/8/13 23:42:36',`CreateTime`= '2015/5/12 0:00:00',`UpdateUserId`= 0,`UpdateTime`= '2022/8/13 23:55:27' WHERE `id`= 5 + } + + #endregion + + #region 导航属性 + + /// + /// 导航属性 + /// + /// + /// + /// + public async Task EntityRelationSave(DemoEntity entity) + { + var res = await Context.InsertNav(entity).Include(m => m.DemoDetailList).ExecuteCommandAsync(); + return res; + } + + #endregion + + #region 缓存 + + /// + /// 获取数据包含缓存 + /// + /// + /// + public async Task GetDataCache(int id) + { + var redisKey = $"Demo:Endity:{id}"; + var demo = await RedisHelper.Client.GetAsync(redisKey); + if (demo != null) + return demo; + + var aa = Context.Ado.Connection; + demo = await base.GetSingleAsync(m => m.Id == id); + + await RedisHelper.Client.SetAsync(redisKey, demo, 60 * 20); + + return demo; + } + + #endregion +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs new file mode 100644 index 00000000..481a5c87 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -0,0 +1,256 @@ +using SJZY.Track.Domain; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +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 +{ + private readonly ITrackDetailsRepository _trackDetailsRepository; + + public OrderRepository( + ITrackDetailsRepository trackDetailsRepository + ) + { + this._trackDetailsRepository=trackDetailsRepository; + } + + public async Task CreateOrderAsync(OrderEntity order) + { + using var tran = TransactionHelper.GetReadCommitted(); + + var orderId = await InsertReturnIdentityAsync(order); + order.OrderTemplates.ForEach(x => x.OrderId = orderId); + await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync(); + order.OrderFlights.ForEach(x => x.OrderId = orderId); + await Context.Insertable(order.OrderFlights).ExecuteCommandAsync(); + + tran.Complete(); + } + + 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.LinkOrderId == b.Id) + .Where(a => a.OrderId == orderId) + .Select((a, b) => new LinkedOrderVO + { + OrderId = b.Id, + OrderType = b.OrderType, + OrderNo = b.OrderNo, + SubSystemId = b.SubSystemId, + IsPushCompleted = b.IsPushCompleted, + CustomId = b.CustomId + }) + .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) + { + List orderNoList = new List(); + if (!input.OrderNos.IsNullOrWhiteSpace()) + { + orderNoList = input.OrderNos.Split(new char[] { ',', ',', ':', ':' }).ToList(); + } + + 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(!orderNoList.IsNullOrEmpty(), (a, b, c) => orderNoList.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) + .OrderByDescending((a, b, c) => a.CreateTime) + .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, ","), + + //TrackTemplateIds = SqlFunc.Subqueryable() + // .LeftJoin((aa, bb) => aa.TrackTemplateId == bb.Id) + // .Where((aa, bb) => a.Id == aa.OrderId).SelectStringJoin((aa, bb) => bb.Id, ","), + NewestTrackContent = a.LatestTrackContent, + NewestTrackEnContent = a.LatestTrackEnContent, + NewestTrackPlace = a.LatestTrackPlace, + NewestTrackTime = a.LatestTrackTime, + IsFinish = a.IsCompleted, + CreateTime = a.CreateTime, + SubSystem = c.CnName, + SubSystemId = c.Id + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + if (pageList.List.Any()) + { + //查询也需要最新的轨迹 + var orderIds = pageList.List.Select(a => a.Id).ToList(); + //查询轨迹模版 + 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, TemplateId = b.Id }) + .ToListAsync(); + var esTrackDetails = await _trackDetailsRepository.GetListAsync(orderIds); + pageList.List.ForEach(a => + { + var esDetails = esTrackDetails?.Where(b => b.OrderId== a.Id).OrderByDescending(b => b.TrackTime); + var trackDetail = esDetails?.FirstOrDefault(); + if (trackDetail!=null) + { + if (trackDetail.TrackContent!=a.NewestTrackContent) + { + a.NewestTrackContent=trackDetail.TrackContent; + } + if (trackDetail.TrackEnContent!=a.NewestTrackEnContent) + { + a.NewestTrackEnContent=trackDetail.TrackEnContent; + } + if (trackDetail.TrackPlace!=a.NewestTrackPlace) + { + a.NewestTrackPlace=trackDetail.TrackPlace; + } + if (trackDetail.TrackTime!= a.NewestTrackTime) + { + a.NewestTrackTime=trackDetail.TrackTime; + } + } + + a.TrackTemplateNames =trackTemplateList.Where(b => b.OrderId== a.Id).Select(a => a.Name).JoinAsString(","); + a.TrackTemplateIds = trackTemplateList.Where(b => b.OrderId== a.Id).Select(a => a.TemplateId).ToList(); + }); + + } + + + + + #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 + + + public async Task> GetOrderTemplatesAsync(List orderNos) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => orderNos.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateVO + { + OrderNo = a.OrderNo, + OrderType = a.OrderType, + TemplateId = b.TrackTemplateId, + ServiceProviderId = b.ServiceProviderId + }) + .ToListAsync(); + } +} \ 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..7609c5a6 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -0,0 +1,234 @@ +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackTemplate; +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, + IsFinish = a.IsCompleted + }) + .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)) + .WhereIF(input.TrackStatusId > 0, (a, b, c, d, e, f) => a.TrackStatusId == input.TrackStatusId) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d, e, f) => 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, + IsFinish= a.IsCompleted + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + return pagedList; + } + + /// + /// 获取轨迹内容属性值 + /// + /// + public async Task> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input) + { + var list = await Context.Queryable() + .LeftJoin((a, b) => a.Id==b.TrackContentId&& b.TrackTemplateId>0 && b.IsDeleted==false) + .LeftJoin((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false) + .WhereIF(!input.TrackCodes.IsNullOrEmpty(), (a, b, c) => input.TrackCodes.Contains(a.Code)) + .WhereIF(input.SubSystemId>0, (a, b, c) => a.SubSystemId==input.SubSystemId) + .WhereIF(!input.TrackTemplateIds.IsNullOrEmpty(), (a, b, c) => input.TrackTemplateIds.Contains(c.Id)) + .Where((a, b, c) => c.Id>0) + //.OrderByIF(!input.TrackTemplateIds.IsNullOrEmpty(), (a, b, c) => SqlFunc.IIF(input.TrackTemplateIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), c.CreateTime), OrderByType.Desc) + .Select((a, b, c) => new GetTemplateContentAttributeValueVO + { + IsCanDelete=b.IsCanDelete, + IsExternal=b.IsExternal, + SubSystemId= a.SubSystemId, + TrackCode= a.Code, + TrackContenId= a.Id, + TrackTemplateId=c.Id + }).ToListAsync(); + + return list; + } + + /// + /// 获取轨迹模版是否存在 + /// + /// + /// + public async Task GetTemplateIsExist(int trackContentId) + { + //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); + var trackContentEntities = await Context.Queryable().LeftJoin((a, b) => a.Id==b.TrackContentId && b.IsDeleted==false) + .LeftJoin((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false) + .Where((a, b, c) => a.Id==trackContentId) + .Select((a, b, c) => new + { + TrackContentId = a.Id, + TemplateId = c.Id + }) + .ToListAsync(); + + if (trackContentEntities.Any(a => a.TemplateId>0)) + { + return true; + } + + return false; + } + + + + 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.Id == id && !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.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs new file mode 100644 index 00000000..70f62f7e --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -0,0 +1,147 @@ +using Nest; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Expand.ElasticSearch.Services; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Dtos.TrackDetails; + +namespace SJZY.Track.Repository.Repositories; + +internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, + ITransientDependency +{ + public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) + { + } + + public async Task GetFirstOrDefaultAsync(int orderId, string trackCode) + { + var r = await Context.SearchAsync(s => s + .Source() + .Query(q => + q.Term(f => f.OrderId, orderId) + && q.Term(f => f.TrackCode.Suffix("keyword"), trackCode) + ) + ); + + var res = r.Documents.FirstOrDefault(); + if (res != default && r.Hits.FirstOrDefault() != default) + { + res.Id = r.Hits.FirstOrDefault()!.Id; + } + + return res; + } + + public async Task UpsertAsync(TrackDetailsIndex index) + { + if (index.Id.IsNullOrWhiteSpace()) + { + // 按天写入es + var r = await Context.IndexAsync(index, request => request + .Index(index.IndexName) + ); + + if (!r.IsValid) + { + LogHelper.Error($"轨迹新增失败,原因:{r.DebugInformation}。"); + } + } + else + { + var r = await Context.UpdateAsync(index.Id, u => u + .Index(index.IndexName) + .Doc(index) + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + ); + + if (!r.IsValid) + { + LogHelper.Error($"轨迹更新失败,原因:{r.DebugInformation}。"); + } + } + } + + public async Task> GetListAsync(int orderType, List orderNos) + { + if (orderNos.Count < 1) return new List(); + + var data = await Context.SearchAsync(x => x + .Source(s => s.Includes(fd => fd + .Field(f => f.OrderNo) + .Field(f => f.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TrackTimeZone) + )) + .Query(q => + q.Terms(t => t + .Field(f => f.OrderNo.Suffix("keyword")) + .Terms(orderNos)) + && q.Term(f => f.OrderType, orderType) + ) + ); + + return data.Documents.ToList(); + } + + public async Task?> GetListAsync(int orderId) + { + var data = await Context.SearchAsync(x => x + .Query(q => + q.Term(t => t.OrderId, orderId) + ) + .Size(1000) + .Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending))); + + return data?.Documents?.ToList(); + } + + public async Task?> GetListAsync(List orderIds) + { + var data = await Context.SearchAsync(x => x.Query(q => + q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) + ) + .Size(10000) + .Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending)) + ); + return data?.Documents?.ToList(); + } + + public async Task DeleteTrackAsync(int orderId, List trackCodes) + { + var r = await Context.DeleteByQueryAsync(x => x + .Query( + q => + q.Term(t => t.OrderId, orderId) + && q.Term(t => t.IsCanDelete, true) + && q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))) + ); + + if (!r.IsValid) + throw new Exception($"轨迹数据删除失败,原因:{r.DebugInformation}"); + } + + public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) + { + if (input.OrderNos.Count < 1) return default; + + var distinctOrderNumbers = input.OrderNos.Distinct(); + var finalSize = input.PageSize > 500 ? 500 : input.PageSize; + + var data = await Context.SearchAsync(x => x + .Query(q => + q.Terms(t => t + .Field(f => f.OrderNo) + .Terms(distinctOrderNumbers)) + ) + .Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)) + .From((input.PageIndex - 1) * input.PageSize) + .Size(finalSize) + .TrackTotalHits() // todo: 聚合获取匹配查询条件的文档总数,而不受"index.max_result_window"的限制 + ); + + return (data.Documents.ToList(), data.Total); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs new file mode 100644 index 00000000..d2227924 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -0,0 +1,67 @@ +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Dtos.TrackFlags; +using SJZY.Track.Domain.VEntities; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency +{ + public TrackFlagRepository() + { + } + + /// + /// 获取轨迹标记明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) + .Where((a, b) => a.Id == id) + .Select((a, b) => new GetTrackFlagDetailVO + { + Id = a.Id, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName, + Code = a.Code, + Flag = a.Name + //,IsFinish=a.IsCompleted + }) + .FirstAsync(); + return detail; + } + + /// + /// 分页获取轨迹标记 + /// + /// + /// + public async Task> GetPageTrackFlag(GetPageTrackFlagVO input) + { + UnifyPageResultDto pagedList = new 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) + .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, + SubSystem = b.CnName, + Code = a.Code, + Flag = a.Name, + //IsFinish=a.IsCompleted, + CreateTime = a.CreateTime, + CreateUser = c.Name, + UpdateTime = a.UpdateTime, + UpdateUser = d.Name + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + return pagedList; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs new file mode 100644 index 00000000..3a381a0f --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -0,0 +1,138 @@ +using System.Linq.Expressions; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +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 SJZY.Track.Domain.VEntities; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, + IScopedDependency +{ + public async Task> GetPageAsync(KeywordsInputVO input) + { + return await AsQueryable() + .LeftJoin((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted) + .LeftJoin((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted) + .Filter(null, true) + .Where(trackPull => !trackPull.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, trackPull => trackPull.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPull, system, service, template) => service.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .OrderByDescending(trackPull => trackPull.CreateTime) + .Select((trackPull, system, service, template) => new GetTrackPullConfigPageOutputVO + { + Id = trackPull.Id, + SubSystem = system.CnName, + ServiceProvider = service.Name, + TrackTemplate = template.Name, + CreateTime = trackPull.CreateTime + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + public async Task> GetContentPageAsync(GetTrackPullContentPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id) + .InnerJoin((pullContent, trackContent, trackPull) => pullContent.TrackPullConfigId == trackPull.Id) + .InnerJoin((pullContent, trackContent, trackPull, templateContent) => trackPull.TrackTemplateId == templateContent.TrackTemplateId && pullContent.TrackContentId == templateContent.TrackContentId) + .Where(pullContent => pullContent.TrackPullConfigId == input.TrackPullConfigId) + .OrderBy((pullContent, trackContent, trackPull, templateContent) => templateContent.Sort) + .Select((pullContent, trackContent, trackPull, templateContent) => new GetTrackPullContentPageOutputVO + { + Id = pullContent.Id + }, true) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + public async Task GetDetailAsync(int id) + { + return await AsQueryable() + .LeftJoin((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted) + .LeftJoin((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted) + .InnerJoin((trackPull, system, service, template, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted) + .Filter(null, true) + .Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted) + .Select((trackPull, system, service, template, paramsConfig) => new GetTrackPullConfigDetailOutputVO + { + Id = trackPull.Id, + SubSystem = system.CnName, + ServiceProvider = service.Name, + TrackTemplate = template.Name + }, true) + .SingleAsync(); + } + + public async Task GetContentDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id) + .Where(pullContent => pullContent.Id == id) + .Select((pullContent, trackContent) => new GetTrackPullContentDetailOutputVO + { + Id = pullContent.Id, + Code = trackContent.Code + "-" + trackContent.Content, + }, true) + .Mapper(x => + { + x.TrackKeywords = x.TrackKeyword?.Split(',').ToList(); + x.TrackKeywordReverses = x.TrackKeywordReverse?.Split(',').ToList(); + }) + .SingleAsync(); + } + + public async Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + public async Task InsertContentRangeAsync(List insertObjs) + { + return await Context.Insertable(insertObjs).ExecuteCommandAsync() > 0; + } + + public async Task GetParamsSingleAsync(Expression> whereExpression) + { + return await Context.Queryable().SingleAsync(whereExpression); + } + + public async Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } + + public async Task SoftDeleteContentAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task SoftDeleteParamsAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateContentAsync(TrackPullContentConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } + + public async Task IsContentAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs new file mode 100644 index 00000000..f6a325fd --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -0,0 +1,141 @@ +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +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 SJZY.Track.Domain.Enums; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; +using System.Linq.Expressions; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, + IScopedDependency +{ + public async Task> GetPageAsync(KeywordsInputVO input) + { + return await AsQueryable() + .LeftJoin((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, template) => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) + .Filter(null, true) + .Where(trackPush => !trackPush.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Abbreviation.Contains(input.Keywords) || externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .OrderByDescending(trackPush => trackPush.CreateTime) + .Select((trackPush, system, externalSubject, template) => new GetTrackPushConfigPageOutputVO + { + Id = trackPush.Id, + SubSystem = system.CnName, + CustomName = externalSubject.Abbreviation, + 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); + } + + public async Task> GetContentPageAsync(GetTrackPushContentPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) + .LeftJoin((pushContent, trackContent, enumValue) => enumValue.Property == EnumPropertyEnums.单号类型.GetDescription() && pushContent.OrderNoType == enumValue.Enumkey && !enumValue.IsDeleted) + .Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId) + .OrderBy(pushContent => pushContent.Sort) + .Select((pushContent, trackContent, enumValue) => new GetTrackPushContentPageOutputVO + { + Id = pushContent.Id, + Sort = pushContent.Sort, + OrderNoType = enumValue.Disp + }, true) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + public async Task GetDetailAsync(int id) + { + return await AsQueryable() + .LeftJoin((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted) + .LeftJoin((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted) + .LeftJoin((trackPush, system, externalSubject, service) => trackPush.ServiceProviderId == service.Id && !service.IsDeleted) + .InnerJoin((trackPush, system, externalSubject, service, paramsConfig) => trackPush.Id == paramsConfig.PullOrPushConfigId && paramsConfig.IsPush && !paramsConfig.IsDeleted) + .Filter(null, true) + .Where(trackPush => trackPush.Id == id && !trackPush.IsDeleted) + .Select((trackPush, system, externalSubject, service, paramsConfig) => new GetTrackPushConfigDetailOutputVO + { + Id = trackPush.Id, + SubSystem = system.CnName, + 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(); + } + + public async Task> GetContentListAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).ToListAsync(); + } + + public async Task UpdateContentRangeAsync(List updateObjs) + { + return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); + } + + public async Task ContentMaxAsync(Expression> columns, Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).MaxAsync(columns); + } + + public async Task UpdateContentAsync(Expression> columns, Expression> whereExpression) + { + return await Context.Updateable().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs new file mode 100644 index 00000000..a4abd5b5 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -0,0 +1,69 @@ +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Track.Domain.VEntities; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency +{ + /// + /// 获取轨迹状态明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false) + .Where((a, b) => a.Id == id) + .Select((a, b) => new GetTrackStatusDetailVO + { + Id = a.Id, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName, + Code = a.Code, + EntrackStatus = a.EnStatus, + NodeId = a.Node, + TrackStatus = a.Status + }) + .FirstAsync(); + return detail; + } + + /// + /// 分页获取轨迹状态 + /// + /// + /// + public async Task> GetPageTrackStatus(GetPageTrackStatusVO input) + { + 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, + Code = a.Code, + 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(""), + CreateTime = a.CreateTime, + CreateUser = c.Name, + UpdateTime = a.UpdateTime, + UpdateUser = d.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + return pagedList; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs new file mode 100644 index 00000000..21b72d53 --- /dev/null +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -0,0 +1,204 @@ +using System.Linq.Expressions; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackTemplate; +using SJZY.Track.Domain.Enums; +using SJZY.Track.Domain.VEntities; + +namespace SJZY.Track.Repository.Repositories; + +public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency +{ + /// + /// 获取轨迹模版明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .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(); + + return detail; + } + + /// + /// 分页获取轨迹模版 + /// + /// + /// + public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) + { + UnifyPageResultDto pagedList = await Context.Queryable() + .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.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, + Code = a.Code, + CreateTime = a.CreateTime, + Name = a.Name, + SubSystem = b.CnName, + SubSystemId = b.Id + }) + .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; + } + + /// + /// 获取轨迹内容属性值 + /// + /// + public async Task GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input) + { + + + return null; + } + + /// + public async Task> GetContentPageAsync( + GetTrackTemplateContentPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((templateContent, trackContent) => + templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus) => + trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus, enumValue) => + enumValue.Property == EnumPropertyEnums.节点.GetDescription() && trackStatus.Node == enumValue.Enumkey && + !enumValue.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus, enumValue, trackFlag) => + trackContent.TrackFlagId == trackFlag.Id && !trackFlag.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser) => + templateContent.CreateUserId == createUser.Id && !createUser.IsDeleted) + .LeftJoin( + (templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => + templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) + .Filter(null, true) + .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) + .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => + new GetTrackTemplateContentPageOutputVO + { + Id = templateContent.Id, + TrackStatus = trackStatus.Status, + Node = enumValue.Disp, + TrackFlag = trackFlag.Name, + CreateTime = templateContent.CreateTime, + CreateUser = createUser.Name, + UpdateTime = templateContent.UpdateTime, + UpdateUser = updateUser.Name + }, true) + .OrderBy(templateContent => templateContent.Sort) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + /// + public async Task GetContentDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((templateContent, trackContent) => + templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus) => + trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted) + .Filter(null, true) + .Where(templateContent => templateContent.Id == id && !templateContent.IsDeleted) + .Select((templateContent, trackContent, trackStatus) => new GetTrackTemplateContentDetailOutputVO + { + Id = templateContent.Id, + TrackContent = trackContent.Code + "-" + trackContent.Content, + TrackStatus = trackStatus.Status + }, true) + .SingleAsync(); + } + + /// + public async Task IsContentAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } + + /// + public async Task InsertContentAsync(TrackTemplateContentEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + /// + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + /// + public async Task UpdateContentAsync(TrackTemplateContentEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } + + /// + public async Task SoftDeleteContentAsync(int id) + { + return await Context.Updateable() + .Where(x => x.Id == id) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } + + public async Task> GetContentListAsync( + Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).ToListAsync(); + } + + public async Task UpdateContentRangeAsync(List updateObjs) + { + return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); + } + + public async Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input) + { + return await Context.Queryable() + .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id) + .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId)) + .OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc) + .Select((templateContent, trackContent) => new DropdownListDataDto + { + Value = templateContent.TrackContentId, + Key = trackContent.Code + "-" + trackContent.Content + }) + .Distinct() + .ToPagedListAsync(input.PageIndex, input.PageSize); + } + + public async Task ContentMaxAsync(Expression> columns, Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).MaxAsync(columns); + } + + public async Task UpdateContentAsync(Expression> columns, Expression> whereExpression) + { + return await Context.Updateable().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/RepositoryModule.cs b/src/SJZY.Track.Repository/RepositoryModule.cs deleted file mode 100644 index e4a336b9..00000000 --- a/src/SJZY.Track.Repository/RepositoryModule.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using SJZY.Expand.ABP.Core.SqlSugar.Options; -using Volo.Abp.Autofac; -using Volo.Abp.Modularity; - -namespace SJZY.Track.Repository -{ - /// - /// 仓储模块 - /// - [DependsOn(typeof(AbpAutofacModule))] - public class RepositoryModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - - context.Services.AddSqlsugar(options => - { - options.AddRange(new List { - new SqlsugarOptions() - { - ConnectionString = configuration["ConnectionStrings:DefaultConnection"], - DbType = DbType.MySql, - IsAutoCloseConnection = true, - ConfigId = "default" - } - } - ); - }, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository"); - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index d4c60ce9..b2285e0b 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -1,23 +1,20 @@  + + + net7.0 + True + preview + - - net7.0 - enable - enable - True - + + + + + + - - - - - - - - - - - - + + + diff --git a/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs new file mode 100644 index 00000000..e7ca3b6b --- /dev/null +++ b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs @@ -0,0 +1,59 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using SJZY.Expand.ABP.Core.SqlSugar.Options; +using SJZY.Expand.ElasticSearch; +using SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; +using SJZY.Track.Repository.Queries; +using SJZY.Track.Repository.Repositories; +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; + +namespace SJZY.Track.Repository; + +/// +/// 仓储模块 +/// +[DependsOn(typeof(AbpAutofacModule))] +[DependsOn(typeof(SjzyTrackDomainModule))] +public class SjzyTrackRepositoryModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + context.Services.AddSqlsugar(options => + { + options.AddRange(new List + { + new() + { + ConnectionString = configuration["ConnectionStrings:DefaultConnection"]!, + DbType = DbType.MySql, + IsAutoCloseConnection = true, + ConfigId = "default", OpenSqlLog = true + } + } + ); + }, DataBaseContext.OnExcutingAction, "SJZY.Track.Domain"); + + context.Services.AddElasticSearch(options => + { + if (System.Diagnostics.Debugger.IsAttached) + { + options.ShowLogInfo = true; + } + options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>()!; + options.LoginName = configuration["ElasticSearch:LoginName"]!; + options.Password = configuration["ElasticSearch:Password"]!; + options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]!; + }); + } + + + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); + context.Services.AddTransient(typeof(IBasicRepository<>), typeof(BasicRepository<>)); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs new file mode 100644 index 00000000..b3c2ff5b --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -0,0 +1,59 @@ +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository.TrackPushRecord.Entitys +{ + /// + /// 轨迹推送记录 + /// + [SugarTable("t_track_push_record")] + public class TrackPushRecordEntity : IAggregateRoot + { + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 创建时间(推送时间) + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime CreateTime { get; set; } + + /// + /// 创建人(推送人) + /// + [SugarColumn(ColumnName = "CreateUserId")] + public int CreateUserId { get; set; } + + /// + /// 是否自动推送 + /// + [SugarColumn(ColumnName = "IsAutoPush")] + public bool IsAutoPush { get; set; } + + /// + /// 推送内容 + /// + [SugarColumn(ColumnName = "PushContent")] + public string PushContent { get; set; } = null!; + + /// + /// 接口通请求id + /// + [SugarColumn(ColumnName = "RequestId")] + public string RequestId { get; set; } = null!; + + /// + /// 服务商id + /// + [SugarColumn(ColumnName = "ServiceProviderId")] + public int ServiceProviderId { get; set; } + + /// + /// 推送轨迹总数 + /// + [SugarColumn(ColumnName = "TrackTotal")] + 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.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs new file mode 100644 index 00000000..64208102 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -0,0 +1,47 @@ +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys +{ + /// + /// 轨迹推送明细表 + /// + [SugarTable("t_track_push_record_details")] + public class TrackPushRecordDetailsEntity : IAggregateRoot + { + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 创建时间(消费完成时间) + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime CreateTime { get; set; } + + /// + /// 异常信息 + /// + [SugarColumn(ColumnName = "ErrorMessage")] + public string ErrorMessage { get; set; } + + /// + /// 是否成功 + /// + [SugarColumn(ColumnName = "IsSuccess")] + public bool IsSuccess { get; set; } + + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 推送记录id + /// + [SugarColumn(ColumnName = "PushRecordId")] + public int PushRecordId { get; set; } + } +} \ No newline at end of file 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.OpenApi.Test/Demo/DemoTest.cs b/test/SJZY.OpenApi.Test/Demo/DemoTest.cs deleted file mode 100644 index c8479c89..00000000 --- a/test/SJZY.OpenApi.Test/Demo/DemoTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -using SJZY.OpenApi.Application.Dtos.Demo; -using SJZY.OpenApi.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.OpenApi.Test/ProblemTypeService/ProblemTypeServiceTest.cs b/test/SJZY.OpenApi.Test/ProblemTypeService/ProblemTypeServiceTest.cs deleted file mode 100644 index ce783b3f..00000000 --- a/test/SJZY.OpenApi.Test/ProblemTypeService/ProblemTypeServiceTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SJZY.OpenApi.Test.ProblemTypeServiceTest -{ - public class ProblemTypeServiceTest : TestModuleTestBase - { - - } -} \ No newline at end of file diff --git a/test/SJZY.OpenApi.Test/TestModule.cs b/test/SJZY.OpenApi.Test/TestModule.cs deleted file mode 100644 index f0567c60..00000000 --- a/test/SJZY.OpenApi.Test/TestModule.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using SJZY.OpenApi.Api; -using SJZY.OpenApi.Application; -using SJZY.OpenApi.Repository; -using Volo.Abp; -using Volo.Abp.AspNetCore.TestBase; -using Volo.Abp.Authorization; -using Volo.Abp.Autofac; -using Volo.Abp.Data; -using Volo.Abp.Http.Client; -using Volo.Abp.Modularity; -using Volo.Abp.Threading; - -[assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] -namespace SJZY.OpenApi.Test -{ - [DependsOn( - typeof(AbpAspNetCoreTestBaseModule), - typeof(AbpAutofacModule), - typeof(AbpAuthorizationModule), - typeof(RepositoryModule), - typeof(ApplicationModule), - typeof(ApiModule), - typeof(AbpHttpClientModule) //添加abp的http代理模块 - )] - - [assembly: HostingStartup(typeof(Expand.ABP.Core.HostingStartup))] - public class TestModule : AbpModule - { - - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAlwaysAllowAuthorization(); - //添加内网服务 - //context.Services.AddHttpClientProxies(typeof(LoggerCenterHttpApiModule).Assembly, "LoggerCenter", false); - } - - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - SeedTestData(context); - } - - public override void OnApplicationShutdown(ApplicationShutdownContext context) - { - //根据业务场景决定,是否需要删除测试数据 - } - - /// - /// 生成种子测试数据 - /// - /// - private static void SeedTestData(ApplicationInitializationContext context) - { - AsyncHelper.RunSync(async () => - { - using (var scope = context.ServiceProvider.CreateScope()) - { - await scope.ServiceProvider - .GetRequiredService() - .SeedAsync(); - } - }); - } - } - -} diff --git a/test/SJZY.OpenApi.Test/SJZY.OpenApi.Test.csproj b/test/SJZY.Track.Test/SJZY - Backup.Track.Test.csproj similarity index 93% rename from test/SJZY.OpenApi.Test/SJZY.OpenApi.Test.csproj rename to test/SJZY.Track.Test/SJZY - Backup.Track.Test.csproj index 1969e8f8..c2b5048f 100644 --- a/test/SJZY.OpenApi.Test/SJZY.OpenApi.Test.csproj +++ b/test/SJZY.Track.Test/SJZY - Backup.Track.Test.csproj @@ -39,7 +39,7 @@ - + diff --git a/test/SJZY.Track.Test/SJZY.Track.Test.csproj b/test/SJZY.Track.Test/SJZY.Track.Test.csproj new file mode 100644 index 00000000..c2b5048f --- /dev/null +++ b/test/SJZY.Track.Test/SJZY.Track.Test.csproj @@ -0,0 +1,45 @@ + + + + net7.0 + enable + enable + + false + + + + + + + + + PreserveNewest + true + PreserveNewest + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/test/SJZY.OpenApi.Test/Startup.cs b/test/SJZY.Track.Test/Startup.cs similarity index 95% rename from test/SJZY.OpenApi.Test/Startup.cs rename to test/SJZY.Track.Test/Startup.cs index eee65d21..27397eb3 100644 --- a/test/SJZY.OpenApi.Test/Startup.cs +++ b/test/SJZY.Track.Test/Startup.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using SJZY.Track.Test; namespace SJZY.OpenApi.Test { diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs new file mode 100644 index 00000000..aa5f8d90 --- /dev/null +++ b/test/SJZY.Track.Test/TestModule.cs @@ -0,0 +1,64 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using SJZY.Track.Api; +using SJZY.Track.Application; +using SJZY.Track.Repository; +using Volo.Abp; +using Volo.Abp.AspNetCore.TestBase; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Http.Client; +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(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(); + //添加内网服务 + //context.Services.AddHttpClientProxies(typeof(LoggerCenterHttpApiModule).Assembly, "LoggerCenter", false); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + public override void OnApplicationShutdown(ApplicationShutdownContext context) + { + //根据业务场景决定,是否需要删除测试数据 + } + + /// + /// 生成种子测试数据 + /// + /// + private static void SeedTestData(ApplicationInitializationContext context) + { + AsyncHelper.RunSync(async () => + { + using (var scope = context.ServiceProvider.CreateScope()) + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync(); + } + }); + } +} \ No newline at end of file diff --git a/test/SJZY.OpenApi.Test/TestModuleTestBase.cs b/test/SJZY.Track.Test/TestModuleTestBase.cs similarity index 100% rename from test/SJZY.OpenApi.Test/TestModuleTestBase.cs rename to test/SJZY.Track.Test/TestModuleTestBase.cs diff --git a/test/SJZY.OpenApi.Test/Usings.cs b/test/SJZY.Track.Test/Usings.cs similarity index 100% rename from test/SJZY.OpenApi.Test/Usings.cs rename to test/SJZY.Track.Test/Usings.cs diff --git a/test/SJZY.OpenApi.Test/appsettings.json b/test/SJZY.Track.Test/appsettings.json similarity index 100% rename from test/SJZY.OpenApi.Test/appsettings.json rename to test/SJZY.Track.Test/appsettings.json