From 1e9c1d9c7ebb525ba6d93f43f8dcaa342bccfc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Tue, 27 Feb 2024 16:22:42 +0800 Subject: [PATCH] =?UTF-8?q?change=20=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=94=B9=E9=80=A0DDD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln | 16 ++- common.props | 7 ++ src/SJZY.Track.Api/Program.cs | 4 +- src/SJZY.Track.Api/SJZY.Track.Api.csproj | 2 + .../{ApiModule.cs => SJZYTrackApiModule.cs} | 8 +- .../appsettings.Development.json | 9 +- .../ApplicationModule.cs | 12 +-- .../AutoMapper/AutoMapperProfile.cs | 44 ++++----- .../Dtos/ProvideServices/GetTrackInput.cs | 37 +++++++ .../Dtos/ProvideServices/GetTrackOutput.cs | 21 ++++ src/SJZY.Track.Application/GlobalUsing.cs | 1 - .../SJZY.Track.Application.csproj | 6 +- .../Services/Demo/InterFaceDemoService.cs | 6 +- .../ProvideServices/TrackQueryService.cs | 79 +++++++++++++++ .../DemoAggregate/DemoDetailEntity.cs | 23 +++++ .../DemoAggregate/DemoEntity.cs | 37 +++++++ .../DemoAggregate/Dtos}/DemoValueObject.cs | 2 +- .../DemoAggregate}/IDemoRepository.cs | 5 +- src/SJZY.Track.Domain/GlobalUsings.cs | 9 ++ src/SJZY.Track.Domain/IBasicRepository.cs | 97 +++++++++++++++++++ .../OrderAggregate/Dtos/OrderTemplateDto.cs | 14 +++ .../OrderAggregate/IOrderRepository.cs | 13 +++ .../OrderAggregate/OrderEntity.cs | 70 +++++++++++++ .../OrderAggregate/OrderLinkEntity.cs | 28 ++++++ .../OrderAggregate/OrderTemplateEntity.cs | 34 +++++++ .../SJZY.Track.Domain.csproj | 14 +++ .../SJZYTrackDomainModule.cs | 7 ++ .../Dtos/TrackDetailsQueryInput.cs | 9 ++ .../ITrackDetailsRepository.cs | 13 +++ .../TrackDetailsIndex.cs | 90 +++++++++++++++++ .../Dtos/TemplateContentDto.cs | 6 ++ .../ITrackTemplateRepository.cs | 8 ++ .../TrackTemplateContentEntity.cs | 46 +++++++++ .../TrackTemplateEntity.cs | 34 +++++++ src/SJZY.Track.Repository/BasicRepository.cs | 79 ++++++++++++--- .../Demo/Entitys/DemoDetailEntity.cs | 24 ----- .../Demo/Entitys/DemoEntity.cs | 40 -------- .../{Demo/Services => }/DemoRepository.cs | 8 +- .../Order/Entitys/OrderEntity.cs | 71 -------------- .../Order/Services/IOrderRepository.cs | 9 -- .../Order/Services/OrderRepository.cs | 9 -- .../OrderLink/Entitys/OrderLinkEntity.cs | 29 ------ .../Services/IOrderLinkRepository.cs | 9 -- .../OrderLink/Services/OrderLinkRepository.cs | 9 -- src/SJZY.Track.Repository/OrderRepository.cs | 16 +++ .../Entitys/OrderTemplateEntity.cs | 35 ------- .../Services/IOrderTemplateRepository.cs | 9 -- .../Services/OrderTemplateRepository.cs | 9 -- src/SJZY.Track.Repository/RepositoryModule.cs | 33 ------- .../SJZY.Track.Repository.csproj | 14 +-- .../SJZYTrackRepositoryModule.cs | 48 +++++++++ .../TrackDetailsRepository.cs | 73 ++++++++++++++ .../Entitys/TrackTemplateEntity.cs | 35 ------- .../Services/ITrackTemplateRepository.cs | 9 -- .../Services/TrackTemplateRepository.cs | 9 -- .../Entitys/TrackTemplateContentEntity.cs | 47 --------- .../ITrackTemplateContentRepository.cs | 9 -- .../TrackTemplateContentRepository.cs | 9 -- .../TrackTemplateRepository.cs | 13 +++ test/SJZY.Track.Test/Startup.cs | 1 + test/SJZY.Track.Test/TestModule.cs | 92 +++++++++--------- 61 files changed, 1035 insertions(+), 524 deletions(-) create mode 100644 common.props rename src/SJZY.Track.Api/{ApiModule.cs => SJZYTrackApiModule.cs} (94%) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs create mode 100644 src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs create mode 100644 src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs rename src/{SJZY.Track.Repository/Demo/ValueObjects => SJZY.Track.Domain/DemoAggregate/Dtos}/DemoValueObject.cs (85%) rename src/{SJZY.Track.Repository/Demo/Services => SJZY.Track.Domain/DemoAggregate}/IDemoRepository.cs (85%) create mode 100644 src/SJZY.Track.Domain/GlobalUsings.cs create mode 100644 src/SJZY.Track.Domain/IBasicRepository.cs create mode 100644 src/SJZY.Track.Domain/OrderAggregate/Dtos/OrderTemplateDto.cs create mode 100644 src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs create mode 100644 src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs create mode 100644 src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs create mode 100644 src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs create mode 100644 src/SJZY.Track.Domain/SJZY.Track.Domain.csproj create mode 100644 src/SJZY.Track.Domain/SJZYTrackDomainModule.cs create mode 100644 src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs create mode 100644 src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs delete mode 100644 src/SJZY.Track.Repository/Demo/Entitys/DemoDetailEntity.cs delete mode 100644 src/SJZY.Track.Repository/Demo/Entitys/DemoEntity.cs rename src/SJZY.Track.Repository/{Demo/Services => }/DemoRepository.cs (97%) delete mode 100644 src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs delete mode 100644 src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs delete mode 100644 src/SJZY.Track.Repository/Order/Services/OrderRepository.cs delete mode 100644 src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs delete mode 100644 src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs delete mode 100644 src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs create mode 100644 src/SJZY.Track.Repository/OrderRepository.cs delete mode 100644 src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs delete mode 100644 src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs delete mode 100644 src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs delete mode 100644 src/SJZY.Track.Repository/RepositoryModule.cs create mode 100644 src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs create mode 100644 src/SJZY.Track.Repository/TrackDetailsRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplateRepository.cs diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index 45fdba01..8a9c51e8 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -16,6 +16,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.HttpApi", "src\S 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/common.props b/common.props new file mode 100644 index 00000000..9ad7e595 --- /dev/null +++ b/common.props @@ -0,0 +1,7 @@ + + + latest + enable + + + diff --git a/src/SJZY.Track.Api/Program.cs b/src/SJZY.Track.Api/Program.cs index a9d373a7..9d6d0ed4 100644 --- a/src/SJZY.Track.Api/Program.cs +++ b/src/SJZY.Track.Api/Program.cs @@ -13,7 +13,7 @@ try .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..44113706 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -21,10 +21,12 @@ + + diff --git a/src/SJZY.Track.Api/ApiModule.cs b/src/SJZY.Track.Api/SJZYTrackApiModule.cs similarity index 94% rename from src/SJZY.Track.Api/ApiModule.cs rename to src/SJZY.Track.Api/SJZYTrackApiModule.cs index f679135d..9db64785 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,7 +18,7 @@ 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( @@ -25,9 +26,10 @@ namespace SJZY.Track.Api typeof(SjzyAbpCodeModule), typeof(ApplicationModule), typeof(AbpAspNetCoreMvcModule), - typeof(AbpAspNetCoreSerilogModule) + typeof(AbpAspNetCoreSerilogModule), + typeof(SJZYTrackRepositoryModule) )] - public class ApiModule : AbpModule + public class SJZYTrackApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/src/SJZY.Track.Api/appsettings.Development.json b/src/SJZY.Track.Api/appsettings.Development.json index 0856dfd7..d50e3e8a 100644 --- a/src/SJZY.Track.Api/appsettings.Development.json +++ b/src/SJZY.Track.Api/appsettings.Development.json @@ -7,8 +7,7 @@ } }, "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,6 +59,12 @@ "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/" diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs index 0fa79af5..286821bf 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/ApplicationModule.cs @@ -1,5 +1,5 @@ -using SJZY.Expand.ABP.Core.Localization; -using SJZY.LoggerCenter.HttpApi; +using SJZY.Track.Domain; +using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; @@ -15,12 +15,11 @@ namespace SJZY.Track.Application { [DependsOn( typeof(AbpAutoMapperModule), - typeof(RepositoryModule), typeof(AbpFluentValidationModule), typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), - typeof(LoggerCenterHttpApiModule) + typeof(SJZYTrackDomainModule) )] public class ApplicationModule : AbpModule { @@ -37,8 +36,6 @@ namespace SJZY.Track.Application options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly);//创建动态api }); - - //添加虚拟文件系统 Configure(options => { @@ -54,9 +51,6 @@ namespace SJZY.Track.Application .AddVirtualJson("/Localization/Resources"); }); - //日志中心 - context.Services.AddHttpClientProxies(typeof(LoggerCenterHttpApiModule).Assembly, "LoggerCenter", false); - //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); } diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs index 563fc396..59910582 100644 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs @@ -1,33 +1,33 @@ using AutoMapper; +using SJZY.Track.Domain.DemoAggregate; +using SJZY.Track.Domain.DemoAggregate.Dtos; using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Repository.Demo.ValueObjects; -namespace SJZY.Track.Application.AutoMapper +namespace SJZY.Track.Application.AutoMapper; + +internal class AutoMapperProfile : Profile { - internal class AutoMapperProfile : Profile + public AutoMapperProfile() { - public AutoMapperProfile() - { - CreateMap, UnifyPageResultDto>(MemberList.None); + 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, 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(); + CreateMap(MemberList.None).ReverseMap(); + CreateMap(MemberList.None); + CreateMap(MemberList.None).ReverseMap(); - } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs new file mode 100644 index 00000000..c1e68789 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs @@ -0,0 +1,37 @@ +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class GetTrackInput +{ + /// + /// 订单号 + /// + public List OrderNos { get; set; } = new(); + + /// + /// 时区 +8 +8.25 -8.5 -9 + /// + public float TimeZone { get; set; } + + /// + /// 排序方式 + /// + public SortMethod SortMethod { get; set; } +} + +public enum SortMethod +{ + /// + /// 按轨迹发生时间排序 + /// + ByTrackTime, + + /// + /// 按轨迹发生时间降序 + /// + ByTrackTimeDesc, + + /// + /// 按订单模板排序 + /// + ByTemplate +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs new file mode 100644 index 00000000..659ed260 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs @@ -0,0 +1,21 @@ +namespace SJZY.Track.Application.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 Date { get; set; } + public float TimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs index 23e3b927..3ee457cc 100644 --- a/src/SJZY.Track.Application/GlobalUsing.cs +++ b/src/SJZY.Track.Application/GlobalUsing.cs @@ -3,7 +3,6 @@ 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; diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index ee9510bf..dd4d7e2a 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -23,11 +23,7 @@ + - - - - - diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs index 93c2f4cb..e7781daf 100644 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs @@ -1,7 +1,7 @@ -using SJZY.Expand.ABP.Core.Common; +using SJZY.Track.Domain.DemoAggregate; +using SJZY.Track.Domain.DemoAggregate.Dtos; +using SJZY.Expand.ABP.Core.Common; using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Repository.Demo.Services; -using SJZY.Track.Repository.Demo.ValueObjects; namespace SJZY.Track.Application.Services.Demo { 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..4b70ff76 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -0,0 +1,79 @@ +using SJZY.Track.Domain.OrderAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Repository.TrackDetails; + +namespace SJZY.Track.Application.Services.ProvideServices; + +[ApiExplorerSettings(GroupName = "TrackQuery")] +public class TrackQueryService : ApplicationService +{ + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly IOrderRepository _orderRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; + + public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, IOrderRepository orderRepository, + ITrackTemplateRepository trackTemplateRepository) + { + _trackDetailsRepository = trackDetailsRepository; + _orderRepository = orderRepository; + _trackTemplateRepository = trackTemplateRepository; + } + + [HttpPost("TrackQuery/GetTrack")] + public async Task> GetTrackAsync(GetTrackInput input) + { + if (input.OrderNos.Count > 500) + { + throw new BusinessException(message: "最多只能查询500单"); + } + + var res = new List(); + var distinctOrderNumbers = input.OrderNos.Distinct().ToList(); + var details = await _trackDetailsRepository.GetListAsync(distinctOrderNumbers); + var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(distinctOrderNumbers); + var distinctTemplateIds = orderTemplates.Select(x => x.TrackTemplateId).Distinct().ToList(); + var templateContents = await _trackTemplateRepository.GetTemplateContentsAsync(distinctTemplateIds); + + 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, + Date = x.TrackTime.AddHours(input.TimeZone - x.TraceTimeZone), + TimeZone = x.TraceTimeZone + }).ToList(); + + TrackDetailSort(item, input.SortMethod); + + res.Add(item); + } + + + return res; + } + + private void TrackDetailSort(GetTrackOutput item, SortMethod sortMethod) + { + switch (sortMethod) + { + case SortMethod.ByTrackTime: + // tips:quick-sort 直接修改原list + item.TrackDetails.Sort((a, b) => a.Date.CompareTo(b.Date)); + break; + case SortMethod.ByTrackTimeDesc: + item.TrackDetails.Sort((a, b) => b.Date.CompareTo(a.Date)); + break; + case SortMethod.ByTemplate: + default: + throw new ArgumentOutOfRangeException(nameof(sortMethod), sortMethod, "不支持的排序方式"); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs b/src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs new file mode 100644 index 00000000..1399ed5c --- /dev/null +++ b/src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs @@ -0,0 +1,23 @@ +namespace SJZY.Track.Domain.DemoAggregate; + +[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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs b/src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs new file mode 100644 index 00000000..256eb7ae --- /dev/null +++ b/src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs @@ -0,0 +1,37 @@ +namespace SJZY.Track.Domain.DemoAggregate; + +/// +/// 测试表 +/// +[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; } + +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs b/src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs similarity index 85% rename from src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs rename to src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs index 782554e1..1c09d547 100644 --- a/src/SJZY.Track.Repository/Demo/ValueObjects/DemoValueObject.cs +++ b/src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Repository.Demo.ValueObjects +namespace SJZY.Track.Domain.DemoAggregate.Dtos { public class DemoValueObject { diff --git a/src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs b/src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs similarity index 85% rename from src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs rename to src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs index bf3a2083..b8abaef7 100644 --- a/src/SJZY.Track.Repository/Demo/Services/IDemoRepository.cs +++ b/src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs @@ -1,7 +1,6 @@ -using SJZY.Track.Repository.Demo.Entitys; -using SJZY.Track.Repository.Demo.ValueObjects; +using SJZY.Track.Domain.DemoAggregate.Dtos; -namespace SJZY.Track.Repository.Demo.Services +namespace SJZY.Track.Domain.DemoAggregate { public interface IDemoRepository { diff --git a/src/SJZY.Track.Domain/GlobalUsings.cs b/src/SJZY.Track.Domain/GlobalUsings.cs new file mode 100644 index 00000000..e12a965a --- /dev/null +++ b/src/SJZY.Track.Domain/GlobalUsings.cs @@ -0,0 +1,9 @@ +// Global using directives + +global using System; +global using System.Collections.Generic; +global using System.Linq.Expressions; +global using System.Threading.Tasks; +global using SJZY.Expand.ABP.Core.Common.Dto; +global using SJZY.Expand.ABP.Core.SqlSugar.Entitys; +global using SqlSugar; \ 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..3daf3e9d --- /dev/null +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -0,0 +1,97 @@ +namespace SJZY.Track.Domain; + +public interface IBasicRepository +{ + /// + /// 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); + + /// + /// 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/OrderAggregate/Dtos/OrderTemplateDto.cs b/src/SJZY.Track.Domain/OrderAggregate/Dtos/OrderTemplateDto.cs new file mode 100644 index 00000000..7cf444f2 --- /dev/null +++ b/src/SJZY.Track.Domain/OrderAggregate/Dtos/OrderTemplateDto.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.OrderAggregate.Dtos; + +public class OrderTemplateDto +{ + /// + /// 订单id + /// + public int OrderId { get; set; } + + /// + /// 模板id + /// + public int TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs new file mode 100644 index 00000000..1dd02831 --- /dev/null +++ b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs @@ -0,0 +1,13 @@ +using SJZY.Track.Domain.OrderAggregate.Dtos; + +namespace SJZY.Track.Domain.OrderAggregate; + +public interface IOrderRepository : IBasicRepository +{ + /// + /// 根据订单号,获取订单模板 + /// + /// + /// + Task> GetOrderTemplatesAsync(List distinctOrderNumbers); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs new file mode 100644 index 00000000..cb593bf3 --- /dev/null +++ b/src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs @@ -0,0 +1,70 @@ +namespace SJZY.Track.Domain.OrderAggregate; + +/// +/// 轨迹订单主表 +/// +[SugarTable("t_order")] +public class OrderEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 客户id(外部主体id) + /// + [SugarColumn(ColumnName = "CustomId")] + public int CustomId { get; set; } + + /// + /// 订单是否完结(异步维护) + /// + [SugarColumn(ColumnName = "IsCompleted")] + public bool IsCompleted { get; set; } + + /// + /// 最新轨迹内容(异步维护) + /// + [SugarColumn(ColumnName = "LatestTraceContent")] + public string LatestTraceContent { get; set; } + + /// + /// 最新轨迹内容英文(异步维护) + /// + [SugarColumn(ColumnName = "LatestTraceEnContent")] + public string LatestTraceEnContent { get; set; } + + /// + /// 最新轨迹时间(异步维护) + /// + [SugarColumn(ColumnName = "LatestTraceTime")] + public DateTime? LatestTraceTime { get; set; } + + /// + /// 订单明细(json字符串) + /// + [SugarColumn(ColumnName = "OrderDetails")] + public string OrderDetails { get; set; } + + /// + /// 订单号 + /// + [SugarColumn(ColumnName = "OrderNo")] + public string OrderNo { get; set; } + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + [SugarColumn(ColumnName = "OrderType")] + public int OrderType { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs new file mode 100644 index 00000000..fecb1812 --- /dev/null +++ b/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs @@ -0,0 +1,28 @@ +namespace SJZY.Track.Domain.OrderAggregate; + +/// +/// 轨迹订单关联表(1:N) +/// +[SugarTable("t_order_link")] +public class OrderLinkEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 关联的订单id + /// + [SugarColumn(ColumnName = "LinkOrderId")] + public int LinkOrderId { get; set; } + + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs b/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs new file mode 100644 index 00000000..9f9da293 --- /dev/null +++ b/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs @@ -0,0 +1,34 @@ +namespace SJZY.Track.Domain.OrderAggregate; + +/// +/// 轨迹订单模板表(1:N) +/// +[SugarTable("t_order_template")] +public class OrderTemplateEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [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; } + +} \ 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..811cfbce --- /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..09ae6214 --- /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/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs b/src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs new file mode 100644 index 00000000..680a0806 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Repository.TrackDetails.Dtos; + +public class TrackDetailsQueryInput : PageInfoInput +{ + /// + /// 单号 + /// + public List OrderNos { get; set; } = new(); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs new file mode 100644 index 00000000..54588768 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -0,0 +1,13 @@ +using SJZY.Track.Domain.TrackDetailsAggregate; +using SJZY.Track.Repository.TrackDetails.Dtos; + +namespace SJZY.Track.Repository.TrackDetails; + +public interface ITrackDetailsRepository +{ + Task WriteTrack(TrackDetailsIndex index); + + Task> GetListAsync(List orderNos); + + Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs new file mode 100644 index 00000000..b81817ef --- /dev/null +++ b/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -0,0 +1,90 @@ +using Nest; +using SJZY.Expand.ElasticSearch; + +namespace SJZY.Track.Domain.TrackDetailsAggregate; + +[ElasticsearchType(Name = IndexName)] +public class TrackDetailsIndex : IdBaseIndex +{ + public const string IndexName = "sjzy_track_details"; + + /// + /// 订单Id + /// + public int OrderId { get; set; } + + /// + /// 订单号 + /// + public string OrderNo { get; set; } + + /// + /// 订单类型(主数据枚举TrackOrderType) + /// + public string OrderType { get; set; } + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 原轨迹状态 + /// + public string OriginTrackStatus { get; set; } + + /// + /// 轨迹内容代码 + /// + public string TrackCode { get; set; } + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } + + /// + /// 原轨迹内容 + /// + public string OriginTrackContent { get; set; } + + /// + /// 原轨迹报文 + /// + public string OriginTrackData { get; set; } + + /// + /// 轨迹内容英文 + /// + public string TrackEnContent { get; set; } + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public float TraceTimeZone { get; set; } + + /// 删除标记 0正常 1 已删除 + public bool IsDeleted { get; set; } + + /// 创建人id + public int CreateUserId { get; set; } + + /// 创建时间 + public DateTime CreateTime { get; set; } + + /// 修改人id + public int? UpdateUserId { get; set; } + + /// 修改时间 + public DateTime? UpdateTime { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs new file mode 100644 index 00000000..92be4c81 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +public class TemplateContentDto +{ + +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs new file mode 100644 index 00000000..ffa1a742 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +namespace SJZY.Track.Domain.TrackTemplateAggregate; + +public interface ITrackTemplateRepository : IBasicRepository +{ + Task GetTemplateContentsAsync(List distinctTemplateIds); +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs new file mode 100644 index 00000000..4263d227 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs @@ -0,0 +1,46 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate; + +/// +/// 轨迹模板内容表(1:N) +/// +[SugarTable("t_track_template_content")] +public class TrackTemplateContentEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [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/TrackTemplateAggregate/TrackTemplateEntity.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs new file mode 100644 index 00000000..a8fa9718 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs @@ -0,0 +1,34 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate; + +/// +/// 轨迹模板表 +/// +[SugarTable("t_track_template")] +public class TrackTemplateEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [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.Repository/BasicRepository.cs b/src/SJZY.Track.Repository/BasicRepository.cs index 380b3256..fa2ed22b 100644 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ b/src/SJZY.Track.Repository/BasicRepository.cs @@ -1,15 +1,72 @@ -#pragma warning disable 1591 -namespace SJZY.Track.Repository +using System.Linq.Expressions; +using SJZY.Track.Domain; +using Volo.Abp; + +namespace SJZY.Track.Repository; + +/// +/// 仓储基类实现 +/// +/// +public class BasicRepository : SimpleClient,IBasicRepository where T : class, new() { - /// - /// 仓储基类 - /// - /// - public class BasicRepository : SimpleClient where T : class, new() + public BasicRepository() { - public BasicRepository() - { - Context = SqlsugarScopeBasic.GetContextSafely("default"); - } + 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(); + } + + 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(); + } + + public async Task SoftDeleteAsync(Expression> where) + { + if (!typeof(T).IsAssignableTo()) + throw new BusinessException( + message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}"); + + // tips: required where + if (where == default) return false; + + return await Context.Updateable() + .Where(where) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) + .ExecuteCommandHasChangeAsync(); } } \ 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/DemoRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/Demo/Services/DemoRepository.cs rename to src/SJZY.Track.Repository/DemoRepository.cs index 4bb01002..6cdfe78b 100644 --- a/src/SJZY.Track.Repository/Demo/Services/DemoRepository.cs +++ b/src/SJZY.Track.Repository/DemoRepository.cs @@ -1,8 +1,8 @@ -using SJZY.Track.Repository.Demo.Entitys; -using SJZY.Track.Repository.Demo.ValueObjects; -using System.Transactions; +using System.Transactions; +using SJZY.Track.Domain.DemoAggregate; +using SJZY.Track.Domain.DemoAggregate.Dtos; -namespace SJZY.Track.Repository.Demo.Services +namespace SJZY.Track.Repository { public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs b/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs deleted file mode 100644 index 53566dca..00000000 --- a/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace SJZY.Track.Repository.Order.Entitys -{ - /// - /// 轨迹订单主表 - /// - [SugarTable("t_order")] - public class OrderEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 客户id(外部主体id) - /// - [SugarColumn(ColumnName = "CustomId")] - public int CustomId { get; set; } - - /// - /// 订单是否完结(异步维护) - /// - [SugarColumn(ColumnName = "IsCompleted")] - public bool IsCompleted { get; set; } - - /// - /// 最新轨迹内容(异步维护) - /// - [SugarColumn(ColumnName = "LatestTraceContent")] - public string LatestTraceContent { get; set; } - - /// - /// 最新轨迹内容英文(异步维护) - /// - [SugarColumn(ColumnName = "LatestTraceEnContent")] - public string LatestTraceEnContent { get; set; } - - /// - /// 最新轨迹时间(异步维护) - /// - [SugarColumn(ColumnName = "LatestTraceTime")] - public DateTime? LatestTraceTime { get; set; } - - /// - /// 订单明细(json字符串) - /// - [SugarColumn(ColumnName = "OrderDetails")] - public string OrderDetails { get; set; } - - /// - /// 订单号 - /// - [SugarColumn(ColumnName = "OrderNo")] - public string OrderNo { get; set; } - - /// - /// 订单类型(主数据枚举TrackOrderType) - /// - [SugarColumn(ColumnName = "OrderType")] - public int OrderType { get; set; } - - /// - /// 子系统id - /// - [SugarColumn(ColumnName = "SubSystemId")] - public int SubSystemId { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs b/src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs deleted file mode 100644 index 7a67dae4..00000000 --- a/src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.Order.Entitys; - -namespace SJZY.Track.Repository.Order.Services -{ - public interface IOrderRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/Order/Services/OrderRepository.cs b/src/SJZY.Track.Repository/Order/Services/OrderRepository.cs deleted file mode 100644 index 5e682c3a..00000000 --- a/src/SJZY.Track.Repository/Order/Services/OrderRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.Order.Entitys; - -namespace SJZY.Track.Repository.Order.Services -{ - public class OrderRepository : BasicRepository, IOrderRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs b/src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs deleted file mode 100644 index 701ed883..00000000 --- a/src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace SJZY.Track.Repository.OrderLink.Entitys -{ - /// - /// 轨迹订单关联表(1:N) - /// - [SugarTable("t_order_link")] - public class OrderLinkEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 关联的订单id - /// - [SugarColumn(ColumnName = "LinkOrderId")] - public int LinkOrderId { get; set; } - - /// - /// 订单id - /// - [SugarColumn(ColumnName = "OrderId")] - public int OrderId { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs b/src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs deleted file mode 100644 index d43818a1..00000000 --- a/src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.OrderLink.Entitys; - -namespace SJZY.Track.Repository.OrderLink.Services -{ - public interface IOrderLinkRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs b/src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs deleted file mode 100644 index 5085004b..00000000 --- a/src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.OrderLink.Entitys; - -namespace SJZY.Track.Repository.OrderLink.Services -{ - public class OrderLinkRepository : BasicRepository, IOrderLinkRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs new file mode 100644 index 00000000..07793394 --- /dev/null +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -0,0 +1,16 @@ +using SJZY.Track.Domain.OrderAggregate; +using SJZY.Track.Domain.OrderAggregate.Dtos; + +namespace SJZY.Track.Repository; + +public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency +{ + public async Task> GetOrderTemplatesAsync(List distinctOrderNumbers) + { + return await AsQueryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => distinctOrderNumbers.Contains(a.OrderNo)) + .Select() + .ToListAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs b/src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs deleted file mode 100644 index 8c6b589e..00000000 --- a/src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace SJZY.Track.Repository.OrderTemplate.Entitys -{ - /// - /// 轨迹订单模板表(1:N) - /// - [SugarTable("t_order_template")] - public class OrderTemplateEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs b/src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs deleted file mode 100644 index 39279ef4..00000000 --- a/src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.OrderTemplate.Entitys; - -namespace SJZY.Track.Repository.OrderTemplate.Services -{ - public interface IOrderTemplateRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs b/src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs deleted file mode 100644 index 3bf0346a..00000000 --- a/src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.OrderTemplate.Entitys; - -namespace SJZY.Track.Repository.OrderTemplate.Services -{ - public class OrderTemplateRepository : BasicRepository, IOrderTemplateRepository, IScopedDependency - { - - } -} 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 1583dea7..0c731f1e 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -11,20 +11,19 @@ + + + - - - - @@ -36,8 +35,11 @@ - - + + + + + diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs new file mode 100644 index 00000000..61701b13 --- /dev/null +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using SJZY.Expand.ABP.Core.SqlSugar.Options; +using SJZY.Expand.ElasticSearch; +using SJZY.Track.Domain; +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" + } + } + ); + }, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository"); + + + context.Services.AddScoped(typeof(IBasicRepository<>), typeof(BasicRepository<>)); + + + context.Services.AddElasticSearch(options => + { + options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>(); + options.LoginName = configuration["ElasticSearch:LoginName"]; + options.Password = configuration["ElasticSearch:Password"]; + options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]; + }); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs new file mode 100644 index 00000000..3431bd6b --- /dev/null +++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs @@ -0,0 +1,73 @@ +using Nest; +using SJZY.Track.Domain.TrackDetailsAggregate; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Expand.ElasticSearch.Services; +using SJZY.Track.Repository.TrackDetails; +using SJZY.Track.Repository.TrackDetails.Dtos; + +namespace SJZY.Track.Repository; + +internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, + ITransientDependency +{ + public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) + { + } + + public async Task WriteTrack(TrackDetailsIndex index) + { + try + { + //await Context.IndexDocumentAsync(idx); + var response = await Context.IndexAsync(index, + request => request.Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}")); + if (!response.IsValid) LogHelper.Error("数据添加失败,原因:" + response.DebugInformation); + } + catch (Exception ex) + { + LogHelper.Error($"日志插入ES失败:{ex.Message}。{index.ToJson()}"); + } + } + + public async Task> GetListAsync(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.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TraceTimeZone) + )) + .Query(q => q.Terms(t => t + .Field(f => f.OrderNo) + .Terms(orderNos))) + ); + + return data.Documents.ToList(); + } + + 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/TrackTemplate/Entitys/TrackTemplateEntity.cs b/src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs deleted file mode 100644 index 1dfbad6c..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace SJZY.Track.Repository.TrackTemplate.Entitys -{ - /// - /// 轨迹模板表 - /// - [SugarTable("t_track_template")] - public class TrackTemplateEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs deleted file mode 100644 index 240aadaa..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackTemplate.Entitys; - -namespace SJZY.Track.Repository.TrackTemplate.Services -{ - public interface ITrackTemplateRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs deleted file mode 100644 index e3347eac..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackTemplate.Entitys; - -namespace SJZY.Track.Repository.TrackTemplate.Services -{ - public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs b/src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs deleted file mode 100644 index 32c4ce66..00000000 --- a/src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace SJZY.Track.Repository.TrackTemplateContent.Entitys -{ - /// - /// 轨迹模板内容表(1:N) - /// - [SugarTable("t_track_template_content")] - public class TrackTemplateContentEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs b/src/SJZY.Track.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs deleted file mode 100644 index 0894357d..00000000 --- a/src/SJZY.Track.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackTemplateContent.Entitys; - -namespace SJZY.Track.Repository.TrackTemplateContent.Services -{ - public interface ITrackTemplateContentRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs b/src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs deleted file mode 100644 index 3ba4d5a2..00000000 --- a/src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackTemplateContent.Entitys; - -namespace SJZY.Track.Repository.TrackTemplateContent.Services -{ - public class TrackTemplateContentRepository : BasicRepository, ITrackTemplateContentRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs new file mode 100644 index 00000000..08370333 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -0,0 +1,13 @@ +using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +namespace SJZY.Track.Repository.TrackTemplate +{ + public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency + { + public Task GetTemplateContentsAsync(List distinctTemplateIds) + { + throw new NotImplementedException(); + } + } +} diff --git a/test/SJZY.Track.Test/Startup.cs b/test/SJZY.Track.Test/Startup.cs index eee65d21..27397eb3 100644 --- a/test/SJZY.Track.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 index 69e0681b..8cff2d50 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -13,55 +13,53 @@ using Volo.Abp.Modularity; using Volo.Abp.Threading; [assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] -namespace SJZY.OpenApi.Test +namespace SJZY.Track.Test; + +[DependsOn( + typeof(AbpAspNetCoreTestBaseModule), + typeof(AbpAutofacModule), + typeof(AbpAuthorizationModule), + typeof(SJZYTrackRepositoryModule), + typeof(ApplicationModule), + typeof(SJZYTrackApiModule), + typeof(AbpHttpClientModule) //添加abp的http代理模块 +)] + +[assembly: HostingStartup(typeof(Expand.ABP.Core.HostingStartup))] +public class TestModule : AbpModule { - [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) { - - 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(); - } - }); - } + 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