From afe2b318cbb8eb1fa418fa56ce2947f54f9d50be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=92=99=E6=81=A9?= Date: Sun, 18 Feb 2024 18:32:25 +0800 Subject: [PATCH 001/196] first commit --- .../ProblemTypeServiceTest.cs | 7 --- .../Demo/DemoTest.cs | 5 ++- .../SJZY - Backup.Track.Test.csproj} | 2 +- test/SJZY.Track.Test/SJZY.Track.Test.csproj | 45 +++++++++++++++++++ .../Startup.cs | 0 .../TestModule.cs | 6 +-- .../TestModuleTestBase.cs | 0 .../Usings.cs | 0 .../appsettings.json | 0 9 files changed, 52 insertions(+), 13 deletions(-) delete mode 100644 test/SJZY.OpenApi.Test/ProblemTypeService/ProblemTypeServiceTest.cs rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/Demo/DemoTest.cs (85%) rename test/{SJZY.OpenApi.Test/SJZY.OpenApi.Test.csproj => SJZY.Track.Test/SJZY - Backup.Track.Test.csproj} (93%) create mode 100644 test/SJZY.Track.Test/SJZY.Track.Test.csproj rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/Startup.cs (100%) rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/TestModule.cs (95%) rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/TestModuleTestBase.cs (100%) rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/Usings.cs (100%) rename test/{SJZY.OpenApi.Test => SJZY.Track.Test}/appsettings.json (100%) 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/Demo/DemoTest.cs b/test/SJZY.Track.Test/Demo/DemoTest.cs similarity index 85% rename from test/SJZY.OpenApi.Test/Demo/DemoTest.cs rename to test/SJZY.Track.Test/Demo/DemoTest.cs index c8479c89..da9cd4f2 100644 --- a/test/SJZY.OpenApi.Test/Demo/DemoTest.cs +++ b/test/SJZY.Track.Test/Demo/DemoTest.cs @@ -1,5 +1,6 @@ -using SJZY.OpenApi.Application.Dtos.Demo; -using SJZY.OpenApi.Application.Services.Demo; + +using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Services.Demo; namespace SJZY.OpenApi.Test.Demo { 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 100% rename from test/SJZY.OpenApi.Test/Startup.cs rename to test/SJZY.Track.Test/Startup.cs diff --git a/test/SJZY.OpenApi.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs similarity index 95% rename from test/SJZY.OpenApi.Test/TestModule.cs rename to test/SJZY.Track.Test/TestModule.cs index f0567c60..69e0681b 100644 --- a/test/SJZY.OpenApi.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -1,8 +1,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using SJZY.OpenApi.Api; -using SJZY.OpenApi.Application; -using SJZY.OpenApi.Repository; +using SJZY.Track.Api; +using SJZY.Track.Application; +using SJZY.Track.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Authorization; 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 From 77691fcaaa6e7bfc9b39963ca1288b44889f9815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 24 Feb 2024 13:44:42 +0800 Subject: [PATCH 002/196] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs | 4 ++-- src/SJZY.Track.Application/SJZY.Track.Application.csproj | 8 ++++---- .../Services/Demo/InterFaceDemoService.cs | 1 - src/SJZY.Track.Repository/SJZY.Track.Repository.csproj | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs index 13f63049..1b46a3e1 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs +++ b/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs @@ -8,7 +8,7 @@ public OptionType Option { get; set; } /// - /// + /// /// public int Id { get; set; } @@ -39,4 +39,4 @@ /// public string CreateTime { get; set; } } -} +} \ 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..ee9510bf 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -14,10 +14,10 @@ - - - - + + + + diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs index 145322ac..93c2f4cb 100644 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs @@ -2,7 +2,6 @@ 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 { diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index d4c60ce9..97ea5bf1 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -15,8 +15,8 @@ - - + + From 886dfcae383082e50ed246549aa6c413d4f7cd6f Mon Sep 17 00:00:00 2001 From: dingenwen <543338760@qq.com> Date: Mon, 26 Feb 2024 18:02:17 +0800 Subject: [PATCH 003/196] =?UTF-8?q?=E4=BB=93=E5=82=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../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 ++ .../Entitys/OrderTemplateEntity.cs | 35 ++++++++ .../Services/IOrderTemplateRepository.cs | 9 ++ .../Services/OrderTemplateRepository.cs | 9 ++ .../SJZY.Track.Repository.csproj | 20 +++++ .../Entitys/TrackContentEntity.cs | 53 ++++++++++++ .../Services/ITrackContentRepository.cs | 9 ++ .../Services/TrackContentRepository.cs | 9 ++ .../Entitys/TrackContentMapEntity.cs | 29 +++++++ .../Services/ITrackContentMapRepository.cs | 9 ++ .../Services/TrackContentMapRepository.cs | 9 ++ .../TrackFlag/Entitys/TrackFlagEntity.cs | 35 ++++++++ .../Services/ITrackFlagRepository.cs | 9 ++ .../TrackFlag/Services/TrackFlagRepository.cs | 9 ++ .../Entitys/TrackPullConfigEntity.cs | 47 +++++++++++ .../Services/ITrackPullConfigRepository.cs | 9 ++ .../Services/TrackPullConfigRepository.cs | 14 ++++ .../Entitys/TrackPullContentConfigEntity.cs | 71 ++++++++++++++++ .../ITrackPullContentConfigRepository.cs | 9 ++ .../TrackPullContentConfigRepository.cs | 9 ++ .../Entitys/TrackPushConfigEntity.cs | 47 +++++++++++ .../Services/ITrackPushConfigRepository.cs | 9 ++ .../Services/TrackPushConfigRepository.cs | 9 ++ .../Entitys/TrackPushContentConfigEntity.cs | 77 +++++++++++++++++ .../ITrackPushContentConfigRepository.cs | 9 ++ .../TrackPushContentConfigRepository.cs | 9 ++ .../TrackPushPullParamsConfigEntity.cs | 83 +++++++++++++++++++ .../ITrackPushPullParamsConfigRepository.cs | 9 ++ .../TrackPushPullParamsConfigRepository.cs | 14 ++++ .../Entitys/TrackPushRecordEntity.cs | 59 +++++++++++++ .../Services/ITrackPushRecordRepository.cs | 9 ++ .../Services/TrackPushRecordRepository.cs | 9 ++ .../Entitys/TrackPushRecordDetailsEntity.cs | 47 +++++++++++ .../ITrackPushRecordDetailsRepository.cs | 9 ++ .../TrackPushRecordDetailsRepository.cs | 9 ++ .../TrackStatus/Entitys/TrackStatusEntity.cs | 47 +++++++++++ .../Services/ITrackStatusRepository.cs | 9 ++ .../Services/TrackStatusRepository.cs | 9 ++ .../Entitys/TrackTemplateEntity.cs | 35 ++++++++ .../Services/ITrackTemplateRepository.cs | 9 ++ .../Services/TrackTemplateRepository.cs | 9 ++ .../Entitys/TrackTemplateContentEntity.cs | 47 +++++++++++ .../ITrackTemplateContentRepository.cs | 9 ++ .../TrackTemplateContentRepository.cs | 9 ++ 49 files changed, 1130 insertions(+) create mode 100644 src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs create mode 100644 src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs create mode 100644 src/SJZY.Track.Repository/Order/Services/OrderRepository.cs create mode 100644 src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs create mode 100644 src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs create mode 100644 src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs create mode 100644 src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs create mode 100644 src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs create mode 100644 src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs diff --git a/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs b/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs new file mode 100644 index 00000000..53566dca --- /dev/null +++ b/src/SJZY.Track.Repository/Order/Entitys/OrderEntity.cs @@ -0,0 +1,71 @@ +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 new file mode 100644 index 00000000..7a67dae4 --- /dev/null +++ b/src/SJZY.Track.Repository/Order/Services/IOrderRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..5e682c3a --- /dev/null +++ b/src/SJZY.Track.Repository/Order/Services/OrderRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..701ed883 --- /dev/null +++ b/src/SJZY.Track.Repository/OrderLink/Entitys/OrderLinkEntity.cs @@ -0,0 +1,29 @@ +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 new file mode 100644 index 00000000..d43818a1 --- /dev/null +++ b/src/SJZY.Track.Repository/OrderLink/Services/IOrderLinkRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..5085004b --- /dev/null +++ b/src/SJZY.Track.Repository/OrderLink/Services/OrderLinkRepository.cs @@ -0,0 +1,9 @@ +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/OrderTemplate/Entitys/OrderTemplateEntity.cs b/src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs new file mode 100644 index 00000000..8c6b589e --- /dev/null +++ b/src/SJZY.Track.Repository/OrderTemplate/Entitys/OrderTemplateEntity.cs @@ -0,0 +1,35 @@ +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 new file mode 100644 index 00000000..39279ef4 --- /dev/null +++ b/src/SJZY.Track.Repository/OrderTemplate/Services/IOrderTemplateRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..3bf0346a --- /dev/null +++ b/src/SJZY.Track.Repository/OrderTemplate/Services/OrderTemplateRepository.cs @@ -0,0 +1,9 @@ +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/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index 97ea5bf1..1583dea7 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -20,4 +20,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs b/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs new file mode 100644 index 00000000..29ef777a --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs @@ -0,0 +1,53 @@ +namespace SJZY.Track.Repository.TrackContent.Entitys +{ + /// + /// 轨迹内容 + /// + [SugarTable("t_track_content")] + public class TrackContentEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹内容代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + [SugarColumn(ColumnName = "Content")] + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + [SugarColumn(ColumnName = "EnContent")] + public string EnContent { get; set; } + + /// + /// 子系统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; } + + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs new file mode 100644 index 00000000..e07a950a --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackContent.Entitys; + +namespace SJZY.Track.Repository.TrackContent.Services +{ + public interface ITrackContentRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs new file mode 100644 index 00000000..28163046 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackContent.Entitys; + +namespace SJZY.Track.Repository.TrackContent.Services +{ + public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs b/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs new file mode 100644 index 00000000..b8b5f757 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs @@ -0,0 +1,29 @@ +namespace SJZY.Track.Repository.TrackContentMap.Entitys +{ + /// + /// 轨迹内容映射表 + /// + [SugarTable("t_track_content_map")] + public class TrackContentMapEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 映射轨迹内容id + /// + [SugarColumn(ColumnName = "MapTrackContentId")] + public int MapTrackContentId { get; set; } + + /// + /// 源轨迹内容id + /// + [SugarColumn(ColumnName = "TrackContentId")] + public int TrackContentId { get; set; } + + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs b/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs new file mode 100644 index 00000000..9aab5da6 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackContentMap.Entitys; + +namespace SJZY.Track.Repository.TrackContentMap.Services +{ + public interface ITrackContentMapRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs b/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs new file mode 100644 index 00000000..4e6783c4 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackContentMap.Entitys; + +namespace SJZY.Track.Repository.TrackContentMap.Services +{ + public class TrackContentMapRepository : BasicRepository, ITrackContentMapRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs b/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs new file mode 100644 index 00000000..11b86c26 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs @@ -0,0 +1,35 @@ +namespace SJZY.Track.Repository.TrackFlag.Entitys +{ + /// + /// 轨迹标记表 + /// + [SugarTable("t_track_flag")] + public class TrackFlagEntity : 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/TrackFlag/Services/ITrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs new file mode 100644 index 00000000..709655e5 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackFlag.Entitys; + +namespace SJZY.Track.Repository.TrackFlag.Services +{ + public interface ITrackFlagRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs new file mode 100644 index 00000000..2a6977fc --- /dev/null +++ b/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackFlag.Entitys; + +namespace SJZY.Track.Repository.TrackFlag.Services +{ + public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs new file mode 100644 index 00000000..5efa67b0 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs @@ -0,0 +1,47 @@ +namespace SJZY.Track.Repository.TrackPullConfig.Entitys +{ + /// + /// 轨迹拉取配置表 + /// + [SugarTable("t_track_pull_config")] + public class TrackPullConfigEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [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.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs new file mode 100644 index 00000000..646bc6bc --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPullConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPullConfig.Services +{ + public interface ITrackPullConfigRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs new file mode 100644 index 00000000..f99ae2ce --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs @@ -0,0 +1,14 @@ +using SJZY.Track.Repository.TrackPullConfig.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Repository.TrackPullConfig.Services +{ + public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs new file mode 100644 index 00000000..cf3e4b9d --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs @@ -0,0 +1,71 @@ +namespace SJZY.Track.Repository.TrackPullContentConfig.Entitys +{ + /// + /// 轨迹拉取内容配置表 + /// + [SugarTable("t_track_pull_content_config")] + public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [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 string TrackTimeZone { get; set; } + + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs new file mode 100644 index 00000000..9fce3f8a --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPullContentConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPullContentConfig.Services +{ + public interface ITrackPullContentConfigRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs new file mode 100644 index 00000000..05ae7d19 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPullContentConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPullContentConfig.Services +{ + public class TrackPullContentConfigRepository : BasicRepository, ITrackPullContentConfigRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs new file mode 100644 index 00000000..5c99ec50 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs @@ -0,0 +1,47 @@ +namespace SJZY.Track.Repository.TrackPushConfig.Entitys +{ + /// + /// 轨迹推送配置表 + /// + [SugarTable("t_track_push_config")] + public class TrackPushConfigEntity : 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 = "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.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs new file mode 100644 index 00000000..72f31a32 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPushConfig.Services +{ + public interface ITrackPushConfigRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs new file mode 100644 index 00000000..529fef74 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPushConfig.Services +{ + public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs new file mode 100644 index 00000000..7caefd7a --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs @@ -0,0 +1,77 @@ +namespace SJZY.Track.Repository.TrackPushContentConfig.Entitys +{ + /// + /// 轨迹推送内容配置表 + /// + [SugarTable("t_track_push_content_config")] + public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [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 string TrackTimeZone { get; set; } + + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs new file mode 100644 index 00000000..aac710d9 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushContentConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPushContentConfig.Services +{ + public interface ITrackPushContentConfigRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs new file mode 100644 index 00000000..0c2eb86e --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushContentConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPushContentConfig.Services +{ + public class TrackPushContentConfigRepository : BasicRepository, ITrackPushContentConfigRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs new file mode 100644 index 00000000..3f0ca590 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs @@ -0,0 +1,83 @@ +namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys +{ + /// + /// 轨迹拉取/推送参数配置 + /// + [SugarTable("t_track_push_pull_params_config")] + public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [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.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs new file mode 100644 index 00000000..4098b145 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys; + +namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Services +{ + public interface ITrackPushPullParamsConfigRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs new file mode 100644 index 00000000..a24556d1 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs @@ -0,0 +1,14 @@ +using SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Services +{ + public class TrackPushPullParamsConfigRepository : BasicRepository, ITrackPushPullParamsConfigRepository, IScopedDependency + { + + } +} 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..0eeca89e --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -0,0 +1,59 @@ +namespace SJZY.Track.Repository.TrackPushRecord.Entitys +{ + /// + /// 轨迹推送记录 + /// + [SugarTable("t_track_push_record")] + public class TrackPushRecordEntity + { + + /// + /// 自增主键 + /// + [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; } + + /// + /// 接口通请求id + /// + [SugarColumn(ColumnName = "RequestId")] + public string RequestId { get; set; } + + /// + /// 服务商id + /// + [SugarColumn(ColumnName = "ServiceProviderId")] + public int ServiceProviderId { get; set; } + + /// + /// 推送轨迹总数 + /// + [SugarColumn(ColumnName = "TrackTotal")] + public string 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..cac702c2 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushRecord.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecord.Services +{ + public interface ITrackPushRecordRepository : ISimpleClient + { + + } +} 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..06a72739 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs @@ -0,0 +1,9 @@ +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..73140fd9 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -0,0 +1,47 @@ +namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys +{ + /// + /// 轨迹推送明细表 + /// + [SugarTable("t_track_push_record_details")] + public class TrackPushRecordDetailsEntity + { + + /// + /// 自增主键 + /// + [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..85047d16 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public interface ITrackPushRecordDetailsRepository : ISimpleClient + { + + } +} 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..20cd54e3 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs b/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs new file mode 100644 index 00000000..f0d60726 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs @@ -0,0 +1,47 @@ +namespace SJZY.Track.Repository.TrackStatus.Entitys +{ + /// + /// 轨迹状态表 + /// + [SugarTable("t_track_status")] + public class TrackStatusEntity : IFullAuditedBasicEntitys + { + + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹状态代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 轨迹状态英文 + /// + [SugarColumn(ColumnName = "EnStatus")] + public string EnStatus { get; set; } + + /// + /// 所属节点(主数据枚举ServiceNode) + /// + [SugarColumn(ColumnName = "Node")] + public int Node { get; set; } + + /// + /// 轨迹状态 + /// + [SugarColumn(ColumnName = "Status")] + public string Status { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } + + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs new file mode 100644 index 00000000..aeed1fbf --- /dev/null +++ b/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackStatus.Entitys; + +namespace SJZY.Track.Repository.TrackStatus.Services +{ + public interface ITrackStatusRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs new file mode 100644 index 00000000..67425dff --- /dev/null +++ b/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackStatus.Entitys; + +namespace SJZY.Track.Repository.TrackStatus.Services +{ + public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs b/src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs new file mode 100644 index 00000000..1dfbad6c --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/Entitys/TrackTemplateEntity.cs @@ -0,0 +1,35 @@ +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 new file mode 100644 index 00000000..240aadaa --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..e3347eac --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..32c4ce66 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplateContent/Entitys/TrackTemplateContentEntity.cs @@ -0,0 +1,47 @@ +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 new file mode 100644 index 00000000..0894357d --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplateContent/Services/ITrackTemplateContentRepository.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..3ba4d5a2 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplateContent/Services/TrackTemplateContentRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.TrackTemplateContent.Entitys; + +namespace SJZY.Track.Repository.TrackTemplateContent.Services +{ + public class TrackTemplateContentRepository : BasicRepository, ITrackTemplateContentRepository, IScopedDependency + { + + } +} From 3036cfbab4925c7e42523e66156f37e17bf1d356 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 10:05:30 +0800 Subject: [PATCH 004/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/ITrackTemplateService.cs | 13 ++++++++++++ .../TrackTemplates/TrackTemplateService.cs | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs create mode 100644 src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs 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..b082a1ff --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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..e671231d --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -0,0 +1,20 @@ +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.TrackTemplates +{ + [ApiExplorerSettings(GroupName = "轨迹模版")] + public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency + { + public TrackTemplateService() + { + + } + + + } +} From cbabe27185b270be70e277b7d2c90324a17d3e70 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 14:33:36 +0800 Subject: [PATCH 005/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplateAutoMapperProfile.cs | 25 +++++ .../GetPageTrackTemplateInput.cs | 24 +++++ .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 102 ++++++++++++++++++ .../TrackTemplates/TrackTemplateService.cs | 86 ++++++++++++++- .../SJZY.Track.Repository.csproj | 1 - .../Services/ITrackTemplateRepository.cs | 3 + .../Services/TrackTemplateRepository.cs | 27 +++++ .../ValueObjects/GetPageTrackTemplateVO.cs | 21 ++++ .../ValueObjects/GetTrackTemplateDetailVO.cs | 70 ++++++++++++ 9 files changed, 355 insertions(+), 4 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs create mode 100644 src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs new file mode 100644 index 00000000..f715d0cf --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -0,0 +1,25 @@ +using AutoMapper; +using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Repository.TrackTemplate.ValueObjects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.AutoMapper +{ + /// + /// 轨迹模版自动映射 + /// + public class TrackTemplateAutoMapperProfile : Profile + { + public TrackTemplateAutoMapperProfile() + { + CreateMap(MemberList.None); + + //CreateMap, UnifyResultDto>(MemberList.None); + } + } +} diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs new file mode 100644 index 00000000..c118b36b --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.TrackTemplates +{ + /// + /// 获取轨迹模版分页输入 + /// + public class GetPageTrackTemplateInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + } +} diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs new file mode 100644 index 00000000..ca928b8c --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -0,0 +1,102 @@ +using Microsoft.OpenApi.Writers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + + /// + /// 创建时间 + /// + 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 int Name { set; get; } + + /// + /// 模板代码 + /// + public int Code { set; get; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index e671231d..30ccccfa 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,20 +1,100 @@ -using System; +using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Repository.TrackTemplate.Entitys; +using SJZY.Track.Repository.TrackTemplate.Services; +using SJZY.Track.Repository.TrackTemplate.ValueObjects; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; +using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.Services.TrackTemplates { [ApiExplorerSettings(GroupName = "轨迹模版")] + [Route("/Track")] public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency { - public TrackTemplateService() - { + private readonly ITrackTemplateRepository _trackTemplateRepository; + public TrackTemplateService( + ITrackTemplateRepository trackTemplateRepository + ) + { + this._trackTemplateRepository=trackTemplateRepository; } + /// + /// 轨迹模版编辑 + /// + /// + [HttpPost("/Template/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("/Template/GetDetail")] + public async Task> GetDetailAsync(int id) + { + //var detailInfo = await _trackTemplateRepository.GetFirstAsync(a => a.Id== 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("/Template/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) + { + + return null; + } + + private async Task UpdateAsync(EditTrackTemplateInput input) + { + + + return null; + } + + private async Task DeleteAsync(EditTrackTemplateInput input) + { + + + return null; + } + #endregion } } diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index 1583dea7..64fa00cd 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -37,7 +37,6 @@ - diff --git a/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs index 240aadaa..5036bb72 100644 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/ITrackTemplateRepository.cs @@ -1,9 +1,12 @@ using SJZY.Track.Repository.TrackTemplate.Entitys; +using SJZY.Track.Repository.TrackTemplate.ValueObjects; namespace SJZY.Track.Repository.TrackTemplate.Services { public interface ITrackTemplateRepository : ISimpleClient { + Task GetDetailAsync(int id); + Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); } } diff --git a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs index e3347eac..7b3432a6 100644 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs @@ -1,9 +1,36 @@ using SJZY.Track.Repository.TrackTemplate.Entitys; +using SJZY.Track.Repository.TrackTemplate.ValueObjects; namespace SJZY.Track.Repository.TrackTemplate.Services { public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { + public TrackTemplateRepository() + { + } + /// + /// 获取轨迹模版明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + //await Context.Queryable().LeftJoin<> + + return new GetTrackTemplateDetailVO(); + } + + + /// + /// 分页获取轨迹模版 + /// + /// + /// + public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) + { + + return null; + } } } diff --git a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs new file mode 100644 index 00000000..50c343e8 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Repository.TrackTemplate.ValueObjects +{ + public class GetPageTrackTemplateVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + } +} diff --git a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs new file mode 100644 index 00000000..1ec9565f --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Repository.TrackTemplate.ValueObjects +{ + /// + /// 获取轨迹模版明细 + /// + 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; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + } +} From 798226f3ab23c1123736ba067cdb03d4833f0730 Mon Sep 17 00:00:00 2001 From: dingenwen <543338760@qq.com> Date: Tue, 27 Feb 2024 14:36:18 +0800 Subject: [PATCH 006/196] =?UTF-8?q?v=E8=A1=A8=E4=BB=93=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SJZY.Track.Repository.csproj | 1 + .../VData/Entitys/VExternalSubjectEntity.cs | 131 +++++++++++++++ .../VData/Entitys/VServiceProviderEntity.cs | 77 +++++++++ .../VData/Entitys/VSystemEntity.cs | 155 ++++++++++++++++++ .../VData/Entitys/VUserEntity.cs | 107 ++++++++++++ .../Services/ExternalSubjectRepository.cs | 9 + .../Services/IExternalSubjectRepository.cs | 9 + .../Services/IServiceProviderRepository.cs | 9 + .../VData/Services/ISystemRepository.cs | 9 + .../VData/Services/IUserRepository.cs | 9 + .../Services/ServiceProviderRepository.cs | 9 + .../VData/Services/SystemRepository.cs | 9 + .../VData/Services/UserRepository.cs | 9 + 13 files changed, 543 insertions(+) create mode 100644 src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs create mode 100644 src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs create mode 100644 src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs create mode 100644 src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/IUserRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/SystemRepository.cs create mode 100644 src/SJZY.Track.Repository/VData/Services/UserRepository.cs diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index 1583dea7..d88f7e29 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -38,6 +38,7 @@ + diff --git a/src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs new file mode 100644 index 00000000..9cff66ea --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs @@ -0,0 +1,131 @@ +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.Repository/VData/Entitys/VServiceProviderEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs new file mode 100644 index 00000000..45a28246 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs @@ -0,0 +1,77 @@ +namespace SJZY.Track.Repository.VData.Entitys +{ + /// + /// 服务商主表 + /// + [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.Repository/VData/Entitys/VSystemEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs new file mode 100644 index 00000000..76e5fcdb --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs @@ -0,0 +1,155 @@ +namespace SJZY.Track.Repository.VData.Entitys +{ + /// + /// + /// + [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.Repository/VData/Entitys/VUserEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs new file mode 100644 index 00000000..1049171f --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs @@ -0,0 +1,107 @@ +namespace SJZY.Track.Repository.VData.Entitys +{ + /// + /// 用户信息表 + /// + [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.Repository/VData/Services/ExternalSubjectRepository.cs b/src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs new file mode 100644 index 00000000..cc3763b1 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public class ExternalSubjectRepository : BasicRepository, IExternalSubjectRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs b/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs new file mode 100644 index 00000000..3860ca53 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public interface IExternalSubjectRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs b/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs new file mode 100644 index 00000000..bc3b5182 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public interface IServiceProviderRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs b/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs new file mode 100644 index 00000000..ae4864df --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public interface ISystemRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs b/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs new file mode 100644 index 00000000..63847127 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public interface IUserRepository : ISimpleClient + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs b/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs new file mode 100644 index 00000000..097c3ae7 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public class VServiceProviderRepository : BasicRepository, IServiceProviderRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs b/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs new file mode 100644 index 00000000..5193a325 --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public class SystemRepository : BasicRepository, ISystemRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/VData/Services/UserRepository.cs b/src/SJZY.Track.Repository/VData/Services/UserRepository.cs new file mode 100644 index 00000000..2a3b76df --- /dev/null +++ b/src/SJZY.Track.Repository/VData/Services/UserRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.VData.Services +{ + public class UserRepository : BasicRepository, IUserRepository, IScopedDependency + { + + } +} From 60839dee12340a409ae459c67965a3dcb6cf8d08 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 15:19:06 +0800 Subject: [PATCH 007/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 14 ++++--- .../EditTrackTemplateInputValidation.cs | 37 +++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 30ccccfa..1ea21e22 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -78,22 +78,26 @@ namespace SJZY.Track.Application.Services.TrackTemplates #region 私有方法 private async Task AddAsync(EditTrackTemplateInput input) { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackTemplateRepository.InsertAsync(entity); - return null; + return new UnifyResultDto("200", "新增成功", isTrue); } private async Task UpdateAsync(EditTrackTemplateInput input) { + var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id==input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity); - - return null; + return new UnifyResultDto("200", "修改成功", isTrue); } private async Task DeleteAsync(EditTrackTemplateInput input) { + var isTrue = await _trackTemplateRepository.DeleteByIdAsync(input.Id); - - return null; + return new UnifyResultDto("200", "删除成功", isTrue); } #endregion } 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..da2ac89b --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -0,0 +1,37 @@ +using FluentValidation; +using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Dtos.TrackTemplates; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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.Name).NotNull().WithMessage("模版名称必填!").NotEmpty().WithMessage("模版名称不能为空!"); + RuleFor(x => x.Code).NotNull().WithMessage("模版代码必填!").NotEmpty().WithMessage("模版代码不能为空!"); + }); + } + } +} From b4e0621a37ed07a75bd2d59a94f856d1dc9e2fc2 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 15:59:42 +0800 Subject: [PATCH 008/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 6 ++-- .../Services/TrackTemplateRepository.cs | 30 ++++++++++++++++--- .../ValueObjects/GetTrackTemplateDetailVO.cs | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 1ea21e22..eaa7d010 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -13,6 +13,9 @@ using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.Services.TrackTemplates { + /// + /// 轨迹模版 + /// [ApiExplorerSettings(GroupName = "轨迹模版")] [Route("/Track")] public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency @@ -49,8 +52,7 @@ namespace SJZY.Track.Application.Services.TrackTemplates /// [HttpGet("/Template/GetDetail")] public async Task> GetDetailAsync(int id) - { - //var detailInfo = await _trackTemplateRepository.GetFirstAsync(a => a.Id== id); + { var detailInfo = await _trackTemplateRepository.GetDetailAsync(id); if (detailInfo==null) { diff --git a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs index 7b3432a6..7a91300d 100644 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs @@ -1,5 +1,6 @@ using SJZY.Track.Repository.TrackTemplate.Entitys; using SJZY.Track.Repository.TrackTemplate.ValueObjects; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository.TrackTemplate.Services { @@ -16,9 +17,19 @@ namespace SJZY.Track.Repository.TrackTemplate.Services /// public async Task GetDetailAsync(int id) { - //await Context.Queryable().LeftJoin<> + var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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 new GetTrackTemplateDetailVO(); + return detail; } @@ -29,8 +40,19 @@ namespace SJZY.Track.Repository.TrackTemplate.Services /// public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { - - return null; + var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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)) + .Select((a, b) => new GetTrackTemplateListVO + { + Id=a.Id, + Code=a.Code, + CreateTime= a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + return pagedList; } } } diff --git a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs index 1ec9565f..b5393e84 100644 --- a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs +++ b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs @@ -65,6 +65,6 @@ namespace SJZY.Track.Repository.TrackTemplate.ValueObjects /// /// 创建时间 /// - public DateTime CreateTime { get; set; } + public DateTime? CreateTime { get; set; } } } 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 009/196] =?UTF-8?q?change=20=E9=A1=B9=E7=9B=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84=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 From 333862e8f9d561240c893aa95ed7f29e510b5f5b Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 15:59:42 +0800 Subject: [PATCH 010/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 1 + .../Services/TrackTemplateRepository.cs | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index eaa7d010..e74dbe83 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using SJZY.Track.Domain.TrackTemplateAggregate; using Volo.Abp.DependencyInjection; using Volo.Abp.ObjectMapping; diff --git a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs new file mode 100644 index 00000000..7a91300d --- /dev/null +++ b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs @@ -0,0 +1,58 @@ +using SJZY.Track.Repository.TrackTemplate.Entitys; +using SJZY.Track.Repository.TrackTemplate.ValueObjects; +using SJZY.Track.Repository.VData.Entitys; + +namespace SJZY.Track.Repository.TrackTemplate.Services +{ + public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency + { + public TrackTemplateRepository() + { + } + + /// + /// 获取轨迹模版明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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) + { + var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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)) + .Select((a, b) => new GetTrackTemplateListVO + { + Id=a.Id, + Code=a.Code, + CreateTime= a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + return pagedList; + } + } +} From c5e8d65906185e5ec919a488382f3178d1616051 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 15:19:06 +0800 Subject: [PATCH 011/196] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplateAutoMapperProfile.cs | 8 +- .../TrackTemplates/TrackTemplateService.cs | 197 +++++++++--------- .../Dtos/GetPageTrackTemplateVO.cs | 14 ++ .../Dtos/GetTrackTemplateDetailVO.cs | 63 ++++++ .../ITrackTemplateRepository.cs | 4 + .../VEntities}/VExternalSubjectEntity.cs | 0 .../VEntities/VServiceProviderEntity.cs | 76 +++++++ .../VEntities/VSystemEntity.cs | 154 ++++++++++++++ .../VEntities/VUserEntity.cs | 106 ++++++++++ .../Services/TrackTemplateRepository.cs | 58 ------ .../ValueObjects/GetPageTrackTemplateVO.cs | 21 -- .../ValueObjects/GetTrackTemplateDetailVO.cs | 70 ------- .../TrackTemplateRepository.cs | 59 +++++- .../VData/Entitys/VServiceProviderEntity.cs | 77 ------- .../VData/Entitys/VSystemEntity.cs | 155 -------------- .../VData/Entitys/VUserEntity.cs | 107 ---------- .../Services/ExternalSubjectRepository.cs | 9 - .../Services/IExternalSubjectRepository.cs | 9 - .../Services/IServiceProviderRepository.cs | 9 - .../VData/Services/ISystemRepository.cs | 9 - .../VData/Services/IUserRepository.cs | 9 - .../Services/ServiceProviderRepository.cs | 9 - .../VData/Services/SystemRepository.cs | 9 - .../VData/Services/UserRepository.cs | 9 - 24 files changed, 566 insertions(+), 675 deletions(-) create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs rename src/{SJZY.Track.Repository/VData/Entitys => SJZY.Track.Domain/VEntities}/VExternalSubjectEntity.cs (100%) create mode 100644 src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs create mode 100644 src/SJZY.Track.Domain/VEntities/VSystemEntity.cs create mode 100644 src/SJZY.Track.Domain/VEntities/VUserEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs delete mode 100644 src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs delete mode 100644 src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs delete mode 100644 src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs delete mode 100644 src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/IUserRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/SystemRepository.cs delete mode 100644 src/SJZY.Track.Repository/VData/Services/UserRepository.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index f715d0cf..e581521f 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,12 +1,6 @@ using AutoMapper; -using SJZY.Track.Application.Dtos.Demo; using SJZY.Track.Application.Dtos.TrackTemplates; -using SJZY.Track.Repository.TrackTemplate.ValueObjects; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; namespace SJZY.Track.Application.AutoMapper { diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index e74dbe83..3421669c 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,107 +1,102 @@ -using SJZY.Expand.ABP.Core.Common.Dto; -using SJZY.Track.Application.Dtos.TrackTemplates; -using SJZY.Track.Repository.TrackTemplate.Entitys; -using SJZY.Track.Repository.TrackTemplate.Services; -using SJZY.Track.Repository.TrackTemplate.ValueObjects; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using Volo.Abp.DependencyInjection; -using Volo.Abp.ObjectMapping; -namespace SJZY.Track.Application.Services.TrackTemplates +namespace SJZY.Track.Application.Services.TrackTemplates; + +/// +/// 轨迹模版 +/// +[ApiExplorerSettings(GroupName = "轨迹模版")] +[Route("/Track")] +public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency { - /// - /// 轨迹模版 - /// - [ApiExplorerSettings(GroupName = "轨迹模版")] - [Route("/Track")] - public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency + private readonly ITrackTemplateRepository _trackTemplateRepository; + + public TrackTemplateService( + ITrackTemplateRepository trackTemplateRepository + ) { - private readonly ITrackTemplateRepository _trackTemplateRepository; - - public TrackTemplateService( - ITrackTemplateRepository trackTemplateRepository - ) - { - this._trackTemplateRepository=trackTemplateRepository; - } - - /// - /// 轨迹模版编辑 - /// - /// - [HttpPost("/Template/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("/Template/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("/Template/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) - { - var entity = ObjectMapper.Map(input); - var isTrue = await _trackTemplateRepository.InsertAsync(entity); - - return new UnifyResultDto("200", "新增成功", isTrue); - } - - private async Task UpdateAsync(EditTrackTemplateInput input) - { - 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) - { - var isTrue = await _trackTemplateRepository.DeleteByIdAsync(input.Id); - - return new UnifyResultDto("200", "删除成功", isTrue); - } - #endregion + _trackTemplateRepository = trackTemplateRepository; } -} + + /// + /// 轨迹模版编辑 + /// + /// + [HttpPost("/Template/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("/Template/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("/Template/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) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackTemplateRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackTemplateInput input) + { + 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) + { + var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + + #endregion +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs new file mode 100644 index 00000000..88e54c4f --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +public class GetPageTrackTemplateVO: PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs new file mode 100644 index 00000000..72e19fcf --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs @@ -0,0 +1,63 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +/// +/// 获取轨迹模版明细 +/// +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; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs index ffa1a742..4a27aa53 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -5,4 +5,8 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { Task GetTemplateContentsAsync(List distinctTemplateIds); + + Task GetDetailAsync(int id); + + Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs b/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs similarity index 100% rename from src/SJZY.Track.Repository/VData/Entitys/VExternalSubjectEntity.cs rename to src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs diff --git a/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs b/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs new file mode 100644 index 00000000..eb9c74a4 --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs @@ -0,0 +1,76 @@ +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..a7166a5b --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs @@ -0,0 +1,154 @@ +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..eee0b80d --- /dev/null +++ b/src/SJZY.Track.Domain/VEntities/VUserEntity.cs @@ -0,0 +1,106 @@ +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.Repository/TrackTemplate/Services/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs deleted file mode 100644 index 7a91300d..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/Services/TrackTemplateRepository.cs +++ /dev/null @@ -1,58 +0,0 @@ -using SJZY.Track.Repository.TrackTemplate.Entitys; -using SJZY.Track.Repository.TrackTemplate.ValueObjects; -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.TrackTemplate.Services -{ - public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency - { - public TrackTemplateRepository() - { - } - - /// - /// 获取轨迹模版明细 - /// - /// - /// - public async Task GetDetailAsync(int id) - { - var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) - .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) - { - var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) - .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)) - .Select((a, b) => new GetTrackTemplateListVO - { - Id=a.Id, - Code=a.Code, - CreateTime= a.CreateTime, - Name = a.Name, - SubSystem = b.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); - return pagedList; - } - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs deleted file mode 100644 index 50c343e8..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetPageTrackTemplateVO.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Repository.TrackTemplate.ValueObjects -{ - public class GetPageTrackTemplateVO : PageInfoInput - { - /// - /// 子系统id - /// - public int SubSystemId { get; set; } - - /// - /// 关键字 - /// - public string Keywords { get; set; } - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs deleted file mode 100644 index b5393e84..00000000 --- a/src/SJZY.Track.Repository/TrackTemplate/ValueObjects/GetTrackTemplateDetailVO.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Repository.TrackTemplate.ValueObjects -{ - /// - /// 获取轨迹模版明细 - /// - 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; } - - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } - } -} diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 08370333..6ac4ef56 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -1,13 +1,58 @@ using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository.TrackTemplate +namespace SJZY.Track.Repository; + +public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { - public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency + public Task GetTemplateContentsAsync(List distinctTemplateIds) { - public Task GetTemplateContentsAsync(List distinctTemplateIds) - { - throw new NotImplementedException(); - } + throw new NotImplementedException(); } -} + + /// + /// 获取轨迹模版明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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) + { + var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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)) + .Select((a, b) => new GetTrackTemplateListVO + { + Id=a.Id, + Code=a.Code, + CreateTime= a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + return pagedList; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs deleted file mode 100644 index 45a28246..00000000 --- a/src/SJZY.Track.Repository/VData/Entitys/VServiceProviderEntity.cs +++ /dev/null @@ -1,77 +0,0 @@ -namespace SJZY.Track.Repository.VData.Entitys -{ - /// - /// 服务商主表 - /// - [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.Repository/VData/Entitys/VSystemEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs deleted file mode 100644 index 76e5fcdb..00000000 --- a/src/SJZY.Track.Repository/VData/Entitys/VSystemEntity.cs +++ /dev/null @@ -1,155 +0,0 @@ -namespace SJZY.Track.Repository.VData.Entitys -{ - /// - /// - /// - [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.Repository/VData/Entitys/VUserEntity.cs b/src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs deleted file mode 100644 index 1049171f..00000000 --- a/src/SJZY.Track.Repository/VData/Entitys/VUserEntity.cs +++ /dev/null @@ -1,107 +0,0 @@ -namespace SJZY.Track.Repository.VData.Entitys -{ - /// - /// 用户信息表 - /// - [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.Repository/VData/Services/ExternalSubjectRepository.cs b/src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs deleted file mode 100644 index cc3763b1..00000000 --- a/src/SJZY.Track.Repository/VData/Services/ExternalSubjectRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public class ExternalSubjectRepository : BasicRepository, IExternalSubjectRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs b/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs deleted file mode 100644 index 3860ca53..00000000 --- a/src/SJZY.Track.Repository/VData/Services/IExternalSubjectRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public interface IExternalSubjectRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs b/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs deleted file mode 100644 index bc3b5182..00000000 --- a/src/SJZY.Track.Repository/VData/Services/IServiceProviderRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public interface IServiceProviderRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs b/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs deleted file mode 100644 index ae4864df..00000000 --- a/src/SJZY.Track.Repository/VData/Services/ISystemRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public interface ISystemRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs b/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs deleted file mode 100644 index 63847127..00000000 --- a/src/SJZY.Track.Repository/VData/Services/IUserRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public interface IUserRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs b/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs deleted file mode 100644 index 097c3ae7..00000000 --- a/src/SJZY.Track.Repository/VData/Services/ServiceProviderRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public class VServiceProviderRepository : BasicRepository, IServiceProviderRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs b/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs deleted file mode 100644 index 5193a325..00000000 --- a/src/SJZY.Track.Repository/VData/Services/SystemRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public class SystemRepository : BasicRepository, ISystemRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/VData/Services/UserRepository.cs b/src/SJZY.Track.Repository/VData/Services/UserRepository.cs deleted file mode 100644 index 2a3b76df..00000000 --- a/src/SJZY.Track.Repository/VData/Services/UserRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.VData.Entitys; - -namespace SJZY.Track.Repository.VData.Services -{ - public class UserRepository : BasicRepository, IUserRepository, IScopedDependency - { - - } -} From e6d52a389494026490650e48c7c8c499ea5a4b51 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 17:25:30 +0800 Subject: [PATCH 012/196] examples --- .../SJZY.Track.Application.csproj | 4 ++ .../ProvideServices/TrackQueryService.cs | 10 +++ .../OrderAggregate/IOrderRepository.cs | 7 ++ .../ITrackPullConfigRepository.cs | 6 ++ .../TrackPullConfigEntity.cs | 46 ++++++++++++ .../TrackPullContentConfigEntity.cs | 70 ++++++++++++++++++ src/SJZY.Track.Domain/TransactionHelper.cs | 17 +++++ src/SJZY.Track.Repository/OrderRepository.cs | 5 ++ .../SJZY.Track.Repository.csproj | 2 - .../Entitys/TrackPullConfigEntity.cs | 47 ------------ .../Services/ITrackPullConfigRepository.cs | 9 --- .../Services/TrackPullConfigRepository.cs | 14 ---- .../TrackPullConfigRepository.cs | 9 +++ .../Entitys/TrackPullContentConfigEntity.cs | 71 ------------------- .../ITrackPullContentConfigRepository.cs | 9 --- .../TrackPullContentConfigRepository.cs | 9 --- 16 files changed, 174 insertions(+), 161 deletions(-) create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs create mode 100644 src/SJZY.Track.Domain/TransactionHelper.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPullConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index dd4d7e2a..678ee30c 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -26,4 +26,8 @@ + + + + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 4b70ff76..66803064 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,6 +1,7 @@ using SJZY.Track.Domain.OrderAggregate; using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain; using SJZY.Track.Repository.TrackDetails; namespace SJZY.Track.Application.Services.ProvideServices; @@ -60,6 +61,15 @@ public class TrackQueryService : ApplicationService return res; } + public async Task CreateOrder() + { + using var tran = TransactionHelper.GetReadCommitted(); + await _orderRepository.InsertAsync(new OrderEntity()); + await _orderRepository.CreateOrderTemplateAsync(new OrderTemplateEntity()); + + tran.Complete(); + } + private void TrackDetailSort(GetTrackOutput item, SortMethod sortMethod) { switch (sortMethod) diff --git a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs index 1dd02831..404224c0 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs @@ -10,4 +10,11 @@ public interface IOrderRepository : IBasicRepository /// /// Task> GetOrderTemplatesAsync(List distinctOrderNumbers); + + /// + /// 创建订单模板 + /// + /// + /// + Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs new file mode 100644 index 00000000..5ef232c9 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Domain.TrackPullAggregate; + +public interface ITrackPullConfigRepository : IBasicRepository +{ + +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs new file mode 100644 index 00000000..090e8078 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs @@ -0,0 +1,46 @@ +namespace SJZY.Track.Domain.TrackPullAggregate; + +/// +/// 轨迹拉取配置表 +/// +[SugarTable("t_track_pull_config")] +public class TrackPullConfigEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [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/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs new file mode 100644 index 00000000..f4194d72 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -0,0 +1,70 @@ +namespace SJZY.Track.Domain.TrackPullAggregate; + +/// +/// 轨迹拉取内容配置表 +/// +[SugarTable("t_track_pull_content_config")] +public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys +{ + + /// + /// 自增主键 + /// + [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 string TrackTimeZone { get; set; } + +} \ 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.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 07793394..7c04dba6 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -13,4 +13,9 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .Select() .ToListAsync(); } + + public async Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity) + { + await Context.Insertable(templateEntity).ExecuteCommandAsync(); + } } \ 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 0c731f1e..8752942a 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -27,8 +27,6 @@ - - diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs deleted file mode 100644 index 5efa67b0..00000000 --- a/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace SJZY.Track.Repository.TrackPullConfig.Entitys -{ - /// - /// 轨迹拉取配置表 - /// - [SugarTable("t_track_pull_config")] - public class TrackPullConfigEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs deleted file mode 100644 index 646bc6bc..00000000 --- a/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPullConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPullConfig.Services -{ - public interface ITrackPullConfigRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs deleted file mode 100644 index f99ae2ce..00000000 --- a/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using SJZY.Track.Repository.TrackPullConfig.Entitys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Repository.TrackPullConfig.Services -{ - public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs new file mode 100644 index 00000000..c67087b4 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -0,0 +1,9 @@ +using SJZY.Track.Domain.TrackPullAggregate; + +namespace SJZY.Track.Repository +{ + public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs deleted file mode 100644 index cf3e4b9d..00000000 --- a/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace SJZY.Track.Repository.TrackPullContentConfig.Entitys -{ - /// - /// 轨迹拉取内容配置表 - /// - [SugarTable("t_track_pull_content_config")] - public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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 string TrackTimeZone { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs deleted file mode 100644 index 9fce3f8a..00000000 --- a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPullContentConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPullContentConfig.Services -{ - public interface ITrackPullContentConfigRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs deleted file mode 100644 index 05ae7d19..00000000 --- a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPullContentConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPullContentConfig.Services -{ - public class TrackPullContentConfigRepository : BasicRepository, ITrackPullContentConfigRepository, IScopedDependency - { - - } -} From bac642c96ec8e8e5c50568a906ac910dfbc23ca5 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 17:31:48 +0800 Subject: [PATCH 013/196] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs | 2 +- .../TrackTemplateAggregate/Dtos/TemplateContentDto.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs index 88e54c4f..326a7d0c 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; -public class GetPageTrackTemplateVO: PageInfoInput +public class GetPageTrackTemplateVO : PageInfoInput { /// /// 子系统id diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs index 92be4c81..0906d25a 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs @@ -2,5 +2,5 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; public class TemplateContentDto { - + } \ No newline at end of file From a006804970f4838b42d4d8ca71560f19778770e0 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 18:19:22 +0800 Subject: [PATCH 014/196] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.props | 1 + .../Dtos/ProvideServices/CreateOrderInput.cs | 86 +++++++++++++++++++ .../Dtos/ProvideServices/LinkOrderInput.cs | 26 ++++++ .../SJZY.Track.Application.csproj | 4 +- .../Services/ProvideServices/OrderService.cs | 83 ++++++++++++++++++ .../ProvideServices/TrackQueryService.cs | 31 ++++--- .../OrderAggregate/IOrderRepository.cs | 4 +- src/SJZY.Track.Repository/OrderRepository.cs | 4 +- 8 files changed, 217 insertions(+), 22 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs diff --git a/common.props b/common.props index 9ad7e595..6dfdd8fe 100644 --- a/common.props +++ b/common.props @@ -2,6 +2,7 @@ latest enable + enable diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs new file mode 100644 index 00000000..b5b6520a --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs @@ -0,0 +1,86 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class CreateOrderInput +{ + public OrderInfo OrderInfo { get; set; } + + /// + /// 客户id + /// + public int ClientId { get; set; } + + /// + /// 订单模板 + /// + public List Templates { get; set; } + + /// + /// 订单明细 + /// + public OrderDetails Details { get; set; } +} + + +public class OrderTemplateInfo +{ + /// + /// 模板id + /// + [Required] + public int TemplateId { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } +} + +public class OrderDetails +{ + /// + /// 目的港口 + /// + public string? ArrivalPort { get; set; } + + /// + /// 起运港口 + /// + public string? LeavePort { get; set; } + + /// + /// 目的国家,必填 + /// + public string ArrivalCountry { get; set; } + + /// + /// 起运国家,必填 + /// + public string LeaveCountry { get; set; } + + /// + /// 目的城市,必填 + /// + public string ArrivalCity { get; set; } + + /// + /// 起运城市,必填 + /// + public string LeaveCity { get; set; } + + public List FligthInfos { get; set; } +} + +public class FligthInfo +{ + /// + /// 航班号 + /// + public string FlightNo { get; set; } + + /// + /// 班期 + /// + public string FlightDate { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs new file mode 100644 index 00000000..a9177890 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class LinkOrderInput +{ + public OrderInfo OrderInfo { get; set; } + + public List LinkedOrderInfos { get; set; } +} + + +public class OrderInfo +{ + /// + /// 订单类型 + /// + public int NoType { get; set; } + + /// + /// 订单号 + /// + [Required] + [MaxLength(100)] + public string OrderNo { get; set; } +} \ 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 678ee30c..58d32d12 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -1,10 +1,10 @@  + + net7.0 - enable True - 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..fa526c1e --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -0,0 +1,83 @@ +using Newtonsoft.Json; +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain; +using SJZY.Track.Domain.OrderAggregate; +using SJZY.UserCenter.HttpApi.Services; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 订单服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class OrderService: ApplicationService +{ + private readonly IOrderRepository _orderRepository; + + public OrderService(IOrderRepository orderRepository) + { + _orderRepository = orderRepository; + } + + /// + /// 创建订单 + /// + /// + /// + /// + [HttpPost("Order/Create")] + public async Task CreateOrderAsync(CreateOrderInput input) + { + if (await _orderRepository.IsAnyAsync(x => + x.OrderType == input.OrderInfo.NoType && x.OrderNo == input.OrderInfo.OrderNo)) + { + throw new BusinessException(message: $"单号:{input.OrderInfo.OrderNo}已存在"); + } + + var order = new OrderEntity + { + CustomId = input.ClientId, + OrderDetails = JsonConvert.SerializeObject(input.Details), + OrderNo = input.OrderInfo.OrderNo, + OrderType = input.OrderInfo.NoType, + SubSystemId = CurrentUserRequest.SubSystemId + }; + + using var tran = TransactionHelper.GetReadCommitted(); + + // 创建订单 + var orderId = await _orderRepository.InsertReturnIdentityAsync(order); + + // 创建订单模板 + var templates = input.Templates.Select(x => new OrderTemplateEntity + { + OrderId = orderId, + ServiceProviderId = x.ServiceProviderId, + TrackTemplateId = x.TemplateId + }).ToList(); + await _orderRepository.CreateOrderTemplatesAsync(templates); + tran.Complete(); + + return true; + } + + /// + /// 关联订单 + /// + /// + /// + [HttpPost("Order/Link")] + public async Task LinkOrderAsync(LinkOrderInput input) + { + // var distinctOrderNos = input.LinkedOrderInfos.Distinct().ToList(); + // + // var links = input.LinkedOrderInfos.Select(x => new OrderLinkEntity + // { + // LinkOrderId = x., + // OrderId = 0 + // }) + // _orderRepository.LinkOrderAsync(); + + return true; + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 66803064..c7d9b1ff 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,12 +1,14 @@ using SJZY.Track.Domain.OrderAggregate; using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Domain; using SJZY.Track.Repository.TrackDetails; namespace SJZY.Track.Application.Services.ProvideServices; -[ApiExplorerSettings(GroupName = "TrackQuery")] +/// +/// 轨迹查询服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; @@ -21,8 +23,14 @@ public class TrackQueryService : ApplicationService _trackTemplateRepository = trackTemplateRepository; } - [HttpPost("TrackQuery/GetTrack")] - public async Task> GetTrackAsync(GetTrackInput input) + /// + /// 根据订单号获取轨迹 + /// + /// + /// + /// + [HttpPost("TrackQuery/GetByOrderNos")] + public async Task> GetByOrderNosAsync(GetTrackInput input) { if (input.OrderNos.Count > 500) { @@ -30,9 +38,9 @@ public class TrackQueryService : ApplicationService } var res = new List(); - var distinctOrderNumbers = input.OrderNos.Distinct().ToList(); - var details = await _trackDetailsRepository.GetListAsync(distinctOrderNumbers); - var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(distinctOrderNumbers); + var distinctOrderNos = input.OrderNos.Distinct().ToList(); + var details = await _trackDetailsRepository.GetListAsync(distinctOrderNos); + var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(distinctOrderNos); var distinctTemplateIds = orderTemplates.Select(x => x.TrackTemplateId).Distinct().ToList(); var templateContents = await _trackTemplateRepository.GetTemplateContentsAsync(distinctTemplateIds); @@ -61,15 +69,6 @@ public class TrackQueryService : ApplicationService return res; } - public async Task CreateOrder() - { - using var tran = TransactionHelper.GetReadCommitted(); - await _orderRepository.InsertAsync(new OrderEntity()); - await _orderRepository.CreateOrderTemplateAsync(new OrderTemplateEntity()); - - tran.Complete(); - } - private void TrackDetailSort(GetTrackOutput item, SortMethod sortMethod) { switch (sortMethod) diff --git a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs index 404224c0..84ca93a2 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs @@ -14,7 +14,7 @@ public interface IOrderRepository : IBasicRepository /// /// 创建订单模板 /// - /// + /// /// - Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity); + Task CreateOrderTemplatesAsync(List templateEntities); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 7c04dba6..1aa6978b 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -14,8 +14,8 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .ToListAsync(); } - public async Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity) + public async Task CreateOrderTemplatesAsync(List templateEntities) { - await Context.Insertable(templateEntity).ExecuteCommandAsync(); + await Context.Insertable(templateEntities).ExecuteCommandAsync(); } } \ No newline at end of file From ced9b2144b423bac62f12ecccfd80e6b41681407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 27 Feb 2024 18:41:11 +0800 Subject: [PATCH 015/196] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A2=86=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplicationModule.cs | 4 +- .../AutoMapper/AutoMapperProfile.cs | 2 +- .../Dtos/ProvideServices/GetTrackInput.cs | 4 +- .../GetPageTrackTemplateInput.cs | 12 +-- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 13 +-- src/SJZY.Track.Application/GlobalUsing.cs | 1 - .../Services/Demo/InterFaceDemoService.cs | 6 +- .../ProvideServices/TrackQueryService.cs | 4 +- .../TrackTemplates/ITrackTemplateService.cs | 8 +- .../TrackTemplates/TrackTemplateService.cs | 22 +++-- .../EditTrackTemplateInputValidation.cs | 6 -- src/SJZY.Track.Domain/GlobalUsings.cs | 6 +- src/SJZY.Track.Domain/IBasicRepository.cs | 22 ++--- .../SJZY.Track.Domain.csproj | 8 ++ .../SJZYTrackDomainModule.cs | 2 +- .../ITrackContentRepository.cs | 6 ++ .../TrackContentEntity.cs | 50 +++++++++++ .../TrackContentMapEntity.cs | 26 ++++++ .../TrackDetailsIndex.cs | 2 +- .../ITrackFlagRepository.cs | 5 ++ .../TrackFlagAggregate/TrackFlagEntity.cs | 32 +++++++ .../TrackPushPullParamsConfigEntity.cs | 80 ++++++++++++++++++ .../ITrackPushConfigRepository.cs | 5 ++ .../TrackPushConfigEntity.cs | 44 ++++++++++ .../TrackPushContentConfigEntity.cs | 74 +++++++++++++++++ .../ITrackStatusRepository.cs | 5 ++ .../TrackStatusAggregate/TrackStatusEntity.cs | 44 ++++++++++ .../Dtos/GetContentPageInputVO.cs | 9 ++ .../Dtos/GetContentPageOutputVO.cs | 71 ++++++++++++++++ .../ITrackTemplateRepository.cs | 4 +- .../TrackTemplateContentEntity.cs | 2 - .../VEntities/VSystemEntity.cs | 4 +- src/SJZY.Track.Repository/BasicRepository.cs | 8 +- src/SJZY.Track.Repository/DemoRepository.cs | 4 +- .../SJZY.Track.Repository.csproj | 7 -- .../SJZYTrackRepositoryModule.cs | 4 +- .../Entitys/TrackContentEntity.cs | 53 ------------ .../Services/ITrackContentRepository.cs | 9 -- .../Services/TrackContentRepository.cs | 9 -- .../Entitys/TrackContentMapEntity.cs | 29 ------- .../Services/ITrackContentMapRepository.cs | 9 -- .../Services/TrackContentMapRepository.cs | 9 -- .../TrackContentRepository.cs | 7 ++ .../TrackDetailsRepository.cs | 4 +- .../TrackFlag/Entitys/TrackFlagEntity.cs | 35 -------- .../Services/ITrackFlagRepository.cs | 9 -- .../TrackFlag/Services/TrackFlagRepository.cs | 9 -- .../TrackFlagRepository.cs | 7 ++ .../TrackPullConfigRepository.cs | 10 +-- .../Entitys/TrackPushConfigEntity.cs | 47 ----------- .../Services/ITrackPushConfigRepository.cs | 9 -- .../Services/TrackPushConfigRepository.cs | 9 -- .../TrackPushConfigRepository.cs | 7 ++ .../Entitys/TrackPushContentConfigEntity.cs | 77 ----------------- .../ITrackPushContentConfigRepository.cs | 9 -- .../TrackPushContentConfigRepository.cs | 9 -- .../TrackPushPullParamsConfigEntity.cs | 83 ------------------- .../ITrackPushPullParamsConfigRepository.cs | 9 -- .../TrackPushPullParamsConfigRepository.cs | 14 ---- .../TrackStatus/Entitys/TrackStatusEntity.cs | 47 ----------- .../Services/ITrackStatusRepository.cs | 9 -- .../Services/TrackStatusRepository.cs | 9 -- .../TrackStatusRepository.cs | 7 ++ .../TrackTemplateRepository.cs | 48 +++++++---- 64 files changed, 586 insertions(+), 612 deletions(-) create mode 100644 src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs create mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs delete mode 100644 src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackContentRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackFlagRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs delete mode 100644 src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackStatusRepository.cs diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs index 286821bf..899bceee 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/ApplicationModule.cs @@ -1,6 +1,6 @@ -using SJZY.Track.Domain; -using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; using Volo.Abp.AspNetCore.Mvc; diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs index 59910582..e2f97051 100644 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs @@ -1,7 +1,7 @@ using AutoMapper; +using SJZY.Track.Application.Dtos.Demo; using SJZY.Track.Domain.DemoAggregate; using SJZY.Track.Domain.DemoAggregate.Dtos; -using SJZY.Track.Application.Dtos.Demo; namespace SJZY.Track.Application.AutoMapper; diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs index c1e68789..2dc3c39a 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs @@ -24,12 +24,12 @@ public enum SortMethod /// 按轨迹发生时间排序 /// ByTrackTime, - + /// /// 按轨迹发生时间降序 /// ByTrackTimeDesc, - + /// /// 按订单模板排序 /// diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index c118b36b..1c98499d 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Dtos.TrackTemplates { /// /// 获取轨迹模版分页输入 @@ -14,11 +8,11 @@ namespace SJZY.Track.Application.Dtos.TrackTemplates /// /// 子系统id /// - public int SubSystemId { get; set; } + public int SubSystemId { get; set; } /// /// 关键字 /// - public string Keywords { get; set; } + public string Keywords { get; set; } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs index ca928b8c..03b4f535 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -1,11 +1,4 @@ -using Microsoft.OpenApi.Writers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Dtos.TrackTemplates { /// /// 获取轨迹模版详情 @@ -77,12 +70,12 @@ namespace SJZY.Track.Application.Dtos.TrackTemplates /// /// Id /// - public int Id { set; get; } + public int Id { set; get; } /// /// 操作类型 /// - public OptionType Options { get; set; } + public OptionType Options { get; set; } /// /// 子系统id diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs index 3ee457cc..e21f1746 100644 --- a/src/SJZY.Track.Application/GlobalUsing.cs +++ b/src/SJZY.Track.Application/GlobalUsing.cs @@ -2,7 +2,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 Volo.Abp; global using Volo.Abp.Application.Services; global using Volo.Abp.Validation; diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs index e7781daf..f8170079 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.Track.Domain.DemoAggregate; -using SJZY.Track.Domain.DemoAggregate.Dtos; -using SJZY.Expand.ABP.Core.Common; +using SJZY.Expand.ABP.Core.Common; using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Domain.DemoAggregate; +using SJZY.Track.Domain.DemoAggregate.Dtos; 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 index 66803064..0cafaeb6 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,7 +1,7 @@ -using SJZY.Track.Domain.OrderAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain; +using SJZY.Track.Domain.OrderAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Repository.TrackDetails; namespace SJZY.Track.Application.Services.ProvideServices; diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs index b082a1ff..f6e29107 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackTemplates +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 index 3421669c..acd21ae5 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -9,11 +9,12 @@ namespace SJZY.Track.Application.Services.TrackTemplates; /// 轨迹模版 /// [ApiExplorerSettings(GroupName = "轨迹模版")] -[Route("/Track")] +[Route("/Track/Template")] public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency { private readonly ITrackTemplateRepository _trackTemplateRepository; + /// public TrackTemplateService( ITrackTemplateRepository trackTemplateRepository ) @@ -25,7 +26,7 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I /// 轨迹模版编辑 /// /// - [HttpPost("/Template/Edit")] + [HttpPost("Edit")] public async Task EditAsync(EditTrackTemplateInput input) { return input.Options switch @@ -42,7 +43,7 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I /// /// /// - [HttpGet("/Template/GetDetail")] + [HttpGet("GetDetail")] public async Task> GetDetailAsync(int id) { var detailInfo = await _trackTemplateRepository.GetDetailAsync(id); @@ -60,7 +61,7 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I /// /// /// - [HttpPost("/Template/GetList")] + [HttpPost("GetList")] public async Task> GetPageTrackTemplate(GetPageTrackTemplateInput input) { var vo = ObjectMapper.Map(input); @@ -98,5 +99,16 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I return new UnifyResultDto("200", "删除成功", isTrue); } - #endregion + #endregion 私有方法 + + /// + /// 轨迹模板内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync([FromBody] GetContentPageInputVO input) + { + return await _trackTemplateRepository.GetContentPageAsync(input); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs index da2ac89b..412e5ef9 100644 --- a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; using SJZY.Track.Application.Dtos.TrackTemplates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SJZY.Track.Application.Validations.TrackTemplates { diff --git a/src/SJZY.Track.Domain/GlobalUsings.cs b/src/SJZY.Track.Domain/GlobalUsings.cs index e12a965a..439aa8ea 100644 --- a/src/SJZY.Track.Domain/GlobalUsings.cs +++ b/src/SJZY.Track.Domain/GlobalUsings.cs @@ -1,9 +1,9 @@ // 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.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 index 3daf3e9d..05560f86 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -8,8 +8,8 @@ public interface IBasicRepository /// /// Task GetFirstAsync(Expression> whereExpression); - - Task GetFirstAsync(Expression> whereExpression,Expression> resultExpression); + + Task GetFirstAsync(Expression> whereExpression, Expression> resultExpression); /// /// get list @@ -17,8 +17,8 @@ public interface IBasicRepository /// /// Task> GetListAsync(Expression> whereExpression); - - Task> GetListAsync(Expression> whereExpression,Expression> resultExpression); + + Task> GetListAsync(Expression> whereExpression, Expression> resultExpression); /// /// count @@ -33,7 +33,7 @@ public interface IBasicRepository /// /// Task IsAnyAsync(Expression> exp); - + /// /// update /// @@ -41,7 +41,7 @@ public interface IBasicRepository /// 要忽略更新的列 /// Task UpdateAsync(T entity, Expression> ignoreColumns); - + /// /// update /// @@ -58,7 +58,7 @@ public interface IBasicRepository /// 不更新默认值列 /// Task UpdateAsync(T entity, bool ignoreAllNullColumns = false, bool ignoreAllDefaultValue = false); - + /// /// 批量更新 /// @@ -66,28 +66,28 @@ public interface IBasicRepository /// 要更新的列 /// Task UpdateRangeAsync(List entities, Expression> updateColumns = null); - + /// /// 软删 /// /// /// Task SoftDeleteAsync(Expression> where); - + /// /// insert /// /// /// Task InsertAsync(T insertObj); - + /// /// 新增返回id /// /// /// Task InsertReturnIdentityAsync(T insertObj); - + /// /// 批量insert /// diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 811cfbce..43e82900 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -10,5 +10,13 @@ + + + + + + + + diff --git a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs index 09ae6214..e9c743d8 100644 --- a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs +++ b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs @@ -2,6 +2,6 @@ namespace SJZY.Track.Domain; -public class SJZYTrackDomainModule:AbpModule +public class SJZYTrackDomainModule : AbpModule { } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs new file mode 100644 index 00000000..110f297e --- /dev/null +++ b/src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Domain.TrackContentAggregate +{ + public interface ITrackContentRepository : IBasicRepository + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs b/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs new file mode 100644 index 00000000..baaa22de --- /dev/null +++ b/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs @@ -0,0 +1,50 @@ +namespace SJZY.Track.Domain.TrackContentAggregate; + +/// +/// 轨迹内容 +/// +[SugarTable("t_track_content")] +public class TrackContentEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹内容代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + [SugarColumn(ColumnName = "Content")] + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + [SugarColumn(ColumnName = "EnContent")] + public string EnContent { get; set; } + + /// + /// 子系统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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs b/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs new file mode 100644 index 00000000..d09351b9 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs @@ -0,0 +1,26 @@ +namespace SJZY.Track.Domain.TrackContentAggregate; + +/// +/// 轨迹内容映射表 +/// +[SugarTable("t_track_content_map")] +public class TrackContentMapEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 映射轨迹内容id + /// + [SugarColumn(ColumnName = "MapTrackContentId")] + public int MapTrackContentId { get; set; } + + /// + /// 源轨迹内容id + /// + [SugarColumn(ColumnName = "TrackContentId")] + public int TrackContentId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs index b81817ef..d82c1cfc 100644 --- a/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -47,7 +47,7 @@ public class TrackDetailsIndex : IdBaseIndex /// 原轨迹内容 /// public string OriginTrackContent { get; set; } - + /// /// 原轨迹报文 /// diff --git a/src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs b/src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs new file mode 100644 index 00000000..1242e908 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.TrackFlagAggregate; + +public interface ITrackFlagRepository : IBasicRepository +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs b/src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs new file mode 100644 index 00000000..5a74c55e --- /dev/null +++ b/src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs @@ -0,0 +1,32 @@ +namespace SJZY.Track.Domain.TrackFlagAggregate; + +/// +/// 轨迹标记表 +/// +[SugarTable("t_track_flag")] +public class TrackFlagEntity : 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.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs new file mode 100644 index 00000000..7473bf76 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs @@ -0,0 +1,80 @@ +namespace SJZY.Track.Domain.TrackPullAggregate; + +/// +/// 轨迹拉取/推送参数配置 +/// +[SugarTable("t_track_push_pull_params_config")] +public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [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/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs new file mode 100644 index 00000000..6f3474b0 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.TrackPushAggregate; + +public interface ITrackPushConfigRepository : IBasicRepository +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs b/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs new file mode 100644 index 00000000..334b93c1 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.TrackPushAggregate; + +/// +/// 轨迹推送配置表 +/// +[SugarTable("t_track_push_config")] +public class TrackPushConfigEntity : 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 = "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/TrackPushAggregate/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs new file mode 100644 index 00000000..db2e408b --- /dev/null +++ b/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs @@ -0,0 +1,74 @@ +namespace SJZY.Track.Domain.TrackPushAggregate; + +/// +/// 轨迹推送内容配置表 +/// +[SugarTable("t_track_push_content_config")] +public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [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 string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs new file mode 100644 index 00000000..bdb5a17d --- /dev/null +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.TrackStatusAggregate; + +public interface ITrackStatusRepository : IBasicRepository +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs new file mode 100644 index 00000000..f23c8340 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs @@ -0,0 +1,44 @@ +namespace SJZY.Track.Domain.TrackStatusAggregate; + +/// +/// 轨迹状态表 +/// +[SugarTable("t_track_status")] +public class TrackStatusEntity : IFullAuditedBasicEntitys +{ + /// + /// 自增主键 + /// + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 轨迹状态代码 + /// + [SugarColumn(ColumnName = "Code")] + public string Code { get; set; } + + /// + /// 轨迹状态英文 + /// + [SugarColumn(ColumnName = "EnStatus")] + public string EnStatus { get; set; } + + /// + /// 所属节点(主数据枚举ServiceNode) + /// + [SugarColumn(ColumnName = "Node")] + public int Node { get; set; } + + /// + /// 轨迹状态 + /// + [SugarColumn(ColumnName = "Status")] + public string Status { get; set; } + + /// + /// 子系统id + /// + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs new file mode 100644 index 00000000..396fe85b --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +public class GetContentPageInputVO : PageInfoInput +{ + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs new file mode 100644 index 00000000..945a4978 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs @@ -0,0 +1,71 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; + +public class GetContentPageOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 创建时间 + /// + public string CreateTime { get; set; } + + /// + /// 创建人 + /// + public string CreateUser { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + public long? Id { get; set; } + + /// + /// 是否可删 + /// + public bool? IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool? IsExternal { get; set; } + + /// + /// 所属节点 + /// + public string Node { get; set; } + + /// + /// 排序 + /// + public long? Sort { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } + + /// + /// 所属状态 + /// + public string TrackStatus { get; set; } + + /// + /// 修改时间 + /// + public string UpdateTime { get; set; } + + /// + /// 修改人 + /// + public string UpdateUser { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs index 4a27aa53..241f85ca 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -5,8 +5,10 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { Task GetTemplateContentsAsync(List distinctTemplateIds); - + Task GetDetailAsync(int id); Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); + + Task> GetContentPageAsync(GetContentPageInputVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs index 4263d227..95f666ae 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs @@ -6,7 +6,6 @@ [SugarTable("t_track_template_content")] public class TrackTemplateContentEntity : IFullAuditedBasicEntitys { - /// /// 自增主键 /// @@ -42,5 +41,4 @@ public class TrackTemplateContentEntity : IFullAuditedBasicEntitys /// [SugarColumn(ColumnName = "TrackTemplateId")] public int TrackTemplateId { 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 index a7166a5b..e1ba1115 100644 --- a/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs +++ b/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs @@ -125,8 +125,8 @@ public class VSystemEntity : IFullAuditedBasicEntitys /// 排序值 /// [SugarColumn(ColumnName = "Sort")] - public int? Sort { get; set; } - + public int? Sort { get; set; } + /// /// 跨境电商物流1 干线物流2 国内代理贸易3 非业务类4 /// diff --git a/src/SJZY.Track.Repository/BasicRepository.cs b/src/SJZY.Track.Repository/BasicRepository.cs index fa2ed22b..d6ed5564 100644 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ b/src/SJZY.Track.Repository/BasicRepository.cs @@ -1,5 +1,5 @@ -using System.Linq.Expressions; -using SJZY.Track.Domain; +using SJZY.Track.Domain; +using System.Linq.Expressions; using Volo.Abp; namespace SJZY.Track.Repository; @@ -8,7 +8,7 @@ namespace SJZY.Track.Repository; /// 仓储基类实现 /// /// -public class BasicRepository : SimpleClient,IBasicRepository where T : class, new() +public class BasicRepository : SimpleClient, IBasicRepository where T : class, new() { public BasicRepository() { @@ -63,7 +63,7 @@ public class BasicRepository : SimpleClient,IBasicRepository where T : // tips: required where if (where == default) return false; - + return await Context.Updateable() .Where(where) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) diff --git a/src/SJZY.Track.Repository/DemoRepository.cs b/src/SJZY.Track.Repository/DemoRepository.cs index 6cdfe78b..3d8135f9 100644 --- a/src/SJZY.Track.Repository/DemoRepository.cs +++ b/src/SJZY.Track.Repository/DemoRepository.cs @@ -1,6 +1,6 @@ -using System.Transactions; -using SJZY.Track.Domain.DemoAggregate; +using SJZY.Track.Domain.DemoAggregate; using SJZY.Track.Domain.DemoAggregate.Dtos; +using System.Transactions; namespace SJZY.Track.Repository { diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index 8752942a..e4341712 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -24,15 +24,8 @@ - - - - - - - diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index 61701b13..2d26e40d 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -32,8 +32,8 @@ public class SJZYTrackRepositoryModule : AbpModule } ); }, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository"); - - + + context.Services.AddScoped(typeof(IBasicRepository<>), typeof(BasicRepository<>)); diff --git a/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs b/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs deleted file mode 100644 index 29ef777a..00000000 --- a/src/SJZY.Track.Repository/TrackContent/Entitys/TrackContentEntity.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace SJZY.Track.Repository.TrackContent.Entitys -{ - /// - /// 轨迹内容 - /// - [SugarTable("t_track_content")] - public class TrackContentEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 轨迹内容代码 - /// - [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } - - /// - /// 轨迹内容 - /// - [SugarColumn(ColumnName = "Content")] - public string Content { get; set; } - - /// - /// 轨迹内容英文 - /// - [SugarColumn(ColumnName = "EnContent")] - public string EnContent { get; set; } - - /// - /// 子系统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; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs deleted file mode 100644 index e07a950a..00000000 --- a/src/SJZY.Track.Repository/TrackContent/Services/ITrackContentRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackContent.Entitys; - -namespace SJZY.Track.Repository.TrackContent.Services -{ - public interface ITrackContentRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs deleted file mode 100644 index 28163046..00000000 --- a/src/SJZY.Track.Repository/TrackContent/Services/TrackContentRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackContent.Entitys; - -namespace SJZY.Track.Repository.TrackContent.Services -{ - public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs b/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs deleted file mode 100644 index b8b5f757..00000000 --- a/src/SJZY.Track.Repository/TrackContentMap/Entitys/TrackContentMapEntity.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace SJZY.Track.Repository.TrackContentMap.Entitys -{ - /// - /// 轨迹内容映射表 - /// - [SugarTable("t_track_content_map")] - public class TrackContentMapEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 映射轨迹内容id - /// - [SugarColumn(ColumnName = "MapTrackContentId")] - public int MapTrackContentId { get; set; } - - /// - /// 源轨迹内容id - /// - [SugarColumn(ColumnName = "TrackContentId")] - public int TrackContentId { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs b/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs deleted file mode 100644 index 9aab5da6..00000000 --- a/src/SJZY.Track.Repository/TrackContentMap/Services/ITrackContentMapRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackContentMap.Entitys; - -namespace SJZY.Track.Repository.TrackContentMap.Services -{ - public interface ITrackContentMapRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs b/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs deleted file mode 100644 index 4e6783c4..00000000 --- a/src/SJZY.Track.Repository/TrackContentMap/Services/TrackContentMapRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackContentMap.Entitys; - -namespace SJZY.Track.Repository.TrackContentMap.Services -{ - public class TrackContentMapRepository : BasicRepository, ITrackContentMapRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs new file mode 100644 index 00000000..8214de10 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -0,0 +1,7 @@ +using SJZY.Track.Domain.TrackContentAggregate; + +namespace SJZY.Track.Repository; + +public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs index 3431bd6b..2b16dde8 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs @@ -1,8 +1,8 @@ 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.Domain.TrackDetailsAggregate; using SJZY.Track.Repository.TrackDetails; using SJZY.Track.Repository.TrackDetails.Dtos; @@ -33,7 +33,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract> 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) diff --git a/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs b/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs deleted file mode 100644 index 11b86c26..00000000 --- a/src/SJZY.Track.Repository/TrackFlag/Entitys/TrackFlagEntity.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace SJZY.Track.Repository.TrackFlag.Entitys -{ - /// - /// 轨迹标记表 - /// - [SugarTable("t_track_flag")] - public class TrackFlagEntity : 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/TrackFlag/Services/ITrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs deleted file mode 100644 index 709655e5..00000000 --- a/src/SJZY.Track.Repository/TrackFlag/Services/ITrackFlagRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackFlag.Entitys; - -namespace SJZY.Track.Repository.TrackFlag.Services -{ - public interface ITrackFlagRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs deleted file mode 100644 index 2a6977fc..00000000 --- a/src/SJZY.Track.Repository/TrackFlag/Services/TrackFlagRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackFlag.Entitys; - -namespace SJZY.Track.Repository.TrackFlag.Services -{ - public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlagRepository.cs new file mode 100644 index 00000000..360c71fd --- /dev/null +++ b/src/SJZY.Track.Repository/TrackFlagRepository.cs @@ -0,0 +1,7 @@ +using SJZY.Track.Domain.TrackFlagAggregate; + +namespace SJZY.Track.Repository; + +public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index c67087b4..85723f1e 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -1,9 +1,7 @@ using SJZY.Track.Domain.TrackPullAggregate; -namespace SJZY.Track.Repository -{ - public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency - { +namespace SJZY.Track.Repository; - } -} +public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs deleted file mode 100644 index 5c99ec50..00000000 --- a/src/SJZY.Track.Repository/TrackPushConfig/Entitys/TrackPushConfigEntity.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace SJZY.Track.Repository.TrackPushConfig.Entitys -{ - /// - /// 轨迹推送配置表 - /// - [SugarTable("t_track_push_config")] - public class TrackPushConfigEntity : 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 = "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.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs deleted file mode 100644 index 72f31a32..00000000 --- a/src/SJZY.Track.Repository/TrackPushConfig/Services/ITrackPushConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPushConfig.Services -{ - public interface ITrackPushConfigRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs deleted file mode 100644 index 529fef74..00000000 --- a/src/SJZY.Track.Repository/TrackPushConfig/Services/TrackPushConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPushConfig.Services -{ - public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs new file mode 100644 index 00000000..b47db5ee --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -0,0 +1,7 @@ +using SJZY.Track.Domain.TrackPushAggregate; + +namespace SJZY.Track.Repository; + +public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs deleted file mode 100644 index 7caefd7a..00000000 --- a/src/SJZY.Track.Repository/TrackPushContentConfig/Entitys/TrackPushContentConfigEntity.cs +++ /dev/null @@ -1,77 +0,0 @@ -namespace SJZY.Track.Repository.TrackPushContentConfig.Entitys -{ - /// - /// 轨迹推送内容配置表 - /// - [SugarTable("t_track_push_content_config")] - public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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 string TrackTimeZone { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs deleted file mode 100644 index aac710d9..00000000 --- a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/ITrackPushContentConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushContentConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPushContentConfig.Services -{ - public interface ITrackPushContentConfigRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs deleted file mode 100644 index 0c2eb86e..00000000 --- a/src/SJZY.Track.Repository/TrackPushContentConfig/Services/TrackPushContentConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushContentConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPushContentConfig.Services -{ - public class TrackPushContentConfigRepository : BasicRepository, ITrackPushContentConfigRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs deleted file mode 100644 index 3f0ca590..00000000 --- a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Entitys/TrackPushPullParamsConfigEntity.cs +++ /dev/null @@ -1,83 +0,0 @@ -namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys -{ - /// - /// 轨迹拉取/推送参数配置 - /// - [SugarTable("t_track_push_pull_params_config")] - public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [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.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs deleted file mode 100644 index 4098b145..00000000 --- a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/ITrackPushPullParamsConfigRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys; - -namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Services -{ - public interface ITrackPushPullParamsConfigRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs deleted file mode 100644 index a24556d1..00000000 --- a/src/SJZY.Track.Repository/TrackPushPullParamsConfig/Services/TrackPushPullParamsConfigRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using SJZY.Track.Repository.TrackPushPullParamsConfig.Entitys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Repository.TrackPushPullParamsConfig.Services -{ - public class TrackPushPullParamsConfigRepository : BasicRepository, ITrackPushPullParamsConfigRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs b/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs deleted file mode 100644 index f0d60726..00000000 --- a/src/SJZY.Track.Repository/TrackStatus/Entitys/TrackStatusEntity.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace SJZY.Track.Repository.TrackStatus.Entitys -{ - /// - /// 轨迹状态表 - /// - [SugarTable("t_track_status")] - public class TrackStatusEntity : IFullAuditedBasicEntitys - { - - /// - /// 自增主键 - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 轨迹状态代码 - /// - [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } - - /// - /// 轨迹状态英文 - /// - [SugarColumn(ColumnName = "EnStatus")] - public string EnStatus { get; set; } - - /// - /// 所属节点(主数据枚举ServiceNode) - /// - [SugarColumn(ColumnName = "Node")] - public int Node { get; set; } - - /// - /// 轨迹状态 - /// - [SugarColumn(ColumnName = "Status")] - public string Status { get; set; } - - /// - /// 子系统id - /// - [SugarColumn(ColumnName = "SubSystemId")] - public int SubSystemId { get; set; } - - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs deleted file mode 100644 index aeed1fbf..00000000 --- a/src/SJZY.Track.Repository/TrackStatus/Services/ITrackStatusRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackStatus.Entitys; - -namespace SJZY.Track.Repository.TrackStatus.Services -{ - public interface ITrackStatusRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs deleted file mode 100644 index 67425dff..00000000 --- a/src/SJZY.Track.Repository/TrackStatus/Services/TrackStatusRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackStatus.Entitys; - -namespace SJZY.Track.Repository.TrackStatus.Services -{ - public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs new file mode 100644 index 00000000..6ac8f9cc --- /dev/null +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -0,0 +1,7 @@ +using SJZY.Track.Domain.TrackStatusAggregate; + +namespace SJZY.Track.Repository; + +public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 6ac4ef56..9d71866a 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Domain.TrackContentAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using SJZY.Track.Domain.VEntities; @@ -10,7 +11,7 @@ public class TrackTemplateRepository : BasicRepository, ITr { throw new NotImplementedException(); } - + /// /// 获取轨迹模版明细 /// @@ -18,22 +19,21 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task GetDetailAsync(int id) { - var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) - .Where((a, b) => a.Id==id) + var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem=b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } - /// /// 分页获取轨迹模版 /// @@ -41,18 +41,30 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { - var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) - .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)) + var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + .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)) .Select((a, b) => new GetTrackTemplateListVO { - Id=a.Id, - Code=a.Code, - CreateTime= a.CreateTime, + Id = a.Id, + Code = a.Code, + CreateTime = a.CreateTime, Name = a.Name, SubSystem = b.CnName }) .ToPagedListAsync(input.PageIndex, input.PageSize); return pagedList; } + + public async Task> GetContentPageAsync(GetContentPageInputVO input) + { + return await AsSugarClient().Queryable() + .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id) + .Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId) + .Select((templateContent, trackContent) => new GetContentPageOutputVO + { + Id = templateContent.Id + }, true) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 0a3a9b18221271f8af9a5bfad106361326d5efd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 27 Feb 2024 19:22:48 +0800 Subject: [PATCH 016/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 10 +- .../Dtos/GetContentPageOutputVO.cs | 4 +- .../VEntities/VEnumValueInfo.cs | 50 ++++ .../VEntities/VExternalSubjectEntity.cs | 213 +++++++++--------- .../VEntities/VServiceProviderEntity.cs | 2 - .../VEntities/VSystemEntity.cs | 4 +- .../VEntities/VUserEntity.cs | 2 - src/SJZY.Track.Repository/Enum/Enums.cs | 15 ++ .../TrackTemplateRepository.cs | 32 ++- 9 files changed, 207 insertions(+), 125 deletions(-) create mode 100644 src/SJZY.Track.Domain/VEntities/VEnumValueInfo.cs create mode 100644 src/SJZY.Track.Repository/Enum/Enums.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index acd21ae5..c901720b 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,4 +1,6 @@ -using SJZY.Track.Application.Dtos.TrackTemplates; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Localization; using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using Volo.Abp.DependencyInjection; @@ -12,13 +14,15 @@ namespace SJZY.Track.Application.Services.TrackTemplates; [Route("/Track/Template")] public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency { + private readonly IStringLocalizer _stringLocalizer; private readonly ITrackTemplateRepository _trackTemplateRepository; /// public TrackTemplateService( - ITrackTemplateRepository trackTemplateRepository - ) + IStringLocalizer stringLocalizer, + ITrackTemplateRepository trackTemplateRepository) { + _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; } diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs index 945a4978..582cef6a 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs @@ -15,7 +15,7 @@ public class GetContentPageOutputVO /// /// 创建时间 /// - public string CreateTime { get; set; } + public DateTime? CreateTime { get; set; } /// /// 创建人 @@ -62,7 +62,7 @@ public class GetContentPageOutputVO /// /// 修改时间 /// - public string UpdateTime { get; set; } + public DateTime? UpdateTime { get; set; } /// /// 修改人 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 index 9cff66ea..51bea216 100644 --- a/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs +++ b/src/SJZY.Track.Domain/VEntities/VExternalSubjectEntity.cs @@ -1,131 +1,128 @@ -namespace SJZY.Track.Repository.VData.Entitys +namespace SJZY.Track.Repository.VData.Entitys; + +/// +/// 外部主体 +/// +[SugarTable("v_external_subject")] +public class VExternalSubjectEntity : IFullAuditedBasicEntitys { /// - /// 外部主体 + /// /// - [SugarTable("v_external_subject")] - public class VExternalSubjectEntity : IFullAuditedBasicEntitys - { + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } - /// - /// - /// - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } + /// + /// 公司简称 + /// + [SugarColumn(ColumnName = "Abbreviation")] + public string Abbreviation { 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; } - /// - /// 所属网络(主数据枚举表 (属性=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; } - /// - /// 公司代码 - /// - [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } + /// + /// (主数据枚举表 (属性=CustomerQuality)国内同行,国外同行,国内直客,国外直客,海外代理,国内贸易公司,国外贸易公司,仅供应商,内部子公司,个人,内部子部门) + /// + [SugarColumn(ColumnName = "CooperationNature")] + public int? CooperationNature { get; set; } - /// - /// (主数据枚举表 (属性=CustomerQuality)国内同行,国外同行,国内直客,国外直客,海外代理,国内贸易公司,国外贸易公司,仅供应商,内部子公司,个人,内部子部门) - /// - [SugarColumn(ColumnName = "CooperationNature")] - public int? CooperationNature { get; set; } + /// + /// 公司英文名 + /// + [SugarColumn(ColumnName = "EnName")] + public string EnName { get; set; } - /// - /// 公司英文名 - /// - [SugarColumn(ColumnName = "EnName")] - public string EnName { get; set; } + /// + /// 是否核准 + /// + [SugarColumn(ColumnName = "IsApprove")] + public bool IsApprove { get; set; } - /// - /// 是否核准 - /// - [SugarColumn(ColumnName = "IsApprove")] - public bool IsApprove { get; set; } + /// + /// 是否黑名单 + /// + [SugarColumn(ColumnName = "IsBlacklist")] + public bool IsBlacklist { get; set; } - /// - /// 是否黑名单 - /// - [SugarColumn(ColumnName = "IsBlacklist")] - public bool IsBlacklist { get; set; } + /// + /// 是否订香港 + /// + [SugarColumn(ColumnName = "IsBookingHongKong")] + public bool? IsBookingHongKong { get; set; } - /// - /// 是否订香港 - /// - [SugarColumn(ColumnName = "IsBookingHongKong")] - public bool? IsBookingHongKong { get; set; } + /// + /// 是否海外代理 + /// + [SugarColumn(ColumnName = "IsOverseasAgent")] + public bool IsOverseasAgent { get; set; } - /// - /// 是否海外代理 - /// - [SugarColumn(ColumnName = "IsOverseasAgent")] - public bool IsOverseasAgent { get; set; } + /// + /// 是否自行结算 + /// + [SugarColumn(ColumnName = "IsSelfSettlement")] + public bool IsSelfSettlement { get; set; } - /// - /// 是否自行结算 - /// - [SugarColumn(ColumnName = "IsSelfSettlement")] - public bool IsSelfSettlement { get; set; } + /// + /// 是否结算主体 + /// + [SugarColumn(ColumnName = "IsSettlementSubject")] + public bool IsSettlementSubject { get; set; } - /// - /// 是否结算主体 - /// - [SugarColumn(ColumnName = "IsSettlementSubject")] - public bool IsSettlementSubject { get; set; } + /// + /// 主网络,从多选的所属网络中选其中一个 + /// + [SugarColumn(ColumnName = "MainNetwork")] + public int? MainNetwork { get; set; } - /// - /// 主网络,从多选的所属网络中选其中一个 - /// - [SugarColumn(ColumnName = "MainNetwork")] - public int? MainNetwork { get; set; } + /// + /// 公司名称 + /// + [SugarColumn(ColumnName = "Name")] + public string Name { 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; } - /// - /// 性质,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 = "OrgId")] - public int? OrgId { get; set; } + /// + /// 母公司id + /// + [SugarColumn(ColumnName = "ParentId")] + public int? ParentId { get; set; } - /// - /// 母公司id - /// - [SugarColumn(ColumnName = "ParentId")] - public int? ParentId { get; set; } + /// + /// 备注 + /// + [SugarColumn(ColumnName = "Remark")] + public string Remark { 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; } - /// - /// 类型,位运算存储;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; } - - } + /// + /// 已验证公司名称 + /// + [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 index eb9c74a4..737fbb0f 100644 --- a/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs +++ b/src/SJZY.Track.Domain/VEntities/VServiceProviderEntity.cs @@ -6,7 +6,6 @@ [SugarTable("v_service_provider")] public class VServiceProviderEntity : IFullAuditedBasicEntitys { - /// /// 自增主键 /// @@ -72,5 +71,4 @@ public class VServiceProviderEntity : IFullAuditedBasicEntitys /// [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 index e1ba1115..eb0030be 100644 --- a/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs +++ b/src/SJZY.Track.Domain/VEntities/VSystemEntity.cs @@ -1,12 +1,11 @@ namespace SJZY.Track.Domain.VEntities; /// -/// +/// /// [SugarTable("v_system")] public class VSystemEntity : IFullAuditedBasicEntitys { - /// /// 子系统id /// @@ -150,5 +149,4 @@ public class VSystemEntity : IFullAuditedBasicEntitys /// [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 index eee0b80d..71a52664 100644 --- a/src/SJZY.Track.Domain/VEntities/VUserEntity.cs +++ b/src/SJZY.Track.Domain/VEntities/VUserEntity.cs @@ -6,7 +6,6 @@ [SugarTable("v_user")] public class VUserEntity : IFullAuditedBasicEntitys { - /// /// 用户id /// @@ -102,5 +101,4 @@ public class VUserEntity : IFullAuditedBasicEntitys /// [SugarColumn(ColumnName = "UserOrigin")] public bool? UserOrigin { get; set; } - } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Enum/Enums.cs b/src/SJZY.Track.Repository/Enum/Enums.cs new file mode 100644 index 00000000..f32f511c --- /dev/null +++ b/src/SJZY.Track.Repository/Enum/Enums.cs @@ -0,0 +1,15 @@ +using System.ComponentModel; + +namespace SJZY.Track.Repository.Enum; + +/// +/// 枚举属性 +/// +public enum EnumPropertyEnums +{ + /// + /// 节点 + /// + [Description("ServiceNode")] + 节点, +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 9d71866a..19308200 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -1,7 +1,11 @@ -using SJZY.Track.Domain.TrackContentAggregate; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.TrackContentAggregate; +using SJZY.Track.Domain.TrackFlagAggregate; +using SJZY.Track.Domain.TrackStatusAggregate; using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.Enum; namespace SJZY.Track.Repository; @@ -56,14 +60,32 @@ public class TrackTemplateRepository : BasicRepository, ITr return pagedList; } + /// + /// 轨迹模板内容列表 + /// + /// + /// public async Task> GetContentPageAsync(GetContentPageInputVO input) { return await AsSugarClient().Queryable() - .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id) - .Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId) - .Select((templateContent, trackContent) => new GetContentPageOutputVO + .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 => templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) + .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetContentPageOutputVO { - Id = templateContent.Id + 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) .ToPagedListAsync(input.PageIndex, input.PageSize); } From 8962bc4055ddc657848a713a87c0806aaf61e6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 27 Feb 2024 19:42:40 +0800 Subject: [PATCH 017/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 11 +++++ .../Dtos/GetContentDetailOutputVO.cs | 42 +++++++++++++++++++ .../Dtos/GetContentPageOutputVO.cs | 8 ++-- .../ITrackTemplateRepository.cs | 12 ++++++ .../TrackTemplateRepository.cs | 23 +++++++--- 5 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index c901720b..d0920499 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -115,4 +115,15 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I { return await _trackTemplateRepository.GetContentPageAsync(input); } + + /// + /// 轨迹模板内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackTemplateRepository.GetContentDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs new file mode 100644 index 00000000..0f67eed7 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs @@ -0,0 +1,42 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos +{ + public class GetContentDetailOutputVO + { + 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; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs index 582cef6a..d008a8ef 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs @@ -27,17 +27,17 @@ public class GetContentPageOutputVO /// public string EnContent { get; set; } - public long? Id { get; set; } + public int Id { get; set; } /// /// 是否可删 /// - public bool? IsCanDelete { get; set; } + public bool IsCanDelete { get; set; } /// /// 是否对外 /// - public bool? IsExternal { get; set; } + public bool IsExternal { get; set; } /// /// 所属节点 @@ -47,7 +47,7 @@ public class GetContentPageOutputVO /// /// 排序 /// - public long? Sort { get; set; } + public long Sort { get; set; } /// /// 轨迹标记 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs index 241f85ca..252a1a44 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -10,5 +10,17 @@ public interface ITrackTemplateRepository : IBasicRepository> GetPageTrackTemplate(GetPageTrackTemplateVO input); + /// + /// 轨迹模板内容列表 + /// + /// + /// Task> GetContentPageAsync(GetContentPageInputVO input); + + /// + /// 轨迹模板内容详情 + /// + /// + /// + Task GetContentDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 19308200..4c293af4 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -60,11 +60,7 @@ public class TrackTemplateRepository : BasicRepository, ITr return pagedList; } - /// - /// 轨迹模板内容列表 - /// - /// - /// + /// public async Task> GetContentPageAsync(GetContentPageInputVO input) { return await AsSugarClient().Queryable() @@ -89,4 +85,21 @@ public class TrackTemplateRepository : BasicRepository, ITr }, true) .ToPagedListAsync(input.PageIndex, input.PageSize); } + + /// + public async Task GetContentDetailAsync(int id) + { + return await AsSugarClient().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 GetContentDetailOutputVO + { + Id = templateContent.Id, + TrackContent = trackContent.Code + "-" + trackContent.Content, + TrackStatus = trackStatus.Status + }, true) + .SingleAsync(); + } } \ No newline at end of file From 393c6a8e5474f88589f7eb1f517aefa93ce98deb Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 20:26:54 +0800 Subject: [PATCH 018/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B7=BB=E5=8A=A0=E6=A8=A1=E7=89=88id?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetPageTrackTemplateInput.cs | 5 ++ .../SJZY.Track.Domain.csproj | 1 + .../Dtos/GetPageTrackTemplateVO.cs | 10 +++ .../TrackTemplateRepository.cs | 61 +++++++++++++++---- 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index 1c98499d..357784df 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -14,5 +14,10 @@ /// 关键字 /// public string Keywords { get; set; } + + /// + /// 轨迹模版id,轨迹映射的查询使用 + /// + public int TrackTemplateId { get; set; } } } diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 43e82900..69cf9fb3 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -17,6 +17,7 @@ + diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs index 326a7d0c..c0c26bfe 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs @@ -11,4 +11,14 @@ public class GetPageTrackTemplateVO : PageInfoInput /// 关键字 /// public string Keywords { get; set; } + + ///// + ///// 是否置顶 + ///// + //public bool IsTop { get; set; }=false; + + /// + /// 轨迹模版id + /// + public int TrackTemplateId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 19308200..71f0ade8 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Domain.TrackContentAggregate; using SJZY.Track.Domain.TrackFlagAggregate; using SJZY.Track.Domain.TrackStatusAggregate; @@ -45,18 +46,54 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { - var pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) - .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)) - .Select((a, b) => new GetTrackTemplateListVO + UnifyPageResultDto pagedList = new UnifyPageResultDto(); + pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + .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)) + .Select((a, b) => new GetTrackTemplateListVO + { + Id = a.Id, + Code = a.Code, + CreateTime = a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + //如果轨迹模版id传值了,就置顶在第一条 + if (input.TrackTemplateId>0&& (!pagedList.List.IsNullOrEmpty())) + { + if (input.PageIndex==1) { - Id = a.Id, - Code = a.Code, - CreateTime = a.CreateTime, - Name = a.Name, - SubSystem = b.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); + bool existCurrent = pagedList.List.Any(x => x.Id==input.TrackTemplateId); + if (existCurrent) + { + var item = pagedList.List.FirstOrDefault(x => x.Id==input.TrackTemplateId); + pagedList.List.Remove(item); + pagedList.List.Insert(0, item); + } + else + { + var item = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + .Where((a, b) => a.Id==input.TrackTemplateId) + .Select((a, b) => new GetTrackTemplateListVO + { + Id = a.Id, + Code = a.Code, + CreateTime = a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .FirstAsync(); + if (item!=null) + { + var removeItem = pagedList.List.LastOrDefault(); + pagedList.List.Remove(removeItem); + pagedList.List.Insert(0, item); + } + } + } + } + return pagedList; } From 31951cd0b14a22f542c8ffbe2c11966d5ecf7498 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 20:52:04 +0800 Subject: [PATCH 019/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 13 +++++++++++++ .../Services/TrackTemplates/TrackTemplateService.cs | 2 +- .../TrackStatusAggregate/ITrackStatusRepository.cs | 1 + src/SJZY.Track.Repository/TrackStatusRepository.cs | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs 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..938837c7 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Services.TrackStatus +{ + public class TrackStatusService + { + + } +} diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index d0920499..0dfe71fa 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -12,7 +12,7 @@ namespace SJZY.Track.Application.Services.TrackTemplates; /// [ApiExplorerSettings(GroupName = "轨迹模版")] [Route("/Track/Template")] -public class TrackTemplateService : ApplicationService, ITrackTemplateService, IScopedDependency +public class TrackTemplateService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackTemplateRepository _trackTemplateRepository; diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs index bdb5a17d..34cb832b 100644 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs @@ -2,4 +2,5 @@ public interface ITrackStatusRepository : IBasicRepository { + } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index 6ac8f9cc..bb13b376 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -4,4 +4,9 @@ namespace SJZY.Track.Repository; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { + public TrackStatusRepository() + { + } + + } \ No newline at end of file From 397297177ea436af3732ec8425781b8fa430da0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 27 Feb 2024 20:52:43 +0800 Subject: [PATCH 020/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplateAutoMapperProfile.cs | 5 +- .../EditTrackTemplateContentInput.cs | 38 +++++++++++++ .../TrackTemplates/TrackTemplateService.cs | 57 ++++++++++++++++++- ... GetTrackTemplateContentDetailOutputVO.cs} | 2 +- ... => GetTrackTemplateContentPageInputVO.cs} | 2 +- ...=> GetTrackTemplateContentPageOutputVO.cs} | 2 +- .../ITrackTemplateRepository.cs | 14 ++++- .../TrackTemplateRepository.cs | 47 +++++++++++++-- 8 files changed, 153 insertions(+), 14 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs rename src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/{GetContentDetailOutputVO.cs => GetTrackTemplateContentDetailOutputVO.cs} (94%) rename src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/{GetContentPageInputVO.cs => GetTrackTemplateContentPageInputVO.cs} (72%) rename src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/{GetContentPageOutputVO.cs => GetTrackTemplateContentPageOutputVO.cs} (96%) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index e581521f..bd6d7f2b 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,5 +1,6 @@ using AutoMapper; using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; namespace SJZY.Track.Application.AutoMapper @@ -14,6 +15,8 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); //CreateMap, UnifyResultDto>(MemberList.None); + + CreateMap(MemberList.None); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs new file mode 100644 index 00000000..bb45dc74 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs @@ -0,0 +1,38 @@ +namespace SJZY.Track.Application.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; } + + /// + /// 排序 + /// + public int Sort { 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/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index d0920499..03ce0705 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,8 +1,10 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackTemplates; @@ -111,7 +113,7 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I /// /// [HttpPost("GetContentPage")] - public async Task> GetContentPageAsync([FromBody] GetContentPageInputVO input) + public async Task> GetContentPageAsync([FromBody] GetTrackTemplateContentPageInputVO input) { return await _trackTemplateRepository.GetContentPageAsync(input); } @@ -122,8 +124,59 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I /// /// [HttpGet("GetContentDetail")] - public async Task GetContentDetailAsync(int id) + public async Task GetContentDetailAsync(int id) { return await _trackTemplateRepository.GetContentDetailAsync(id); } + + /// + /// 轨迹模板内容编辑 + /// + /// + /// + [HttpPost("EditContent")] + public async Task EditContentAsync([FromBody] EditTrackTemplateContentInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isAnyExp = x => + x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; + if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + + if (await _trackTemplateRepository.IsAnyAsync(isAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + + var entity = ObjectMapper.Map(input); + + await _trackTemplateRepository.InsertAsync(entity); + + break; + + case OptionTypeNoNull.修改: + + var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldEntity); + + await _trackTemplateRepository.UpdateAsync(oldEntity); + + break; + + case OptionTypeNoNull.删除: + + await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value); + + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackTemplateContentInput.Options)]); + } + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs similarity index 94% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs rename to src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs index 0f67eed7..eb787aef 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos { - public class GetContentDetailOutputVO + public class GetTrackTemplateContentDetailOutputVO { public int Id { get; set; } diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs similarity index 72% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs rename to src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs index 396fe85b..01f0d8ad 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; -public class GetContentPageInputVO : PageInfoInput +public class GetTrackTemplateContentPageInputVO : PageInfoInput { /// /// 轨迹模板id diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs similarity index 96% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs rename to src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs index d008a8ef..d5159437 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; -public class GetContentPageOutputVO +public class GetTrackTemplateContentPageOutputVO { /// /// 轨迹内容代码 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs index 252a1a44..41f4fbf3 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -15,12 +15,22 @@ public interface ITrackTemplateRepository : IBasicRepository /// /// - Task> GetContentPageAsync(GetContentPageInputVO input); + Task> GetContentPageAsync(GetTrackTemplateContentPageInputVO input); /// /// 轨迹模板内容详情 /// /// /// - Task GetContentDetailAsync(int id); + Task GetContentDetailAsync(int id); + + Task IsAnyAsync(Expression> whereExpression); + + Task InsertAsync(TrackTemplateContentEntity insertObj); + + Task GetByIdAsync(int id); + + Task UpdateAsync(TrackTemplateContentEntity updateObj); + + Task SoftDeleteContentAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 4c293af4..63d889c6 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -6,9 +6,11 @@ using SJZY.Track.Domain.TrackTemplateAggregate; using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.Enum; +using System.Linq.Expressions; namespace SJZY.Track.Repository; +/// public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { public Task GetTemplateContentsAsync(List distinctTemplateIds) @@ -61,9 +63,9 @@ public class TrackTemplateRepository : BasicRepository, ITr } /// - public async Task> GetContentPageAsync(GetContentPageInputVO input) + public async Task> GetContentPageAsync(GetTrackTemplateContentPageInputVO input) { - return await AsSugarClient().Queryable() + 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) @@ -72,7 +74,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .LeftJoin((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) .Filter(null, true) .Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) - .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetContentPageOutputVO + .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO { Id = templateContent.Id, TrackStatus = trackStatus.Status, @@ -87,14 +89,14 @@ public class TrackTemplateRepository : BasicRepository, ITr } /// - public async Task GetContentDetailAsync(int id) + public async Task GetContentDetailAsync(int id) { - return await AsSugarClient().Queryable() + 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 GetContentDetailOutputVO + .Select((templateContent, trackContent, trackStatus) => new GetTrackTemplateContentDetailOutputVO { Id = templateContent.Id, TrackContent = trackContent.Code + "-" + trackContent.Content, @@ -102,4 +104,37 @@ public class TrackTemplateRepository : BasicRepository, ITr }, true) .SingleAsync(); } + + /// + public async Task IsAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } + + /// + public async Task InsertAsync(TrackTemplateContentEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + /// + public async Task GetByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + /// + public async Task UpdateAsync(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(); + } } \ No newline at end of file From 46a669a7db4a0bd255a38857f2f608bbdde4da33 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 27 Feb 2024 21:17:07 +0800 Subject: [PATCH 021/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackStatus/EditTrackStatusInput.cs | 46 ++++++++++++++ .../TrackStatus/ITrackStatusService.cs | 12 ++++ .../TrackStatus/TrackStatusService.cs | 63 ++++++++++++++++++- 3 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs create mode 100644 src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs new file mode 100644 index 00000000..a77a4f1c --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs new file mode 100644 index 00000000..eef632b7 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Services.TrackStatus +{ + public interface ITrackStatusService + { + } +} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 938837c7..432cabad 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,13 +1,72 @@ -using System; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Domain.TrackStatusAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate; +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.TrackStatus { - public class TrackStatusService + /// + /// 轨迹状态 + /// + [ApiExplorerSettings(GroupName = "轨迹状态")] + [Route("/Track/Status")] + public class TrackStatusService : ApplicationService, ITransientDependency { + private readonly ITrackStatusRepository _trackStatusRepository; + public TrackStatusService( + ITrackStatusRepository trackStatusRepository + ) + { + this._trackStatusRepository=trackStatusRepository; + } + + /// + /// 轨迹状态编辑 + /// + /// + [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: "当前操作动作不合法") + }; + } + + #region 私有方法 + private async Task AddAsync(EditTrackStatusInput input) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackStatusRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackStatusInput input) + { + 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) + { + var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + #endregion } } From 90fd55c32556aa24284d7e7775277751db147f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 10:08:30 +0800 Subject: [PATCH 022/196] =?UTF-8?q?change=20=E8=AE=A2=E5=8D=95=E8=81=9A?= =?UTF-8?q?=E5=90=88=E5=AE=9E=E4=BD=93=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/CreateOrderInput.cs | 2 +- .../Dtos/ProvideServices/LinkOrderInput.cs | 6 +-- .../Services/ProvideServices/OrderService.cs | 8 ++-- .../OrderAggregate/OrderLinkEntity.cs | 43 +++++++++++++++---- .../OrderAggregate/OrderTemplateEntity.cs | 4 +- 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs index b5b6520a..52d9545f 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs @@ -4,7 +4,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices; public class CreateOrderInput { - public OrderInfo OrderInfo { get; set; } + public NoInfo NoInfo { get; set; } /// /// 客户id diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs index a9177890..0d3a972a 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs @@ -4,13 +4,13 @@ namespace SJZY.Track.Application.Dtos.ProvideServices; public class LinkOrderInput { - public OrderInfo OrderInfo { get; set; } + public NoInfo NoInfo { get; set; } - public List LinkedOrderInfos { get; set; } + public List LinkedOrderInfos { get; set; } } -public class OrderInfo +public class NoInfo { /// /// 订单类型 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index fa526c1e..27ebcbb5 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -29,17 +29,17 @@ public class OrderService: ApplicationService public async Task CreateOrderAsync(CreateOrderInput input) { if (await _orderRepository.IsAnyAsync(x => - x.OrderType == input.OrderInfo.NoType && x.OrderNo == input.OrderInfo.OrderNo)) + x.OrderType == input.NoInfo.NoType && x.OrderNo == input.NoInfo.OrderNo)) { - throw new BusinessException(message: $"单号:{input.OrderInfo.OrderNo}已存在"); + throw new BusinessException(message: $"单号:{input.NoInfo.OrderNo}已存在"); } var order = new OrderEntity { CustomId = input.ClientId, OrderDetails = JsonConvert.SerializeObject(input.Details), - OrderNo = input.OrderInfo.OrderNo, - OrderType = input.OrderInfo.NoType, + OrderNo = input.NoInfo.OrderNo, + OrderType = input.NoInfo.NoType, SubSystemId = CurrentUserRequest.SubSystemId }; diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs index fecb1812..7f8cbb5d 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs @@ -4,7 +4,8 @@ /// 轨迹订单关联表(1:N) /// [SugarTable("t_order_link")] -public class OrderLinkEntity : IFullAuditedBasicEntitys +public class OrderLinkEntity : ICreateBaicEntity, + ISoftDeleteBasicEntity { /// @@ -14,15 +15,41 @@ public class OrderLinkEntity : IFullAuditedBasicEntitys public int Id { 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; } + + /// + /// 关联的订单类型 + /// + [SugarColumn(ColumnName = "LinkOrderType")] + public int LinkOrderType { get; set; } + + /// + /// 关联的订单号 + /// + [SugarColumn(ColumnName = "LinkOrderNo")] + public string LinkOrderNo { get; set; } /// - /// 订单id + /// 创建人 /// - [SugarColumn(ColumnName = "OrderId")] - public int OrderId { get; set; } - + public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 是否删除(已解绑) + /// + public bool IsDeleted { 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 index 9f9da293..fcff4ede 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs +++ b/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs @@ -4,7 +4,7 @@ /// 轨迹订单模板表(1:N) /// [SugarTable("t_order_template")] -public class OrderTemplateEntity : IFullAuditedBasicEntitys +public class OrderTemplateEntity : ICreateBaicEntity { /// @@ -31,4 +31,6 @@ public class OrderTemplateEntity : IFullAuditedBasicEntitys [SugarColumn(ColumnName = "TrackTemplateId")] public int TrackTemplateId { get; set; } + public int CreateUserId { get; set; } + public DateTime? CreateTime { get; set; } } \ No newline at end of file From c8ad695a27449d02458eb844a643fee13cf44d96 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 11:27:34 +0800 Subject: [PATCH 023/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackStatus/GetTrackStatusDetailDto.cs | 46 ++++++++++++ .../Dtos/TrackStatus/GetTrackStatusListDto.cs | 75 +++++++++++++++++++ .../TrackStatus/TrackStatusService.cs | 37 +++++++++ .../SJZY.Track.Domain.csproj | 2 - .../Dtos/GetPageTrackStatusVO.cs | 21 ++++++ .../Dtos/GetTrackStatusDetailVO.cs | 46 ++++++++++++ .../Dtos/GetTrackStatusListVO.cs | 61 +++++++++++++++ .../ITrackStatusRepository.cs | 7 +- .../TrackStatusRepository.cs | 56 ++++++++++++++ 9 files changed, 347 insertions(+), 4 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs create mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs create mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs create mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs new file mode 100644 index 00000000..6779d6da --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + } +} diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs new file mode 100644 index 00000000..ec218c97 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 432cabad..d21adead 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,7 +1,9 @@ using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Domain.TrackStatusAggregate; +using SJZY.Track.Domain.TrackStatusAggregate.Dtos; using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; using System; using System.Collections.Generic; using System.Linq; @@ -43,6 +45,41 @@ namespace SJZY.Track.Application.Services.TrackStatus }; } + /// + /// 根据状态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) { diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 69cf9fb3..7c4f268b 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -16,8 +16,6 @@ - - diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs new file mode 100644 index 00000000..217e5e0f --- /dev/null +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos +{ + public class GetPageTrackStatusVO : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs new file mode 100644 index 00000000..c99bfbc3 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos +{ + 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; } + } +} diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs new file mode 100644 index 00000000..bf0f622d --- /dev/null +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos +{ + public class GetTrackStatusListVO + { + /// + /// 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; } + } +} diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs index 34cb832b..7d2691a2 100644 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs @@ -1,6 +1,9 @@ -namespace SJZY.Track.Domain.TrackStatusAggregate; +using SJZY.Track.Domain.TrackStatusAggregate.Dtos; + +namespace SJZY.Track.Domain.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.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index bb13b376..17bc0a33 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -1,4 +1,8 @@ using SJZY.Track.Domain.TrackStatusAggregate; +using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +using SJZY.Track.Domain.TrackTemplateAggregate; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Domain.TrackStatusAggregate.Dtos; namespace SJZY.Track.Repository; @@ -8,5 +12,57 @@ public class TrackStatusRepository : BasicRepository, ITrackS { } + /// + /// 获取轨迹模版明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) + .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 = new UnifyPageResultDto(); + pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c) => a.CreateUserId==c.Id) + .LeftJoin((a, b, c, d) => a.UpdateUserId== d.Id) + .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)) + .Select((a, b, c, d) => new GetTrackStatusListVO + { + Id = a.Id, + Code = a.Code, + EntrackStatus = a.EnStatus, + TrackStatus=a.Status, + Node="", + 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 From 37e225e4563fe1b0f24a3bc4fa84a51e595a3d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 11:40:15 +0800 Subject: [PATCH 024/196] =?UTF-8?q?change=20=E7=BB=93=E6=9E=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/SJZYTrackApiModule.cs | 13 +- .../AutoMapper/AutoMapperProfile.cs | 8 +- .../TrackTemplateAutoMapperProfile.cs | 25 +- .../Dtos/ProvideServices/CreateOrderInput.cs | 14 +- .../Dtos/ProvideServices/LinkOrderInput.cs | 23 +- .../Services/Demo/InterFaceDemoService.cs | 444 +++++++++--------- .../Services/ProvideServices/OrderService.cs | 34 +- .../ProvideServices/TrackQueryService.cs | 8 +- .../TrackStatus/TrackStatusService.cs | 126 +++-- .../TrackTemplates/TrackTemplateService.cs | 19 +- .../DemoAggregate/DemoDetailEntity.cs | 4 +- .../DemoAggregate/DemoEntity.cs | 5 +- .../DemoAggregate/IDemoRepository.cs | 4 +- .../OrderAggregate/IOrderRepository.cs | 4 +- .../OrderAggregate/OrderEntity.cs | 28 +- .../OrderAggregate/OrderLinkEntity.cs | 15 +- .../OrderAggregate/OrderTemplateEntity.cs | 5 +- .../ITrackContentRepository.cs | 5 + .../TrackContentEntity.cs | 4 +- .../TrackContentMapEntity.cs | 4 +- .../ITrackDetailsRepository.cs | 5 +- .../TrackDetailsIndex.cs | 4 +- .../ITrackFlagRepository.cs | 2 +- .../TrackFlagAggregate/TrackFlagEntity.cs | 4 +- .../ITrackPullConfigRepository.cs | 3 +- .../TrackPullConfigEntity.cs | 6 +- .../TrackPullContentConfigEntity.cs | 6 +- .../TrackPushPullParamsConfigEntity.cs | 4 +- .../ITrackPushConfigRepository.cs | 2 +- .../TrackPushConfigEntity.cs | 4 +- .../TrackPushContentConfigEntity.cs | 4 +- .../ITrackStatusRepository.cs | 3 +- .../TrackStatusAggregate/TrackStatusEntity.cs | 4 +- .../ITrackTemplateRepository.cs | 7 +- .../TrackTemplateContentEntity.cs | 4 +- .../TrackTemplateEntity.cs | 6 +- .../DemoAggregate/Dtos/DemoValueObject.cs | 18 - .../Dtos/Demo/DemoValueObject.cs | 16 + .../Dtos => Dtos/Order}/OrderTemplateDto.cs | 2 +- .../TrackDetails}/TrackDetailsQueryInput.cs | 2 +- .../TrackTemplate}/GetPageTrackTemplateVO.cs | 2 +- .../GetTrackTemplateContentDetailOutputVO.cs | 41 ++ .../GetTrackTemplateContentPageInputVO.cs | 2 +- .../GetTrackTemplateContentPageOutputVO.cs | 2 +- .../GetTrackTemplateDetailVO.cs | 2 +- .../Dtos/TrackTemplate/TemplateContentDto.cs | 5 + src/SJZY.Track.Domain/GlobalUsings.cs | 1 + src/SJZY.Track.Domain/IBasicQuery.cs | 38 ++ src/SJZY.Track.Domain/IBasicRepository.cs | 34 +- .../SJZY.Track.Domain.csproj | 7 +- .../SeedWork/IAggregateRoot.cs | 5 + src/SJZY.Track.Domain/SeedWork/IEntity.cs | 5 + .../ITrackContentRepository.cs | 6 - .../GetTrackTemplateContentDetailOutputVO.cs | 42 -- .../Dtos/TemplateContentDto.cs | 6 - src/SJZY.Track.Repository/BasicQuery.cs | 25 + src/SJZY.Track.Repository/BasicRepository.cs | 24 +- src/SJZY.Track.Repository/DemoRepository.cs | 330 ++++++------- src/SJZY.Track.Repository/OrderRepository.cs | 4 +- .../SJZYTrackRepositoryModule.cs | 13 +- .../TrackContentRepository.cs | 2 +- .../TrackDetailsRepository.cs | 5 +- .../TrackFlagRepository.cs | 2 +- .../TrackPullConfigRepository.cs | 5 +- .../TrackPushConfigRepository.cs | 5 +- .../Entitys/TrackPushRecordEntity.cs | 8 +- .../Entitys/TrackPushRecordDetailsEntity.cs | 8 +- .../TrackStatusRepository.cs | 4 +- .../TrackTemplateRepository.cs | 148 +++--- 69 files changed, 875 insertions(+), 804 deletions(-) rename src/SJZY.Track.Domain/{ => Aggregates}/DemoAggregate/DemoDetailEntity.cs (82%) rename src/SJZY.Track.Domain/{ => Aggregates}/DemoAggregate/DemoEntity.cs (85%) rename src/SJZY.Track.Domain/{ => Aggregates}/DemoAggregate/IDemoRepository.cs (89%) rename src/SJZY.Track.Domain/{ => Aggregates}/OrderAggregate/IOrderRepository.cs (85%) rename src/SJZY.Track.Domain/{ => Aggregates}/OrderAggregate/OrderEntity.cs (75%) rename src/SJZY.Track.Domain/{ => Aggregates}/OrderAggregate/OrderLinkEntity.cs (92%) rename src/SJZY.Track.Domain/{ => Aggregates}/OrderAggregate/OrderTemplateEntity.cs (86%) create mode 100644 src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs rename src/SJZY.Track.Domain/{ => Aggregates}/TrackContentAggregate/TrackContentEntity.cs (89%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackContentAggregate/TrackContentMapEntity.cs (81%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackDetailsAggregate/ITrackDetailsRepository.cs (65%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackDetailsAggregate/TrackDetailsIndex.cs (94%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackFlagAggregate/ITrackFlagRepository.cs (55%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackFlagAggregate/TrackFlagEntity.cs (83%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPullAggregate/ITrackPullConfigRepository.cs (59%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPullAggregate/TrackPullConfigEntity.cs (88%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPullAggregate/TrackPullContentConfigEntity.cs (96%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs (96%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPushAggregate/ITrackPushConfigRepository.cs (59%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPushAggregate/TrackPushConfigEntity.cs (88%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackPushAggregate/TrackPushContentConfigEntity.cs (96%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackStatusAggregate/ITrackStatusRepository.cs (56%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackStatusAggregate/TrackStatusEntity.cs (87%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackTemplateAggregate/ITrackTemplateRepository.cs (85%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackTemplateAggregate/TrackTemplateContentEntity.cs (93%) rename src/SJZY.Track.Domain/{ => Aggregates}/TrackTemplateAggregate/TrackTemplateEntity.cs (82%) delete mode 100644 src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Demo/DemoValueObject.cs rename src/SJZY.Track.Domain/{OrderAggregate/Dtos => Dtos/Order}/OrderTemplateDto.cs (82%) rename src/SJZY.Track.Domain/{TrackDetailsAggregate/Dtos => Dtos/TrackDetails}/TrackDetailsQueryInput.cs (76%) rename src/SJZY.Track.Domain/{TrackTemplateAggregate/Dtos => Dtos/TrackTemplate}/GetPageTrackTemplateVO.cs (88%) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs rename src/SJZY.Track.Domain/{TrackTemplateAggregate/Dtos => Dtos/TrackTemplate}/GetTrackTemplateContentPageInputVO.cs (74%) rename src/SJZY.Track.Domain/{TrackTemplateAggregate/Dtos => Dtos/TrackTemplate}/GetTrackTemplateContentPageOutputVO.cs (95%) rename src/SJZY.Track.Domain/{TrackTemplateAggregate/Dtos => Dtos/TrackTemplate}/GetTrackTemplateDetailVO.cs (95%) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs create mode 100644 src/SJZY.Track.Domain/IBasicQuery.cs create mode 100644 src/SJZY.Track.Domain/SeedWork/IAggregateRoot.cs create mode 100644 src/SJZY.Track.Domain/SeedWork/IEntity.cs delete mode 100644 src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs delete mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs delete mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs create mode 100644 src/SJZY.Track.Repository/BasicQuery.cs diff --git a/src/SJZY.Track.Api/SJZYTrackApiModule.cs b/src/SJZY.Track.Api/SJZYTrackApiModule.cs index 9db64785..93e04188 100644 --- a/src/SJZY.Track.Api/SJZYTrackApiModule.cs +++ b/src/SJZY.Track.Api/SJZYTrackApiModule.cs @@ -19,14 +19,15 @@ using Volo.Abp.Json; using Volo.Abp.Modularity; [assembly: HostingStartup(typeof(HostingStartup))] + namespace SJZY.Track.Api { [DependsOn( typeof(AbpAutofacModule), typeof(SjzyAbpCodeModule), - typeof(ApplicationModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), + typeof(ApplicationModule), typeof(SJZYTrackRepositoryModule) )] public class SJZYTrackApiModule : AbpModule @@ -49,7 +50,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()); }); @@ -59,7 +62,6 @@ namespace SJZY.Track.Api context.Services.AddRedis(); - } public override void OnApplicationInitialization(ApplicationInitializationContext context) @@ -79,6 +81,7 @@ namespace SJZY.Track.Api app.UsePrometheus(); #region 启动提示 + Console.WriteLine($@" +-------------------------------------------------------+ | | @@ -89,8 +92,8 @@ namespace SJZY.Track.Api | | +-------------------------------------------------------+ "); + #endregion } } - -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs index e2f97051..b315446d 100644 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs @@ -1,7 +1,7 @@ using AutoMapper; using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Domain.DemoAggregate; -using SJZY.Track.Domain.DemoAggregate.Dtos; +using SJZY.Track.Domain.Aggregates.DemoAggregate; +using SJZY.Track.Domain.Dtos.Demo; namespace SJZY.Track.Application.AutoMapper; @@ -12,7 +12,8 @@ internal class AutoMapperProfile : Profile CreateMap, UnifyPageResultDto>(MemberList.None); CreateMap(MemberList.None).ReverseMap(); - CreateMap, UnifyPageResultDto>(MemberList.None).ReverseMap(); + CreateMap, UnifyPageResultDto>(MemberList.None) + .ReverseMap(); /* 代码说明: MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员) @@ -28,6 +29,5 @@ internal class AutoMapperProfile : Profile 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/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index bd6d7f2b..79a142eb 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,22 +1,21 @@ using AutoMapper; using SJZY.Track.Application.Dtos.TrackTemplates; -using SJZY.Track.Domain.TrackTemplateAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackTemplate; -namespace SJZY.Track.Application.AutoMapper +namespace SJZY.Track.Application.AutoMapper; + +/// +/// 轨迹模版自动映射 +/// +public class TrackTemplateAutoMapperProfile : Profile { - /// - /// 轨迹模版自动映射 - /// - public class TrackTemplateAutoMapperProfile : Profile + public TrackTemplateAutoMapperProfile() { - public TrackTemplateAutoMapperProfile() - { - CreateMap(MemberList.None); + CreateMap(MemberList.None); - //CreateMap, UnifyResultDto>(MemberList.None); + //CreateMap, UnifyResultDto>(MemberList.None); - CreateMap(MemberList.None); - } + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs index 52d9545f..d099eaaa 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using SJZY.Track.Domain.Aggregates.OrderAggregate; namespace SJZY.Track.Application.Dtos.ProvideServices; @@ -22,7 +23,6 @@ public class CreateOrderInput public OrderDetails Details { get; set; } } - public class OrderTemplateInfo { /// @@ -43,22 +43,22 @@ public class OrderDetails /// 目的港口 /// public string? ArrivalPort { get; set; } - + /// /// 起运港口 /// public string? LeavePort { get; set; } - + /// /// 目的国家,必填 /// public string ArrivalCountry { get; set; } - + /// /// 起运国家,必填 /// public string LeaveCountry { get; set; } - + /// /// 目的城市,必填 /// @@ -68,7 +68,7 @@ public class OrderDetails /// 起运城市,必填 /// public string LeaveCity { get; set; } - + public List FligthInfos { get; set; } } @@ -78,7 +78,7 @@ public class FligthInfo /// 航班号 /// public string FlightNo { get; set; } - + /// /// 班期 /// diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs index 0d3a972a..460c506d 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs @@ -1,26 +1,15 @@ -using System.ComponentModel.DataAnnotations; +using SJZY.Track.Domain.Aggregates.OrderAggregate; namespace SJZY.Track.Application.Dtos.ProvideServices; public class LinkOrderInput { + /// + /// false解绑,true关联,必填 + /// + public bool IsLink { get; set; } + public NoInfo NoInfo { get; set; } public List LinkedOrderInfos { get; set; } -} - - -public class NoInfo -{ - /// - /// 订单类型 - /// - public int NoType { get; set; } - - /// - /// 订单号 - /// - [Required] - [MaxLength(100)] - public string OrderNo { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs index f8170079..6402f596 100644 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs @@ -1,79 +1,45 @@ using SJZY.Expand.ABP.Core.Common; using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Domain.DemoAggregate; -using SJZY.Track.Domain.DemoAggregate.Dtos; +using SJZY.Track.Domain.Aggregates.DemoAggregate; +using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Application.Services.Demo +namespace SJZY.Track.Application.Services.Demo; + +/// +/// 接口请求完整样例 +/// +[ApiExplorerSettings(GroupName = "Demo")] +public class InterFaceDemoService : ApplicationService { - /// - /// 接口请求完整样例 - /// - [ApiExplorerSettings(GroupName = "Demo")] - public class InterFaceDemoService : ApplicationService + #region 构造函数 + + private readonly IDemoRepository _demoRepository; + + public InterFaceDemoService(IDemoRepository demoRepository) { - #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.新增) { - _demoRepository = demoRepository; + var entity = ObjectMapper.Map(input); + res.Id = await _demoRepository.InsertReturnIdentityAsync(entity); } - #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) + else if (input.Option == OptionType.修改 || input.Option == OptionType.删除) { var demoInfo = await _demoRepository.GetById1(input.Id); if (demoInfo == null) @@ -82,152 +48,204 @@ namespace SJZY.Track.Application.Services.Demo throw new BusinessException(message: "未找到指定编号下的数据"); } - //更新同时忽略某几项参数 - await _demoRepository.UpdatePartColumns(demoInfo); + res.Id = demoInfo.Id; + if (input.Option == OptionType.删除) + { + //await _demoRepository.DeleteAsync(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; + //软删除 + demoInfo.IsDeleted = true; + await _demoRepository.UpdateAsync(demoInfo); + } + else + { + var entity = ObjectMapper.Map(input, demoInfo); + await _demoRepository.UpdateAsync(entity); + } } - #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; - //} + 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/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 27ebcbb5..cb0f68ef 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain; -using SJZY.Track.Domain.OrderAggregate; +using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.UserCenter.HttpApi.Services; namespace SJZY.Track.Application.Services.ProvideServices; @@ -10,13 +10,15 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 订单服务 /// [ApiExplorerSettings(GroupName = "提供接口")] -public class OrderService: ApplicationService +public class OrderService : ApplicationService { private readonly IOrderRepository _orderRepository; + private readonly IBasicQuery _orderLinkQuery; - public OrderService(IOrderRepository orderRepository) + public OrderService(IOrderRepository orderRepository, IBasicQuery orderLinkQuery) { _orderRepository = orderRepository; + _orderLinkQuery = orderLinkQuery; } /// @@ -44,10 +46,10 @@ public class OrderService: ApplicationService }; using var tran = TransactionHelper.GetReadCommitted(); - + // 创建订单 var orderId = await _orderRepository.InsertReturnIdentityAsync(order); - + // 创建订单模板 var templates = input.Templates.Select(x => new OrderTemplateEntity { @@ -60,7 +62,7 @@ public class OrderService: ApplicationService return true; } - + /// /// 关联订单 /// @@ -69,13 +71,23 @@ public class OrderService: ApplicationService [HttpPost("Order/Link")] public async Task LinkOrderAsync(LinkOrderInput input) { - // var distinctOrderNos = input.LinkedOrderInfos.Distinct().ToList(); - // + //todo:去重 + var distinctOrderInfos = input.LinkedOrderInfos.Distinct().ToList(); + + if (await _orderRepository.IsAnyAsync(x => x.IsEqual(input.NoInfo))) + { + } + // var links = input.LinkedOrderInfos.Select(x => new OrderLinkEntity // { - // LinkOrderId = x., - // OrderId = 0 - // }) + // OrderNo = x.OrderNo, + // OrderType = x.NoType + // }).ToList(); + // + // foreach (var link in links) + // { + // if (await _orderLinkQuery.IsAnyAsync(x => x.)) + // } // _orderRepository.LinkOrderAsync(); return true; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index ad8640fe..e768cbab 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,9 +1,7 @@ using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Domain; -using SJZY.Track.Domain.OrderAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate; -using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Repository.TrackDetails; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; namespace SJZY.Track.Application.Services.ProvideServices; diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 432cabad..b5a94b5d 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,72 +1,66 @@ using SJZY.Track.Application.Dtos.TrackStatus; -using SJZY.Track.Application.Dtos.TrackTemplates; -using SJZY.Track.Domain.TrackStatusAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using Volo.Abp.DependencyInjection; -namespace SJZY.Track.Application.Services.TrackStatus +namespace SJZY.Track.Application.Services.TrackStatus; + +/// +/// 轨迹状态 +/// +[ApiExplorerSettings(GroupName = "轨迹状态")] +[Route("/Track/Status")] +public class TrackStatusService : ApplicationService, ITransientDependency { - /// - /// 轨迹状态 - /// - [ApiExplorerSettings(GroupName = "轨迹状态")] - [Route("/Track/Status")] - public class TrackStatusService : ApplicationService, ITransientDependency + private readonly ITrackStatusRepository _trackStatusRepository; + + public TrackStatusService( + ITrackStatusRepository trackStatusRepository + ) { - private readonly ITrackStatusRepository _trackStatusRepository; - - public TrackStatusService( - ITrackStatusRepository trackStatusRepository - ) - { - this._trackStatusRepository=trackStatusRepository; - } - - /// - /// 轨迹状态编辑 - /// - /// - [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: "当前操作动作不合法") - }; - } - - #region 私有方法 - private async Task AddAsync(EditTrackStatusInput input) - { - var entity = ObjectMapper.Map(input); - var isTrue = await _trackStatusRepository.InsertAsync(entity); - - return new UnifyResultDto("200", "新增成功", isTrue); - } - - private async Task UpdateAsync(EditTrackStatusInput input) - { - 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) - { - var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); - - return new UnifyResultDto("200", "删除成功", isTrue); - } - #endregion + this._trackStatusRepository = trackStatusRepository; } -} + + /// + /// 轨迹状态编辑 + /// + /// + [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: "当前操作动作不合法") + }; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackStatusInput input) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackStatusRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackStatusInput input) + { + 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) + { + var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + + #endregion +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index e4f875dc..b2df6211 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,10 +1,10 @@ -using Microsoft.Extensions.Localization; +using System.Linq.Expressions; +using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; -using SJZY.Track.Domain.TrackTemplateAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; -using System.Linq.Expressions; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Dtos.TrackTemplate; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackTemplates; @@ -113,7 +113,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency /// /// [HttpPost("GetContentPage")] - public async Task> GetContentPageAsync([FromBody] GetTrackTemplateContentPageInputVO input) + public async Task> GetContentPageAsync( + [FromBody] GetTrackTemplateContentPageInputVO input) { return await _trackTemplateRepository.GetContentPageAsync(input); } @@ -140,7 +141,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isAnyExp = x => - x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; + x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); if (await _trackTemplateRepository.IsAnyAsync(isAnyExp)) @@ -159,7 +160,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency case OptionTypeNoNull.修改: - var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); ObjectMapper.Map(input, oldEntity); @@ -174,7 +176,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency break; default: - throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackTemplateContentInput.Options)]); + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackTemplateContentInput.Options)]); } return true; diff --git a/src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs similarity index 82% rename from src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs rename to src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs index 1399ed5c..65734437 100644 --- a/src/SJZY.Track.Domain/DemoAggregate/DemoDetailEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoDetailEntity.cs @@ -1,7 +1,7 @@ -namespace SJZY.Track.Domain.DemoAggregate; +namespace SJZY.Track.Domain.Aggregates.DemoAggregate; [SugarTable("t_demo_detail")] -public class DemoDetailEntity +public class DemoDetailEntity : IEntity { /// /// Id diff --git a/src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs similarity index 85% rename from src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs rename to src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs index 256eb7ae..44d7d6eb 100644 --- a/src/SJZY.Track.Domain/DemoAggregate/DemoEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/DemoEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.DemoAggregate; +namespace SJZY.Track.Domain.Aggregates.DemoAggregate; /// /// 测试表 /// [SugarTable("t_demo")] -public class DemoEntity : IFullAuditedBasicEntitys +public class DemoEntity : IFullAuditedBasicEntitys, IAggregateRoot { /// /// Id @@ -33,5 +33,4 @@ public class DemoEntity : IFullAuditedBasicEntitys [Navigate(NavigateType.OneToMany, nameof(DemoDetailEntity.DemoId))] public List DemoDetailList { get; set; } - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs similarity index 89% rename from src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs rename to src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs index b8abaef7..207cc3b3 100644 --- a/src/SJZY.Track.Domain/DemoAggregate/IDemoRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/DemoAggregate/IDemoRepository.cs @@ -1,6 +1,6 @@ -using SJZY.Track.Domain.DemoAggregate.Dtos; +using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Domain.DemoAggregate +namespace SJZY.Track.Domain.Aggregates.DemoAggregate { public interface IDemoRepository { diff --git a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs similarity index 85% rename from src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs rename to src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 84ca93a2..fb130780 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -1,6 +1,6 @@ -using SJZY.Track.Domain.OrderAggregate.Dtos; +using SJZY.Track.Domain.Dtos.Order; -namespace SJZY.Track.Domain.OrderAggregate; +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; public interface IOrderRepository : IBasicRepository { diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs similarity index 75% rename from src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs rename to src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index cb593bf3..2faa141f 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -1,12 +1,13 @@ -namespace SJZY.Track.Domain.OrderAggregate; +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; /// /// 轨迹订单主表 /// [SugarTable("t_order")] -public class OrderEntity : IFullAuditedBasicEntitys +public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot { - /// /// 自增主键 /// @@ -67,4 +68,25 @@ public class OrderEntity : IFullAuditedBasicEntitys [SugarColumn(ColumnName = "SubSystemId")] public int SubSystemId { get; set; } + + public bool IsEqual(NoInfo noInfo) + { + return OrderType == noInfo.NoType && OrderNo == noInfo.OrderNo; + } +} + +public struct NoInfo +{ + /// + /// 订单类型,必填 + /// + [Required] + public int NoType { get; set; } + + /// + /// 订单号,必填 + /// + [Required] + [MaxLength(100)] + public string OrderNo { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs similarity index 92% rename from src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs rename to src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs index 7f8cbb5d..96c005b5 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -1,13 +1,12 @@ -namespace SJZY.Track.Domain.OrderAggregate; +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; /// /// 轨迹订单关联表(1:N) /// [SugarTable("t_order_link")] public class OrderLinkEntity : ICreateBaicEntity, - ISoftDeleteBasicEntity + ISoftDeleteBasicEntity, IEntity { - /// /// 自增主键 /// @@ -19,19 +18,19 @@ public class OrderLinkEntity : ICreateBaicEntity, /// [SugarColumn(ColumnName = "OrderType")] public int OrderType { get; set; } - + /// /// 订单号 /// [SugarColumn(ColumnName = "OrderNo")] public string OrderNo { get; set; } - + /// /// 关联的订单类型 /// [SugarColumn(ColumnName = "LinkOrderType")] public int LinkOrderType { get; set; } - + /// /// 关联的订单号 /// @@ -42,12 +41,12 @@ public class OrderLinkEntity : ICreateBaicEntity, /// 创建人 /// public int CreateUserId { get; set; } - + /// /// 创建时间 /// public DateTime? CreateTime { get; set; } - + /// /// 是否删除(已解绑) /// diff --git a/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs similarity index 86% rename from src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs rename to src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs index fcff4ede..91219904 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/OrderTemplateEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs @@ -1,12 +1,11 @@ -namespace SJZY.Track.Domain.OrderAggregate; +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; /// /// 轨迹订单模板表(1:N) /// [SugarTable("t_order_template")] -public class OrderTemplateEntity : ICreateBaicEntity +public class OrderTemplateEntity : ICreateBaicEntity, IEntity { - /// /// 自增主键 /// 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..b343163b --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; + +public interface ITrackContentRepository : IBasicRepository +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs similarity index 89% rename from src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs index baaa22de..adf4b23b 100644 --- a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackContentAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; /// /// 轨迹内容 /// [SugarTable("t_track_content")] -public class TrackContentEntity : IFullAuditedBasicEntitys +public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs similarity index 81% rename from src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs index d09351b9..fbeb2e9c 100644 --- a/src/SJZY.Track.Domain/TrackContentAggregate/TrackContentMapEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackContentAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; /// /// 轨迹内容映射表 /// [SugarTable("t_track_content_map")] -public class TrackContentMapEntity : IFullAuditedBasicEntitys +public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs similarity index 65% rename from src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 54588768..5e83c476 100644 --- a/src/SJZY.Track.Domain/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -1,7 +1,6 @@ -using SJZY.Track.Domain.TrackDetailsAggregate; -using SJZY.Track.Repository.TrackDetails.Dtos; +using SJZY.Track.Domain.Dtos.TrackDetails; -namespace SJZY.Track.Repository.TrackDetails; +namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; public interface ITrackDetailsRepository { diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs similarity index 94% rename from src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs rename to src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index d82c1cfc..9040ecc2 100644 --- a/src/SJZY.Track.Domain/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -1,9 +1,9 @@ using Nest; using SJZY.Expand.ElasticSearch; -namespace SJZY.Track.Domain.TrackDetailsAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -[ElasticsearchType(Name = IndexName)] +[ElasticsearchType(RelationName = IndexName)] public class TrackDetailsIndex : IdBaseIndex { public const string IndexName = "sjzy_track_details"; diff --git a/src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs similarity index 55% rename from src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs index 1242e908..f465cb25 100644 --- a/src/SJZY.Track.Domain/TrackFlagAggregate/ITrackFlagRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackFlagAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate; public interface ITrackFlagRepository : IBasicRepository { diff --git a/src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs similarity index 83% rename from src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs index 5a74c55e..6f689e51 100644 --- a/src/SJZY.Track.Domain/TrackFlagAggregate/TrackFlagEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackFlagAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate; /// /// 轨迹标记表 /// [SugarTable("t_track_flag")] -public class TrackFlagEntity : IFullAuditedBasicEntitys +public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs similarity index 59% rename from src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 5ef232c9..3b0b8441 100644 --- a/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -1,6 +1,5 @@ -namespace SJZY.Track.Domain.TrackPullAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; public interface ITrackPullConfigRepository : IBasicRepository { - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs similarity index 88% rename from src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs index 090e8078..1a672799 100644 --- a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullConfigEntity.cs @@ -1,12 +1,11 @@ -namespace SJZY.Track.Domain.TrackPullAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; /// /// 轨迹拉取配置表 /// [SugarTable("t_track_pull_config")] -public class TrackPullConfigEntity : IFullAuditedBasicEntitys +public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot { - /// /// 自增主键 /// @@ -42,5 +41,4 @@ public class TrackPullConfigEntity : IFullAuditedBasicEntitys /// [SugarColumn(ColumnName = "TrackTemplateId")] public int TrackTemplateId { get; set; } - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs similarity index 96% rename from src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs index f4194d72..f9de867c 100644 --- a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -1,12 +1,11 @@ -namespace SJZY.Track.Domain.TrackPullAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; /// /// 轨迹拉取内容配置表 /// [SugarTable("t_track_pull_content_config")] -public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys +public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity { - /// /// 自增主键 /// @@ -66,5 +65,4 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys /// [SugarColumn(ColumnName = "TrackTimeZone")] public string TrackTimeZone { get; set; } - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs similarity index 96% rename from src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs index 7473bf76..8187c651 100644 --- a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPushPullParamsConfigEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackPullAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; /// /// 轨迹拉取/推送参数配置 /// [SugarTable("t_track_push_pull_params_config")] -public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys +public class TrackPushPullParamsConfigEntity : IFullAuditedBasicEntitys, IEntity { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs similarity index 59% rename from src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 6f3474b0..abceffa6 100644 --- a/src/SJZY.Track.Domain/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackPushAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; public interface ITrackPushConfigRepository : IBasicRepository { diff --git a/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs similarity index 88% rename from src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs index 334b93c1..00088ccd 100644 --- a/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushConfigEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackPushAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; /// /// 轨迹推送配置表 /// [SugarTable("t_track_push_config")] -public class TrackPushConfigEntity : IFullAuditedBasicEntitys +public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs similarity index 96% rename from src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs index db2e408b..a1223bb0 100644 --- a/src/SJZY.Track.Domain/TrackPushAggregate/TrackPushContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackPushAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; /// /// 轨迹推送内容配置表 /// [SugarTable("t_track_push_content_config")] -public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys +public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs similarity index 56% rename from src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs index 34cb832b..9d17663e 100644 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/ITrackStatusRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs @@ -1,6 +1,5 @@ -namespace SJZY.Track.Domain.TrackStatusAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate; public interface ITrackStatusRepository : IBasicRepository { - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs similarity index 87% rename from src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs index f23c8340..7d1b1a0d 100644 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/TrackStatusEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackStatusAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate; /// /// 轨迹状态表 /// [SugarTable("t_track_status")] -public class TrackStatusEntity : IFullAuditedBasicEntitys +public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs similarity index 85% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs rename to src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index 41f4fbf3..a20f2ced 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -1,6 +1,6 @@ -using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +using SJZY.Track.Domain.Dtos.TrackTemplate; -namespace SJZY.Track.Domain.TrackTemplateAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { @@ -15,7 +15,8 @@ public interface ITrackTemplateRepository : IBasicRepository /// /// - Task> GetContentPageAsync(GetTrackTemplateContentPageInputVO input); + Task> GetContentPageAsync( + GetTrackTemplateContentPageInputVO input); /// /// 轨迹模板内容详情 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs similarity index 93% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs index 95f666ae..3d8ba38a 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateContentEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateContentEntity.cs @@ -1,10 +1,10 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; /// /// 轨迹模板内容表(1:N) /// [SugarTable("t_track_template_content")] -public class TrackTemplateContentEntity : IFullAuditedBasicEntitys +public class TrackTemplateContentEntity : IFullAuditedBasicEntitys, IEntity { /// /// 自增主键 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs similarity index 82% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs rename to src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs index a8fa9718..ce861050 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/TrackTemplateEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/TrackTemplateEntity.cs @@ -1,12 +1,11 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate; +namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; /// /// 轨迹模板表 /// [SugarTable("t_track_template")] -public class TrackTemplateEntity : IFullAuditedBasicEntitys +public class TrackTemplateEntity : IFullAuditedBasicEntitys, IAggregateRoot { - /// /// 自增主键 /// @@ -30,5 +29,4 @@ public class TrackTemplateEntity : IFullAuditedBasicEntitys /// [SugarColumn(ColumnName = "SubSystemId")] public int SubSystemId { get; set; } - } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs b/src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs deleted file mode 100644 index 1c09d547..00000000 --- a/src/SJZY.Track.Domain/DemoAggregate/Dtos/DemoValueObject.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace SJZY.Track.Domain.DemoAggregate.Dtos -{ - public class DemoValueObject - { - - public string Name { get; set; } - - /// - /// 当前页码 - /// - public int PageIndex { get; set; } - - /// - /// 每页大小 - /// - public int PageSize { get; set; } - } -} 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/OrderAggregate/Dtos/OrderTemplateDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs similarity index 82% rename from src/SJZY.Track.Domain/OrderAggregate/Dtos/OrderTemplateDto.cs rename to src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs index 7cf444f2..df433d5d 100644 --- a/src/SJZY.Track.Domain/OrderAggregate/Dtos/OrderTemplateDto.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.OrderAggregate.Dtos; +namespace SJZY.Track.Domain.Dtos.Order; public class OrderTemplateDto { diff --git a/src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs similarity index 76% rename from src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs rename to src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs index 680a0806..3a7b4d0d 100644 --- a/src/SJZY.Track.Domain/TrackDetailsAggregate/Dtos/TrackDetailsQueryInput.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/TrackDetailsQueryInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Repository.TrackDetails.Dtos; +namespace SJZY.Track.Domain.Dtos.TrackDetails; public class TrackDetailsQueryInput : PageInfoInput { diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs similarity index 88% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs index c0c26bfe..e4fa7963 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +namespace SJZY.Track.Domain.Dtos.TrackTemplate; public class GetPageTrackTemplateVO : PageInfoInput { 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..4e8a8f45 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs @@ -0,0 +1,41 @@ +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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs similarity index 74% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs index 01f0d8ad..d08ad492 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +namespace SJZY.Track.Domain.Dtos.TrackTemplate; public class GetTrackTemplateContentPageInputVO : PageInfoInput { diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs similarity index 95% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs index d5159437..dd3a27d4 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +namespace SJZY.Track.Domain.Dtos.TrackTemplate; public class GetTrackTemplateContentPageOutputVO { diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs similarity index 95% rename from src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs index 72e19fcf..1fa28d92 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateDetailVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +namespace SJZY.Track.Domain.Dtos.TrackTemplate; /// /// 获取轨迹模版明细 diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs new file mode 100644 index 00000000..4d82a4d5 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class TemplateContentDto +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/GlobalUsings.cs b/src/SJZY.Track.Domain/GlobalUsings.cs index 439aa8ea..deaf0047 100644 --- a/src/SJZY.Track.Domain/GlobalUsings.cs +++ b/src/SJZY.Track.Domain/GlobalUsings.cs @@ -7,3 +7,4 @@ 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/IBasicQuery.cs b/src/SJZY.Track.Domain/IBasicQuery.cs new file mode 100644 index 00000000..0ddba65d --- /dev/null +++ b/src/SJZY.Track.Domain/IBasicQuery.cs @@ -0,0 +1,38 @@ +namespace SJZY.Track.Domain; + +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/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index 05560f86..b085429b 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -1,39 +1,7 @@ namespace SJZY.Track.Domain; -public interface IBasicRepository +public interface IBasicRepository : IBasicQuery where T : IAggregateRoot { - /// - /// 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 /// diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 69cf9fb3..b40c78be 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -12,12 +12,7 @@ - - - - - - + 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/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs deleted file mode 100644 index 110f297e..00000000 --- a/src/SJZY.Track.Domain/TrackContentAggregate/ITrackContentRepository.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Domain.TrackContentAggregate -{ - public interface ITrackContentRepository : IBasicRepository - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs deleted file mode 100644 index eb787aef..00000000 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetTrackTemplateContentDetailOutputVO.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos -{ - 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; } - } -} \ 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 deleted file mode 100644 index 0906d25a..00000000 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/TemplateContentDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos; - -public class TemplateContentDto -{ - -} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Repository/BasicQuery.cs new file mode 100644 index 00000000..0e0d8874 --- /dev/null +++ b/src/SJZY.Track.Repository/BasicQuery.cs @@ -0,0 +1,25 @@ +using System.Linq.Expressions; +using SJZY.Track.Domain; +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository; + +public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() +{ + 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/BasicRepository.cs b/src/SJZY.Track.Repository/BasicRepository.cs index d6ed5564..a4616860 100644 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ b/src/SJZY.Track.Repository/BasicRepository.cs @@ -1,5 +1,6 @@ -using SJZY.Track.Domain; -using System.Linq.Expressions; +using System.Linq.Expressions; +using SJZY.Track.Domain; +using SJZY.Track.Domain.SeedWork; using Volo.Abp; namespace SJZY.Track.Repository; @@ -8,25 +9,8 @@ namespace SJZY.Track.Repository; /// 仓储基类实现 /// /// -public class BasicRepository : SimpleClient, IBasicRepository where T : class, new() +public class BasicRepository : BasicQuery, IBasicRepository where T : class, IAggregateRoot, new() { - public BasicRepository() - { - 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) diff --git a/src/SJZY.Track.Repository/DemoRepository.cs b/src/SJZY.Track.Repository/DemoRepository.cs index 3d8135f9..18a8d5da 100644 --- a/src/SJZY.Track.Repository/DemoRepository.cs +++ b/src/SJZY.Track.Repository/DemoRepository.cs @@ -1,84 +1,87 @@ -using SJZY.Track.Domain.DemoAggregate; -using SJZY.Track.Domain.DemoAggregate.Dtos; -using System.Transactions; +using System.Transactions; +using SJZY.Track.Domain.Aggregates.DemoAggregate; +using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Repository +namespace SJZY.Track.Repository; + +public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { - public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency + /* + 一般情况下常规的增删改方法不需要自己实现,只需要按照 BasicRepository 中的格式原封不动的暴露出去即可, + 比如这里接口 只声明了 UpdateAsync 和 InsertReturnIdentityAsync 接口的定义,但是这两个方法的实现我们不用写,直接交给父类实现即可 + */ + + #region 根据主键获取单条数据 + + /// + /// 根据主键获取单条数据 + /// + /// + /// + public Task GetById1(int id) { /* - 一般情况下常规的增删改方法不需要自己实现,只需要按照 BasicRepository 中的格式原封不动的暴露出去即可, - 比如这里接口 只声明了 UpdateAsync 和 InsertReturnIdentityAsync 接口的定义,但是这两个方法的实现我们不用写,直接交给父类实现即可 + + //以下两种方法都不会因为没找到数据而抛异常 + 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); + } - #region 根据主键获取单条数据 + #endregion - /// - /// 根据主键获取单条数据 - /// - /// - /// - public Task GetById1(int id) - { - /* - - //以下两种方法都不会因为没找到数据而抛异常 - var model1 = base.GetFirst(m => m.Id == 0); - var model = base.GetSingle(m => m.Id == 0); - + #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); - //同样的写法在linq下,如果不加 OrDefault 一定会报错 - var model = base.GetList().Single(m => m.Id == 0); - var model1 = base.GetList().First(m => m.Id == 0); + return list; + } - */ - return base.GetSingleAsync(it => it.Id == id); - } + #endregion - #endregion + #region 参数为实体 - #region 分页获取 + /// + /// 参数很多的时候,定义模型接受参数 + /// + /// + /// + public async Task> InputToValueObject(DemoValueObject obj) + { + var list = await AsQueryable().ToListAsync(); + return list; + } - /// - /// 分页获取 - /// - /// - /// - 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); + #endregion - return list; - } - #endregion + #region 执行原生sql语句 - #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 = @$" + /// + /// 执行原生sql语句 + /// + /// + /// + public async Task> OriginalSql(DemoValueObject obj) + { + var parameters = new List(); + var sql = @$" select a.id, a.Name, @@ -89,110 +92,117 @@ namespace SJZY.Track.Repository {" 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); + var list = await Context.SqlQueryable(sql) + .AddParameters(parameters) + .ToPagedListAsync(obj.PageIndex, obj.PageSize); - return list; - } + return list; + } - #endregion + #endregion - #region 简单事务 - public async Task Transaction() + #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" }); - using (var ts = new TransactionScope()) - { + //throw new BusinessException("E05632","手动抛异常"); + await base.InsertAsync(new DemoEntity { Name = "4444" }); - 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(); - } + ts.Complete(); } - #endregion + } - #region 夸方法事务 - public async Task MultipleMethodTrans1() + #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 base.InsertAsync(new DemoEntity { Name = "---" }); - await base.InsertAsync(new DemoEntity { Name = "+++" }); - } - - public async Task MultipleMethodTrans2() - { - + await Transaction(); + await MultipleMethodTrans1(); //throw new BusinessException(message: "手动抛出异常"); await base.InsertAsync(new DemoEntity { Name = "xxx" }); + + ts.Complete(); } - #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 - } -} + + #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/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 1aa6978b..77d83641 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,5 +1,5 @@ -using SJZY.Track.Domain.OrderAggregate; -using SJZY.Track.Domain.OrderAggregate.Dtos; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index 2d26e40d..08cdcbb0 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -21,7 +21,8 @@ public class SJZYTrackRepositoryModule : AbpModule context.Services.AddSqlsugar(options => { - options.AddRange(new List { + options.AddRange(new List + { new() { ConnectionString = configuration["ConnectionStrings:DefaultConnection"], @@ -33,10 +34,6 @@ public class SJZYTrackRepositoryModule : AbpModule ); }, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository"); - - context.Services.AddScoped(typeof(IBasicRepository<>), typeof(BasicRepository<>)); - - context.Services.AddElasticSearch(options => { options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>(); @@ -45,4 +42,10 @@ public class SJZYTrackRepositoryModule : AbpModule 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/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 8214de10..1bf04097 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Domain.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs index 2b16dde8..3a0677b9 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs @@ -2,9 +2,8 @@ using Nest; using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ElasticSearch.Services; -using SJZY.Track.Domain.TrackDetailsAggregate; -using SJZY.Track.Repository.TrackDetails; -using SJZY.Track.Repository.TrackDetails.Dtos; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Dtos.TrackDetails; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/TrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlagRepository.cs index 360c71fd..4c4d623f 100644 --- a/src/SJZY.Track.Repository/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/TrackFlagRepository.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Domain.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 85723f1e..d63120b7 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -1,7 +1,8 @@ -using SJZY.Track.Domain.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; namespace SJZY.Track.Repository; -public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency +public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, + IScopedDependency { } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index b47db5ee..32c71905 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,7 +1,8 @@ -using SJZY.Track.Domain.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; namespace SJZY.Track.Repository; -public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency +public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, + IScopedDependency { } \ 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 index 0eeca89e..9b45f7c2 100644 --- a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -1,12 +1,13 @@ -namespace SJZY.Track.Repository.TrackPushRecord.Entitys +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository.TrackPushRecord.Entitys { /// /// 轨迹推送记录 /// [SugarTable("t_track_push_record")] - public class TrackPushRecordEntity + public class TrackPushRecordEntity : IAggregateRoot { - /// /// 自增主键 /// @@ -54,6 +55,5 @@ /// [SugarColumn(ColumnName = "TrackTotal")] public string TrackTotal { get; set; } - } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs index 73140fd9..64208102 100644 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -1,12 +1,13 @@ -namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys +using SJZY.Track.Domain.SeedWork; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys { /// /// 轨迹推送明细表 /// [SugarTable("t_track_push_record_details")] - public class TrackPushRecordDetailsEntity + public class TrackPushRecordDetailsEntity : IAggregateRoot { - /// /// 自增主键 /// @@ -42,6 +43,5 @@ /// [SugarColumn(ColumnName = "PushRecordId")] public int PushRecordId { get; set; } - } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index bb13b376..c54bf511 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Domain.TrackStatusAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; namespace SJZY.Track.Repository; @@ -7,6 +7,4 @@ public class TrackStatusRepository : BasicRepository, ITrackS public TrackStatusRepository() { } - - } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 55c78505..1424b6df 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -1,13 +1,12 @@ -using SJZY.Expand.ABP.Core.Common.Dto; +using System.Linq.Expressions; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Domain.TrackContentAggregate; -using SJZY.Track.Domain.TrackFlagAggregate; -using SJZY.Track.Domain.TrackStatusAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate; -using SJZY.Track.Domain.TrackTemplateAggregate.Dtos; +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.VEntities; using SJZY.Track.Repository.Enum; -using System.Linq.Expressions; namespace SJZY.Track.Repository; @@ -26,17 +25,18 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task GetDetailAsync(int id) { - var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -49,44 +49,47 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) - .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)) - .Select((a, b) => new GetTrackTemplateListVO - { - Id = a.Id, - Code = a.Code, - CreateTime = a.CreateTime, - Name = a.Name, - SubSystem = b.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); - //如果轨迹模版id传值了,就置顶在第一条 - if (input.TrackTemplateId>0&& (!pagedList.List.IsNullOrEmpty())) - { - if (input.PageIndex==1) + pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .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)) + .Select((a, b) => new GetTrackTemplateListVO { - bool existCurrent = pagedList.List.Any(x => x.Id==input.TrackTemplateId); + Id = a.Id, + Code = a.Code, + CreateTime = a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + //如果轨迹模版id传值了,就置顶在第一条 + if (input.TrackTemplateId > 0 && (!pagedList.List.IsNullOrEmpty())) + { + if (input.PageIndex == 1) + { + bool existCurrent = pagedList.List.Any(x => x.Id == input.TrackTemplateId); if (existCurrent) { - var item = pagedList.List.FirstOrDefault(x => x.Id==input.TrackTemplateId); + var item = pagedList.List.FirstOrDefault(x => x.Id == input.TrackTemplateId); pagedList.List.Remove(item); pagedList.List.Insert(0, item); } else { - var item = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) - .Where((a, b) => a.Id==input.TrackTemplateId) - .Select((a, b) => new GetTrackTemplateListVO - { - Id = a.Id, - Code = a.Code, - CreateTime = a.CreateTime, - Name = a.Name, - SubSystem = b.CnName - }) - .FirstAsync(); - if (item!=null) + var item = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .Where((a, b) => a.Id == input.TrackTemplateId) + .Select((a, b) => new GetTrackTemplateListVO + { + Id = a.Id, + Code = a.Code, + CreateTime = a.CreateTime, + Name = a.Name, + SubSystem = b.CnName + }) + .FirstAsync(); + if (item != null) { var removeItem = pagedList.List.LastOrDefault(); pagedList.List.Remove(removeItem); @@ -100,28 +103,39 @@ public class TrackTemplateRepository : BasicRepository, ITr } /// - public async Task> GetContentPageAsync(GetTrackTemplateContentPageInputVO input) + 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) + .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 => templateContent.TrackTemplateId == input.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) + .Where(templateContent => + templateContent.TrackTemplateId == input.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) .ToPagedListAsync(input.PageIndex, input.PageSize); } @@ -129,8 +143,10 @@ public class TrackTemplateRepository : BasicRepository, ITr 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) + .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 From 05637db671fcb97b0932cb2de0e45b3a0795c10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 11:49:18 +0800 Subject: [PATCH 025/196] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackStatus/TrackStatusService.cs | 75 ++++++++++--------- .../ITrackStatusRepository.cs | 2 + .../Dtos/TrackStatus/GetPageTrackStatusVO.cs | 14 ++++ .../TrackStatus/GetTrackStatusDetailVO.cs | 39 ++++++++++ .../Dtos/TrackStatus/GetTrackStatusListVO.cs | 54 +++++++++++++ .../Dtos/GetPageTrackStatusVO.cs | 21 ------ .../Dtos/GetTrackStatusDetailVO.cs | 46 ------------ .../Dtos/GetTrackStatusListVO.cs | 61 --------------- .../TrackStatusRepository.cs | 70 +++++++++-------- 9 files changed, 184 insertions(+), 198 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusDetailVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs delete mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs delete mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs delete mode 100644 src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 84f93e92..acf14311 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,6 +1,6 @@ using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; -using Volo.Abp.DependencyInjection; +using SJZY.Track.Domain.Dtos.TrackStatus; namespace SJZY.Track.Application.Services.TrackStatus; @@ -9,7 +9,7 @@ namespace SJZY.Track.Application.Services.TrackStatus; /// [ApiExplorerSettings(GroupName = "轨迹状态")] [Route("/Track/Status")] -public class TrackStatusService : ApplicationService, ITransientDependency +public class TrackStatusService : ApplicationService { private readonly ITrackStatusRepository _trackStatusRepository; @@ -36,46 +36,47 @@ public class TrackStatusService : ApplicationService, ITransientDependency }; } - /// - /// 根据状态id获取轨迹状态 - /// - /// - /// - [HttpGet("GetDetail")] - public async Task> GetDetailAsync(int id) + /// + /// 根据状态id获取轨迹状态 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task> GetDetailAsync(int id) + { + var detailInfo = await _trackStatusRepository.GetDetailAsync(id); + if (detailInfo == null) { - var detailInfo = await _trackStatusRepository.GetDetailAsync(id); - if (detailInfo == null) - { - return new UnifyResultDto(false, null, "未查询到轨迹状态"); - } - - var dto = ObjectMapper.Map(detailInfo); - return new UnifyResultDto("200", "", dto); + return new UnifyResultDto(false, null, "未查询到轨迹状态"); } - /// - /// 获取分页轨迹状态 - /// - /// - /// - [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); + var dto = ObjectMapper.Map(detailInfo); + return new UnifyResultDto("200", "", dto); + } - return pageResultDto; - } + /// + /// 获取分页轨迹状态 + /// + /// + /// + [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); - #region 私有方法 - private async Task AddAsync(EditTrackStatusInput input) - { - var entity = ObjectMapper.Map(input); - var isTrue = await _trackStatusRepository.InsertAsync(entity); + return pageResultDto; + } + + #region 私有方法 + + private async Task AddAsync(EditTrackStatusInput input) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackStatusRepository.InsertAsync(entity); return new UnifyResultDto("200", "新增成功", isTrue); } diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs index 4bcc5677..5123bd2b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/ITrackStatusRepository.cs @@ -1,3 +1,5 @@ +using SJZY.Track.Domain.Dtos.TrackStatus; + namespace SJZY.Track.Domain.Aggregates.TrackStatusAggregate; public interface ITrackStatusRepository : IBasicRepository 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..6c5d3b46 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.TrackStatus; + +public class GetPageTrackStatusVO : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { 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..38a75ed0 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs @@ -0,0 +1,54 @@ +namespace SJZY.Track.Domain.Dtos.TrackStatus; + +public class GetTrackStatusListVO +{ + /// + /// 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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs deleted file mode 100644 index 217e5e0f..00000000 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetPageTrackStatusVO.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos -{ - public class GetPageTrackStatusVO : PageInfoInput - { - /// - /// 子系统id - /// - public int SubSystemId { get; set; } - - /// - /// 关键字 - /// - public string Keywords { get; set; } - } -} diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs deleted file mode 100644 index c99bfbc3..00000000 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusDetailVO.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos -{ - 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; } - } -} diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs deleted file mode 100644 index bf0f622d..00000000 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos -{ - public class GetTrackStatusListVO - { - /// - /// 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; } - } -} diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index 38f7d3b7..7f5d88b7 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -1,5 +1,5 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; -using SJZY.Track.Domain.TrackStatusAggregate.Dtos; +using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; namespace SJZY.Track.Repository; @@ -17,19 +17,20 @@ public class TrackStatusRepository : BasicRepository, ITrackS /// public async Task GetDetailAsync(int id) { - var detail = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId==b.Id) - .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(); + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .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; } @@ -41,25 +42,28 @@ public class TrackStatusRepository : BasicRepository, ITrackS public async Task> GetPageTrackStatus(GetPageTrackStatusVO input) { UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable().LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId==c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId== d.Id) - .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)) - .Select((a, b, c, d) => new GetTrackStatusListVO - { - Id = a.Id, - Code = a.Code, - EntrackStatus = a.EnStatus, - TrackStatus=a.Status, - Node="", - CreateTime = a.CreateTime, - CreateUser = c.Name, - UpdateTime = a.UpdateTime, - UpdateUser = d.Name, - SubSystem = b.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); + pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .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)) + .Select((a, b, c, d) => new GetTrackStatusListVO + { + Id = a.Id, + Code = a.Code, + EntrackStatus = a.EnStatus, + TrackStatus = a.Status, + Node = "", + CreateTime = a.CreateTime, + CreateUser = c.Name, + UpdateTime = a.UpdateTime, + UpdateUser = d.Name, + SubSystem = b.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); return pagedList; } From 16803b849f5b3fac16bcdfa6593841d461060440 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 11:50:45 +0800 Subject: [PATCH 026/196] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs | 11 +++++++++-- src/SJZY.Track.Repository/TrackStatusRepository.cs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs index bf0f622d..a3863273 100644 --- a/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs +++ b/src/SJZY.Track.Domain/TrackStatusAggregate/Dtos/GetTrackStatusListVO.cs @@ -1,4 +1,6 @@ -using System; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.Eunms; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -18,10 +20,15 @@ namespace SJZY.Track.Domain.TrackStatusAggregate.Dtos /// public string SubSystem { get; set; } + /// + /// 节点id + /// + public int NodeId { get; set; } + /// /// 所属节点 /// - public string Node { get; set; } + public string Node => NodeId.GetDescription(); /// /// 所属轨迹状态 diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index 17bc0a33..54adf695 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -53,8 +53,8 @@ public class TrackStatusRepository : BasicRepository, ITrackS Id = a.Id, Code = a.Code, EntrackStatus = a.EnStatus, + NodeId=a.Node, TrackStatus=a.Status, - Node="", CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, From db4e0c658713ebfa95a36fa9bf7020e22de9c987 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 14:10:38 +0800 Subject: [PATCH 027/196] =?UTF-8?q?dto=E6=B7=BB=E5=8A=A0=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackStatus/GetTrackStatusListVO.cs | 99 +++++++++++-------- .../SJZY.Track.Domain.csproj | 4 +- 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs index 38a75ed0..ff570fc0 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetTrackStatusListVO.cs @@ -1,54 +1,67 @@ -namespace SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Expand.ABP.Core.PublicMethords; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -public class GetTrackStatusListVO +namespace SJZY.Track.Domain.Dtos.TrackStatus { - /// - /// Id - /// - public int Id { get; set; } + public class GetTrackStatusListVO + { + /// + /// Id + /// + public int Id { get; set; } - /// - /// 子系统 - /// - public string SubSystem { get; set; } + /// + /// 子系统 + /// + public string SubSystem { get; set; } - /// - /// 所属节点 - /// - public string Node { get; set; } + /// + /// 节点id + /// + public int NodeId { get; set; } - /// - /// 所属轨迹状态 - /// - public string TrackStatus { get; set; } + /// + /// 所属节点 + /// + public string Node { get; set; } - /// - /// 轨迹状态代码 - /// - public string Code { get; set; } + /// + /// 所属轨迹状态 + /// + public string TrackStatus { get; set; } - /// - /// 轨迹内容英文 - /// - public string EntrackStatus { get; set; } + /// + /// 轨迹状态代码 + /// + public string Code { get; set; } - /// - /// 创建人 - /// - public string CreateUser { get; set; } + /// + /// 轨迹内容英文 + /// + public string EntrackStatus { get; set; } - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } + /// + /// 创建人 + /// + public string CreateUser { get; set; } - /// - /// 修改人 - /// - public string UpdateUser { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } - /// - /// 修改时间 - /// - public DateTime? UpdateTime { get; set; } -} \ No newline at end of file + /// + /// 修改人 + /// + public string UpdateUser { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateTime { get; set; } + } +} diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index b40c78be..aac0e12d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -12,7 +12,7 @@ - + From ca2792180a979eea935b6f50299e48ac0dcd1946 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 14:28:19 +0800 Subject: [PATCH 028/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/ITrackContentService.cs | 13 +++++++++++ .../TrackContents/TrackContentService.cs | 22 +++++++++++++++++++ .../TrackStatus/TrackStatusService.cs | 3 ++- .../TrackContentRepository.cs | 7 ++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs create mode 100644 src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs diff --git a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs new file mode 100644 index 00000000..8747af44 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Services.TrackContents +{ + public interface ITrackContentService + { + + } +} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs new file mode 100644 index 00000000..a96b960c --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -0,0 +1,22 @@ +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.TrackContents +{ + [ApiExplorerSettings(GroupName = "轨迹内容")] + [Route("/Track/Content")] + public class TrackContentService : ApplicationService, ITransientDependency + { + + public TrackContentService() + { + + } + + + } +} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index acf14311..9db46c6f 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,6 +1,7 @@ using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; +using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackStatus; @@ -9,7 +10,7 @@ namespace SJZY.Track.Application.Services.TrackStatus; /// [ApiExplorerSettings(GroupName = "轨迹状态")] [Route("/Track/Status")] -public class TrackStatusService : ApplicationService +public class TrackStatusService : ApplicationService, ITransientDependency { private readonly ITrackStatusRepository _trackStatusRepository; diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 1bf04097..075b925a 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -4,4 +4,11 @@ namespace SJZY.Track.Repository; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { + + public TrackContentRepository() + { + + } + + } \ No newline at end of file From bee28546b43dd661e53c8442fc72604c8c202a6f Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 14:38:33 +0800 Subject: [PATCH 029/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentInput.cs | 51 +++++++++++++++++ .../TrackContents/TrackContentService.cs | 55 ++++++++++++++++++- 2 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs new file mode 100644 index 00000000..87cc3632 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index a96b960c..dc5c40c2 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,4 +1,7 @@ -using System; +using SJZY.Track.Application.Dtos.TrackContents; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,16 +10,62 @@ using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackContents { + /// + /// 轨迹内容服务 + /// [ApiExplorerSettings(GroupName = "轨迹内容")] [Route("/Track/Content")] public class TrackContentService : ApplicationService, ITransientDependency { + private readonly ITrackContentRepository _trackContentRepository; - public TrackContentService() + public TrackContentService( + ITrackContentRepository trackContentRepository + ) { - + this._trackContentRepository=trackContentRepository; } + /// + /// 轨迹内容编辑 + /// + /// + [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: "当前操作动作不合法") + }; + } + #region 私有方法 + private async Task AddAsync(EditTrackContentInput input) + { + var entity = ObjectMapper.Map(input); + var isTrue = await _trackContentRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackContentInput input) + { + var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); + ObjectMapper.Map(input, templateEntity); + var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); + + return new UnifyResultDto("200", "修改成功", isTrue); + } + + private async Task DeleteAsync(EditTrackContentInput input) + { + var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + #endregion } } From 047e9b48851e2596558b79b27156594a937138d6 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 15:48:48 +0800 Subject: [PATCH 030/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentInput.cs | 64 ++++++++++++-- .../TrackContents/GetPageTrackContentInput.cs | 84 +++++++++++++++++++ .../TrackContents/TrackContentService.cs | 37 ++++++++ .../ITrackContentRepository.cs | 7 +- .../TrackContents/GetPageTrackContentVO.cs | 84 +++++++++++++++++++ .../TrackContents/GetTrackContentDetailVO.cs | 61 ++++++++++++++ .../TrackContentRepository.cs | 66 +++++++++++++++ 7 files changed, 397 insertions(+), 6 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs index 87cc3632..23294dfe 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs @@ -11,22 +11,70 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// Id /// - public int Id { get; set; } + public int Id { get; set; } /// /// 操作类型 /// - public OptionType Options { get; set; } + public OptionType Options { get; set; } /// /// 子系统id /// - public int SubSystemId { get; set; } + public int SubSystemId { get; set; } /// /// 所属轨迹状态id /// - public int TrackStatusId { get; set; } + 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 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; } /// /// 轨迹内容代码 @@ -41,11 +89,17 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string EnContent { get; set; } /// /// 轨迹标记id /// public int TrackFlagId { get; set; } + + /// + /// 轨迹标记 + /// + public string TrackFlag { get; set; } } } + diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs new file mode 100644 index 00000000..a494d030 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.TrackContents +{ + public class GetPageTrackContentInput : PageInfoInput + { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 关键字 + /// + public string Keywords { 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; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index dc5c40c2..fb7bacb5 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,6 +1,8 @@ using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; using System; using System.Collections.Generic; using System.Linq; @@ -42,6 +44,41 @@ namespace SJZY.Track.Application.Services.TrackContents }; } + /// + /// 根据内容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) { diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index b343163b..fbd0e412 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -1,5 +1,10 @@ -namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; + +namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; public interface ITrackContentRepository : IBasicRepository { + Task GetDetailAsync(int id); + Task> GetPageTrackContent(GetPageTrackContentVO input); } \ 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..f093836d --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -0,0 +1,84 @@ +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; } + } + + 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; } + } +} 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..b58df450 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs @@ -0,0 +1,61 @@ +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; } + } +} diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 075b925a..1671ac80 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -1,4 +1,8 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Track.Domain.VEntities; namespace SJZY.Track.Repository; @@ -10,5 +14,67 @@ public class TrackContentRepository : BasicRepository, ITrac } + /// + /// 获取轨迹内容明细 + /// + /// + /// + public async Task GetDetailAsync(int id) + { + var detail = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .Where((a, b) => a.Id == id) + .Select((a, b) => new GetTrackContentDetailVO + { + Id = a.Id, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName, + TrackStatusId=a.TrackStatusId, + TrackStatus= "", + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackFlagId=a.TrackFlagId, + TrackFlag="" + }) + .FirstAsync(); + return detail; + } + /// + /// 分页获取轨迹内容 + /// + /// + /// + public async Task> GetPageTrackContent(GetPageTrackContentVO input) + { + UnifyPageResultDto pagedList = new UnifyPageResultDto(); + pagedList = await Context.Queryable() + .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), + (a, b, c, d) => a.Code.Contains(input.Keywords) + ) + .Select((a, b, c, d) => new GetTrackContentListVO + { + Id = a.Id, + SubSystem = b.CnName, + Code = a.Code, + Content = a.Content, + EnContent = a.EnContent, + TrackStatus= "", + Node = "", + TrackFlag= "", + 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 From 4c4cdd63264f7f00383e8f11d91996c397d08759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 16:15:32 +0800 Subject: [PATCH 031/196] =?UTF-8?q?add=20=E5=85=B3=E8=81=94=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.props | 1 + .../Dtos/ProvideServices/LinkOrderInput.cs | 24 +++++-- .../Services/ProvideServices/OrderService.cs | 64 ++++++++++++++----- .../OrderAggregate/IOrderRepository.cs | 14 ++++ .../Aggregates/OrderAggregate/OrderEntity.cs | 11 ++++ src/SJZY.Track.Repository/OrderRepository.cs | 10 +++ .../SJZY.Track.Repository.csproj | 4 +- 7 files changed, 106 insertions(+), 22 deletions(-) diff --git a/common.props b/common.props index 6dfdd8fe..492bcb09 100644 --- a/common.props +++ b/common.props @@ -3,6 +3,7 @@ latest enable enable + $(NoWarn);CS1591;CS0436;NU1803 diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs index 460c506d..ae3dfd9d 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs @@ -1,15 +1,31 @@ -using SJZY.Track.Domain.Aggregates.OrderAggregate; +using System.ComponentModel.DataAnnotations; namespace SJZY.Track.Application.Dtos.ProvideServices; public class LinkOrderInput { /// - /// false解绑,true关联,必填 + /// false解绑,true关联 /// + [Required] public bool IsLink { get; set; } - public NoInfo NoInfo { get; set; } + /// + /// 订单类型,必填 + /// + [Required] + public int OrderType { get; set; } - public List LinkedOrderInfos { 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/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index cb0f68ef..4ebfcc66 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -71,24 +71,58 @@ public class OrderService : ApplicationService [HttpPost("Order/Link")] public async Task LinkOrderAsync(LinkOrderInput input) { - //todo:去重 - var distinctOrderInfos = input.LinkedOrderInfos.Distinct().ToList(); - - if (await _orderRepository.IsAnyAsync(x => x.IsEqual(input.NoInfo))) + if (!await _orderRepository.IsAnyAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) { + throw new BusinessException(message: $"单号:{input.OrderNo}不存在"); } - // var links = input.LinkedOrderInfos.Select(x => new OrderLinkEntity - // { - // OrderNo = x.OrderNo, - // OrderType = x.NoType - // }).ToList(); - // - // foreach (var link in links) - // { - // if (await _orderLinkQuery.IsAnyAsync(x => x.)) - // } - // _orderRepository.LinkOrderAsync(); + if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; + + // 单号去重 + input.LinkOrderNos = input.LinkOrderNos.Distinct().ToList(); + + // 解绑 + if (!input.IsLink) return await UnLinkOrderAsync(input); + + // 关联订单 + return await DoLinkOrderAsync(input); + } + + private async Task DoLinkOrderAsync(LinkOrderInput input) + { + // 获取已关联的订单 + 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 canLinkOrderNos = await _orderRepository.GetListAsync(x => + x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo), + x => x.OrderNo); + + await _orderRepository.LinkOrderAsync(canLinkOrderNos.Select(x => new OrderLinkEntity + { + OrderNo = input.OrderNo, + OrderType = input.OrderType, + LinkOrderNo = x, + LinkOrderType = input.LinkOrderType + }).ToList()); + + 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; } diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index fb130780..d187933a 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -17,4 +17,18 @@ public interface IOrderRepository : IBasicRepository /// /// Task CreateOrderTemplatesAsync(List templateEntities); + + /// + /// 关联订单 + /// + /// + /// + Task LinkOrderAsync(List orderLinkEntities); + + /// + /// 解除订单关联关系 + /// + /// + /// + Task UnLinkByIdsAsync(List linkIds); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index 2faa141f..e474f40e 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -89,4 +89,15 @@ public struct NoInfo [Required] [MaxLength(100)] public string OrderNo { get; set; } + + public NoInfo(int noType, string orderNo) + { + NoType = noType; + OrderNo = orderNo; + } + + public override string ToString() + { + return $"[订单类型: {NoType}, 订单号: {OrderNo}]"; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 77d83641..9b64b010 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -18,4 +18,14 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { await Context.Insertable(templateEntities).ExecuteCommandAsync(); } + + public async Task LinkOrderAsync(List orderLinkEntities) + { + await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); + } + + public async Task UnLinkByIdsAsync(List linkIds) + { + await Context.Deleteable(linkIds).ExecuteCommandAsync(); + } } \ 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 e4341712..d75f4b08 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -1,9 +1,7 @@  - + net7.0 - enable - enable True From 14933065e4cc9150c07d6b3d9abd61073fd20ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 16:20:16 +0800 Subject: [PATCH 032/196] =?UTF-8?q?change=20=E6=8B=86=E5=88=86=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=85=B3=E8=81=94=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplicationModule.cs | 12 +-- src/SJZY.Track.Application/GlobalUsings.cs | 3 + .../ProvideServices/OrderLinkService.cs | 84 +++++++++++++++++++ .../Services/ProvideServices/OrderService.cs | 69 +-------------- 4 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 src/SJZY.Track.Application/GlobalUsings.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs index 899bceee..ba3bc813 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/ApplicationModule.cs @@ -1,6 +1,5 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Localization; -using SJZY.Track.Domain; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; using Volo.Abp.AspNetCore.Mvc; @@ -26,14 +25,11 @@ namespace SJZY.Track.Application public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); - Configure(options => - { - options.AddMaps(true); - }); + Configure(options => { options.AddMaps(true); }); Configure(options => { - options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly);//创建动态api + options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly); //创建动态api }); //添加虚拟文件系统 @@ -60,7 +56,6 @@ namespace SJZY.Track.Application var configuration = context.Services.GetConfiguration(); PreConfigure(options => { - options.ProxyClientActions.Add(async (remoteName, serviceProvider, httpClient) => { //如果设置Token,前端需要传入Token 否则引发异常 @@ -70,6 +65,5 @@ namespace SJZY.Track.Application }); }); } - } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsings.cs b/src/SJZY.Track.Application/GlobalUsings.cs new file mode 100644 index 00000000..63eef9f8 --- /dev/null +++ b/src/SJZY.Track.Application/GlobalUsings.cs @@ -0,0 +1,3 @@ +// Global using directives + +global using SJZY.Track.Domain; \ 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..f729f6b1 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -0,0 +1,84 @@ +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; + +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 订单关联服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class OrderLinkService +{ + 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) + { + if (!await _orderRepository.IsAnyAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) + { + throw new BusinessException(message: $"单号:{input.OrderNo}不存在"); + } + + if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; + + // 单号去重 + input.LinkOrderNos = input.LinkOrderNos.Distinct().ToList(); + + // 解绑 + if (!input.IsLink) return await UnLinkOrderAsync(input); + + // 关联订单 + return await DoLinkOrderAsync(input); + } + + private async Task DoLinkOrderAsync(LinkOrderInput input) + { + // 获取已关联的订单 + 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 canLinkOrderNos = await _orderRepository.GetListAsync(x => + x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo), + x => x.OrderNo); + + await _orderRepository.LinkOrderAsync(canLinkOrderNos.Select(x => new OrderLinkEntity + { + OrderNo = input.OrderNo, + OrderType = input.OrderType, + LinkOrderNo = x, + LinkOrderType = input.LinkOrderType + }).ToList()); + + 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 index 4ebfcc66..e40ed43e 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,6 +1,5 @@ using Newtonsoft.Json; using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.UserCenter.HttpApi.Services; @@ -13,12 +12,10 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class OrderService : ApplicationService { private readonly IOrderRepository _orderRepository; - private readonly IBasicQuery _orderLinkQuery; - public OrderService(IOrderRepository orderRepository, IBasicQuery orderLinkQuery) + public OrderService(IOrderRepository orderRepository) { _orderRepository = orderRepository; - _orderLinkQuery = orderLinkQuery; } /// @@ -62,68 +59,4 @@ public class OrderService : ApplicationService return true; } - - /// - /// 关联订单 - /// - /// - /// - [HttpPost("Order/Link")] - public async Task LinkOrderAsync(LinkOrderInput input) - { - if (!await _orderRepository.IsAnyAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) - { - throw new BusinessException(message: $"单号:{input.OrderNo}不存在"); - } - - if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; - - // 单号去重 - input.LinkOrderNos = input.LinkOrderNos.Distinct().ToList(); - - // 解绑 - if (!input.IsLink) return await UnLinkOrderAsync(input); - - // 关联订单 - return await DoLinkOrderAsync(input); - } - - private async Task DoLinkOrderAsync(LinkOrderInput input) - { - // 获取已关联的订单 - 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 canLinkOrderNos = await _orderRepository.GetListAsync(x => - x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo), - x => x.OrderNo); - - await _orderRepository.LinkOrderAsync(canLinkOrderNos.Select(x => new OrderLinkEntity - { - OrderNo = input.OrderNo, - OrderType = input.OrderType, - LinkOrderNo = x, - LinkOrderType = input.LinkOrderType - }).ToList()); - - 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 From 3f7a978ec69c6172362ff8d8c22cf56231210104 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 16:21:53 +0800 Subject: [PATCH 033/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 2 +- .../Localization/Resources/en.json | 4 +++- .../Localization/Resources/zh.json | 3 ++- .../TrackTemplates/TrackTemplateService.cs | 20 +++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs index 03b4f535..b0c8dc6b 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -90,6 +90,6 @@ /// /// 模板代码 /// - public int Code { set; get; } + public string Code { set; get; } } } diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 5994b511..23d14ff9 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -3,6 +3,8 @@ "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" + } } \ 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..1bb47943 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -3,6 +3,7 @@ "texts": { "NotFindData": "未找到指定编号下的任何数据!", "ParameterDemo": "{0}在{1}地方做了{2}动作", - "ParameterDemo1": "{0}在{1}地方做了{2}动作" + "ParameterDemo1": "{0}在{1}地方做了{2}动作", + "TemplateExist": "模板代码已存在于当前选择的子系统下" } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index b2df6211..4716c2ba 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -83,6 +83,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task AddAsync(EditTrackTemplateInput input) { + #region 业务校验 + //校验模版代码唯一性 + var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + if (templateEntity != null) + { + throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + } + #endregion + var entity = ObjectMapper.Map(input); var isTrue = await _trackTemplateRepository.InsertAsync(entity); @@ -91,6 +100,14 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackTemplateInput input) { + #region 业务校验 + var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + if (isExist != null) + { + throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + } + #endregion + var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity); @@ -100,6 +117,9 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackTemplateInput input) { + #region 业务校验 + //到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示 + #endregion var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); From 1b55ad296530cb16731a87c51a0295d86c09a169 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 16:46:02 +0800 Subject: [PATCH 034/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackTemplateAutoMapperProfile.cs | 3 +++ .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 2 +- .../Services/TrackContents/TrackContentService.cs | 4 +++- .../TrackTemplates/EditTrackTemplateInputValidation.cs | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index 79a142eb..94219051 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; @@ -17,5 +18,7 @@ public class TrackTemplateAutoMapperProfile : Profile //CreateMap, UnifyResultDto>(MemberList.None); CreateMap(MemberList.None); + + CreateMap(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs index b0c8dc6b..6269ba0b 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -85,7 +85,7 @@ /// /// 模板名称 /// - public int Name { set; get; } + public string Name { set; get; } /// /// 模板代码 diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index fb7bacb5..95504518 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Application.Dtos.TrackContents; +using Microsoft.AspNetCore.Authorization; +using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Dtos.TrackContents; @@ -33,6 +34,7 @@ namespace SJZY.Track.Application.Services.TrackContents /// /// [HttpPost("Edit")] + [AllowAnonymous] public async Task EditAsync(EditTrackContentInput input) { return input.Options switch diff --git a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs index 412e5ef9..8768b688 100644 --- a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -19,10 +19,12 @@ namespace SJZY.Track.Application.Validations.TrackTemplates 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("模版代码不能为空!"); }); From 72a10635236bbb0a9f5b9de09b10b790a9fea0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 28 Feb 2024 16:51:21 +0800 Subject: [PATCH 035/196] =?UTF-8?q?change=20=E8=AE=A2=E5=8D=95=E8=81=9A?= =?UTF-8?q?=E5=90=88=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/CreateOrderInput.cs | 57 ++---------------- .../Dtos/ProvideServices/UpdateOrderInput.cs | 59 +++++++++++++++++++ .../Services/ProvideServices/OrderService.cs | 31 ++++++---- .../Aggregates/OrderAggregate/OrderEntity.cs | 57 +++++++++--------- .../OrderAggregate/OrderFlightEntity.cs | 38 ++++++++++++ .../OrderAggregate/OrderLinkEntity.cs | 8 +-- 6 files changed, 154 insertions(+), 96 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs create mode 100644 src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs index d099eaaa..31b917f2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs @@ -1,26 +1,13 @@ using System.ComponentModel.DataAnnotations; -using SJZY.Track.Domain.Aggregates.OrderAggregate; namespace SJZY.Track.Application.Dtos.ProvideServices; -public class CreateOrderInput +public class CreateOrderInput : UpdateOrderInput { - public NoInfo NoInfo { get; set; } - /// /// 客户id /// public int ClientId { get; set; } - - /// - /// 订单模板 - /// - public List Templates { get; set; } - - /// - /// 订单明细 - /// - public OrderDetails Details { get; set; } } public class OrderTemplateInfo @@ -34,42 +21,7 @@ public class OrderTemplateInfo /// /// 服务商id /// - public int ServiceProviderId { get; set; } -} - -public class OrderDetails -{ - /// - /// 目的港口 - /// - public string? ArrivalPort { get; set; } - - /// - /// 起运港口 - /// - public string? LeavePort { get; set; } - - /// - /// 目的国家,必填 - /// - public string ArrivalCountry { get; set; } - - /// - /// 起运国家,必填 - /// - public string LeaveCountry { get; set; } - - /// - /// 目的城市,必填 - /// - public string ArrivalCity { get; set; } - - /// - /// 起运城市,必填 - /// - public string LeaveCity { get; set; } - - public List FligthInfos { get; set; } + public int? ServiceProviderId { get; set; } } public class FligthInfo @@ -77,10 +29,13 @@ public class FligthInfo /// /// 航班号 /// + [Required] + [MaxLength(50)] public string FlightNo { get; set; } /// /// 班期 /// - public string FlightDate { get; set; } + [Required] + public DateTime FlightDate { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs new file mode 100644 index 00000000..88b12be1 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs @@ -0,0 +1,59 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class UpdateOrderInput +{ + /// + /// 订单类型,必填 + /// + [Required] + public int OrderType { get; set; } + + /// + /// 订单号,必填 + /// + [Required] + [MaxLength(100)] + public string OrderNo { get; set; } + + /// + /// 订单模板(传全量) + /// + public List Templates { get; set; } = new(); + + /// + /// 目的港口 + /// + public string? ArrivalPort { get; set; } + + /// + /// 起运港口 + /// + public string? LeavePort { get; set; } + + /// + /// 目的国家,必填 + /// + public string ArrivalCountry { get; set; } + + /// + /// 起运国家,必填 + /// + public string LeaveCountry { get; set; } + + /// + /// 目的城市,必填 + /// + public string ArrivalCity { get; set; } + + /// + /// 起运城市,必填 + /// + public string LeaveCity { get; set; } + + /// + /// 订单航班信息 + /// + public List FlightInfos { get; set; } = new(); +} \ 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 index e40ed43e..a5a37ce2 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,5 +1,4 @@ -using Newtonsoft.Json; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.UserCenter.HttpApi.Services; @@ -28,18 +27,22 @@ public class OrderService : ApplicationService public async Task CreateOrderAsync(CreateOrderInput input) { if (await _orderRepository.IsAnyAsync(x => - x.OrderType == input.NoInfo.NoType && x.OrderNo == input.NoInfo.OrderNo)) + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) { - throw new BusinessException(message: $"单号:{input.NoInfo.OrderNo}已存在"); + throw new BusinessException(message: $"单号:{input.OrderNo}已存在"); } var order = new OrderEntity { CustomId = input.ClientId, - OrderDetails = JsonConvert.SerializeObject(input.Details), - OrderNo = input.NoInfo.OrderNo, - OrderType = input.NoInfo.NoType, - SubSystemId = CurrentUserRequest.SubSystemId + OrderNo = input.OrderNo, + OrderType = input.OrderType, + SubSystemId = CurrentUserRequest.SubSystemId, + IsCompleted = false, + LatestTraceContent = null, + LatestTraceEnContent = null, + LatestTraceTime = null, + OrderDetails = null, }; using var tran = TransactionHelper.GetReadCommitted(); @@ -47,16 +50,24 @@ public class OrderService : ApplicationService // 创建订单 var orderId = await _orderRepository.InsertReturnIdentityAsync(order); - // 创建订单模板 var templates = input.Templates.Select(x => new OrderTemplateEntity { OrderId = orderId, - ServiceProviderId = x.ServiceProviderId, + ServiceProviderId = x.ServiceProviderId ?? 0, TrackTemplateId = x.TemplateId }).ToList(); + + // 创建订单模板 await _orderRepository.CreateOrderTemplatesAsync(templates); + tran.Complete(); return true; } + + [HttpPost("Order/Update")] + public async Task UpdateOrderAsync(UpdateOrderInput input) + { + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index e474f40e..9fe699e4 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -1,6 +1,4 @@ -using System.ComponentModel.DataAnnotations; - -namespace SJZY.Track.Domain.Aggregates.OrderAggregate; +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; /// /// 轨迹订单主表 @@ -68,36 +66,39 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot [SugarColumn(ColumnName = "SubSystemId")] public int SubSystemId { get; set; } - - public bool IsEqual(NoInfo noInfo) - { - return OrderType == noInfo.NoType && OrderNo == noInfo.OrderNo; - } -} - -public struct NoInfo -{ /// - /// 订单类型,必填 + /// 目的城市 /// - [Required] - public int NoType { get; set; } + [SugarColumn(ColumnName = "ArrivalCity")] + public string ArrivalCity { get; set; } /// - /// 订单号,必填 + /// 目的国家 /// - [Required] - [MaxLength(100)] - public string OrderNo { get; set; } + [SugarColumn(ColumnName = "ArrivalCountry")] + public string ArrivalCountry { get; set; } - public NoInfo(int noType, string orderNo) - { - NoType = noType; - OrderNo = orderNo; - } + /// + /// 目的港口 + /// + [SugarColumn(ColumnName = "ArrivalPort")] + public string ArrivalPort { get; set; } - public override string ToString() - { - return $"[订单类型: {NoType}, 订单号: {OrderNo}]"; - } + /// + /// 起运城市 + /// + [SugarColumn(ColumnName = "LeaveCity")] + public string LeaveCity { get; set; } + + /// + /// 起运国家 + /// + [SugarColumn(ColumnName = "LeaveCountry")] + public string LeaveCountry { get; set; } + + /// + /// 起运港口 + /// + [SugarColumn(ColumnName = "LeavePort")] + public string LeavePort { 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..8e828946 --- /dev/null +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs @@ -0,0 +1,38 @@ +namespace SJZY.Track.Domain.Aggregates.OrderAggregate; + +public class OrderFlightEntity : ICreateBaicEntity, 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; } + + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 创建人 + /// + public int CreateUserId { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { 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 index 96c005b5..bc94704a 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -4,8 +4,7 @@ /// 轨迹订单关联表(1:N) /// [SugarTable("t_order_link")] -public class OrderLinkEntity : ICreateBaicEntity, - ISoftDeleteBasicEntity, IEntity +public class OrderLinkEntity : ICreateBaicEntity, IEntity { /// /// 自增主键 @@ -46,9 +45,4 @@ public class OrderLinkEntity : ICreateBaicEntity, /// 创建时间 /// public DateTime? CreateTime { get; set; } - - /// - /// 是否删除(已解绑) - /// - public bool IsDeleted { get; set; } } \ No newline at end of file From 25bed79bf615556635d71d9da1adfac86f2499d3 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 17:19:09 +0800 Subject: [PATCH 036/196] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplateAutoMapperProfile.cs | 8 +-- .../TrackContents/TrackContentService.cs | 1 - .../TrackTemplateRepository.cs | 50 +++---------------- 3 files changed, 12 insertions(+), 47 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index 94219051..cec240ac 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -3,6 +3,7 @@ using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; +using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper; @@ -14,11 +15,10 @@ public class TrackTemplateAutoMapperProfile : Profile public TrackTemplateAutoMapperProfile() { CreateMap(MemberList.None); - - //CreateMap, UnifyResultDto>(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/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 95504518..86116173 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -34,7 +34,6 @@ namespace SJZY.Track.Application.Services.TrackContents /// /// [HttpPost("Edit")] - [AllowAnonymous] public async Task EditAsync(EditTrackContentInput input) { return input.Options switch diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 1424b6df..d853725a 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -30,13 +30,13 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -54,6 +54,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) + .OrderByIF(input.TrackTemplateId>0, (a, b) => SqlFunc.IIF(a.Id==input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -63,41 +64,6 @@ public class TrackTemplateRepository : BasicRepository, ITr SubSystem = b.CnName }) .ToPagedListAsync(input.PageIndex, input.PageSize); - //如果轨迹模版id传值了,就置顶在第一条 - if (input.TrackTemplateId > 0 && (!pagedList.List.IsNullOrEmpty())) - { - if (input.PageIndex == 1) - { - bool existCurrent = pagedList.List.Any(x => x.Id == input.TrackTemplateId); - if (existCurrent) - { - var item = pagedList.List.FirstOrDefault(x => x.Id == input.TrackTemplateId); - pagedList.List.Remove(item); - pagedList.List.Insert(0, item); - } - else - { - var item = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .Where((a, b) => a.Id == input.TrackTemplateId) - .Select((a, b) => new GetTrackTemplateListVO - { - Id = a.Id, - Code = a.Code, - CreateTime = a.CreateTime, - Name = a.Name, - SubSystem = b.CnName - }) - .FirstAsync(); - if (item != null) - { - var removeItem = pagedList.List.LastOrDefault(); - pagedList.List.Remove(removeItem); - pagedList.List.Insert(0, item); - } - } - } - } return pagedList; } From 07418e4810c2dd47777b8e0abcf4fd0575cb214d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Wed, 28 Feb 2024 19:00:38 +0800 Subject: [PATCH 037/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SJZY.Track.Application.csproj | 7 ++-- .../Services/TrackPull/TrackPullService.cs | 38 +++++++++++++++++++ .../ITrackPullConfigRepository.cs | 11 +++++- .../Dtos/Common/KeywordsInputVO.cs | 19 ++++++++++ .../GetTrackPullConfigPageOutputVO.cs | 26 +++++++++++++ .../SJZY.Track.Domain.csproj | 2 +- .../TrackPullConfigRepository.cs | 25 ++++++++++++ .../TrackTemplateRepository.cs | 3 +- 8 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 58d32d12..e8f1425c 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -8,8 +8,11 @@ + + + @@ -26,8 +29,4 @@ - - - - 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..5bd82b7f --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPull; +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; + + public TrackPullService( + IStringLocalizer stringLocalizer, + ITrackPullConfigRepository trackPullConfigRepository) + { + _stringLocalizer = stringLocalizer; + _trackPullConfigRepository = trackPullConfigRepository; + } + + /// + /// 轨迹拉取配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPullConfigRepository.GetPageAsync(input); + } +} \ 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 index 3b0b8441..0b8173e3 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -1,5 +1,14 @@ -namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate; +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); } \ 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..9cf11c60 --- /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 int? SelectedId { 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..e45b7de8 --- /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/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..0354af7d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index d63120b7..3082bafe 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -1,8 +1,33 @@ 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; 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); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index d853725a..f26d606c 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -54,7 +54,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId>0, (a, b) => SqlFunc.IIF(a.Id==input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -90,6 +90,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .Filter(null, true) .Where(templateContent => templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) + .OrderByDescending(templateContent => templateContent.CreateTime) .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO { From 2a07b472be497a1673dc22b0472f5c1633be2c46 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 19:59:55 +0800 Subject: [PATCH 038/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContentAutoMapperProfile.cs | 27 +++++++++++ .../Localization/Resources/en.json | 3 +- .../Localization/Resources/zh.json | 3 +- .../TrackContents/TrackContentService.cs | 23 ++++++++++ .../EditTrackContentInputValidation.cs | 38 ++++++++++++++++ .../TrackContentRepository.cs | 45 +++++++++++-------- 6 files changed, 118 insertions(+), 21 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs new file mode 100644 index 00000000..cf4453f8 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -0,0 +1,27 @@ +using AutoMapper; +using AutoMapper.Internal.Mappers; +using SJZY.Track.Application.Dtos.TrackContents; +using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackTemplate; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.ObjectMapping; + +namespace SJZY.Track.Application.AutoMapper +{ + public class TrackContentAutoMapperProfile : Profile + { + public TrackContentAutoMapperProfile() + { + CreateMap(MemberList.None); + CreateMap(MemberList.None); + CreateMap(MemberList.None); + + } + } +} diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 23d14ff9..3fd41b14 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -4,7 +4,8 @@ "NotNull1": "{0} is not null", "NotFindData": "No data found under the specified number", "ParameterDemo1": "{0} in {1} to do {2}", - "TemplateExist": "The template code already exists under the currently selected subsystem" + "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" } } \ 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 1bb47943..4692d323 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -4,6 +4,7 @@ "NotFindData": "未找到指定编号下的任何数据!", "ParameterDemo": "{0}在{1}地方做了{2}动作", "ParameterDemo1": "{0}在{1}地方做了{2}动作", - "TemplateExist": "模板代码已存在于当前选择的子系统下" + "TemplateExist": "模板代码已存在于当前选择的子系统下", + "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复" } } \ 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 index 86116173..3245d2ce 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,6 +1,8 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Localization; using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackStatus; @@ -20,12 +22,15 @@ namespace SJZY.Track.Application.Services.TrackContents [Route("/Track/Content")] public class TrackContentService : ApplicationService, ITransientDependency { + private readonly IStringLocalizer _stringLocalizer; private readonly ITrackContentRepository _trackContentRepository; public TrackContentService( + IStringLocalizer stringLocalizer, ITrackContentRepository trackContentRepository ) { + this._stringLocalizer=stringLocalizer; this._trackContentRepository=trackContentRepository; } @@ -83,6 +88,15 @@ namespace SJZY.Track.Application.Services.TrackContents #region 私有方法 private async Task AddAsync(EditTrackContentInput input) { + #region 业务逻辑校验 + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&&(a.Code==input.Code || + a.Content==input.Content || a.EnContent==input.EnContent)); + if (trackContentEntity != null) + { + throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + } + #endregion + var entity = ObjectMapper.Map(input); var isTrue = await _trackContentRepository.InsertAsync(entity); @@ -91,6 +105,15 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task UpdateAsync(EditTrackContentInput input) { + #region 业务逻辑校验 + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId==input.SubSystemId && (a.Code==input.Code || + a.Content==input.Content || a.EnContent==input.EnContent)); + if (trackContentEntity != null) + { + throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + } + #endregion + var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); 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..75951dc5 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs @@ -0,0 +1,38 @@ +using FluentValidation; +using SJZY.Track.Application.Dtos.TrackContents; +using SJZY.Track.Application.Dtos.TrackTemplates; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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("轨迹内容英文不能为空!"); + }); + } + + } +} diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 1671ac80..32ebd92d 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -1,4 +1,5 @@ using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackStatus; @@ -22,20 +23,22 @@ public class TrackContentRepository : BasicRepository, ITrac public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .Where((a, b) => a.Id == id) - .Select((a, b) => new GetTrackContentDetailVO + .LeftJoin((a, b) => a.TrackStatusId==b.Id) + .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) + .LeftJoin((a, b, c, d) => a.SubSystemId == b.Id) + .Where((a, b, c, d) => a.Id == id) + .Select((a, b, c, d) => new GetTrackContentDetailVO { Id = a.Id, SubSystemId = a.SubSystemId, - SubSystem = b.CnName, + SubSystem = d.CnName, TrackStatusId=a.TrackStatusId, - TrackStatus= "", + TrackStatus= b.Status, Code = a.Code, Content = a.Content, EnContent = a.EnContent, TrackFlagId=a.TrackFlagId, - TrackFlag="" + TrackFlag=c.Name }) .FirstAsync(); return detail; @@ -50,28 +53,32 @@ public class TrackContentRepository : BasicRepository, ITrac { UnifyPageResultDto pagedList = new UnifyPageResultDto(); pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId == c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) - .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .LeftJoin((a, b) => a.TrackStatusId==b.Id) + .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) + .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) + .LeftJoin((a, b, c, d, e) => a.CreateUserId == e.Id) + .LeftJoin((a, b, c, d, e, f) => a.UpdateUserId == f.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), - (a, b, c, d) => a.Code.Contains(input.Keywords) + (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) + || a.EnContent.Contains(input.Keywords) ) - .Select((a, b, c, d) => new GetTrackContentListVO + .Select((a, b, c, d, e, f) => new GetTrackContentListVO { Id = a.Id, - SubSystem = b.CnName, + SubSystem = d.CnName, Code = a.Code, Content = a.Content, EnContent = a.EnContent, - TrackStatus= "", - Node = "", - TrackFlag= "", + 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 = c.Name, + CreateUser = e.Name, UpdateTime = a.UpdateTime, - UpdateUser = d.Name, - + UpdateUser = f.Name }) .ToPagedListAsync(input.PageIndex, input.PageSize); From 6596a26def5d25ef030ca4acdb7144c781736c60 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 20:04:29 +0800 Subject: [PATCH 039/196] =?UTF-8?q?=E6=98=A0=E5=B0=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackContentAutoMapperProfile.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs index cf4453f8..e9346eff 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -21,7 +21,8 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - + CreateMap(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); } } } From 8791f124238ded6010461d39b42dfb61fb5dd2b8 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 21:07:37 +0800 Subject: [PATCH 040/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackStatusAutoMapperProfile.cs | 31 +++++++++++++++++++ .../Localization/Resources/en.json | 4 +-- .../Localization/Resources/zh.json | 3 +- .../TrackStatus/TrackStatusService.cs | 27 ++++++++++++++-- .../TrackStatusRepository.cs | 7 +++-- 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs new file mode 100644 index 00000000..c66d09e7 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs @@ -0,0 +1,31 @@ +using AutoMapper; +using AutoMapper.Internal.Mappers; +using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.ObjectMapping; + +namespace SJZY.Track.Application.AutoMapper +{ + 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); + } + } +} diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 3fd41b14..7833f864 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -5,7 +5,7 @@ "NotFindData": "No data found under the specified number", "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" - + "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" } } \ 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 4692d323..7ef977fe 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -5,6 +5,7 @@ "ParameterDemo": "{0}在{1}地方做了{2}动作", "ParameterDemo1": "{0}在{1}地方做了{2}动作", "TemplateExist": "模板代码已存在于当前选择的子系统下", - "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复" + "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", + "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复" } } \ 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 index 9db46c6f..7b076868 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,4 +1,6 @@ -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using Volo.Abp.DependencyInjection; @@ -12,12 +14,15 @@ namespace SJZY.Track.Application.Services.TrackStatus; [Route("/Track/Status")] public class TrackStatusService : ApplicationService, ITransientDependency { + private readonly IStringLocalizer _stringLocalizer; private readonly ITrackStatusRepository _trackStatusRepository; public TrackStatusService( + IStringLocalizer stringLocalizer, ITrackStatusRepository trackStatusRepository ) { + this._stringLocalizer=stringLocalizer; this._trackStatusRepository = trackStatusRepository; } @@ -73,9 +78,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency } #region 私有方法 - private async Task AddAsync(EditTrackStatusInput input) { + #region 业务校验 + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || + a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); + if (trackStatusEntity!=null) + { + throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + } + #endregion + var entity = ObjectMapper.Map(input); var isTrue = await _trackStatusRepository.InsertAsync(entity); @@ -84,6 +97,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackStatusInput input) { + #region 业务校验 + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || + a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); + if (trackStatusEntity!=null) + { + throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + } + #endregion + var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity); @@ -97,6 +119,5 @@ public class TrackStatusService : ApplicationService, ITransientDependency return new UnifyResultDto("200", "删除成功", isTrue); } - #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Repository/TrackStatusRepository.cs index 7f5d88b7..9e88da35 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/TrackStatusRepository.cs @@ -11,7 +11,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS } /// - /// 获取轨迹模版明细 + /// 获取轨迹状态明细 /// /// /// @@ -56,7 +56,10 @@ public class TrackStatusRepository : BasicRepository, ITrackS Code = a.Code, EntrackStatus = a.EnStatus, TrackStatus = a.Status, - Node = "", + 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, From 82cee1ed13545ad89175a06cf188265ce8287889 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 28 Feb 2024 21:19:10 +0800 Subject: [PATCH 041/196] =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditTrackContentInputValidation.cs | 2 +- .../EditTrackStatusInputValidation.cs | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs index 75951dc5..0faf7a0c 100644 --- a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs @@ -28,7 +28,7 @@ namespace SJZY.Track.Application.Validations.TrackContents { 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.Code).NotNull().WithMessage("轨迹内容代码必填!").NotEmpty().WithMessage("轨迹内容代码不能为空!"); RuleFor(x => x.Content).NotNull().WithMessage("轨迹内容必填!").NotEmpty().WithMessage("轨迹内容不能为空!"); RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!"); }); 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..beb1df54 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs @@ -0,0 +1,37 @@ +using FluentValidation; +using SJZY.Track.Application.Dtos.TrackContents; +using SJZY.Track.Application.Dtos.TrackStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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("轨迹状态英文不能为空!"); + }); + } + } +} From df037021ba6792870fe7215d6e0236749ed31661 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 09:18:24 +0800 Subject: [PATCH 042/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackFlags/ITrackFlagService.cs | 12 +++++++++ .../Services/TrackFlags/TrackFlagService.cs | 26 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs create mode 100644 src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs diff --git a/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs new file mode 100644 index 00000000..1e745341 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Services.TrackFlags +{ + public interface ITrackFlagService + { + } +} diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs new file mode 100644 index 00000000..371f5b85 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -0,0 +1,26 @@ +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.TrackFlags +{ + /// + /// 轨迹标记服务 + /// + [ApiExplorerSettings(GroupName = "轨迹标记")] + [Route("/Track/TrackFlag")] + public class TrackFlagService : ApplicationService, ITransientDependency + { + public TrackFlagService() + { + } + + + } +} From 1e9d4fdd6f54b47a3086aeb51e4b296f033016cf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 09:18:48 +0800 Subject: [PATCH 043/196] 1 --- .../Services/TrackFlags/TrackFlagService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index 371f5b85..a01d56b5 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -14,7 +14,7 @@ namespace SJZY.Track.Application.Services.TrackFlags /// 轨迹标记服务 /// [ApiExplorerSettings(GroupName = "轨迹标记")] - [Route("/Track/TrackFlag")] + [Route("/Track/Flag")] public class TrackFlagService : ApplicationService, ITransientDependency { public TrackFlagService() From eddd529718d13b0a792c5b75da0583d7de1d2415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 09:20:18 +0800 Subject: [PATCH 044/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 11 ++++ .../ITrackPullConfigRepository.cs | 7 +++ .../GetTrackPullContentPageInputVO.cs | 9 +++ .../GetTrackPullContentPageOutputVO.cs | 61 +++++++++++++++++++ .../TrackPullConfigRepository.cs | 23 ++++++- 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 5bd82b7f..08e8406c 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -35,4 +35,15 @@ public class TrackPullService : ApplicationService, ITransientDependency { return await _trackPullConfigRepository.GetPageAsync(input); } + + /// + /// 轨迹拉取配置内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync([FromBody] GetTrackPullContentPageInputVO input) + { + return await _trackPullConfigRepository.GetContentPageAsync(input); + } } \ 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 index 0b8173e3..8229f27c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -11,4 +11,11 @@ public interface ITrackPullConfigRepository : IBasicRepository /// Task> GetPageAsync(KeywordsInputVO input); + + /// + /// 轨迹拉取配置内容列表 + /// + /// + /// + Task> GetContentPageAsync(GetTrackPullContentPageInputVO input); } \ 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..c05a0375 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs @@ -0,0 +1,61 @@ +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 bool? TrackContentValue { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public string TrackKeyword { get; set; } + + /// + /// 拉取轨迹关键字(正向) + /// + public List TrackKeywords { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public string TrackKeywordReverse { get; set; } + + /// + /// 拉取轨迹关键字(反向) + /// + public List TrackKeywordsReverse { get; set; } + + /// + /// 轨迹发生地 + /// + public string TrackPlaceValue { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string TrackStatusValue { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 3082bafe..43b0d367 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +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; @@ -30,4 +31,24 @@ public class TrackPullConfigRepository : BasicRepository, }) .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) + .Mapper(x => + { + x.TrackKeywords = [.. x.TrackKeyword.Split(',')]; + x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')]; + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 249a77851b12a43eaef90ff4b37f985c4230fb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 09:44:36 +0800 Subject: [PATCH 045/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 11 +++ .../TrackTemplates/TrackTemplateService.cs | 8 +- .../ITrackPullConfigRepository.cs | 7 ++ .../ITrackTemplateRepository.cs | 8 +- .../GetTrackPullConfigDetailOutputVO.cs | 82 +++++++++++++++++++ .../TrackPullConfigRepository.cs | 19 +++++ .../TrackTemplateRepository.cs | 8 +- 7 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 08e8406c..e9300b88 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -46,4 +46,15 @@ public class TrackPullService : ApplicationService, ITransientDependency { return await _trackPullConfigRepository.GetContentPageAsync(input); } + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int id) + { + return await _trackPullConfigRepository.GetDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 4716c2ba..422aafde 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -164,7 +164,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); - if (await _trackTemplateRepository.IsAnyAsync(isAnyExp)) + if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); } @@ -174,18 +174,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var entity = ObjectMapper.Map(input); - await _trackTemplateRepository.InsertAsync(entity); + await _trackTemplateRepository.InsertContentAsync(entity); break; case OptionTypeNoNull.修改: - var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ?? + var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); ObjectMapper.Map(input, oldEntity); - await _trackTemplateRepository.UpdateAsync(oldEntity); + await _trackTemplateRepository.UpdateContentAsync(oldEntity); break; diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 8229f27c..98bb4822 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -18,4 +18,11 @@ public interface ITrackPullConfigRepository : IBasicRepository /// Task> GetContentPageAsync(GetTrackPullContentPageInputVO input); + + /// + /// 轨迹拉取配置详情 + /// + /// + /// + Task GetDetailAsync(int id); } \ 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 index a20f2ced..ac26857b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -25,13 +25,13 @@ public interface ITrackTemplateRepository : IBasicRepository Task GetContentDetailAsync(int id); - Task IsAnyAsync(Expression> whereExpression); + Task IsContentAnyAsync(Expression> whereExpression); - Task InsertAsync(TrackTemplateContentEntity insertObj); + Task InsertContentAsync(TrackTemplateContentEntity insertObj); - Task GetByIdAsync(int id); + Task GetContentByIdAsync(int id); - Task UpdateAsync(TrackTemplateContentEntity updateObj); + Task UpdateContentAsync(TrackTemplateContentEntity updateObj); Task SoftDeleteContentAsync(int id); } \ No newline at end of file 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..76fbdaf4 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs @@ -0,0 +1,82 @@ +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.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 43b0d367..289552b0 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -51,4 +51,23 @@ public class TrackPullConfigRepository : BasicRepository, }) .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(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index f26d606c..ee2ee76f 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -126,25 +126,25 @@ public class TrackTemplateRepository : BasicRepository, ITr } /// - public async Task IsAnyAsync(Expression> whereExpression) + public async Task IsContentAnyAsync(Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).AnyAsync(); } /// - public async Task InsertAsync(TrackTemplateContentEntity insertObj) + public async Task InsertContentAsync(TrackTemplateContentEntity insertObj) { return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; } /// - public async Task GetByIdAsync(int id) + public async Task GetContentByIdAsync(int id) { return await Context.Queryable().InSingleAsync(id); } /// - public async Task UpdateAsync(TrackTemplateContentEntity updateObj) + public async Task UpdateContentAsync(TrackTemplateContentEntity updateObj) { return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); } From 90e59e27ea92f40328e9fddd708dd526a7966224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 09:55:44 +0800 Subject: [PATCH 046/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 11 ++ .../ITrackPullConfigRepository.cs | 7 + .../GetTrackPullConfigDetailOutputVO.cs | 129 +++++++++--------- .../GetTrackPullContentDetailOutputVO.cs | 56 ++++++++ .../TrackPullConfigRepository.cs | 13 ++ 5 files changed, 151 insertions(+), 65 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index e9300b88..004198e0 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -57,4 +57,15 @@ public class TrackPullService : ApplicationService, ITransientDependency { return await _trackPullConfigRepository.GetDetailAsync(id); } + + /// + /// 轨迹拉取配置内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackPullConfigRepository.GetContentDetailAsync(id); + } } \ 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 index 98bb4822..6de7445c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -25,4 +25,11 @@ public interface ITrackPullConfigRepository : IBasicRepository /// Task GetDetailAsync(int id); + + /// + /// 轨迹拉取配置内容详情 + /// + /// + /// + Task GetContentDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs index 76fbdaf4..c424e5a6 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigDetailOutputVO.cs @@ -1,82 +1,81 @@ -namespace SJZY.Track.Domain.Dtos.TrackPull +namespace SJZY.Track.Domain.Dtos.TrackPull; + +public class GetTrackPullConfigDetailOutputVO { - public class GetTrackPullConfigDetailOutputVO - { - public int Id { get; set; } + public int Id { get; set; } - /// - /// 拉取轨迹订单号 - /// - public string OrderNoName { get; set; } + /// + /// 拉取轨迹订单号 + /// + public string OrderNoName { get; set; } - /// - /// 返参解析对象 - /// - public int ParseMethod { get; set; } + /// + /// 返参解析对象 + /// + public int ParseMethod { get; set; } - /// - /// 定时任务(分钟) - /// - public int PullInterval { get; set; } + /// + /// 定时任务(分钟) + /// + public int PullInterval { get; set; } - /// - /// 服务商 - /// - public string ServiceProvider { get; set; } + /// + /// 服务商 + /// + public string ServiceProvider { get; set; } - /// - /// 服务商id - /// - public int ServiceProviderId { get; set; } + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } - /// - /// 子系统 - /// - public string SubSystem { get; set; } + /// + /// 子系统 + /// + public string SubSystem { get; set; } - /// - /// 子系统id - /// - public int SubSystemId { get; set; } + /// + /// 子系统id + /// + public int SubSystemId { get; set; } - /// - /// 拉取轨迹时区 - /// - public string TackTimeZoneName { get; set; } + /// + /// 拉取轨迹时区 + /// + public string TackTimeZoneName { get; set; } - /// - /// 拉取轨迹内容代码 - /// - public string TrackContentCodeName { get; set; } + /// + /// 拉取轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } - /// - /// 拉取轨迹内容 - /// - public string TrackContentName { get; set; } + /// + /// 拉取轨迹内容 + /// + public string TrackContentName { get; set; } - /// - /// 拉取轨迹发生地 - /// - public string TrackPlaceName { get; set; } + /// + /// 拉取轨迹发生地 + /// + public string TrackPlaceName { get; set; } - /// - /// 拉取轨迹状态 - /// - public string TrackStatusName { get; set; } + /// + /// 拉取轨迹状态 + /// + public string TrackStatusName { get; set; } - /// - /// 轨迹模板 - /// - public string TrackTemplate { get; set; } + /// + /// 轨迹模板 + /// + public string TrackTemplate { get; set; } - /// - /// 轨迹模板id - /// - public int TrackTemplateId { get; set; } + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } - /// - /// 拉取轨迹发生时间 - /// - public string TrackTimeName { get; set; } - } + /// + /// 拉取轨迹发生时间 + /// + public string TrackTimeName { 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..af51f0cf --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -0,0 +1,56 @@ +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 string TrackKeywordReverse { get; set; } + + /// + /// 拉取轨迹发生地 + /// + public int TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 拉取轨迹状态 + /// + public string TrackStatusValue { get; set; } + + /// + /// 拉取轨迹时区 + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 289552b0..8965f22a 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -70,4 +70,17 @@ public class TrackPullConfigRepository : BasicRepository, }, 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) + .SingleAsync(); + } } \ No newline at end of file From d37722dfb251db65ca348b3db51b8982afbd6c61 Mon Sep 17 00:00:00 2001 From: yunwei Date: Thu, 29 Feb 2024 11:26:06 +0800 Subject: [PATCH 047/196] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/SJZY.Track.Api?= =?UTF-8?q?/appsettings.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 850809ba..c501b7d4 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -1,7 +1,7 @@ { "Configuration": { - "UseLocalConfiguration": true, // 是否使用本地配置文件 - "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启 UseLocalConfiguration 时生效 + "UseLocalConfiguration": true, //是否使用本地配置文件 + "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration 时生效 "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", From 93b694b5b73c60b7c67bb9da333cc8a953c353d4 Mon Sep 17 00:00:00 2001 From: yunwei Date: Thu, 29 Feb 2024 11:29:07 +0800 Subject: [PATCH 048/196] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/SJZY.Track.Api?= =?UTF-8?q?/appsettings.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index c501b7d4..17cba222 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -1,7 +1,7 @@ { "Configuration": { "UseLocalConfiguration": true, //是否使用本地配置文件 - "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration 时生效 + "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration时生效 "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", From 403c9af492df9afba249ed570de6f737da3f53e7 Mon Sep 17 00:00:00 2001 From: dingenwen <543338760@qq.com> Date: Thu, 29 Feb 2024 11:30:25 +0800 Subject: [PATCH 049/196] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/TrackPullConfigRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 8965f22a..e2e8882c 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -46,8 +46,8 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .Mapper(x => { - x.TrackKeywords = [.. x.TrackKeyword.Split(',')]; - x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')]; + x.TrackKeywords = x.TrackKeyword.Split(',').ToList(); + x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } From 5bbf7d1824d0d3e2055e25ed1efc3627e75f33a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Thu, 29 Feb 2024 11:31:19 +0800 Subject: [PATCH 050/196] =?UTF-8?q?add=20=E8=AE=A2=E5=8D=95=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=E6=94=B9=E3=80=81=E8=BD=A8=E8=BF=B9=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.Development.json | 2 +- .../AutoMapper/OrderAutoMapperProfile.cs | 19 +++++ .../Dtos/ProvideServices/CreateOrderInput.cs | 4 +- .../Dtos/ProvideServices/DeleteOrderInput.cs | 23 ++++++ .../Dtos/ProvideServices/GetTrackInput.cs | 5 ++ .../Dtos/ProvideServices/GetTrackOutput.cs | 2 +- .../Dtos/ProvideServices/UpdateOrderInput.cs | 31 ++------ .../ProvideServices/OrderLinkService.cs | 2 +- .../Services/ProvideServices/OrderService.cs | 75 ++++++++++--------- .../ProvideServices/TrackQueryService.cs | 43 +++++++---- .../Services/ProvideServices/TrackService.cs | 5 ++ .../OrderAggregate/IOrderRepository.cs | 20 +++-- .../Aggregates/OrderAggregate/OrderEntity.cs | 72 ++++++++++-------- .../OrderAggregate/OrderFlightEntity.cs | 6 +- .../OrderAggregate/OrderLinkEntity.cs | 4 +- .../ITrackTemplateRepository.cs | 2 +- .../Dtos/Order/OrderTemplateDto.cs | 6 +- .../Dtos/TrackTemplate/TemplateContentDto.cs | 5 -- .../TemplateContentOrderlyDto.cs | 14 ++++ src/SJZY.Track.Domain/IBasicQuery.cs | 2 +- src/SJZY.Track.Repository/BasicQuery.cs | 2 + src/SJZY.Track.Repository/OrderRepository.cs | 47 +++++++++--- .../SJZYTrackRepositoryModule.cs | 4 +- .../TrackTemplateRepository.cs | 14 +++- 24 files changed, 265 insertions(+), 144 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs delete mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs diff --git a/src/SJZY.Track.Api/appsettings.Development.json b/src/SJZY.Track.Api/appsettings.Development.json index d50e3e8a..900166d1 100644 --- a/src/SJZY.Track.Api/appsettings.Development.json +++ b/src/SJZY.Track.Api/appsettings.Development.json @@ -2,7 +2,7 @@ "Environment": "Dev", "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Debug", "Microsoft.AspNetCore": "Warning" } }, diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs new file mode 100644 index 00000000..2dac9751 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -0,0 +1,19 @@ +using AutoMapper; +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; + +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); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs index 31b917f2..47888316 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs @@ -7,7 +7,7 @@ public class CreateOrderInput : UpdateOrderInput /// /// 客户id /// - public int ClientId { get; set; } + public int CustomId { get; set; } } public class OrderTemplateInfo @@ -24,7 +24,7 @@ public class OrderTemplateInfo public int? ServiceProviderId { get; set; } } -public class FligthInfo +public class OrderFligthInfo { /// /// 航班号 diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs new file mode 100644 index 00000000..b48f8af7 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class DeleteOrderInput : OrderNoInfo +{ +} + +public class OrderNoInfo +{ + /// + /// 订单类型,必填 + /// + [Required] + 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/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs index 2dc3c39a..d455a5b2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs @@ -2,6 +2,11 @@ namespace SJZY.Track.Application.Dtos.ProvideServices; public class GetTrackInput { + /// + /// 订单类型 + /// + public int OrderType { get; set; } + /// /// 订单号 /// diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs index 659ed260..b6b77862 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs @@ -16,6 +16,6 @@ public class TrackDetail public string Status { get; set; } public string Content { get; set; } public string Location { get; set; } - public DateTime Date { 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/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs index 88b12be1..d614db45 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs @@ -1,27 +1,7 @@ -using System.ComponentModel.DataAnnotations; +namespace SJZY.Track.Application.Dtos.ProvideServices; -namespace SJZY.Track.Application.Dtos.ProvideServices; - -public class UpdateOrderInput +public class UpdateOrderInput : OrderNoInfo { - /// - /// 订单类型,必填 - /// - [Required] - public int OrderType { get; set; } - - /// - /// 订单号,必填 - /// - [Required] - [MaxLength(100)] - public string OrderNo { get; set; } - - /// - /// 订单模板(传全量) - /// - public List Templates { get; set; } = new(); - /// /// 目的港口 /// @@ -52,8 +32,13 @@ public class UpdateOrderInput /// public string LeaveCity { get; set; } + /// + /// 订单模板(传全量) + /// + public List Templates { get; set; } = new(); + /// /// 订单航班信息 /// - public List FlightInfos { get; set; } = new(); + public List FlightInfos { get; set; } = new(); } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index f729f6b1..d4ec1f87 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -7,7 +7,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 订单关联服务 /// [ApiExplorerSettings(GroupName = "提供接口")] -public class OrderLinkService +public class OrderLinkService : ApplicationService { private readonly IOrderRepository _orderRepository; private readonly IBasicQuery _orderLinkQuery; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index a5a37ce2..61ae2a24 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,6 +1,5 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.UserCenter.HttpApi.Services; namespace SJZY.Track.Application.Services.ProvideServices; @@ -18,56 +17,58 @@ public class OrderService : ApplicationService } /// - /// 创建订单 + /// 创建订单,订单已存在则视为更新 /// /// /// /// - [HttpPost("Order/Create")] - public async Task CreateOrderAsync(CreateOrderInput input) + [HttpPost("Order/CreateOrUpdate")] + public async Task CreateOrUpdateOrderAsync(CreateOrderInput input) { - if (await _orderRepository.IsAnyAsync(x => - x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo); + if (order != default) { - throw new BusinessException(message: $"单号:{input.OrderNo}已存在"); + // 订单已存在则视为更新 + await UpdateOrderAsync(input, order); + return "更新成功"; } - var order = new OrderEntity + order = ObjectMapper.Map(input); + order.SubSystemId = 1; + 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) { - CustomId = input.ClientId, - OrderNo = input.OrderNo, - OrderType = input.OrderType, - SubSystemId = CurrentUserRequest.SubSystemId, - IsCompleted = false, - LatestTraceContent = null, - LatestTraceEnContent = null, - LatestTraceTime = null, - OrderDetails = null, - }; + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } - using var tran = TransactionHelper.GetReadCommitted(); - - // 创建订单 - var orderId = await _orderRepository.InsertReturnIdentityAsync(order); - - var templates = input.Templates.Select(x => new OrderTemplateEntity - { - OrderId = orderId, - ServiceProviderId = x.ServiceProviderId ?? 0, - TrackTemplateId = x.TemplateId - }).ToList(); - - // 创建订单模板 - await _orderRepository.CreateOrderTemplatesAsync(templates); - - tran.Complete(); + await _orderRepository.SoftDeleteAsync(x => x.Id == orderId); return true; } - [HttpPost("Order/Update")] - public async Task UpdateOrderAsync(UpdateOrderInput input) + private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) { - return true; + 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/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index e768cbab..7792631f 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -38,12 +38,10 @@ public class TrackQueryService : ApplicationService } var res = new List(); - var distinctOrderNos = input.OrderNos.Distinct().ToList(); - var details = await _trackDetailsRepository.GetListAsync(distinctOrderNos); - var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(distinctOrderNos); - var distinctTemplateIds = orderTemplates.Select(x => x.TrackTemplateId).Distinct().ToList(); - var templateContents = await _trackTemplateRepository.GetTemplateContentsAsync(distinctTemplateIds); + input.OrderNos = input.OrderNos.Distinct().ToList(); + var details = await _trackDetailsRepository.GetListAsync(input.OrderNos); + var isTurn = input.TimeZone != 0; foreach (var group in details.GroupBy(x => x.OrderId)) { var item = new GetTrackOutput(); @@ -56,33 +54,50 @@ public class TrackQueryService : ApplicationService Status = x.TrackStatus, Content = x.TrackContent, Location = x.TrackPlace, - Date = x.TrackTime.AddHours(input.TimeZone - x.TraceTimeZone), - TimeZone = x.TraceTimeZone + Time = isTurn ? x.TrackTime.AddHours(input.TimeZone - x.TraceTimeZone) : x.TrackTime, + TimeZone = isTurn ? input.TimeZone : x.TraceTimeZone }).ToList(); - TrackDetailSort(item, input.SortMethod); - res.Add(item); } + await TrackDetailSort(res, input); return res; } - private void TrackDetailSort(GetTrackOutput item, SortMethod sortMethod) + private async Task TrackDetailSort(List list, GetTrackInput input) { - switch (sortMethod) + switch (input.SortMethod) { case SortMethod.ByTrackTime: // tips:quick-sort 直接修改原list - item.TrackDetails.Sort((a, b) => a.Date.CompareTo(b.Date)); + list.ForEach(item => item.TrackDetails.Sort((a, b) => a.Time.CompareTo(b.Time))); break; case SortMethod.ByTrackTimeDesc: - item.TrackDetails.Sort((a, b) => b.Date.CompareTo(a.Date)); + list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time))); break; case SortMethod.ByTemplate: + var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderType, input.OrderNos); + var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList(); + var templateContent = + await _trackTemplateRepository.GetTemplateContentOrderlyAsync(distinctTemplateIds); + list.ForEach(item => + { + var template = orderTemplates.FirstOrDefault(x => x.OrderNo == item.OrderNo); + if (template == default) return; + var codes = templateContent + .Where(x => x.TemplateId == template.TemplateId) + .Select(x => x.Code) + .ToList(); + item.TrackDetails = item.TrackDetails + .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素 + .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序 + .ToList(); + }); + break; default: - throw new ArgumentOutOfRangeException(nameof(sortMethod), sortMethod, "不支持的排序方式"); + 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..c5cddf06 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Services.ProvideServices; + +public class TrackService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index d187933a..e076b731 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -5,18 +5,19 @@ namespace SJZY.Track.Domain.Aggregates.OrderAggregate; public interface IOrderRepository : IBasicRepository { /// - /// 根据订单号,获取订单模板 + /// 创建订单 /// - /// + /// /// - Task> GetOrderTemplatesAsync(List distinctOrderNumbers); + Task CreateOrderAsync(OrderEntity order); /// - /// 创建订单模板 + /// 根据订单号,获取订单模板 /// - /// + /// 订单类型 + /// /// - Task CreateOrderTemplatesAsync(List templateEntities); + Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers); /// /// 关联订单 @@ -31,4 +32,11 @@ public interface IOrderRepository : IBasicRepository /// /// Task UnLinkByIdsAsync(List linkIds); + + /// + /// 更新订单 + /// + /// + /// + Task UpdateOrderAsync(OrderEntity order); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index 9fe699e4..33e44303 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -12,6 +12,24 @@ 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) /// @@ -27,78 +45,66 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot /// /// 最新轨迹内容(异步维护) /// - [SugarColumn(ColumnName = "LatestTraceContent")] - public string LatestTraceContent { get; set; } + [SugarColumn(ColumnName = "LatestTrackContent")] + public string? LatestTrackContent { get; set; } /// /// 最新轨迹内容英文(异步维护) /// - [SugarColumn(ColumnName = "LatestTraceEnContent")] - public string LatestTraceEnContent { get; set; } + [SugarColumn(ColumnName = "LatestTrackEnContent")] + public string? LatestTrackEnContent { get; set; } /// /// 最新轨迹时间(异步维护) /// - [SugarColumn(ColumnName = "LatestTraceTime")] - public DateTime? LatestTraceTime { get; set; } + [SugarColumn(ColumnName = "LatestTrackTime")] + public DateTime? LatestTrackTime { 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; } + [SugarColumn(ColumnName = "LatestTrackPlace")] + public string? LatestTrackPlace { get; set; } /// /// 目的城市 /// [SugarColumn(ColumnName = "ArrivalCity")] - public string ArrivalCity { get; set; } + public string ArrivalCity { get; set; } = null!; /// /// 目的国家 /// [SugarColumn(ColumnName = "ArrivalCountry")] - public string ArrivalCountry { get; set; } + public string ArrivalCountry { get; set; } = null!; /// /// 目的港口 /// [SugarColumn(ColumnName = "ArrivalPort")] - public string ArrivalPort { get; set; } + public string? ArrivalPort { get; set; } /// /// 起运城市 /// [SugarColumn(ColumnName = "LeaveCity")] - public string LeaveCity { get; set; } + public string LeaveCity { get; set; } = null!; /// /// 起运国家 /// [SugarColumn(ColumnName = "LeaveCountry")] - public string LeaveCountry { get; set; } + public string LeaveCountry { get; set; } = null!; /// /// 起运港口 /// [SugarColumn(ColumnName = "LeavePort")] - public string LeavePort { get; set; } + public string? LeavePort { get; set; } + + [Navigate(NavigateType.OneToMany, nameof(OrderFlightEntity.OrderId))] + public List OrderFlights { get; set; } + + [Navigate(NavigateType.OneToMany, nameof(OrderFlightEntity.OrderId))] + 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 index 8e828946..c76d4d54 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs @@ -1,5 +1,9 @@ namespace SJZY.Track.Domain.Aggregates.OrderAggregate; +/// +/// 订单航班表(1:N) +/// +[SugarTable("t_order_flight")] public class OrderFlightEntity : ICreateBaicEntity, IEntity { /// @@ -18,7 +22,7 @@ public class OrderFlightEntity : ICreateBaicEntity, IEntity /// 航班号 /// [SugarColumn(ColumnName = "FlightNo")] - public string FlightNo { get; set; } + public string FlightNo { get; set; } = null!; /// /// 订单id diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs index bc94704a..68b20740 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -22,7 +22,7 @@ public class OrderLinkEntity : ICreateBaicEntity, IEntity /// 订单号 /// [SugarColumn(ColumnName = "OrderNo")] - public string OrderNo { get; set; } + public string OrderNo { get; set; } = null!; /// /// 关联的订单类型 @@ -34,7 +34,7 @@ public class OrderLinkEntity : ICreateBaicEntity, IEntity /// 关联的订单号 /// [SugarColumn(ColumnName = "LinkOrderNo")] - public string LinkOrderNo { get; set; } + public string LinkOrderNo { get; set; } = null!; /// /// 创建人 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index a20f2ced..72c28edf 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -4,7 +4,7 @@ namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { - Task GetTemplateContentsAsync(List distinctTemplateIds); + Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds); Task GetDetailAsync(int id); diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs index df433d5d..c2655b43 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs @@ -3,12 +3,12 @@ namespace SJZY.Track.Domain.Dtos.Order; public class OrderTemplateDto { /// - /// 订单id + /// 订单号 /// - public int OrderId { get; set; } + public string OrderNo { get; set; } /// /// 模板id /// - public int TrackTemplateId { get; set; } + public int TemplateId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs deleted file mode 100644 index 4d82a4d5..00000000 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentDto.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace SJZY.Track.Domain.Dtos.TrackTemplate; - -public class TemplateContentDto -{ -} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs new file mode 100644 index 00000000..d7ef08ef --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.TrackTemplate; + +public class TemplateContentOrderlyDto +{ + /// + /// 模板id + /// + public int TemplateId { get; set; } + + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/IBasicQuery.cs b/src/SJZY.Track.Domain/IBasicQuery.cs index 0ddba65d..f050d54d 100644 --- a/src/SJZY.Track.Domain/IBasicQuery.cs +++ b/src/SJZY.Track.Domain/IBasicQuery.cs @@ -7,7 +7,7 @@ public interface IBasicQuery where T : IEntity /// /// /// - Task GetFirstAsync(Expression> whereExpression); + Task GetFirstAsync(Expression> whereExpression); Task GetFirstAsync(Expression> whereExpression, Expression> resultExpression); diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Repository/BasicQuery.cs index 0e0d8874..275b3b4d 100644 --- a/src/SJZY.Track.Repository/BasicQuery.cs +++ b/src/SJZY.Track.Repository/BasicQuery.cs @@ -4,7 +4,9 @@ using SJZY.Track.Domain.SeedWork; namespace SJZY.Track.Repository; +#pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() +#pragma warning restore CS8613 { public BasicQuery() { diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 9b64b010..645fb94b 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,24 +1,33 @@ -using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain; +using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency { - public async Task> GetOrderTemplatesAsync(List distinctOrderNumbers) + public async Task CreateOrderAsync(OrderEntity order) + { + return await Context.InsertNav(order) + .Include(x => x.OrderFlights) + .Include(x => x.OrderTemplates) + .ExecuteCommandAsync(); + } + + public async Task> GetOrderTemplatesAsync(int orderType, + List distinctOrderNumbers) { return await AsQueryable() .LeftJoin((a, b) => a.Id == b.OrderId) - .Where(a => distinctOrderNumbers.Contains(a.OrderNo)) - .Select() + .Where(a => a.OrderType == orderType && distinctOrderNumbers.Contains(a.OrderNo)) + .Select((a, b) => new OrderTemplateDto + { + OrderNo = a.OrderNo, + TemplateId = b.TrackTemplateId + }) .ToListAsync(); } - public async Task CreateOrderTemplatesAsync(List templateEntities) - { - await Context.Insertable(templateEntities).ExecuteCommandAsync(); - } - public async Task LinkOrderAsync(List orderLinkEntities) { await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); @@ -28,4 +37,24 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { await Context.Deleteable(linkIds).ExecuteCommandAsync(); } + + public async Task UpdateOrderAsync(OrderEntity order) + { + using var tran = TransactionHelper.GetReadCommitted(); + + // 更新订单主表 + await UpdateAsync(order, x => new { x.CustomId, x.SubSystemId }); + + // 更新订单模板 + await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderTemplates.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderTemplates).ExecuteCommandAsync(); + + // 更新订单航班 + await Context.Deleteable().Where(x => x.OrderId == order.Id).ExecuteCommandAsync(); + order.OrderFlights.ForEach(x => x.OrderId = order.Id); + await Context.Insertable(order.OrderFlights).ExecuteCommandAsync(); + + tran.Complete(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index 08cdcbb0..b58d19b1 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -28,11 +28,11 @@ public class SJZYTrackRepositoryModule : AbpModule ConnectionString = configuration["ConnectionStrings:DefaultConnection"], DbType = DbType.MySql, IsAutoCloseConnection = true, - ConfigId = "default" + ConfigId = "default", OpenSqlLog = true } } ); - }, DataBaseContext.OnExcutingAction, "SJZY.Track.Repository"); + }, DataBaseContext.OnExcutingAction, "SJZY.Track.Domain"); context.Services.AddElasticSearch(options => { diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 1424b6df..b36ea8bf 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -13,9 +13,19 @@ namespace SJZY.Track.Repository; /// public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { - public Task GetTemplateContentsAsync(List distinctTemplateIds) + public async Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds) { - throw new NotImplementedException(); + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.TrackTemplateId) + .LeftJoin((a, b, c) => b.TrackContentId == c.Id) + .Where(a => distinctTemplateIds.Contains(a.Id)) + .OrderBy((a, b) => b.Sort) + .Select((a, b, c) => new TemplateContentOrderlyDto + { + TemplateId = a.Id, + Code = c.Code + }) + .ToListAsync(); } /// From a4504f4d6727350494cba961bee7636bbda8baee Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 11:49:14 +0800 Subject: [PATCH 051/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackFlagAutoMapperProfile.cs | 30 +++++ .../Dtos/TrackFlags/EditTrackFlagInput.cs | 74 ++++++++++++ .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 69 +++++++++++ .../Services/TrackFlags/TrackFlagService.cs | 111 +++++++++++++++++- .../EditTrackFlagInputValidation.cs | 35 ++++++ .../ITrackFlagRepository.cs | 6 +- .../TrackFlagAggregate/TrackFlagEntity.cs | 6 + .../Dtos/TrackFlags/GetPageTrackFlagVO.cs | 69 +++++++++++ .../Dtos/TrackFlags/GetTrackFlagDetailVO.cs | 41 +++++++ .../SJZY.Track.Domain.csproj | 2 +- .../TrackFlagRepository.cs | 61 ++++++++++ 11 files changed, 499 insertions(+), 5 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs create mode 100644 src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs new file mode 100644 index 00000000..a25177a4 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -0,0 +1,30 @@ +using AutoMapper; +using AutoMapper.Internal.Mappers; +using SJZY.Track.Application.Dtos.TrackFlags; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Dtos.TrackFlags; +using SJZY.Track.Domain.Dtos.TrackStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.ObjectMapping; + +namespace SJZY.Track.Application.AutoMapper +{ + 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); + } + } +} diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs new file mode 100644 index 00000000..05c9b56c --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + } +} diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs new file mode 100644 index 00000000..40097fdc --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.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; } + + /// + /// 关键字 + /// + public string keywords { get; set; } + } +} diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index a01d56b5..112345e2 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -1,5 +1,10 @@ -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Dtos.TrackFlags; +using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackFlags; using SJZY.Track.Domain.Dtos.TrackStatus; using System; using System.Collections.Generic; @@ -17,10 +22,110 @@ namespace SJZY.Track.Application.Services.TrackFlags [Route("/Track/Flag")] public class TrackFlagService : ApplicationService, ITransientDependency { - public TrackFlagService() + private readonly IStringLocalizer _stringLocalizer; + private readonly ITrackFlagRepository _trackFlagRepository; + + public TrackFlagService( + IStringLocalizer stringLocalizer, + ITrackFlagRepository trackFlagRepository + ) { + this._stringLocalizer=stringLocalizer; + this._trackFlagRepository=trackFlagRepository; } - + /// + /// 轨迹标记编辑 + /// + /// + [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 trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || a.Name==input.Flag)); + if (trackStatusEntity!=null) + { + throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + } + #endregion + + var entity = ObjectMapper.Map(input); + var isTrue = await _trackFlagRepository.InsertAsync(entity); + + return new UnifyResultDto("200", "新增成功", isTrue); + } + + private async Task UpdateAsync(EditTrackFlagInput input) + { + #region 业务校验 + var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || + a.Name ==input.Flag)); + if (trackStatusEntity!=null) + { + throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + } + #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) + { + var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id); + + return new UnifyResultDto("200", "删除成功", isTrue); + } + #endregion } } 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..da5faec2 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs @@ -0,0 +1,35 @@ +using FluentValidation; +using SJZY.Track.Application.Dtos.TrackFlags; +using SJZY.Track.Application.Dtos.TrackStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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("轨迹标记不能为空!"); + }); + } + } +} diff --git a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs index f465cb25..12ba3bc6 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/ITrackFlagRepository.cs @@ -1,5 +1,9 @@ -namespace SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +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 index 6f689e51..66a2a423 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs @@ -29,4 +29,10 @@ public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot /// [SugarColumn(ColumnName = "SubSystemId")] public int SubSystemId { get; set; } + + /// + /// 是否完结 + /// + [SugarColumn(ColumnName = "SubSystemId")] + public bool IsCompleted { get; set; } } \ 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..20f7c40f --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -0,0 +1,69 @@ +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; } + + ///// + ///// 关键字 + ///// + //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..b88c7afd --- /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/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 0354af7d..aac0e12d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/SJZY.Track.Repository/TrackFlagRepository.cs b/src/SJZY.Track.Repository/TrackFlagRepository.cs index 4c4d623f..508d80ef 100644 --- a/src/SJZY.Track.Repository/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/TrackFlagRepository.cs @@ -1,7 +1,68 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; +using SJZY.Track.Domain.Dtos.TrackFlags; +using SJZY.Track.Domain.Dtos.TrackStatus; +using SJZY.Track.Domain.VEntities; namespace SJZY.Track.Repository; 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) + .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) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .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 From c48e51c40b1ee29d9c82ae0120148a2785345130 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 14:36:38 +0800 Subject: [PATCH 052/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackFlagAutoMapperProfile.cs | 7 ++++++- .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 8 ++++---- src/SJZY.Track.Application/Localization/Resources/en.json | 3 ++- src/SJZY.Track.Application/Localization/Resources/zh.json | 3 ++- .../Aggregates/TrackFlagAggregate/TrackFlagEntity.cs | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs index a25177a4..acc0102a 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -24,7 +24,12 @@ namespace SJZY.Track.Application.AutoMapper .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap(MemberList.None); + + //var pageResultDto = + // ObjectMapper.Map, UnifyPageResultDto>( + // resultDto); } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs index 40097fdc..714203f2 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -61,9 +61,9 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// public int SubSystemId { get; set; } - /// - /// 关键字 - /// - public string keywords { get; set; } + ///// + ///// 关键字 + ///// + //public string Keywords { get; set; } } } diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 7833f864..9e31fad8 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -6,6 +6,7 @@ "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" + "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" } } \ 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 7ef977fe..24a80165 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -6,6 +6,7 @@ "ParameterDemo1": "{0}在{1}地方做了{2}动作", "TemplateExist": "模板代码已存在于当前选择的子系统下", "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", - "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复" + "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复", + "TrackFlagExist": "当前子系统下代码或标记重复" } } \ 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 index 66a2a423..886b458c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs @@ -33,6 +33,6 @@ public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot /// /// 是否完结 /// - [SugarColumn(ColumnName = "SubSystemId")] + [SugarColumn(ColumnName = "IsCompleted")] public bool IsCompleted { get; set; } } \ No newline at end of file From 2d8e89cce78d30e279662926e860c29c267374f6 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 14:38:45 +0800 Subject: [PATCH 053/196] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/SJZY.Track.Repository.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index d75f4b08..42332f80 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -1,8 +1,9 @@  - + net7.0 True + preview From df67c2793675fa5606731df3e1a6e806169d5b2f Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 15:43:06 +0800 Subject: [PATCH 054/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=98=8E=E7=BB=86=E6=9F=A5=E8=AF=A2=E5=92=8C?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetOrderDetailsInput.cs | 54 +++++++++++++++++++ .../ProvideServices/GetPageTrackOrderInput.cs | 21 ++++++++ .../Services/ProvideServices/OrderService.cs | 26 +++++++++ 3 files changed, 101 insertions(+) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs new file mode 100644 index 00000000..d1b7cb92 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.ProvideServices +{ + public class GetOrderDetailsInput + { + /// + /// 轨迹订单id + /// + public int OrderId { get; set; } + } + + public class TrackOrderDetailDto + { + /// + /// 轨迹订单id + /// + public int Id { get; set; } + + /// + /// 轨迹代码 + /// + 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; } + } +} diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs new file mode 100644 index 00000000..62a1bdb2 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SJZY.Track.Application.Dtos.ProvideServices +{ + public class GetPageTrackOrderInput : PageInfoInput + { + + } + + /// + /// 轨迹订单Dto + /// + public class TrackOrderDto + { + + } +} diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 61ae2a24..7381144c 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -64,6 +64,32 @@ public class OrderService : ApplicationService return true; } + #region 轨迹订单明细 + /// + /// 根据轨迹订单id获取轨迹订单明细列表 + /// + /// + /// + [HttpPost("/Order/GetDetails")] + public async Task> GetOrderDetails(GetOrderDetailsInput input) + { + return null; + } + #endregion + + #region 轨迹订单列表 + /// + /// + /// + /// + /// + [HttpPost("/Order/GetTrackOrderList")] + public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) + { + return null; + } + #endregion + private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) { order = ObjectMapper.Map(input, order); From 500b4be531dafe07588d7e322edfabbb35fab523 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 16:35:18 +0800 Subject: [PATCH 055/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=EF=BC=8Ckeywords=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E4=BC=A0?= =?UTF-8?q?=20""=20=E7=A9=BA=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetPageTrackOrderInput.cs | 29 +++++++++++++++++++ .../TrackContents/GetPageTrackContentInput.cs | 4 +-- .../Dtos/TrackStatus/GetTrackStatusListDto.cs | 4 +-- .../GetPageTrackTemplateInput.cs | 4 +-- .../Services/ProvideServices/OrderService.cs | 4 ++- .../OrderAggregate/IOrderRepository.cs | 8 +++++ .../Dtos/Order/GetOrderDetailsInputVO.cs | 18 ++++++++++++ .../Dtos/Order/GetPageTrackOrderInputVO.cs | 21 ++++++++++++++ src/SJZY.Track.Repository/OrderRepository.cs | 29 ++++++++++++++++++- 9 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 62a1bdb2..e2fb21f2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -8,7 +8,25 @@ namespace SJZY.Track.Application.Dtos.ProvideServices { public class GetPageTrackOrderInput : PageInfoInput { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + /// + /// 单号 + /// + public List OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? createTimeEnd { get; set; } } /// @@ -16,6 +34,17 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// public class TrackOrderDto { + /// + /// 轨迹订单id + /// + public int Id { get; set; } + /// + /// 订单类型 + /// + public string OrderType { get; set; } + + + public string OrderNumber { get; set; } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs index a494d030..7a009ccb 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -15,8 +15,8 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 关键字 - /// - public string Keywords { get; set; } + /// + public string Keywords { get; set; } = ""; } public class GetTrackContentListDto diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs index ec218c97..ecdb123d 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -65,11 +65,11 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 子系统id /// - public int SubSystemId { get; set; } + public int SubSystemId { get; set; } /// /// 关键字 /// - public string Keywords { get; set; } + public string Keywords { get; set; } = ""; } } diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index 357784df..3be009ac 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -13,8 +13,8 @@ /// /// 关键字 /// - public string Keywords { get; set; } - + public string Keywords { get; set; } = ""; + /// /// 轨迹模版id,轨迹映射的查询使用 /// diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 7381144c..55560ce6 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -79,13 +79,15 @@ public class OrderService : ApplicationService #region 轨迹订单列表 /// - /// + /// 获取分页的轨迹订单 /// /// /// [HttpPost("/Order/GetTrackOrderList")] public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { + + return null; } #endregion diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index e076b731..ded90121 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -10,6 +10,7 @@ public interface IOrderRepository : IBasicRepository /// /// Task CreateOrderAsync(OrderEntity order); + Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 根据订单号,获取订单模板 @@ -19,6 +20,13 @@ public interface IOrderRepository : IBasicRepository /// Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers); + /// + /// 获取分页的轨迹订单 + /// + /// + /// + Task> GetPageTrackOrder(GetPageTrackOrderInputVO input); + /// /// 关联订单 /// 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..882f2db8 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -0,0 +1,21 @@ +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 + { + + } + + /// + /// 轨迹订单VO + /// + public class TrackOrderVO + { + + } +} diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 645fb94b..303a6c5b 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain; +using Microsoft.AspNetCore.Mvc; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -57,4 +58,30 @@ public class OrderRepository : BasicRepository, IOrderRepository, I tran.Complete(); } + + #region 轨迹订单明细 + + /// + /// 根据轨迹订单id获取轨迹明细列表 + /// + /// + /// + public async Task> GetOrderDetails(GetOrderDetailsInputVO input) + { + return null; + } + #endregion + + #region 轨迹订单分页 + /// + /// 获取分页的轨迹订单 + /// + /// + /// + public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) + { + + return null; + } + #endregion } \ No newline at end of file From 95dee9ec69e49fa4897785f5c922e3dfa867d068 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 17:18:10 +0800 Subject: [PATCH 056/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E5=90=8D=E7=A7=B0=E8=81=94=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/OrderRepository.cs | 1 + src/SJZY.Track.Repository/TrackContentRepository.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 303a6c5b..ae51a536 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -80,6 +80,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I /// public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { + //await Context.Queryable((a,b)= ); return null; } diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs index 32ebd92d..896d02d4 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/TrackContentRepository.cs @@ -25,7 +25,7 @@ public class TrackContentRepository : BasicRepository, ITrac var detail = await Context.Queryable() .LeftJoin((a, b) => a.TrackStatusId==b.Id) .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == b.Id) + .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) .Where((a, b, c, d) => a.Id == id) .Select((a, b, c, d) => new GetTrackContentDetailVO { From 812546bfa344948802dc93cfb7d42338135cbe25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:22:13 +0800 Subject: [PATCH 057/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 17 +++ .../TrackPull/EditTrackPullConfigInput.cs | 71 ++++++++++ .../Services/TrackPull/TrackPullService.cs | 122 +++++++++++++++++- .../ITrackPullConfigRepository.cs | 12 ++ .../ITrackTemplateRepository.cs | 2 + .../TrackPullConfigRepository.cs | 37 ++++++ .../TrackTemplateRepository.cs | 5 + 7 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs new file mode 100644 index 00000000..15d39d05 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -0,0 +1,17 @@ +using AutoMapper; +using SJZY.Track.Application.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)); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs new file mode 100644 index 00000000..71fe55cf --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -0,0 +1,71 @@ +namespace SJZY.Track.Application.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/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 004198e0..646e439b 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -1,8 +1,14 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPull; @@ -16,13 +22,16 @@ public class TrackPullService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackPullConfigRepository _trackPullConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; public TrackPullService( IStringLocalizer stringLocalizer, - ITrackPullConfigRepository trackPullConfigRepository) + ITrackPullConfigRepository trackPullConfigRepository, + ITrackTemplateRepository trackTemplateRepository) { _stringLocalizer = stringLocalizer; _trackPullConfigRepository = trackPullConfigRepository; + _trackTemplateRepository = trackTemplateRepository; } /// @@ -68,4 +77,115 @@ public class TrackPullService : ApplicationService, ITransientDependency { 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.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 (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + { + 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; + } } \ 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 index 6de7445c..3d34310a 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -32,4 +32,16 @@ public interface ITrackPullConfigRepository : IBasicRepository /// 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); } \ 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 index ac26857b..cbc2ccf3 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -34,4 +34,6 @@ public interface ITrackTemplateRepository : IBasicRepository UpdateContentAsync(TrackTemplateContentEntity updateObj); Task SoftDeleteContentAsync(int id); + + Task> GetContentListAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 8965f22a..564cb0f3 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -4,6 +4,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.VEntities; +using System.Linq.Expressions; namespace SJZY.Track.Repository; @@ -83,4 +84,40 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .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(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index ee2ee76f..f8659624 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -157,4 +157,9 @@ public class TrackTemplateRepository : BasicRepository, ITr .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .ExecuteCommandHasChangeAsync(); } + + public async Task> GetContentListAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).ToListAsync(); + } } \ No newline at end of file From dba6172aab73afd8ce0d46d2e2f26a4c07c87967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:24:58 +0800 Subject: [PATCH 058/196] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/TrackPullConfigRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 564cb0f3..058146bd 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -47,8 +47,8 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .Mapper(x => { - x.TrackKeywords = [.. x.TrackKeyword.Split(',')]; - x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')]; + x.TrackKeywords = x.TrackKeyword.Split(',').ToList(); + x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } From 5ddfaf5ec34521d914bdf374086513b8e4353a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:46:14 +0800 Subject: [PATCH 059/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 1 + .../TrackPull/UpdateTrackPullContentInput.cs | 51 +++++++++++++++++++ .../Services/TrackPull/TrackPullService.cs | 17 +++++++ .../ITrackPullConfigRepository.cs | 4 ++ .../TrackPullConfigRepository.cs | 10 ++++ 5 files changed, 83 insertions(+) create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 15d39d05..3577eceb 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None).Ignore(dest => dest.Id) .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs new file mode 100644 index 00000000..74a54567 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -0,0 +1,51 @@ +namespace SJZY.Track.Application.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 string TrackKeyword { get; set; } + + /// + /// 轨迹关键词(反向) + /// + public string TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地参数值 + /// + public int? TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 服务商轨迹状态参数值 + /// + public string TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 646e439b..f76abe50 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency return true; } + + /// + /// 轨迹拉取配置内容修改 + /// + /// + /// + [HttpPost("UpdateContent")] + public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) + { + 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.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 3d34310a..c7a36732 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository SoftDeleteContentAsync(Expression> whereExpression); Task SoftDeleteParamsAsync(Expression> whereExpression); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPullContentConfigEntity updateObj); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 058146bd..dbcb40be 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository, .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(); + } } \ No newline at end of file From 57749fc32e6b053376dd3a4435569912b0b23e64 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 18:33:43 +0800 Subject: [PATCH 060/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Application/ApplicationModule.cs | 9 ++++++++- .../Services/TrackStatus/TrackStatusService.cs | 3 ++- .../Services/TrackTemplates/TrackTemplateService.cs | 1 + src/SJZY.Track.Repository/OrderRepository.cs | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs index ba3bc813..94127ff2 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/ApplicationModule.cs @@ -2,6 +2,7 @@ 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; @@ -18,7 +19,8 @@ namespace SJZY.Track.Application typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), - typeof(SJZYTrackDomainModule) + typeof(SJZYTrackDomainModule), + typeof(SjzyUserCenterHttpApiModule) )] public class ApplicationModule : AbpModule { @@ -46,6 +48,11 @@ namespace SJZY.Track.Application .AddBaseTypes(typeof(SjzyBasicLocalization)) .AddVirtualJson("/Localization/Resources"); }); + //授权拦截提示 + context.Services.Configure(options => + { + options.Filters.Add(new ApiAsyncAuthorizationFilter()); + }); //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 7b076868..bd58470f 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Localization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Localization; using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 422aafde..e77a574d 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,4 +1,5 @@ using System.Linq.Expressions; +using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Dtos.TrackTemplates; diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index ae51a536..3fbb9dfb 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -81,6 +81,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); + //await Context.Queryable((a,b)=> ) return null; } From b139734d57cd76bc974841ce53700ba02530c501 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 19:06:34 +0800 Subject: [PATCH 061/196] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7id=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 5 +++ .../ProvideServices/GetPageTrackOrderInput.cs | 2 +- .../SJZY.Track.Application.csproj | 2 -- .../Services/ProvideServices/OrderService.cs | 4 ++- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 36 ++++++++++++++++++- .../SJZY.Track.Domain.csproj | 1 + src/SJZY.Track.Repository/DataBaseContext.cs | 24 +++++++++++++ src/SJZY.Track.Repository/OrderRepository.cs | 11 +++++- .../SJZYTrackRepositoryModule.cs | 4 +++ 9 files changed, 83 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 2dac9751..4a0bb612 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,6 +1,8 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Application.AutoMapper; @@ -15,5 +17,8 @@ public class OrderAutoMapperProfile : Profile .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); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index e2fb21f2..4709c862 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -16,7 +16,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// /// 单号 /// - public List OrderNos { get; set; } + public List? OrderNos { get; set; } /// /// 创建时间开始 diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index e8f1425c..43edd929 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -19,8 +19,6 @@ - - diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 55560ce6..1c5c25dd 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,5 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Application.Services.ProvideServices; @@ -86,7 +87,8 @@ public class OrderService : ApplicationService [HttpPost("/Order/GetTrackOrderList")] public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { - + var vo = ObjectMapper.Map(input); + var jj = await _orderRepository.GetPageTrackOrder(vo); return null; } diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 882f2db8..5dcbafaf 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -6,9 +6,27 @@ using System.Threading.Tasks; namespace SJZY.Track.Domain.Dtos.Order { - public class GetPageTrackOrderInputVO + public class GetPageTrackOrderInputVO : PageInfoInput { + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + /// + /// 单号 + /// + public List OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? createTimeEnd { get; set; } } /// @@ -16,6 +34,22 @@ namespace SJZY.Track.Domain.Dtos.Order /// public class TrackOrderVO { + /// + /// 轨迹订单id + /// + public int Id { get; set; } + /// + /// 订单类型 + /// + public string OrderType { get; set; } + + + public string OrderNumber { get; set; } + + /// + /// 轨迹模版 + /// + public string TrackTemplateNames { get; set; } } } diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..5ebeded5 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -9,6 +9,7 @@ + diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs index b9712ab1..14dbada8 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -1,4 +1,6 @@ #pragma warning disable 1591 +using SJZY.UserCenter.HttpApi.Services; + namespace SJZY.Track.Repository { /// @@ -22,6 +24,17 @@ namespace SJZY.Track.Repository entityInfo.SetValue(DateTime.Now); if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) { + if (oldValue == null || (int)oldValue == 0) + { + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); + } + catch + { + + } + } //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } } @@ -32,6 +45,17 @@ namespace SJZY.Track.Repository 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); } //删除 diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 3fbb9dfb..98a60b5f 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -81,7 +81,16 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); - //await Context.Queryable((a,b)=> ) + await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) + .GroupBy((a, b) => new { a.Id }) + .Select((a, b) => new TrackOrderVO + { + Id=a.Id, + OrderNumber=a.OrderNo, + + + + }).ToPageListAsync(input.PageIndex, input.PageSize); return null; } diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index b58d19b1..a482fb7f 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -43,6 +43,10 @@ public class SJZYTrackRepositoryModule : AbpModule }); } + + + + public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); From 2603cd1ac46c93f41308a647e55ba1bd3bcc2dab Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 19:45:13 +0800 Subject: [PATCH 062/196] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E5=8A=A0=3F=E5=8F=AF=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentInput.cs | 6 ++-- .../Dtos/TrackStatus/EditTrackStatusInput.cs | 6 ++-- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 4 +-- src/SJZY.Track.Repository/OrderRepository.cs | 29 +++++++++++++------ 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs index 23294dfe..9879ffb8 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs @@ -31,17 +31,17 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹内容代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 轨迹内容 /// - public string Content { get; set; } + public string? Content { get; set; } /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string? EnContent { get; set; } /// /// 轨迹标记id diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs index a77a4f1c..ce9a0ebf 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -31,16 +31,16 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 轨迹状态代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 轨迹状态 /// - public string TrackStatus { get; set; } + public string? TrackStatus { get; set; } /// /// 轨迹状态英文 /// - public string EntrackStatus { get; set; } + public string? EntrackStatus { get; set; } } } diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs index 6269ba0b..f4ac73d8 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -85,11 +85,11 @@ /// /// 模板名称 /// - public string Name { set; get; } + public string? Name { set; get; } /// /// 模板代码 /// - public string Code { set; get; } + public string? Code { set; get; } } } diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 98a60b5f..3196cbdd 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; @@ -81,16 +82,26 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { //await Context.Queryable((a,b)= ); - await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) - .GroupBy((a, b) => new { a.Id }) - .Select((a, b) => new TrackOrderVO - { - Id=a.Id, - OrderNumber=a.OrderNo, - - + //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) + // .GroupBy((a, b) => new { a.Id }) + // .Select((a, b) => new TrackOrderVO + // { + // Id=a.Id, + // OrderNumber=a.OrderNo, + // TrackTemplateNames = SqlFunc.AggregateConcat(b.) - }).ToPageListAsync(input.PageIndex, input.PageSize); + + // }).ToPageListAsync(input.PageIndex, input.PageSize); + + //await Context.Queryable() + // .Includes(a => a.OrderTemplates) + // .Select(a => new TrackOrderVO + // { + // Id=a.Id, + // OrderNumber=a.OrderNo, + // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.) + // }) + // .ToPageListAsync(input.PageIndex, input.PageSize); return null; } From 2e125f8662e558c747bf5869f0005172ea168b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Thu, 29 Feb 2024 20:12:03 +0800 Subject: [PATCH 063/196] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 6 +- .../Dtos/ProvideServices/DeleteOrderInput.cs | 20 +--- .../Dtos/ProvideServices/OrderNoInfo.cs | 19 +++ ...reateOrderInput.cs => UpsertOrderInput.cs} | 2 +- .../Dtos/ProvideServices/UpsertTrackInput.cs | 24 ++++ .../ProvideServices/OrderLinkService.cs | 1 + .../Services/ProvideServices/OrderService.cs | 12 +- .../ProvideServices/TrackQueryService.cs | 42 +++---- .../Services/ProvideServices/TrackService.cs | 84 ++++++++++++- .../OrderAggregate/IOrderRepository.cs | 16 +-- .../OrderAggregate/OrderFlightEntity.cs | 10 +- .../OrderAggregate/OrderLinkEntity.cs | 10 +- .../OrderAggregate/OrderTemplateEntity.cs | 17 ++- .../TrackContentEntity.cs | 6 +- .../ITrackDetailsRepository.cs | 8 +- .../TrackDetailsIndex.cs | 2 +- .../TrackStatusAggregate/TrackStatusEntity.cs | 6 +- .../ITrackTemplateRepository.cs | 5 +- .../Dtos/Order/OrderIdentifier.cs | 23 ++++ ...TemplateDto.cs => OrderTemplateLinkDto.cs} | 4 +- .../Dtos/TrackDetails/MatchTrackContentDto.cs | 19 +++ ...ntOrderlyDto.cs => OrderedTrackCodeDto.cs} | 2 +- src/SJZY.Track.Domain/IBasicRepository.cs | 4 +- .../{ => Queries}/IBasicQuery.cs | 2 +- .../Queries/ITrackQueries.cs | 34 ++++++ src/SJZY.Track.Repository/BasicQuery.cs | 2 +- src/SJZY.Track.Repository/DataBaseContext.cs | 110 +++++++++--------- src/SJZY.Track.Repository/OrderRepository.cs | 35 +++--- .../Queries/TrackQueries.cs | 78 +++++++++++++ .../SJZYTrackRepositoryModule.cs | 4 +- .../TrackDetailsRepository.cs | 55 ++++++--- .../TrackTemplateRepository.cs | 40 +++---- 32 files changed, 504 insertions(+), 198 deletions(-) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs rename src/SJZY.Track.Application/Dtos/ProvideServices/{CreateOrderInput.cs => UpsertOrderInput.cs} (93%) create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs rename src/SJZY.Track.Domain/Dtos/Order/{OrderTemplateDto.cs => OrderTemplateLinkDto.cs} (70%) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs rename src/SJZY.Track.Domain/Dtos/TrackTemplate/{TemplateContentOrderlyDto.cs => OrderedTrackCodeDto.cs} (86%) rename src/SJZY.Track.Domain/{ => Queries}/IBasicQuery.cs (96%) create mode 100644 src/SJZY.Track.Domain/Queries/ITrackQueries.cs create mode 100644 src/SJZY.Track.Repository/Queries/TrackQueries.cs diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 4a0bb612..fabc4fdd 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,5 +1,4 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -10,15 +9,14 @@ public class OrderAutoMapperProfile : Profile { public OrderAutoMapperProfile() { - CreateMap(MemberList.None); + 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); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs index b48f8af7..c4fba2a8 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs @@ -1,23 +1,5 @@ -using System.ComponentModel.DataAnnotations; - -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Dtos.ProvideServices; public class DeleteOrderInput : OrderNoInfo { -} - -public class OrderNoInfo -{ - /// - /// 订单类型,必填 - /// - [Required] - 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/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs new file mode 100644 index 00000000..6f98fafc --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class OrderNoInfo +{ + /// + /// 订单类型,必填 + /// + [Required] + 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/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs similarity index 93% rename from src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs rename to src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs index 47888316..c03d2478 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs @@ -2,7 +2,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices; -public class CreateOrderInput : UpdateOrderInput +public class UpsertOrderInput : UpdateOrderInput { /// /// 客户id diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs new file mode 100644 index 00000000..fa2112ee --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs @@ -0,0 +1,24 @@ +namespace SJZY.Track.Application.Dtos.ProvideServices; + +public class UpsertTrackInput : OrderNoInfo +{ + /// + /// 轨迹内容代码 + /// + public string TrackCode { get; set; } + + /// + /// 轨迹发生地 + /// + public string TrackPlace { get; set; } + + /// + /// 轨迹发生时间 + /// + public DateTime TrackTime { get; set; } + + /// + /// 轨迹发生时区 + /// + public float TraceTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index d4ec1f87..e21ca538 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -1,5 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 1c5c25dd..f75a8de9 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -23,8 +23,8 @@ public class OrderService : ApplicationService /// /// /// - [HttpPost("Order/CreateOrUpdate")] - public async Task CreateOrUpdateOrderAsync(CreateOrderInput input) + [HttpPost("Order/Upsert")] + public async Task UpsertAsync(UpsertOrderInput input) { var order = await _orderRepository.GetFirstAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo); @@ -35,7 +35,7 @@ public class OrderService : ApplicationService return "更新成功"; } - order = ObjectMapper.Map(input); + order = ObjectMapper.Map(input); order.SubSystemId = 1; order.OrderTemplates = ObjectMapper.Map, List>(input.Templates); order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); @@ -60,12 +60,13 @@ public class OrderService : ApplicationService throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); } - await _orderRepository.SoftDeleteAsync(x => x.Id == orderId); + await _orderRepository.DeleteOrderAsync(orderId); return true; } #region 轨迹订单明细 + /// /// 根据轨迹订单id获取轨迹订单明细列表 /// @@ -76,9 +77,11 @@ public class OrderService : ApplicationService { return null; } + #endregion #region 轨迹订单列表 + /// /// 获取分页的轨迹订单 /// @@ -92,6 +95,7 @@ public class OrderService : ApplicationService return null; } + #endregion private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 7792631f..587c316b 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,7 +1,6 @@ using SJZY.Track.Application.Dtos.ProvideServices; -using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; +using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -12,15 +11,13 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; - private readonly IOrderRepository _orderRepository; - private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackQueries _trackQueries; - public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, IOrderRepository orderRepository, - ITrackTemplateRepository trackTemplateRepository) + public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, + ITrackQueries trackQueries) { _trackDetailsRepository = trackDetailsRepository; - _orderRepository = orderRepository; - _trackTemplateRepository = trackTemplateRepository; + _trackQueries = trackQueries; } /// @@ -29,8 +26,8 @@ public class TrackQueryService : ApplicationService /// /// /// - [HttpPost("TrackQuery/GetByOrderNos")] - public async Task> GetByOrderNosAsync(GetTrackInput input) + [HttpPost("Track/Query")] + public async Task> QueryAsync(GetTrackInput input) { if (input.OrderNos.Count > 500) { @@ -38,8 +35,8 @@ public class TrackQueryService : ApplicationService } var res = new List(); - input.OrderNos = input.OrderNos.Distinct().ToList(); - var details = await _trackDetailsRepository.GetListAsync(input.OrderNos); + input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重 + var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos); var isTurn = input.TimeZone != 0; foreach (var group in details.GroupBy(x => x.OrderId)) @@ -78,18 +75,21 @@ public class TrackQueryService : ApplicationService list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time))); break; case SortMethod.ByTemplate: - var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderType, input.OrderNos); + var orderTemplates = await _trackQueries + .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos); var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList(); - var templateContent = - await _trackTemplateRepository.GetTemplateContentOrderlyAsync(distinctTemplateIds); + var templateContent = await _trackQueries.GetOrderedTrackCodesAsync(distinctTemplateIds); list.ForEach(item => { - var template = orderTemplates.FirstOrDefault(x => x.OrderNo == item.OrderNo); - if (template == default) return; - var codes = templateContent - .Where(x => x.TemplateId == template.TemplateId) - .Select(x => x.Code) - .ToList(); + var codes = new List(); + // 多模板拼接显示 + foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo)) + { + codes.AddRange(templateContent + .Where(t => t.TemplateId == orderTemplate.TemplateId) + .Select(t => t.Code)); + } + item.TrackDetails = item.TrackDetails .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素 .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index c5cddf06..5147ae93 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,5 +1,85 @@ -namespace SJZY.Track.Application.Services.ProvideServices; +using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using SJZY.UserCenter.HttpApi.Services; -public class TrackService +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class TrackService : ApplicationService { + private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackQueries _trackQueries; + + public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository) + { + _trackQueries = trackQueries; + _orderRepository = orderRepository; + _trackDetailsRepository = trackDetailsRepository; + } + + /// + /// 新增/更新订单轨迹接口 + /// + /// + /// + /// + [HttpPost("Track/Upsert")] + public async Task UpsertTrackAsync(UpsertTrackInput input) + { + var orderId = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); + if (orderId == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); + } + + // 不存在则新增轨迹,存在则更新 + var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode); + if (track == default) + { + var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode); + if (trackContent == default) + { + throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}"); + } + + track = new TrackDetailsIndex + { + OrderId = orderId, + OrderNo = input.OrderNo, + OrderType = input.OrderType, + TrackStatus = trackContent.Status, + TrackCode = input.TrackCode, + TrackContent = trackContent.Content, + TrackEnContent = trackContent.EnContent, + TrackPlace = input.TrackPlace, + TrackTime = input.TrackTime, + TraceTimeZone = input.TraceTimeZone, + CreateUserId = CurrentUserRequest.CurrentUser.UserId, + CreateTime = DateTime.Now + }; + await _trackDetailsRepository.CreateAsync(track); + } + else + { + track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; + track.UpdateTime = DateTime.Now; + track.TrackPlace = input.TrackPlace; + track.TrackTime = input.TrackTime; + track.TraceTimeZone = input.TraceTimeZone; + await _trackDetailsRepository.UpdateAsync(track); + } + + // 根据订单关联关系向下刷,不同子系统还需要做内容映射 + + // 推送 + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index ded90121..93d162e2 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -10,15 +10,8 @@ public interface IOrderRepository : IBasicRepository /// /// Task CreateOrderAsync(OrderEntity order); - Task> GetOrderDetails(GetOrderDetailsInputVO input); - /// - /// 根据订单号,获取订单模板 - /// - /// 订单类型 - /// - /// - Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers); + Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 获取分页的轨迹订单 @@ -47,4 +40,11 @@ public interface IOrderRepository : IBasicRepository /// /// Task UpdateOrderAsync(OrderEntity order); + + /// + /// 删除订单 + /// + /// + /// + Task DeleteOrderAsync(int orderId); } \ 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 index c76d4d54..4e5f2017 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs @@ -4,7 +4,7 @@ /// 订单航班表(1:N) /// [SugarTable("t_order_flight")] -public class OrderFlightEntity : ICreateBaicEntity, IEntity +public class OrderFlightEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -33,10 +33,18 @@ public class OrderFlightEntity : ICreateBaicEntity, IEntity /// /// 创建人 /// + [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 index 68b20740..112fc472 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -4,7 +4,7 @@ /// 轨迹订单关联表(1:N) /// [SugarTable("t_order_link")] -public class OrderLinkEntity : ICreateBaicEntity, IEntity +public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -39,10 +39,18 @@ public class OrderLinkEntity : ICreateBaicEntity, IEntity /// /// 创建人 /// + [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 index 91219904..88559ae6 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs @@ -4,7 +4,7 @@ /// 轨迹订单模板表(1:N) /// [SugarTable("t_order_template")] -public class OrderTemplateEntity : ICreateBaicEntity, IEntity +public class OrderTemplateEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity { /// /// 自增主键 @@ -30,6 +30,21 @@ public class OrderTemplateEntity : ICreateBaicEntity, IEntity [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/TrackContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs index adf4b23b..02fac985 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs @@ -16,19 +16,19 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹内容代码 /// [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } + public string Code { get; set; } = null!; /// /// 轨迹内容 /// [SugarColumn(ColumnName = "Content")] - public string Content { get; set; } + public string Content { get; set; } = null!; /// /// 轨迹内容英文 /// [SugarColumn(ColumnName = "EnContent")] - public string EnContent { get; set; } + public string EnContent { get; set; } = null!; /// /// 子系统id diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 5e83c476..444dd072 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -4,9 +4,13 @@ namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; public interface ITrackDetailsRepository { - Task WriteTrack(TrackDetailsIndex index); + Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode); - Task> GetListAsync(List orderNos); + Task UpdateAsync(TrackDetailsIndex index); + + Task CreateAsync(TrackDetailsIndex index); + + Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 9040ecc2..a8160da6 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -21,7 +21,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 订单类型(主数据枚举TrackOrderType) /// - public string OrderType { get; set; } + public int OrderType { get; set; } /// /// 轨迹状态 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs index 7d1b1a0d..dd98a21d 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs @@ -16,13 +16,13 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹状态代码 /// [SugarColumn(ColumnName = "Code")] - public string Code { get; set; } + public string Code { get; set; } = null!; /// /// 轨迹状态英文 /// [SugarColumn(ColumnName = "EnStatus")] - public string EnStatus { get; set; } + public string EnStatus { get; set; } = null!; /// /// 所属节点(主数据枚举ServiceNode) @@ -34,7 +34,7 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot /// 轨迹状态 /// [SugarColumn(ColumnName = "Status")] - public string Status { get; set; } + public string Status { get; set; } = null!; /// /// 子系统id diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index f7c5fb2b..13d2ff0a 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -4,8 +4,6 @@ namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; public interface ITrackTemplateRepository : IBasicRepository { - Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds); - Task GetDetailAsync(int id); Task> GetPageTrackTemplate(GetPageTrackTemplateVO input); @@ -35,5 +33,6 @@ public interface ITrackTemplateRepository : IBasicRepository SoftDeleteContentAsync(int id); - Task> GetContentListAsync(Expression> whereExpression); + Task> GetContentListAsync( + Expression> whereExpression); } \ 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/OrderTemplateDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs similarity index 70% rename from src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs rename to src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs index c2655b43..6ca82ed3 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs @@ -1,11 +1,11 @@ namespace SJZY.Track.Domain.Dtos.Order; -public class OrderTemplateDto +public class OrderTemplateLinkDto { /// /// 订单号 /// - public string OrderNo { get; set; } + public string OrderNo { get; set; } = null!; /// /// 模板id 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..c6e07352 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -0,0 +1,19 @@ +namespace SJZY.Track.Domain.Dtos.TrackDetails; + +public class MatchTrackContentDto +{ + /// + /// 轨迹内容 + /// + public string Content { get; set; } + + /// + /// 轨迹内容英文 + /// + public string EnContent { get; set; } + + /// + /// 轨迹状态 + /// + public string Status { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs similarity index 86% rename from src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs index d7ef08ef..60362986 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs @@ -1,6 +1,6 @@ namespace SJZY.Track.Domain.Dtos.TrackTemplate; -public class TemplateContentOrderlyDto +public class OrderedTrackCodeDto { /// /// 模板id diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index b085429b..71bc3175 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -1,4 +1,6 @@ -namespace SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; + +namespace SJZY.Track.Domain; public interface IBasicRepository : IBasicQuery where T : IAggregateRoot { diff --git a/src/SJZY.Track.Domain/IBasicQuery.cs b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs similarity index 96% rename from src/SJZY.Track.Domain/IBasicQuery.cs rename to src/SJZY.Track.Domain/Queries/IBasicQuery.cs index f050d54d..894e72a9 100644 --- a/src/SJZY.Track.Domain/IBasicQuery.cs +++ b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Domain; +namespace SJZY.Track.Domain.Queries; public interface IBasicQuery where T : IEntity { diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs new file mode 100644 index 00000000..df41882c --- /dev/null +++ b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs @@ -0,0 +1,34 @@ +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 ITrackQueries +{ + /// + /// 根据订单号,获取订单模板 + /// + /// 订单类型 + /// 订单号 + /// + Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers); + + /// + /// 根据订单模板,获取有序的轨迹code + /// + /// 模板id + /// + Task> GetOrderedTrackCodesAsync(List templateIds); + + /// + /// 根据订单id找到订单模板,匹配模板命中的轨迹内容 + /// + /// 订单id + /// 轨迹代码 + /// + Task MatchTrackContentAsync(int orderId, string code); +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Repository/BasicQuery.cs index 275b3b4d..4d8e70d1 100644 --- a/src/SJZY.Track.Repository/BasicQuery.cs +++ b/src/SJZY.Track.Repository/BasicQuery.cs @@ -1,5 +1,5 @@ using System.Linq.Expressions; -using SJZY.Track.Domain; +using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; namespace SJZY.Track.Repository; diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs index 14dbada8..88539836 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -1,77 +1,77 @@ -#pragma warning disable 1591 -using SJZY.UserCenter.HttpApi.Services; +using SJZY.UserCenter.HttpApi.Services; -namespace SJZY.Track.Repository +#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) { - if (oldValue == null || (int)oldValue == 0) + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); + } + catch { - try - { - entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId); - } - catch - { - - } } - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } + //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } - //修改 - else if (entityInfo.OperationType == DataFilterType.UpdateByObject) + } + //修改 + else if (entityInfo.OperationType == DataFilterType.UpdateByObject) + { + if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) + entityInfo.SetValue(DateTime.Now); + else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) { - if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime)) - entityInfo.SetValue(DateTime.Now); - else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) + if (oldValue == null || (int)oldValue == 1) { - if (oldValue == null || (int)oldValue == 1) + try + { + entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); + } + catch { - try - { - entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); - } - catch - { - - } } - //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); } - //删除 - else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted)) + //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) { - 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); - } + //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/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index 3196cbdd..c932f142 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,7 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using SJZY.Track.Domain; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; namespace SJZY.Track.Repository; @@ -16,20 +14,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .ExecuteCommandAsync(); } - public async Task> GetOrderTemplatesAsync(int orderType, - List distinctOrderNumbers) - { - return await AsQueryable() - .LeftJoin((a, b) => a.Id == b.OrderId) - .Where(a => a.OrderType == orderType && distinctOrderNumbers.Contains(a.OrderNo)) - .Select((a, b) => new OrderTemplateDto - { - OrderNo = a.OrderNo, - TemplateId = b.TrackTemplateId - }) - .ToListAsync(); - } - public async Task LinkOrderAsync(List orderLinkEntities) { await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); @@ -60,6 +44,20 @@ public class OrderRepository : BasicRepository, IOrderRepository, I tran.Complete(); } + public async Task DeleteOrderAsync(int orderId) + { + using var tran = TransactionHelper.GetReadCommitted(); + + // 软删订单主表 + await SoftDeleteAsync(x => x.Id == orderId); + + // 软删订单模板 + // 软删订单航班 + // 软删订单关联关系 + + tran.Complete(); + } + #region 轨迹订单明细 /// @@ -71,9 +69,11 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { return null; } + #endregion #region 轨迹订单分页 + /// /// 获取分页的轨迹订单 /// @@ -105,5 +105,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I return null; } + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs new file mode 100644 index 00000000..da7c4dab --- /dev/null +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -0,0 +1,78 @@ +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +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 TrackQueries : ISugarRepository, ITrackQueries, + ITransientDependency +{ + public ISqlSugarClient Context { get; set; } + + public TrackQueries() + { + 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.Id, + Code = b.Code + }) + .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 + }) + .FirstAsync(); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs index a482fb7f..799c900a 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs @@ -3,6 +3,7 @@ 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 Volo.Abp.Autofac; using Volo.Abp.Modularity; @@ -44,9 +45,6 @@ public class SJZYTrackRepositoryModule : AbpModule } - - - public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs index 3a0677b9..ef51db46 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs @@ -1,6 +1,4 @@ using Nest; -using SJZY.Expand.ABP.Core.Logger; -using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; @@ -10,26 +8,49 @@ namespace SJZY.Track.Repository; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency { + public string IndexName => $"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}"; + public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) { } - public async Task WriteTrack(TrackDetailsIndex index) + public async Task GetFirstOrDefaultAsync(int orderId, string trackCode) { - try + var r = await Context.SearchAsync(s => s + .Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}") + .Query(q => + q.Term(t => t.Field(f => f.OrderId).Value(orderId)) + && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) + ) + ); + + if (r.IsValid) { - //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()}"); + return r.Documents.FirstOrDefault(); } + + return default; } - public async Task> GetListAsync(List orderNos) + public async Task UpdateAsync(TrackDetailsIndex index) + { + var response = await Context.UpdateAsync(index.Id, u => u + .Index(IndexName) + .Doc(index) + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + ); + if (!response.IsValid) + throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); + } + + public async Task CreateAsync(TrackDetailsIndex index) + { + var response = await Context.IndexAsync(index, request => request.Index(IndexName)); + if (!response.IsValid) + throw new Exception($"数据添加失败,原因:{response.DebugInformation}"); + } + + public async Task> GetListAsync(int orderType, List orderNos) { if (orderNos.Count < 1) return new List(); @@ -42,9 +63,11 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TrackTime) .Field(f => f.TraceTimeZone) )) - .Query(q => q.Terms(t => t - .Field(f => f.OrderNo) - .Terms(orderNos))) + .Query(q => + q.Terms(t => t + .Field(f => f.OrderNo) + .Terms(orderNos)) + && q.Term(f => f.OrderType, orderType)) ); return data.Documents.ToList(); diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 41569c12..43fff1f5 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -10,24 +10,8 @@ using SJZY.Track.Repository.Enum; namespace SJZY.Track.Repository; -/// public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { - public async Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds) - { - return await Context.Queryable() - .LeftJoin((a, b) => a.Id == b.TrackTemplateId) - .LeftJoin((a, b, c) => b.TrackContentId == c.Id) - .Where(a => distinctTemplateIds.Contains(a.Id)) - .OrderBy((a, b) => b.Sort) - .Select((a, b, c) => new TemplateContentOrderlyDto - { - TemplateId = a.Id, - Code = c.Code - }) - .ToListAsync(); - } - /// /// 获取轨迹模版明细 /// @@ -40,13 +24,13 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -58,13 +42,14 @@ public class TrackTemplateRepository : BasicRepository, ITr /// public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { - UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable() + UnifyPageResultDto pagedList = await Context.Queryable() .LeftJoin((a, b) => a.SubSystemId == b.Id) .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.TrackTemplateId > 0, + (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), + a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -168,7 +153,8 @@ public class TrackTemplateRepository : BasicRepository, ITr .ExecuteCommandHasChangeAsync(); } - public async Task> GetContentListAsync(Expression> whereExpression) + public async Task> GetContentListAsync( + Expression> whereExpression) { return await Context.Queryable().Where(whereExpression).ToListAsync(); } From 159ac8b029010407c2e1bc8e672eb64dccf90fcf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Thu, 29 Feb 2024 21:09:25 +0800 Subject: [PATCH 064/196] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 4 ++ .../ProvideServices/GetPageTrackOrderInput.cs | 60 ++++++++++++++++-- .../Services/ProvideServices/OrderService.cs | 9 +-- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 57 +++++++++++++++-- src/SJZY.Track.Repository/OrderRepository.cs | 62 +++++++++++++------ 5 files changed, 159 insertions(+), 33 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index fabc4fdd..a8d93386 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,7 +1,9 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; +using System.Diagnostics; namespace SJZY.Track.Application.AutoMapper; @@ -18,5 +20,7 @@ public class OrderAutoMapperProfile : Profile 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/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 4709c862..06335e34 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -26,7 +26,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// /// 创建时间截止 /// - public DateTime? createTimeEnd { get; set; } + public DateTime? CreateTimeEnd { get; set; } } /// @@ -40,11 +40,63 @@ namespace SJZY.Track.Application.Dtos.ProvideServices public int Id { get; set; } /// - /// 订单类型 + /// 订单类型id /// - public string OrderType { get; set; } + public int OrderType { get; set; } + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } - public string OrderNumber { get; set; } + /// + /// 轨迹模版 + /// + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } } } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index f75a8de9..8b6b8e19 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -91,9 +92,9 @@ public class OrderService : ApplicationService public async Task> GetPageTrackOrder(GetPageTrackOrderInput input) { var vo = ObjectMapper.Map(input); - var jj = await _orderRepository.GetPageTrackOrder(vo); - - return null; + var pageList = await _orderRepository.GetPageTrackOrder(vo); + var pageResultDto = ObjectMapper.Map, UnifyPageResultDto>(pageList); + return pageResultDto; } #endregion diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 5dcbafaf..c95fae3e 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -40,16 +40,63 @@ namespace SJZY.Track.Domain.Dtos.Order public int Id { get; set; } /// - /// 订单类型 + /// 订单类型id /// - public string OrderType { get; set; } + public int OrderType { get; set; } - - public string OrderNumber { get; set; } + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } /// /// 轨迹模版 /// - public string TrackTemplateNames { get; set; } + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } } } diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs index c932f142..1d7ebfa2 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Repository/OrderRepository.cs @@ -1,6 +1,10 @@ -using SJZY.Track.Domain; +using Nest; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.VEntities; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository; @@ -81,29 +85,47 @@ public class OrderRepository : BasicRepository, IOrderRepository, I /// public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { - //await Context.Queryable((a,b)= ); - //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId)) - // .GroupBy((a, b) => new { a.Id }) - // .Select((a, b) => new TrackOrderVO - // { - // Id=a.Id, - // OrderNumber=a.OrderNo, - // TrackTemplateNames = SqlFunc.AggregateConcat(b.) + var pageList = await Context.Queryable() + .LeftJoin((a, b) => a.CustomId==b.Id) + .LeftJoin((a, b, c) => a.SubSystemId==c.Id) + .Select((a, b, c) => new TrackOrderVO + { + Id = a.Id, + OrderNumber= a.OrderNo, + OrderType = a.OrderType, + CustomerShortName= b.Abbreviation, + CustomerCode= b.Code, + TrackTemplateNames = "", + OrderDetails="", + NewestTrackContent= a.LatestTrackContent, + NewestTrackEnContent= a.LatestTrackEnContent, + NewestTrackPlace= a.LatestTrackPlace, + IsFinish=a.IsCompleted, + CreateTime=a.CreateTime, + SubSystem= c.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + + if (pageList.List.Any()) + { + var orderIds = pageList.List.Select(a => a.Id); + //查询轨迹模版 - // }).ToPageListAsync(input.PageIndex, input.PageSize); + 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(); - //await Context.Queryable() - // .Includes(a => a.OrderTemplates) - // .Select(a => new TrackOrderVO - // { - // Id=a.Id, - // OrderNumber=a.OrderNo, - // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.) - // }) - // .ToPageListAsync(input.PageIndex, input.PageSize); + pageList.List.ForEach(a => + { + var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id); + a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(","); + }); + } - return null; + return pageList; } #endregion From 2998d69ed967eb3cde148a16ba3013dbd014c5e0 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 09:11:27 +0800 Subject: [PATCH 065/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=20=3F=20=E5=8F=AF=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackFlags/EditTrackFlagInput.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs index 05c9b56c..901f5e5a 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs +++ b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -26,12 +26,12 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// /// 标记 /// - public string Flag { get; set; } + public string? Flag { get; set; } /// /// 代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 是否完结 From c3886b1d8b45222930626d00ae3c1943b8942bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 09:26:11 +0800 Subject: [PATCH 066/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 17 ++++----- .../AutoMapper/TrackPushAutoMapperProfile.cs | 10 +++++ .../Services/TrackPull/TrackPullService.cs | 1 - .../Services/TrackPush/TrackPushService.cs | 38 +++++++++++++++++++ .../ITrackPushConfigRepository.cs | 6 ++- .../GetTrackPullConfigPageOutputVO.cs | 2 +- .../GetTrackPushConfigPageOutputVO.cs | 26 +++++++++++++ .../TrackPushConfigRepository.cs | 29 ++++++++++++++ 8 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 3577eceb..da6207a5 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -3,16 +3,15 @@ using SJZY.Track.Application.Dtos.TrackPull; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using Volo.Abp.AutoMapper; -namespace SJZY.Track.Application.AutoMapper +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPullAutoMapperProfile : Profile { - public class TrackPullAutoMapperProfile : Profile + public TrackPullAutoMapperProfile() { - public TrackPullAutoMapperProfile() - { - CreateMap(MemberList.None); - CreateMap(MemberList.None).Ignore(dest => dest.Id) - .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); - CreateMap(MemberList.None); - } + CreateMap(MemberList.None); + CreateMap(MemberList.None).Ignore(dest => dest.Id) + .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } \ 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..420b0e23 --- /dev/null +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -0,0 +1,10 @@ +using AutoMapper; + +namespace SJZY.Track.Application.AutoMapper; + +public class TrackPushAutoMapperProfile : Profile +{ + public TrackPushAutoMapperProfile() + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index f76abe50..fcd56e92 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -2,7 +2,6 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Dtos.TrackPull; -using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; 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..b04e1194 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -0,0 +1,38 @@ +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Dtos.Common; +using SJZY.Track.Domain.Dtos.TrackPush; +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; + + public TrackPushService( + IStringLocalizer stringLocalizer, + ITrackPushConfigRepository trackPushConfigRepository) + { + _stringLocalizer = stringLocalizer; + _trackPushConfigRepository = trackPushConfigRepository; + } + + /// + /// 轨迹推送配置列表 + /// + /// + /// + [HttpPost("GetPage")] + public async Task> GetPageAsync([FromBody] KeywordsInputVO input) + { + return await _trackPushConfigRepository.GetPageAsync(input); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index abceffa6..82866c1f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -1,5 +1,9 @@ -namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; +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); } \ 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 index e45b7de8..15d25401 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullConfigPageOutputVO.cs @@ -7,7 +7,7 @@ public class GetTrackPullConfigPageOutputVO /// public DateTime? CreateTime { get; set; } - public int? Id { get; set; } + public int Id { get; set; } /// /// 服务商名称 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..9b2e3a83 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -0,0 +1,26 @@ +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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index 32c71905..a69f2406 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,8 +1,37 @@ 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.VEntities; +using SJZY.Track.Repository.VData.Entitys; namespace SJZY.Track.Repository; 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.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, ","), + CreateTime = trackPush.CreateTime + }) + .Distinct() + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 3260a70fe60622539fd54b39280867d206fd415f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 09:39:35 +0800 Subject: [PATCH 067/196] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln | 2 +- src/SJZY.Track.Api/SJZY.Track.Api.csproj | 2 +- src/SJZY.Track.Api/SJZYTrackApiModule.cs | 4 ++-- .../SJZY.Track.Application.csproj | 1 + .../Services/ProvideServices/TrackService.cs | 7 +++++-- src/SJZY.Track.Domain/SJZY.Track.Domain.csproj | 1 - .../BasicQuery.cs | 2 +- .../DataBaseContext.cs | 2 +- .../Enum/Enums.cs | 5 ++--- .../GlobalUsing.cs | 2 +- .../Queries/TrackQueries.cs | 2 +- .../Repositories}/BasicRepository.cs | 2 +- .../Repositories}/DemoRepository.cs | 2 +- .../Repositories}/OrderRepository.cs | 2 +- .../Repositories}/TrackContentRepository.cs | 3 +-- .../Repositories}/TrackDetailsRepository.cs | 2 +- .../Repositories}/TrackFlagRepository.cs | 4 +--- .../Repositories}/TrackPullConfigRepository.cs | 6 +++--- .../Repositories}/TrackPushConfigRepository.cs | 2 +- .../Repositories}/TrackStatusRepository.cs | 2 +- .../Repositories}/TrackTemplateRepository.cs | 4 ++-- .../SJZY.Track.Infrastructure.csproj} | 6 ++++-- .../SJZYTrackInfrastructureModule.cs} | 5 +++-- .../TrackPushRecord/Entitys/TrackPushRecordEntity.cs | 2 +- .../Services/ITrackPushRecordRepository.cs | 8 ++++++++ .../Services/TrackPushRecordRepository.cs | 10 ++++++++++ .../Entitys/TrackPushRecordDetailsEntity.cs | 2 +- .../Services/ITrackPushRecordDetailsRepository.cs | 8 ++++++++ .../Services/TrackPushRecordDetailsRepository.cs | 10 ++++++++++ .../Services/ITrackPushRecordRepository.cs | 9 --------- .../Services/TrackPushRecordRepository.cs | 9 --------- .../Services/ITrackPushRecordDetailsRepository.cs | 9 --------- .../Services/TrackPushRecordDetailsRepository.cs | 9 --------- test/SJZY.Track.Test/TestModule.cs | 4 ++-- 34 files changed, 76 insertions(+), 74 deletions(-) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/BasicQuery.cs (96%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/DataBaseContext.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/Enum/Enums.cs (66%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/GlobalUsing.cs (85%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/Queries/TrackQueries.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/BasicRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/DemoRepository.cs (99%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/OrderRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackContentRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackDetailsRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackFlagRepository.cs (94%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackPullConfigRepository.cs (97%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackPushConfigRepository.cs (79%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackStatusRepository.cs (98%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure/Repositories}/TrackTemplateRepository.cs (98%) rename src/{SJZY.Track.Repository/SJZY.Track.Repository.csproj => SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj} (81%) rename src/{SJZY.Track.Repository/SJZYTrackRepositoryModule.cs => SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs} (92%) rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/TrackPushRecord/Entitys/TrackPushRecordEntity.cs (96%) create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs rename src/{SJZY.Track.Repository => SJZY.Track.Infrastructure}/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs (94%) create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs create mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs delete mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index 8a9c51e8..c1408517 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DAC93270-5A2 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.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}" EndProject diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index 44113706..0dd07648 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/SJZY.Track.Api/SJZYTrackApiModule.cs b/src/SJZY.Track.Api/SJZYTrackApiModule.cs index 93e04188..07bb3fee 100644 --- a/src/SJZY.Track.Api/SJZYTrackApiModule.cs +++ b/src/SJZY.Track.Api/SJZYTrackApiModule.cs @@ -9,7 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus; using SJZY.Expand.ABP.Core.Redis; using SJZY.Expand.ABP.Core.Swagger; using SJZY.Track.Application; -using SJZY.Track.Repository; +using SJZY.Track.Infrastructure; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; @@ -28,7 +28,7 @@ namespace SJZY.Track.Api typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), typeof(ApplicationModule), - typeof(SJZYTrackRepositoryModule) + typeof(SJZYTrackInfrastructureModule) )] public class SJZYTrackApiModule : AbpModule { diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 43edd929..76ef0752 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -26,5 +26,6 @@ + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 5147ae93..7077cfb3 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using DotNetCore.CAP; +using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Queries; @@ -15,13 +16,15 @@ public class TrackService : ApplicationService private readonly IOrderRepository _orderRepository; private readonly ITrackDetailsRepository _trackDetailsRepository; private readonly ITrackQueries _trackQueries; + private readonly ICapPublisher _capPublisher; public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository) + ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher) { _trackQueries = trackQueries; _orderRepository = orderRepository; _trackDetailsRepository = trackDetailsRepository; + _capPublisher = capPublisher; } /// diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index 5ebeded5..aac0e12d 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -9,7 +9,6 @@ - diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Infrastructure/BasicQuery.cs similarity index 96% rename from src/SJZY.Track.Repository/BasicQuery.cs rename to src/SJZY.Track.Infrastructure/BasicQuery.cs index 4d8e70d1..75ee80b2 100644 --- a/src/SJZY.Track.Repository/BasicQuery.cs +++ b/src/SJZY.Track.Infrastructure/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Infrastructure/DataBaseContext.cs similarity index 98% rename from src/SJZY.Track.Repository/DataBaseContext.cs rename to src/SJZY.Track.Infrastructure/DataBaseContext.cs index 88539836..9fbb7d44 100644 --- a/src/SJZY.Track.Repository/DataBaseContext.cs +++ b/src/SJZY.Track.Infrastructure/DataBaseContext.cs @@ -2,7 +2,7 @@ #pragma warning disable 1591 -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; /// /// Sqlsugar 上下文对象 diff --git a/src/SJZY.Track.Repository/Enum/Enums.cs b/src/SJZY.Track.Infrastructure/Enum/Enums.cs similarity index 66% rename from src/SJZY.Track.Repository/Enum/Enums.cs rename to src/SJZY.Track.Infrastructure/Enum/Enums.cs index f32f511c..a2246eed 100644 --- a/src/SJZY.Track.Repository/Enum/Enums.cs +++ b/src/SJZY.Track.Infrastructure/Enum/Enums.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace SJZY.Track.Repository.Enum; +namespace SJZY.Track.Infrastructure.Enum; /// /// 枚举属性 @@ -10,6 +10,5 @@ public enum EnumPropertyEnums /// /// 节点 /// - [Description("ServiceNode")] - 节点, + [Description("ServiceNode")] 节点, } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/GlobalUsing.cs b/src/SJZY.Track.Infrastructure/GlobalUsing.cs similarity index 85% rename from src/SJZY.Track.Repository/GlobalUsing.cs rename to src/SJZY.Track.Infrastructure/GlobalUsing.cs index dc581267..bb8c080a 100644 --- a/src/SJZY.Track.Repository/GlobalUsing.cs +++ b/src/SJZY.Track.Infrastructure/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/TrackQueries.cs b/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs similarity index 98% rename from src/SJZY.Track.Repository/Queries/TrackQueries.cs rename to src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs index da7c4dab..413c38fe 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs @@ -7,7 +7,7 @@ using SJZY.Track.Domain.Dtos.TrackDetails; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Queries; -namespace SJZY.Track.Repository.Queries; +namespace SJZY.Track.Infrastructure.Queries; public class TrackQueries : ISugarRepository, ITrackQueries, ITransientDependency diff --git a/src/SJZY.Track.Repository/BasicRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/BasicRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs index a4616860..48c7f89c 100644 --- a/src/SJZY.Track.Repository/BasicRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs @@ -3,7 +3,7 @@ using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; using Volo.Abp; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; /// /// 仓储基类实现 diff --git a/src/SJZY.Track.Repository/DemoRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs similarity index 99% rename from src/SJZY.Track.Repository/DemoRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs index 18a8d5da..9acceca7 100644 --- a/src/SJZY.Track.Repository/DemoRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/OrderRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs index c932f142..18bc7cc4 100644 --- a/src/SJZY.Track.Repository/OrderRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency { diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/TrackContentRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs index 896d02d4..eac2265f 100644 --- a/src/SJZY.Track.Repository/TrackContentRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs @@ -2,10 +2,9 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackDetailsRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs index ef51db46..2737c39d 100644 --- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs @@ -3,7 +3,7 @@ using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency diff --git a/src/SJZY.Track.Repository/TrackFlagRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs similarity index 94% rename from src/SJZY.Track.Repository/TrackFlagRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs index 508d80ef..12c29447 100644 --- a/src/SJZY.Track.Repository/TrackFlagRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs @@ -1,10 +1,8 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; -using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs similarity index 97% rename from src/SJZY.Track.Repository/TrackPullConfigRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs index dbcb40be..796e6778 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs @@ -1,12 +1,12 @@ -using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +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; -using System.Linq.Expressions; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs similarity index 79% rename from src/SJZY.Track.Repository/TrackPushConfigRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index 32c71905..70008005 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.Aggregates.TrackPushAggregate; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Repository/TrackStatusRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackStatusRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs index 9e88da35..a9218613 100644 --- a/src/SJZY.Track.Repository/TrackStatusRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs similarity index 98% rename from src/SJZY.Track.Repository/TrackTemplateRepository.cs rename to src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs index 43fff1f5..c3e3a9c0 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs @@ -6,9 +6,9 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.VEntities; -using SJZY.Track.Repository.Enum; +using SJZY.Track.Infrastructure.Enum; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure.Repositories; public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj similarity index 81% rename from src/SJZY.Track.Repository/SJZY.Track.Repository.csproj rename to src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj index 42332f80..f1e677f8 100644 --- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj +++ b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj @@ -17,8 +17,10 @@ - - + + + + diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs similarity index 92% rename from src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs rename to src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs index 799c900a..7f18046a 100644 --- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs +++ b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs @@ -4,17 +4,18 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; +using SJZY.Track.Infrastructure.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; -namespace SJZY.Track.Repository; +namespace SJZY.Track.Infrastructure; /// /// 仓储模块 /// [DependsOn(typeof(AbpAutofacModule))] [DependsOn(typeof(SJZYTrackDomainModule))] -public class SJZYTrackRepositoryModule : AbpModule +public class SJZYTrackInfrastructureModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs similarity index 96% rename from src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs rename to src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs index 9b45f7c2..32615bba 100644 --- a/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository.TrackPushRecord.Entitys +namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys { /// /// 轨迹推送记录 diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs new file mode 100644 index 00000000..7b2e515e --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecord.Services +{ + public interface ITrackPushRecordRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs new file mode 100644 index 00000000..22529060 --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecord.Services +{ + public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs similarity index 94% rename from src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs rename to src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs index 64208102..796e3e47 100644 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys { /// /// 轨迹推送明细表 diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..6f29bbc3 --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services +{ + public interface ITrackPushRecordDetailsRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..157dc8bd --- /dev/null +++ b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services +{ + public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs deleted file mode 100644 index cac702c2..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecord.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecord.Services -{ - public interface ITrackPushRecordRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs deleted file mode 100644 index 06a72739..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -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/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs deleted file mode 100644 index 85047d16..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecordDetails.Services -{ - public interface ITrackPushRecordDetailsRepository : ISimpleClient - { - - } -} diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs deleted file mode 100644 index 20cd54e3..00000000 --- a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Repository.TrackPushRecordDetails.Services -{ - public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency - { - - } -} diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs index 8cff2d50..43bc8f71 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using SJZY.Track.Api; using SJZY.Track.Application; -using SJZY.Track.Repository; +using SJZY.Track.Infrastructure; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Authorization; @@ -19,7 +19,7 @@ namespace SJZY.Track.Test; typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAutofacModule), typeof(AbpAuthorizationModule), - typeof(SJZYTrackRepositoryModule), + typeof(SJZYTrackInfrastructureModule), typeof(ApplicationModule), typeof(SJZYTrackApiModule), typeof(AbpHttpClientModule) //添加abp的http代理模块 From 3578e82bedf6cf8687ea30eb3bfb1829608f8660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 09:44:41 +0800 Subject: [PATCH 068/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 ++++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushContentPageInputVO.cs | 9 +++ .../GetTrackPushContentPageOutputVO.cs | 56 +++++++++++++++++++ .../TrackPushConfigRepository.cs | 19 ++++++- 5 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentPageOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index b04e1194..4acda516 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -35,4 +35,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetPageAsync(input); } + + /// + /// 轨迹推送配置内容列表 + /// + /// + /// + [HttpPost("GetContentPage")] + public async Task> GetContentPageAsync([FromBody] GetTrackPushContentPageInputVO input) + { + return await _trackPushConfigRepository.GetContentPageAsync(input); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 82866c1f..ce41da3b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -6,4 +6,6 @@ namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate; public interface ITrackPushConfigRepository : IBasicRepository { Task> GetPageAsync(KeywordsInputVO input); + + Task> GetContentPageAsync(GetTrackPushContentPageInputVO input); } \ 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.Repository/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs index a69f2406..5d15dab1 100644 --- a/src/SJZY.Track.Repository/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPushConfigRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; @@ -19,7 +20,7 @@ public class TrackPushConfigRepository : BasicRepository, .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.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords)) + .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 { @@ -34,4 +35,18 @@ public class TrackPushConfigRepository : BasicRepository, .Distinct() .ToPagedListAsync(input.PageIndex, input.PageSize); } + + public async Task> GetContentPageAsync(GetTrackPushContentPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id) + .Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId) + .OrderBy((pushContent, trackContent) => pushContent.Sort) + .Select((pushContent, trackContent) => new GetTrackPushContentPageOutputVO + { + Id = pushContent.Id, + Sort = pushContent.Sort + }, true) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 0763cbf2631c4c948cb74c3f65dcde58473e8aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 09:48:49 +0800 Subject: [PATCH 069/196] =?UTF-8?q?=E9=87=8D=E7=BB=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln.DotSettings | 2 ++ .../SJZY.Track.Application.csproj | 11 ++++++----- .../Enums/EnumPropertyEnums.cs} | 2 +- src/SJZY.Track.Domain/IBasicRepository.cs | 2 +- .../{ => Queries}/BasicQuery.cs | 2 +- .../Repositories/BasicRepository.cs | 3 ++- .../Repositories/TrackTemplateRepository.cs | 2 +- .../SJZYTrackInfrastructureModule.cs | 1 + 8 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 SJZY.Track.Api.sln.DotSettings rename src/{SJZY.Track.Infrastructure/Enum/Enums.cs => SJZY.Track.Domain/Enums/EnumPropertyEnums.cs} (83%) rename src/SJZY.Track.Infrastructure/{ => Queries}/BasicQuery.cs (95%) 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/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 76ef0752..ccc853da 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -17,15 +17,16 @@ - - - - + + + + + + - diff --git a/src/SJZY.Track.Infrastructure/Enum/Enums.cs b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs similarity index 83% rename from src/SJZY.Track.Infrastructure/Enum/Enums.cs rename to src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs index a2246eed..e1c08aaf 100644 --- a/src/SJZY.Track.Infrastructure/Enum/Enums.cs +++ b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace SJZY.Track.Infrastructure.Enum; +namespace SJZY.Track.Domain.Enums; /// /// 枚举属性 diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index 71bc3175..8e9baed2 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -35,7 +35,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要更新的列 /// - Task UpdateRangeAsync(List entities, Expression> updateColumns = null); + Task UpdateRangeAsync(List entities, Expression>? updateColumns = null); /// /// 软删 diff --git a/src/SJZY.Track.Infrastructure/BasicQuery.cs b/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs similarity index 95% rename from src/SJZY.Track.Infrastructure/BasicQuery.cs rename to src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs index 75ee80b2..fbb511c7 100644 --- a/src/SJZY.Track.Infrastructure/BasicQuery.cs +++ b/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Infrastructure.Queries; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs index 48c7f89c..a776fd88 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs @@ -1,6 +1,7 @@ using System.Linq.Expressions; using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; +using SJZY.Track.Infrastructure.Queries; using Volo.Abp; namespace SJZY.Track.Infrastructure.Repositories; @@ -32,7 +33,7 @@ public class BasicRepository : BasicQuery, IBasicRepository where T : c .ExecuteCommandHasChangeAsync(); } - public async Task UpdateRangeAsync(List entities, Expression> columns = null) + public async Task UpdateRangeAsync(List entities, Expression>? columns = null) { return await Context.Updateable(entities) .UpdateColumnsIF(columns != null, columns) diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs index c3e3a9c0..d4ae27a6 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs @@ -5,8 +5,8 @@ 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; -using SJZY.Track.Infrastructure.Enum; namespace SJZY.Track.Infrastructure.Repositories; diff --git a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs index 7f18046a..c412b69c 100644 --- a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs +++ b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs @@ -4,6 +4,7 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; +using SJZY.Track.Infrastructure.Queries; using SJZY.Track.Infrastructure.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; From adc30d39c77ca5f1cf31901f89c905134c14b73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 10:12:14 +0800 Subject: [PATCH 070/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 +++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushConfigDetailOutputVO.cs | 98 +++++++++++++++++++ .../Repositories/TrackPushConfigRepository.cs | 20 ++++ 4 files changed, 131 insertions(+) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 4acda516..f303cc4c 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -46,4 +46,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetContentPageAsync(input); } + + /// + /// 轨迹推送配置详情 + /// + /// + /// + [HttpGet("GetDetail")] + public async Task GetDetailAsync(int id) + { + return await _trackPushConfigRepository.GetDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index ce41da3b..9050f090 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -8,4 +8,6 @@ public interface ITrackPushConfigRepository : IBasicRepository> GetPageAsync(KeywordsInputVO input); Task> GetContentPageAsync(GetTrackPushContentPageInputVO input); + + Task GetDetailAsync(int id); } \ 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..6e9cd961 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -0,0 +1,98 @@ +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 int TrackTemplateId { get; set; } + + /// + /// 推送轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index 788741ca..d5180da1 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -1,4 +1,5 @@ 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; @@ -49,4 +50,23 @@ public class TrackPushConfigRepository : BasicRepository, }, 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) + .SingleAsync(); + } } \ No newline at end of file From a2e458e57fbb5dec5d4173095a6d0e500ae2c534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 10:14:49 +0800 Subject: [PATCH 071/196] =?UTF-8?q?=E6=8A=BD=E8=B1=A1=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln | 2 +- .../Dtos/Demo/ComplexAutomapperDemoInput.cs | 6 +- .../Dtos/Demo/DemoDetailInput.cs | 4 +- .../Dtos/Demo/DemoInput.cs | 2 +- .../Dtos/Demo/ExcelImportOuput.cs | 10 ++ .../Dtos/Demo/GetDemoListByPageInput.cs | 9 ++ .../Dtos/Demo/GetDemoListByPageOutput.cs | 4 +- .../Dtos/Demo/MyCustomerResultOutput.cs | 4 +- .../Dtos/Demo/OssUploadOutput.cs | 4 +- .../Dtos/Demo}/RemoteDemoInput.cs | 4 +- .../Dtos/Demo}/RemoteDemoOutput.cs | 4 +- .../Dtos/Demo/SwaggerDemoInput.cs | 13 +- .../Dtos/Demo/ValidateExecuteInput.cs | 5 +- .../Dtos/Demo/ValidateExecuteOutput.cs | 6 + .../Dtos/ProvideServices/DeleteOrderInput.cs | 5 + .../ProvideServices/GetOrderDetailsInput.cs | 12 +- .../ProvideServices/GetPageTrackOrderInput.cs | 95 +++++++++++++ .../Dtos/ProvideServices/GetTrackInput.cs | 2 +- .../Dtos/ProvideServices/GetTrackOutput.cs | 2 +- .../Dtos/ProvideServices/LinkOrderInput.cs | 2 +- .../Dtos/ProvideServices/OrderNoInfo.cs | 2 +- .../Dtos/ProvideServices/UpdateOrderInput.cs | 2 +- .../Dtos/ProvideServices/UpsertOrderInput.cs | 2 +- .../Dtos/ProvideServices/UpsertTrackInput.cs | 2 +- .../TrackContents/EditTrackContentInput.cs | 19 +-- .../TrackContents/GetPageTrackContentInput.cs | 10 +- .../Dtos/TrackFlags/EditTrackFlagInput.cs | 12 +- .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 10 +- .../TrackPull/EditTrackPullConfigInput.cs | 2 +- .../TrackPull/UpdateTrackPullContentInput.cs | 2 +- .../Dtos/TrackStatus/EditTrackStatusInput.cs | 10 +- .../TrackStatus/GetTrackStatusDetailDto.cs | 20 +-- .../Dtos/TrackStatus/GetTrackStatusListDto.cs | 10 +- .../EditTrackTemplateContentInput.cs | 2 +- .../GetPageTrackTemplateInput.cs | 4 +- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 4 +- .../GlobalUsings.cs | 4 + .../SJZY.Track.Application.Contract.csproj} | 0 .../Services/IRemoteDemoService.cs | 13 ++ .../Services/ITrackContentService.cs | 5 + .../Services/ITrackFlagService.cs | 5 + .../Services/ITrackStatusService.cs | 5 + .../TrackHttpApiModule.cs | 3 +- .../AutoMapper/AutoMapperProfile.cs | 2 +- .../AutoMapper/DemoAutoMapperProfile.cs | 19 +-- .../AutoMapper/OrderAutoMapperProfile.cs | 6 +- .../TrackContentAutoMapperProfile.cs | 16 +-- .../AutoMapper/TrackFlagAutoMapperProfile.cs | 18 +-- .../AutoMapper/TrackPullAutoMapperProfile.cs | 2 +- .../TrackStatusAutoMapperProfile.cs | 23 ++-- .../TrackTemplateAutoMapperProfile.cs | 7 +- .../Dtos/Demo/ExcelImportOuput.cs | 11 -- .../Dtos/Demo/GetDemoListByPageInput.cs | 10 -- .../Dtos/Demo/ValidateExecuteOutput.cs | 6 - .../Dtos/ProvideServices/DeleteOrderInput.cs | 5 - .../ProvideServices/GetPageTrackOrderInput.cs | 102 -------------- .../SJZY.Track.Application.csproj | 2 +- .../Services/Demo/InterFaceDemoService.cs | 2 +- .../ProvideServices/OrderLinkService.cs | 2 +- .../Services/ProvideServices/OrderService.cs | 6 +- .../Services/ProvideServices/TrackCustomer.cs | 9 ++ .../ProvideServices/TrackQueryService.cs | 2 +- .../Services/ProvideServices/TrackService.cs | 2 +- .../TrackContents/ITrackContentService.cs | 13 -- .../TrackContents/TrackContentService.cs | 39 +++--- .../Services/TrackFlags/ITrackFlagService.cs | 12 -- .../Services/TrackFlags/TrackFlagService.cs | 36 ++--- .../Services/TrackPull/TrackPullService.cs | 127 ++++++++++-------- .../TrackStatus/ITrackStatusService.cs | 12 -- .../TrackStatus/TrackStatusService.cs | 27 ++-- .../TrackTemplates/TrackTemplateService.cs | 17 ++- .../Demo/SimpleValidateInputValidation.cs | 31 +++-- .../Demo/UserInfoInputValidation.cs | 6 +- .../Demo/UserRoleInputValidation.cs | 4 +- .../EditTrackContentInputValidation.cs | 22 +-- .../EditTrackFlagInputValidation.cs | 21 +-- .../EditTrackStatusInputValidation.cs | 21 +-- .../EditTrackTemplateInputValidation.cs | 16 +-- .../Services/IRemoteDemoService.cs | 15 --- test/SJZY.Track.Test/Demo/DemoTest.cs | 9 +- 80 files changed, 453 insertions(+), 570 deletions(-) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/ComplexAutomapperDemoInput.cs (97%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/DemoDetailInput.cs (94%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/DemoInput.cs (94%) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs create mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/GetDemoListByPageOutput.cs (90%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/MyCustomerResultOutput.cs (71%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/OssUploadOutput.cs (82%) rename src/{SJZY.Track.HttpApi/Dtos => SJZY.Track.Application.Contract/Dtos/Demo}/RemoteDemoInput.cs (76%) rename src/{SJZY.Track.HttpApi/Dtos => SJZY.Track.Application.Contract/Dtos/Demo}/RemoteDemoOutput.cs (64%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/SwaggerDemoInput.cs (77%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/Demo/ValidateExecuteInput.cs (97%) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs create mode 100644 src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/GetOrderDetailsInput.cs (85%) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/GetTrackInput.cs (92%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/GetTrackOutput.cs (87%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/LinkOrderInput.cs (90%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/OrderNoInfo.cs (84%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/UpdateOrderInput.cs (93%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/UpsertOrderInput.cs (91%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/ProvideServices/UpsertTrackInput.cs (87%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackContents/EditTrackContentInput.cs (85%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackContents/GetPageTrackContentInput.cs (90%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackFlags/EditTrackFlagInput.cs (86%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackFlags/GetTrackFlagListDto.cs (88%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackPull/EditTrackPullConfigInput.cs (96%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackPull/UpdateTrackPullContentInput.cs (94%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackStatus/EditTrackStatusInput.cs (83%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackStatus/GetTrackStatusDetailDto.cs (61%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackStatus/GetTrackStatusListDto.cs (89%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs (91%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs (89%) rename src/{SJZY.Track.Application => SJZY.Track.Application.Contract}/Dtos/TrackTemplates/GetTrackDetailDto.cs (96%) create mode 100644 src/SJZY.Track.Application.Contract/GlobalUsings.cs rename src/{SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj => SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj} (100%) create mode 100644 src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs create mode 100644 src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs create mode 100644 src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs create mode 100644 src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs rename src/{SJZY.Track.HttpApi => SJZY.Track.Application.Contract}/TrackHttpApiModule.cs (82%) delete mode 100644 src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs delete mode 100644 src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs delete mode 100644 src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs delete mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs delete mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs delete mode 100644 src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs delete mode 100644 src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs delete mode 100644 src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs delete mode 100644 src/SJZY.Track.HttpApi/Services/IRemoteDemoService.cs diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index c1408517..3de8a025 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.HttpApi", "src\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Application.Contract", "src\SJZY.Track.Application.Contract\SJZY.Track.Application.Contract.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Test", "test\SJZY.Track.Test\SJZY.Track.Test.csproj", "{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}" EndProject diff --git a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs similarity index 97% rename from src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs index de4bc495..f2162eb5 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { /// /// automapper 复杂转换样例 @@ -43,7 +43,6 @@ { return "辽宁省沈阳市..."; } - } public class ComplexAutomapperDemoOutput @@ -83,7 +82,4 @@ /// 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.Contract/Dtos/Demo/DemoDetailInput.cs similarity index 94% rename from src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/DemoDetailInput.cs index 30da5896..e80c4745 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoDetailInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class DemoDetailSaveInput { @@ -45,4 +45,4 @@ /// public string OtherInfo { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs similarity index 94% rename from src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs index 1b46a3e1..87f95820 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class DemoInput { diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs new file mode 100644 index 00000000..b2afbc57 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs @@ -0,0 +1,10 @@ +namespace SJZY.Track.Application.Contract.Dtos.Demo; + +public class ExcelImportOuput +{ + // [MiniExcelLibs.Attributes.ExcelColumnName("姓名")] + public string Name { get; set; } + + // [MiniExcelLibs.Attributes.ExcelColumnName("年龄")] + public int Age { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs new file mode 100644 index 00000000..a49e420a --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs @@ -0,0 +1,9 @@ +namespace SJZY.Track.Application.Contract.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.Contract/Dtos/Demo/GetDemoListByPageOutput.cs similarity index 90% rename from src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs index 3c5bd96d..fd91bc62 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class GetDemoListByPageOutput { @@ -24,4 +24,4 @@ public DateTime CreateTime { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs similarity index 71% rename from src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs index 8d6896ac..f1a5288c 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class MyCustomerResultOutput { @@ -6,4 +6,4 @@ public string Message { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs similarity index 82% rename from src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs index 367d2c54..68b3abcf 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class OssUploadOutput { @@ -12,4 +12,4 @@ /// public string Url { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs similarity index 76% rename from src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs index b010b6bd..2f43a8fa 100644 --- a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.HttpApi.Dtos +namespace SJZY.Track.Application.Contract.Dtos { public class RemoteDemoInput { @@ -7,4 +7,4 @@ /// public DateTime CurrentTime { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs similarity index 64% rename from src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs index 44cd1f41..0cd20796 100644 --- a/src/SJZY.Track.HttpApi/Dtos/RemoteDemoOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs @@ -1,7 +1,7 @@ -namespace SJZY.Track.HttpApi.Dtos +namespace SJZY.Track.Application.Contract.Dtos { public class RemoteDemoOutput { public string Context { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs similarity index 77% rename from src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs index f521c50e..eefc7559 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs @@ -1,7 +1,7 @@ using System.ComponentModel; using System.Text.Json.Serialization; -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class SwaggerDemoInput { @@ -30,13 +30,10 @@ namespace SJZY.Track.Application.Dtos.Demo public enum Gender { - [Description("纯爷们")] - 男 = 2, + [Description("纯爷们")] 男 = 2, - [Description("大姑娘")] - 女 = 5, + [Description("大姑娘")] 女 = 5, - [Description("你憋问")] - 未知 = 8 + [Description("你憋问")] 未知 = 8 } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs similarity index 97% rename from src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs index f1c3fc45..2de0afdf 100644 --- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.Demo +namespace SJZY.Track.Application.Contract.Dtos.Demo { public class ValidateExecuteInput { @@ -56,7 +56,6 @@ /// 用户角色 /// public List UserRoleInputList { get; set; } - } public class UserInfoInput @@ -95,4 +94,4 @@ /// public string Name { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs new file mode 100644 index 00000000..1ea87d0f --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Application.Contract.Dtos.Demo +{ + public class ValidateExecuteOutput + { + } +} \ 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..7d8d79c0 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class DeleteOrderInput : OrderNoInfo +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs similarity index 85% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index d1b7cb92..c82bf122 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.ProvideServices +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices { public class GetOrderDetailsInput { @@ -30,7 +24,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// 轨迹内容 /// public string Content { get; set; } - + /// /// 轨迹内容英文 /// @@ -51,4 +45,4 @@ namespace SJZY.Track.Application.Dtos.ProvideServices /// public string TrackTimeZone { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs new file mode 100644 index 00000000..2f8d31e0 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -0,0 +1,95 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class GetPageTrackOrderInput : PageInfoInput +{ + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 单号 + /// + public List? OrderNos { get; set; } + + /// + /// 创建时间开始 + /// + public DateTime? CreateTimeStart { get; set; } + + /// + /// 创建时间截止 + /// + public DateTime? CreateTimeEnd { get; set; } +} + +/// +/// 轨迹订单Dto +/// +public class TrackOrderDto +{ + /// + /// 轨迹订单id + /// + public int Id { get; set; } + + /// + /// 订单类型id + /// + public int OrderType { get; set; } + + /// + /// 订单号 + /// + public string? OrderNumber { get; set; } + + /// + /// 轨迹模版 + /// + public string? TrackTemplateNames { get; set; } + + /// + /// 客户简称 + /// + public string? CustomerShortName { get; set; } + + /// + /// 客户代码 + /// + public string? CustomerCode { get; set; } + + /// + /// 订单明细(json) + /// + public string? OrderDetails { get; set; } + + /// + /// 最新轨迹内容 + /// + public string? NewestTrackContent { get; set; } + + /// + /// 最新轨迹内容英文 + /// + public string? NewestTrackEnContent { get; set; } + + /// + /// 最新轨迹发生地 + /// + public string? NewestTrackPlace { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + + /// + /// 子系统 + /// + public string SubSystem { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs similarity index 92% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs index d455a5b2..578c31b2 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class GetTrackInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs similarity index 87% rename from src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs index b6b77862..eda7ecbc 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetTrackOutput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class GetTrackOutput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs similarity index 90% rename from src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs index ae3dfd9d..cf3e5b79 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/LinkOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class LinkOrderInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs similarity index 84% rename from src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs index 6f98fafc..b4283022 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class OrderNoInfo { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs similarity index 93% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs index d614db45..a6faf08b 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpdateOrderInput : OrderNoInfo { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs similarity index 91% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs index c03d2478..f6c7cb78 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpsertOrderInput : UpdateOrderInput { diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs similarity index 87% rename from src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs index fa2112ee..91d5429c 100644 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpsertTrackInput : OrderNoInfo { diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs similarity index 85% rename from src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs index 9879ffb8..d2a829ca 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackContents +namespace SJZY.Track.Application.Contract.Dtos.TrackContents { public class EditTrackContentInput { @@ -79,12 +73,12 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹内容代码 /// - public string Code { get; set; } + public string Code { get; set; } /// /// 轨迹内容 /// - public string Content { get; set; } + public string Content { get; set; } /// /// 轨迹内容英文 @@ -94,12 +88,11 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// /// 轨迹标记id /// - public int TrackFlagId { get; set; } + public int TrackFlagId { get; set; } /// /// 轨迹标记 /// - public string TrackFlag { get; set; } + public string TrackFlag { get; set; } } -} - +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs similarity index 90% rename from src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 7a009ccb..9628067c 100644 --- a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackContents +namespace SJZY.Track.Application.Contract.Dtos.TrackContents { public class GetPageTrackContentInput : PageInfoInput { @@ -81,4 +75,4 @@ namespace SJZY.Track.Application.Dtos.TrackContents /// public string UpdateUser { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs similarity index 86% rename from src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs index 901f5e5a..f4c1083e 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackFlags +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags { public class EditTrackFlagInput { @@ -54,7 +48,7 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// /// 子系统 /// - public string SubSystem { get; set; } + public string SubSystem { get; set; } /// /// 代码 @@ -71,4 +65,4 @@ namespace SJZY.Track.Application.Dtos.TrackFlags /// public bool IsFinish { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs similarity index 88% rename from src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs index 714203f2..1ca2c4df 100644 --- a/src/SJZY.Track.Application/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackFlags +namespace SJZY.Track.Application.Contract.Dtos.TrackFlags { public class GetTrackFlagListDto { @@ -66,4 +60,4 @@ namespace SJZY.Track.Application.Dtos.TrackFlags ///// //public string Keywords { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs similarity index 96% rename from src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs index 71fe55cf..61e15c3e 100644 --- a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackPull; +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; public class EditTrackPullConfigInput { diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs similarity index 94% rename from src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs index 74a54567..84d7e335 100644 --- a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackPull; +namespace SJZY.Track.Application.Contract.Dtos.TrackPull; public class UpdateTrackPullContentInput { diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs similarity index 83% rename from src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs index ce9a0ebf..61a9d98e 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class EditTrackStatusInput { @@ -43,4 +37,4 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// public string? EntrackStatus { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs similarity index 61% rename from src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs index 6779d6da..fe39c418 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class GetTrackStatusDetailDto { @@ -21,26 +15,26 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// /// 子系统 /// - public string SubSystem { get; set; } + public string SubSystem { get; set; } /// /// 节点id /// - public int NodeId { get; set; } + public int NodeId { get; set; } /// /// 所属轨迹状态 /// - public string TrackStatus { get; set; } + public string TrackStatus { get; set; } /// /// 轨迹状态代码 /// - public string Code { get; set; } + public string Code { get; set; } /// /// 轨迹内容英文 /// - public string EntrackStatus { get; set; } + public string EntrackStatus { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs similarity index 89% rename from src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs index ecdb123d..8cadc1ea 100644 --- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.TrackStatus +namespace SJZY.Track.Application.Contract.Dtos.TrackStatus { public class GetTrackStatusListDto { @@ -72,4 +66,4 @@ namespace SJZY.Track.Application.Dtos.TrackStatus /// public string Keywords { get; set; } = ""; } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs similarity index 91% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs index bb45dc74..0c7144fc 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates; +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates; /// public class EditTrackTemplateContentInput diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs similarity index 89% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index 3be009ac..ba54db15 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates { /// /// 获取轨迹模版分页输入 @@ -20,4 +20,4 @@ /// public int TrackTemplateId { get; set; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs similarity index 96% rename from src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs rename to src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs index f4ac73d8..86e5db45 100644 --- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -1,4 +1,4 @@ -namespace SJZY.Track.Application.Dtos.TrackTemplates +namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates { /// /// 获取轨迹模版详情 @@ -92,4 +92,4 @@ /// public string? Code { set; get; } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/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 100% rename from src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj rename to src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj diff --git a/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs b/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs new file mode 100644 index 00000000..841cae19 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs @@ -0,0 +1,13 @@ +using SJZY.Track.Application.Contract.Dtos; +using Volo.Abp; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Contract.Services; + +/// +/// 客户端连接测试接口 +/// +public interface IRemoteDemoService : IRemoteService, IScopedDependency +{ + Task> ConnectionTest(RemoteDemoInput input); +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs new file mode 100644 index 00000000..08ce5194 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackContentService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs new file mode 100644 index 00000000..a7d780b9 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackFlagService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs new file mode 100644 index 00000000..b350cb93 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs @@ -0,0 +1,5 @@ +namespace SJZY.Track.Application.Contract.Services; + +public interface ITrackStatusService +{ +} \ No newline at end of file diff --git a/src/SJZY.Track.HttpApi/TrackHttpApiModule.cs b/src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs similarity index 82% rename from src/SJZY.Track.HttpApi/TrackHttpApiModule.cs rename to src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs index 522c4cf8..a76ed6da 100644 --- a/src/SJZY.Track.HttpApi/TrackHttpApiModule.cs +++ b/src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs @@ -1,12 +1,11 @@ using Volo.Abp.Modularity; -namespace SJZY.Track.HttpApi +namespace SJZY.Track.Application.Contract { public class TrackHttpApiModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { - } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs index b315446d..87914d8e 100644 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Contract.Dtos.Demo; using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; diff --git a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs index 8e04d1ce..ba28b16e 100644 --- a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs @@ -1,7 +1,6 @@ using AutoMapper; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Dtos.Demo; - +using SJZY.Track.Application.Contract.Dtos.Demo; namespace SJZY.Track.Application.AutoMapper { @@ -20,12 +19,14 @@ namespace SJZY.Track.Application.AutoMapper //一些简单计算的场景,酌情使用... .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())) + .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.修改); - }); + .ForMember(dest => dest.Id, + opt => + { + opt.Condition(src => src.OptionType == OptionType.删除 || src.OptionType == OptionType.修改); + }); } public int GetAgeByBirthdate(DateTime birthdate) @@ -36,8 +37,8 @@ namespace SJZY.Track.Application.AutoMapper { age--; } + return age < 0 ? 0 : age; } - } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index a8d93386..8ea57e0e 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,9 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; -using System.Diagnostics; namespace SJZY.Track.Application.AutoMapper; @@ -21,6 +19,6 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs index e9346eff..25f17ab6 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -1,16 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackContents; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackTemplate; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -22,7 +13,8 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>( + MemberList.None); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs index acc0102a..a08aa0a0 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -1,16 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -18,10 +9,9 @@ namespace SJZY.Track.Application.AutoMapper { public TrackFlagAutoMapperProfile() { - CreateMap(MemberList.None) - .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) - .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); + .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) + .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); @@ -32,4 +22,4 @@ namespace SJZY.Track.Application.AutoMapper // resultDto); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index da6207a5..2af35a86 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -1,5 +1,5 @@ using AutoMapper; -using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using Volo.Abp.AutoMapper; diff --git a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs index c66d09e7..49796f47 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs @@ -1,15 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.Demo; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper { @@ -18,14 +10,15 @@ namespace SJZY.Track.Application.AutoMapper public TrackStatusAutoMapperProfile() { CreateMap(MemberList.None) - //层级不一致的场景 - .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus)) - .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus)) - .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId)); + //层级不一致的场景 + .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus)) + .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus)) + .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList + .None); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs index cec240ac..36f0e498 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs @@ -1,9 +1,7 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper; @@ -19,6 +17,7 @@ public class TrackTemplateAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList + .None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/Demo/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/ValidateExecuteOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs deleted file mode 100644 index 13cede57..00000000 --- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Application.Dtos.Demo -{ - public class ValidateExecuteOutput - { - } -} diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs deleted file mode 100644 index c4fba2a8..00000000 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace SJZY.Track.Application.Dtos.ProvideServices; - -public class DeleteOrderInput : OrderNoInfo -{ -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs deleted file mode 100644 index 06335e34..00000000 --- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Dtos.ProvideServices -{ - public class GetPageTrackOrderInput : PageInfoInput - { - /// - /// 子系统id - /// - public int SubSystemId { get; set; } - - /// - /// 单号 - /// - public List? OrderNos { get; set; } - - /// - /// 创建时间开始 - /// - public DateTime? CreateTimeStart { get; set; } - - /// - /// 创建时间截止 - /// - public DateTime? CreateTimeEnd { get; set; } - } - - /// - /// 轨迹订单Dto - /// - public class TrackOrderDto - { - /// - /// 轨迹订单id - /// - public int Id { get; set; } - - /// - /// 订单类型id - /// - public int OrderType { get; set; } - - /// - /// 订单号 - /// - public string? OrderNumber { get; set; } - - /// - /// 轨迹模版 - /// - public string? TrackTemplateNames { get; set; } - - /// - /// 客户简称 - /// - public string? CustomerShortName { get; set; } - - /// - /// 客户代码 - /// - public string? CustomerCode { get; set; } - - /// - /// 订单明细(json) - /// - public string? OrderDetails { get; set; } - - /// - /// 最新轨迹内容 - /// - public string? NewestTrackContent { get; set; } - - /// - /// 最新轨迹内容英文 - /// - public string? NewestTrackEnContent { get; set; } - - /// - /// 最新轨迹发生地 - /// - public string? NewestTrackPlace { get; set; } - - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } - - /// - /// 创建时间 - /// - public DateTime? CreateTime { get; set; } - - /// - /// 子系统 - /// - public string SubSystem { get; set; } - } -} diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index ccc853da..93d801c4 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -27,6 +27,6 @@ - + diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs index 6402f596..39d63fc8 100644 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs @@ -1,5 +1,5 @@ using SJZY.Expand.ABP.Core.Common; -using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Contract.Dtos.Demo; using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index e21ca538..f0261697 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Queries; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 8b6b8e19..38eb9466 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,5 +1,4 @@ -using SJZY.Expand.ABP.Core.Common.Dto; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -93,7 +92,8 @@ public class OrderService : ApplicationService { var vo = ObjectMapper.Map(input); var pageList = await _orderRepository.GetPageTrackOrder(vo); - var pageResultDto = ObjectMapper.Map, UnifyPageResultDto>(pageList); + var pageResultDto = + ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs new file mode 100644 index 00000000..d4c57f4c --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs @@ -0,0 +1,9 @@ +using DotNetCore.CAP; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.Services.ProvideServices; + +public class TrackCustomer : ITransientDependency, ICapSubscribe +{ + public const string CapSubscribe = "SJZY.FMC.VoucherRedundantCalc"; +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 587c316b..79f0cb2e 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,4 +1,4 @@ -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Queries; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 7077cfb3..a6a5f932 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,5 +1,5 @@ using DotNetCore.CAP; -using SJZY.Track.Application.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Queries; diff --git a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs deleted file mode 100644 index 8747af44..00000000 --- a/src/SJZY.Track.Application/Services/TrackContents/ITrackContentService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackContents -{ - public interface ITrackContentService - { - - } -} diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 3245d2ce..c7493cec 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,16 +1,8 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackContents; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackContents @@ -28,10 +20,10 @@ namespace SJZY.Track.Application.Services.TrackContents public TrackContentService( IStringLocalizer stringLocalizer, ITrackContentRepository trackContentRepository - ) + ) { - this._stringLocalizer=stringLocalizer; - this._trackContentRepository=trackContentRepository; + this._stringLocalizer = stringLocalizer; + this._trackContentRepository = trackContentRepository; } /// @@ -74,7 +66,8 @@ namespace SJZY.Track.Application.Services.TrackContents /// /// [HttpPost("GetList")] - public async Task> GetPageTrackContent(GetPageTrackContentInput input) + public async Task> GetPageTrackContent( + GetPageTrackContentInput input) { var vo = ObjectMapper.Map(input); var resultDto = await _trackContentRepository.GetPageTrackContent(vo); @@ -86,15 +79,19 @@ namespace SJZY.Track.Application.Services.TrackContents } #region 私有方法 + private async Task AddAsync(EditTrackContentInput input) { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&&(a.Code==input.Code || - a.Content==input.Content || a.EnContent==input.EnContent)); + + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); if (trackContentEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -106,12 +103,15 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task UpdateAsync(EditTrackContentInput input) { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId==input.SubSystemId && (a.Code==input.Code || - a.Content==input.Content || a.EnContent==input.EnContent)); + + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Content == input.Content || a.EnContent == input.EnContent)); if (trackContentEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } + #endregion var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); @@ -127,6 +127,7 @@ namespace SJZY.Track.Application.Services.TrackContents return new UnifyResultDto("200", "删除成功", isTrue); } + #endregion } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs deleted file mode 100644 index 1e745341..00000000 --- a/src/SJZY.Track.Application/Services/TrackFlags/ITrackFlagService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackFlags -{ - public interface ITrackFlagService - { - } -} diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index 112345e2..a6117f0d 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -1,16 +1,8 @@ using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; -using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackFlags; -using SJZY.Track.Domain.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackFlags @@ -28,10 +20,10 @@ namespace SJZY.Track.Application.Services.TrackFlags public TrackFlagService( IStringLocalizer stringLocalizer, ITrackFlagRepository trackFlagRepository - ) + ) { - this._stringLocalizer=stringLocalizer; - this._trackFlagRepository=trackFlagRepository; + this._stringLocalizer = stringLocalizer; + this._trackFlagRepository = trackFlagRepository; } /// @@ -86,14 +78,18 @@ namespace SJZY.Track.Application.Services.TrackFlags } #region 私有方法 + private async Task AddAsync(EditTrackFlagInput input) { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || a.Name==input.Flag)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -105,12 +101,15 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task UpdateAsync(EditTrackFlagInput input) { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Name ==input.Flag)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Name == input.Flag)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); } + #endregion var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id); @@ -126,6 +125,7 @@ namespace SJZY.Track.Application.Services.TrackFlags return new UnifyResultDto("200", "删除成功", isTrue); } + #endregion } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index fcd56e92..4210a46c 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -1,13 +1,13 @@ -using Microsoft.Extensions.Localization; +using System.Linq.Expressions; +using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Dtos.TrackPull; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; -using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPull; @@ -50,7 +50,8 @@ public class TrackPullService : ApplicationService, ITransientDependency /// /// [HttpPost("GetContentPage")] - public async Task> GetContentPageAsync([FromBody] GetTrackPullContentPageInputVO input) + public async Task> GetContentPageAsync( + [FromBody] GetTrackPullContentPageInputVO input) { return await _trackPullConfigRepository.GetContentPageAsync(input); } @@ -88,7 +89,8 @@ public class TrackPullService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isAnyExp = x => - x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; + x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && + x.ServiceProviderId == input.ServiceProviderId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) @@ -98,86 +100,96 @@ public class TrackPullService : ApplicationService, ITransientDependency 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()) { - var trackPullEntity = ObjectMapper.Map(input); - var trackPullParamsEntity = ObjectMapper.Map(input); + int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); - var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); + trackPullParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); - var trackPullContentEntities = new List(); - - using (var ts = TransactionScopeHelper.Create()) + foreach (var item in trackTemplateContentEntities) { - int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); - - trackPullParamsEntity.PullOrPushConfigId = id; - await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); - - foreach (var item in trackTemplateContentEntities) + trackPullContentEntities.Add(new() { - trackPullContentEntities.Add(new() - { - TrackPullConfigId = id, - TrackContentId = item.TrackContentId - }); - } - await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); - - ts.Complete(); + 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 oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => + x.TrackTemplateId == input.TrackTemplateId); - var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = oldTrackPullEntity.Id, + TrackContentId = item.TrackContentId + }); + } + } - var trackPullContentEntities = new List(); + ObjectMapper.Map(input, oldTrackPullEntity); + ObjectMapper.Map(input, oldTrackPullParamsEntity); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); + await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); 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 - }); - } + await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); } - ObjectMapper.Map(input, oldTrackPullEntity); - ObjectMapper.Map(input, oldTrackPullParamsEntity); - - using (var ts = TransactionScopeHelper.Create()) - { - await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); - await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); - - if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) - { - await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); - await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); - } - - ts.Complete(); - } + 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.SoftDeleteParamsAsync(x => + x.PullOrPushConfigId == input.Id && !x.IsPush); await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); ts.Complete(); } + break; default: @@ -196,7 +208,8 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { - var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); ObjectMapper.Map(input, oldTrackPullContentEntity); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs deleted file mode 100644 index eef632b7..00000000 --- a/src/SJZY.Track.Application/Services/TrackStatus/ITrackStatusService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SJZY.Track.Application.Services.TrackStatus -{ - public interface ITrackStatusService - { - } -} diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index bd58470f..f7ba0720 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,6 +1,5 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.Extensions.Localization; -using SJZY.Track.Application.Dtos.TrackStatus; +using Microsoft.Extensions.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; @@ -23,7 +22,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency ITrackStatusRepository trackStatusRepository ) { - this._stringLocalizer=stringLocalizer; + this._stringLocalizer = stringLocalizer; this._trackStatusRepository = trackStatusRepository; } @@ -79,15 +78,19 @@ public class TrackStatusService : ApplicationService, ITransientDependency } #region 私有方法 + private async Task AddAsync(EditTrackStatusInput input) { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId && + (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -99,12 +102,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackStatusInput input) { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || - a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); - if (trackStatusEntity!=null) + + var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id && + a.SubSystemId == input.SubSystemId && (a.Code == input.Code || + a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); + if (trackStatusEntity != null) { throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); } + #endregion var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id); @@ -120,5 +126,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency return new UnifyResultDto("200", "删除成功", isTrue); } + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index e77a574d..5afc3992 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,8 +1,7 @@ using System.Linq.Expressions; -using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; @@ -85,12 +84,16 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task AddAsync(EditTrackTemplateInput input) { #region 业务校验 + //校验模版代码唯一性 - var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + var templateEntity = + await _trackTemplateRepository.GetFirstAsync( + a => a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (templateEntity != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } + #endregion var entity = ObjectMapper.Map(input); @@ -102,11 +105,14 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackTemplateInput input) { #region 业务校验 - var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId == input.SubSystemId &&a.Code==input.Code); + + var isExist = await _trackTemplateRepository.GetFirstAsync(a => + a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } + #endregion var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); @@ -119,8 +125,11 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackTemplateInput input) { #region 业务校验 + //到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示 + #endregion + var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); diff --git a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs index db26be85..a14bc02f 100644 --- a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs @@ -1,9 +1,8 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Contract.Dtos.Demo; namespace SJZY.Track.Application.Validations.Demo { - public class SimpleValidateInputValidation : AbstractValidator, IValidationEnabled { public SimpleValidateInputValidation() @@ -31,14 +30,14 @@ namespace SJZY.Track.Application.Validations.Demo RuleFor(x => x.LoginName).MinimumLength(6).WithMessage("登录账号不能小于6个字符!"); //正则表达式 - RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\\%\\^\\&\\*\\(\\)])[0-9a-zA-Z!@#$\\%\\^\\&\\*\\(\\)]{6,10}") + 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.PassWordAgain).Must((data, context) => { return data.PassWord == data.PassWordAgain; }) + .WithMessage("两次输入密码不一致!"); //数字类型校验 RuleFor(x => x.MiniCount).LessThan(100).WithMessage("最小数量必须小于100"); @@ -50,19 +49,19 @@ namespace SJZY.Track.Application.Validations.Demo 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!"); - }); + 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()); + RuleFor(x => x.UserInfoInput).NotNull().WithMessage("用户信息为必填参数!") + .SetValidator(new UserInfoInputValidation()); //集合校验 RuleForEach(x => x.UserRoleInputList).SetValidator(new UserRoleInputValidation()); } - } - - -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs index b8e5268f..68c7441b 100644 --- a/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs @@ -1,6 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; - +using SJZY.Track.Application.Contract.Dtos.Demo; namespace SJZY.Track.Application.Validations.Demo { @@ -10,6 +9,5 @@ namespace SJZY.Track.Application.Validations.Demo { RuleFor(x => x.QQ).NotNull().WithMessage("QQ号码不能为空"); } - } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs index fa0307a2..dda21ddf 100644 --- a/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs @@ -1,5 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Contract.Dtos.Demo; namespace SJZY.Track.Application.Validations.Demo { @@ -10,4 +10,4 @@ namespace SJZY.Track.Application.Validations.Demo RuleFor(m => m.Id).GreaterThan(0).WithMessage("角色ID必须大于0!"); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs index 0faf7a0c..af97fc37 100644 --- a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackTemplates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackContents; namespace SJZY.Track.Application.Validations.TrackContents { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackContents public EditTrackContentInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -33,6 +22,5 @@ namespace SJZY.Track.Application.Validations.TrackContents RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!"); }); } - } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs index da5faec2..6a06da65 100644 --- a/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackFlags/EditTrackFlagInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackFlags; -using SJZY.Track.Application.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackFlags; namespace SJZY.Track.Application.Validations.TrackFlags { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackFlags public EditTrackFlagInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -32,4 +21,4 @@ namespace SJZY.Track.Application.Validations.TrackFlags }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs index beb1df54..e492a542 100644 --- a/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackStatus/EditTrackStatusInputValidation.cs @@ -1,11 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackContents; -using SJZY.Track.Application.Dtos.TrackStatus; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SJZY.Track.Application.Contract.Dtos.TrackStatus; namespace SJZY.Track.Application.Validations.TrackStatus { @@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackStatus public EditTrackStatusInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -34,4 +23,4 @@ namespace SJZY.Track.Application.Validations.TrackStatus }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs index 8768b688..aa4bdad8 100644 --- a/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateInputValidation.cs @@ -1,5 +1,5 @@ using FluentValidation; -using SJZY.Track.Application.Dtos.TrackTemplates; +using SJZY.Track.Application.Contract.Dtos.TrackTemplates; namespace SJZY.Track.Application.Validations.TrackTemplates { @@ -11,16 +11,10 @@ namespace SJZY.Track.Application.Validations.TrackTemplates public EditTrackTemplateInputValidation() { //条件分支 - When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => - { - RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); - }); + When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, + () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); }); - When(x => x.Options == OptionType.新增, () => - { - RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); - - }); + When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); }); When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => { @@ -30,4 +24,4 @@ namespace SJZY.Track.Application.Validations.TrackTemplates }); } } -} +} \ No newline at end of file diff --git a/src/SJZY.Track.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/test/SJZY.Track.Test/Demo/DemoTest.cs b/test/SJZY.Track.Test/Demo/DemoTest.cs index da9cd4f2..47e60be3 100644 --- a/test/SJZY.Track.Test/Demo/DemoTest.cs +++ b/test/SJZY.Track.Test/Demo/DemoTest.cs @@ -1,5 +1,4 @@ - -using SJZY.Track.Application.Dtos.Demo; +using SJZY.Track.Application.Contract.Dtos.Demo; using SJZY.Track.Application.Services.Demo; namespace SJZY.OpenApi.Test.Demo @@ -7,11 +6,14 @@ namespace SJZY.OpenApi.Test.Demo public class DemoTest : TestModuleTestBase { #region 构造函数 + private InterFaceDemoService _interFaceDemoService; + public DemoTest() { _interFaceDemoService = GetRequiredService(); } + #endregion [Fact] @@ -23,6 +25,5 @@ namespace SJZY.OpenApi.Test.Demo Assert.NotNull(res); } - } -} +} \ No newline at end of file From 7f14abe02767464964306547e9e9d03cb83d6da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 10:27:55 +0800 Subject: [PATCH 072/196] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/Program.cs | 4 +- src/SJZY.Track.Api/SJZY.Track.Api.csproj | 46 ++-- ...rackApiModule.cs => SjzyTrackApiModule.cs} | 6 +- .../Dtos/Demo/ComplexAutomapperDemoInput.cs | 85 ------ .../Dtos/Demo/DemoDetailInput.cs | 48 ---- .../Dtos/Demo/DemoInput.cs | 42 --- .../Dtos/Demo/ExcelImportOuput.cs | 10 - .../Dtos/Demo/GetDemoListByPageInput.cs | 9 - .../Dtos/Demo/GetDemoListByPageOutput.cs | 27 -- .../Dtos/Demo/MyCustomerResultOutput.cs | 9 - .../Dtos/Demo/OssUploadOutput.cs | 15 -- .../Dtos/Demo/RemoteDemoInput.cs | 10 - .../Dtos/Demo/RemoteDemoOutput.cs | 7 - .../Dtos/Demo/SwaggerDemoInput.cs | 39 --- .../Dtos/Demo/ValidateExecuteInput.cs | 97 ------- .../Dtos/Demo/ValidateExecuteOutput.cs | 6 - .../SJZY.Track.Application.Contract.csproj | 8 +- .../Services/IRemoteDemoService.cs | 13 - .../SjzyTrackApplicationContractModule.cs | 10 + .../TrackHttpApiModule.cs | 11 - .../AutoMapper/AutoMapperProfile.cs | 33 --- .../AutoMapper/DemoAutoMapperProfile.cs | 44 --- src/SJZY.Track.Application/GlobalUsing.cs | 1 + src/SJZY.Track.Application/GlobalUsings.cs | 3 - .../SJZY.Track.Application.csproj | 41 ++- .../Services/Demo/InterFaceDemoService.cs | 251 ------------------ ...odule.cs => SjzyTrackApplicationModule.cs} | 14 +- .../Demo/SimpleValidateInputValidation.cs | 67 ----- .../Demo/UserInfoInputValidation.cs | 13 - .../Demo/UserRoleInputValidation.cs | 13 - src/SJZY.Track.Domain/IBasicRepository.cs | 4 +- .../SJZY.Track.Domain.csproj | 4 - .../SJZYTrackDomainModule.cs | 2 +- .../Repositories/BasicRepository.cs | 8 +- .../Repositories/TrackStatusRepository.cs | 14 +- .../SJZY.Track.Infrastructure.csproj | 47 ++-- .../SJZYTrackInfrastructureModule.cs | 14 +- .../Entitys/TrackPushRecordEntity.cs | 6 +- test/SJZY.Track.Test/Demo/DemoTest.cs | 29 -- test/SJZY.Track.Test/TestModule.cs | 9 +- 40 files changed, 102 insertions(+), 1017 deletions(-) rename src/SJZY.Track.Api/{SJZYTrackApiModule.cs => SjzyTrackApiModule.cs} (96%) delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/DemoDetailInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs delete mode 100644 src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs create mode 100644 src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs delete mode 100644 src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs delete mode 100644 src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs delete mode 100644 src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs delete mode 100644 src/SJZY.Track.Application/GlobalUsings.cs delete mode 100644 src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs rename src/SJZY.Track.Application/{ApplicationModule.cs => SjzyTrackApplicationModule.cs} (83%) delete mode 100644 src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs delete mode 100644 src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs delete mode 100644 src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs delete mode 100644 test/SJZY.Track.Test/Demo/DemoTest.cs diff --git a/src/SJZY.Track.Api/Program.cs b/src/SJZY.Track.Api/Program.cs index 9d6d0ed4..db266046 100644 --- a/src/SJZY.Track.Api/Program.cs +++ b/src/SJZY.Track.Api/Program.cs @@ -10,10 +10,10 @@ try .AddConfigurationContainer() .AddOptionsFromConfiguration() .UseSerilogDefault() - .Host.AddAppSettingsSecretsJson() + .Host.AddAppSettingsSecretsJson() .UseAutofac(); - await builder.AddApplicationAsync(); + await builder.AddApplicationAsync(); var app = builder.Build(); await app.InitializeApplicationAsync(); diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index 0dd07648..a2a8fad3 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -1,34 +1,26 @@  - - net7.0 - enable - enable - True - Linux - ..\.. - + - - - - - - + + net7.0 + True + Linux + ..\.. + - - - - - - - + + + + + + + + + + + + - - - - - - diff --git a/src/SJZY.Track.Api/SJZYTrackApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs similarity index 96% rename from src/SJZY.Track.Api/SJZYTrackApiModule.cs rename to src/SJZY.Track.Api/SjzyTrackApiModule.cs index 07bb3fee..443495ce 100644 --- a/src/SJZY.Track.Api/SJZYTrackApiModule.cs +++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs @@ -27,10 +27,10 @@ namespace SJZY.Track.Api typeof(SjzyAbpCodeModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), - typeof(ApplicationModule), - typeof(SJZYTrackInfrastructureModule) + typeof(SjzyTrackApplicationModule), + typeof(SjzyTrackInfrastructureModule) )] - public class SJZYTrackApiModule : AbpModule + public class SjzyTrackApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs deleted file mode 100644 index f2162eb5..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/ComplexAutomapperDemoInput.cs +++ /dev/null @@ -1,85 +0,0 @@ -namespace SJZY.Track.Application.Contract.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.Contract/Dtos/Demo/DemoDetailInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoDetailInput.cs deleted file mode 100644 index e80c4745..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoDetailInput.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace SJZY.Track.Application.Contract.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; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs deleted file mode 100644 index 87f95820..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/DemoInput.cs +++ /dev/null @@ -1,42 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo -{ - public class DemoInput - { - /// - /// 操作类型 - /// - public OptionType Option { get; set; } - - /// - /// - /// - public int Id { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 年龄 - /// - public int Age { get; set; } - - /// - /// 描述 - /// - public string Description { get; set; } - - //以下两个属性用来说明类型转换 - - /// - /// 创建人id - /// - public string CreateUserId { get; set; } - - /// - /// 创建时间 - /// - public string CreateTime { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs deleted file mode 100644 index b2afbc57..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/ExcelImportOuput.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo; - -public class ExcelImportOuput -{ - // [MiniExcelLibs.Attributes.ExcelColumnName("姓名")] - public string Name { get; set; } - - // [MiniExcelLibs.Attributes.ExcelColumnName("年龄")] - public int Age { get; set; } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs deleted file mode 100644 index a49e420a..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo; - -public class GetDemoListByPageInput : PageInfoInput -{ - /// - /// 姓名 - /// - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs deleted file mode 100644 index fd91bc62..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/GetDemoListByPageOutput.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace SJZY.Track.Application.Contract.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; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs deleted file mode 100644 index f1a5288c..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/MyCustomerResultOutput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo -{ - public class MyCustomerResultOutput - { - public string Code { get; set; } - - public string Message { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs deleted file mode 100644 index 68b3abcf..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/OssUploadOutput.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo -{ - public class OssUploadOutput - { - /// - /// 文件key - /// - public string Key { get; set; } - - /// - /// 文件路径 - /// - public string Url { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs deleted file mode 100644 index 2f43a8fa..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoInput.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos -{ - public class RemoteDemoInput - { - /// - /// 当前时间 - /// - public DateTime CurrentTime { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs deleted file mode 100644 index 0cd20796..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/RemoteDemoOutput.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos -{ - public class RemoteDemoOutput - { - public string Context { get; set; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs deleted file mode 100644 index eefc7559..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/SwaggerDemoInput.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.ComponentModel; -using System.Text.Json.Serialization; - -namespace SJZY.Track.Application.Contract.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 - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs deleted file mode 100644 index 2de0afdf..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteInput.cs +++ /dev/null @@ -1,97 +0,0 @@ -namespace SJZY.Track.Application.Contract.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; } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs deleted file mode 100644 index 1ea87d0f..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/Demo/ValidateExecuteOutput.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.Demo -{ - public class ValidateExecuteOutput - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj index 1d376964..a7a570d0 100644 --- a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj +++ b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj @@ -1,14 +1,14 @@ + + net7.0 - enable - enable 0.0.2 - - + + diff --git a/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs b/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs deleted file mode 100644 index 841cae19..00000000 --- a/src/SJZY.Track.Application.Contract/Services/IRemoteDemoService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using SJZY.Track.Application.Contract.Dtos; -using Volo.Abp; -using Volo.Abp.DependencyInjection; - -namespace SJZY.Track.Application.Contract.Services; - -/// -/// 客户端连接测试接口 -/// -public interface IRemoteDemoService : IRemoteService, IScopedDependency -{ - Task> ConnectionTest(RemoteDemoInput input); -} \ 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.Contract/TrackHttpApiModule.cs b/src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs deleted file mode 100644 index a76ed6da..00000000 --- a/src/SJZY.Track.Application.Contract/TrackHttpApiModule.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Modularity; - -namespace SJZY.Track.Application.Contract -{ - public class TrackHttpApiModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs deleted file mode 100644 index 87914d8e..00000000 --- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs +++ /dev/null @@ -1,33 +0,0 @@ -using AutoMapper; -using SJZY.Track.Application.Contract.Dtos.Demo; -using SJZY.Track.Domain.Aggregates.DemoAggregate; -using SJZY.Track.Domain.Dtos.Demo; - -namespace SJZY.Track.Application.AutoMapper; - -internal class AutoMapperProfile : Profile -{ - public AutoMapperProfile() - { - CreateMap, UnifyPageResultDto>(MemberList.None); - - CreateMap(MemberList.None).ReverseMap(); - CreateMap, UnifyPageResultDto>(MemberList.None) - .ReverseMap(); - /* - 代码说明: - MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员) - .ReverseMap()的意思是配置双向调用关系,既一行代码既支持从 GetDemoListByPageInput -> DemoValueObject 的映射,同时也支持从 DemoValueObject -> GetDemoListByPageInput 的映射 - - - 如果对一对模型多次配置规则,会以最后一次为准,配置了这样规则后,最终执行结果是 Name + 444 - CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "22")); - CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "444")); - - */ - - CreateMap(MemberList.None).ReverseMap(); - CreateMap(MemberList.None); - CreateMap(MemberList.None).ReverseMap(); - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs deleted file mode 100644 index ba28b16e..00000000 --- a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs +++ /dev/null @@ -1,44 +0,0 @@ -using AutoMapper; -using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Contract.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; - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs index e21f1746..e4968bf8 100644 --- a/src/SJZY.Track.Application/GlobalUsing.cs +++ b/src/SJZY.Track.Application/GlobalUsing.cs @@ -5,3 +5,4 @@ global using SJZY.Expand.ABP.Core.Common.Dto; global using Volo.Abp; global using Volo.Abp.Application.Services; global using Volo.Abp.Validation; +global using SJZY.Track.Domain; \ No newline at end of file diff --git a/src/SJZY.Track.Application/GlobalUsings.cs b/src/SJZY.Track.Application/GlobalUsings.cs deleted file mode 100644 index 63eef9f8..00000000 --- a/src/SJZY.Track.Application/GlobalUsings.cs +++ /dev/null @@ -1,3 +0,0 @@ -// Global using directives - -global using SJZY.Track.Domain; \ No newline at end of file diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 93d801c4..fa25c565 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -1,32 +1,21 @@  - - - - net7.0 - True - + - - - - - - - - + + net7.0 + True + - - - - - - - - + + + + + + - - - - + + + + diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs deleted file mode 100644 index 39d63fc8..00000000 --- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs +++ /dev/null @@ -1,251 +0,0 @@ -using SJZY.Expand.ABP.Core.Common; -using SJZY.Track.Application.Contract.Dtos.Demo; -using SJZY.Track.Domain.Aggregates.DemoAggregate; -using SJZY.Track.Domain.Dtos.Demo; - -namespace SJZY.Track.Application.Services.Demo; - -/// -/// 接口请求完整样例 -/// -[ApiExplorerSettings(GroupName = "Demo")] -public class InterFaceDemoService : ApplicationService -{ - #region 构造函数 - - private readonly IDemoRepository _demoRepository; - - public InterFaceDemoService(IDemoRepository demoRepository) - { - _demoRepository = demoRepository; - } - - #endregion - - #region 增删改 - - /// - /// 增删改 - /// - /// - /// - [HttpPost("InterFace/Edit")] - public async Task Edit(DemoInput input) - { - var res = new LongIdBaseDto(); - - if (input.Option == OptionType.新增) - { - var entity = ObjectMapper.Map(input); - res.Id = await _demoRepository.InsertReturnIdentityAsync(entity); - } - else if (input.Option == OptionType.修改 || input.Option == OptionType.删除) - { - var demoInfo = await _demoRepository.GetById1(input.Id); - if (demoInfo == null) - { - //校验数据是否存在... - throw new BusinessException(message: "未找到指定编号下的数据"); - } - - res.Id = demoInfo.Id; - if (input.Option == OptionType.删除) - { - //await _demoRepository.DeleteAsync(demoInfo); //真删除 - - //软删除 - demoInfo.IsDeleted = true; - await _demoRepository.UpdateAsync(demoInfo); - } - else - { - var entity = ObjectMapper.Map(input, demoInfo); - await _demoRepository.UpdateAsync(entity); - } - } - - return res; - } - - #endregion - - #region 局部更新最佳实践 - - /// - /// 局部更新最佳实践 - /// - /// - /// - /// - [HttpPost("InterFace/UpdatePartColumns")] - public async Task UpdatePartColumns(DemoInput input) - { - var demoInfo = await _demoRepository.GetById1(input.Id); - if (demoInfo == null) - { - //校验数据是否存在... - throw new BusinessException(message: "未找到指定编号下的数据"); - } - - //更新同时忽略某几项参数 - await _demoRepository.UpdatePartColumns(demoInfo); - - return new IdBaseDto() { Id = input.Id }; - } - - #endregion - - #region 分页查询接口 - - /// - /// 分页查询 - /// - /// - /// - [HttpPost("InterFace/GetListByPage")] - public async Task> GetListByPage(GetDemoListByPageInput input) - { - //分页时返回值统一用 PageResultDto<> 类型 - var list = await _demoRepository.GetListByPage(input.PageSize, input.PageIndex, input.Name); - - var res = ObjectMapper.Map, UnifyPageResultDto>(list); - - return res; - } - - #endregion - - #region 入参转换 - - /// - /// 入参转换 - /// - /// - /// - [HttpPost("InterFace/InputToValueObject")] - public async Task> InputToValueObject(GetDemoListByPageInput input) - { - var obj = ObjectMapper.Map(input); - var list = await _demoRepository.InputToValueObject(obj); - - var res = ObjectMapper.Map, List>(list); - return res; - } - - #endregion - - #region 原生sql - - /// - /// 原生sql - /// - /// - /// - [HttpPost("InterFace/OriginalSql")] - public async Task> OriginalSql(DemoValueObject obj) - { - var list = await _demoRepository.OriginalSql(obj); - return list; - } - - #endregion - - #region 自定义返回结果格式 - - /// - /// 自定义返回结果格式 - /// - /// - /// - [HttpPost("Demo/CustomerResult")] - [CustomerResult] - public async Task GetListAsync() - { - /* - 说明: - 理论上我们有全公司级别的返回值约定,不管是前端调后端,还是后端微服务间的调用,都应完全遵循该规范。 - 但不排除有些特殊情况下,必须要返回自定义格式的场景。 - */ - - var res = new MyCustomerResultOutput(); - res.Code = "200"; - res.Message = "这是一个自定义返回结果"; - - return res; - } - - #endregion - - #region 约定类型下返回null - - /// - /// 约定类型下返回null - /// - /// - /// - [HttpPost("Demo/ReturnNull")] - public async Task ReturnNull() - { - MyCustomerResultOutput res = null; - return res; - } - - #endregion - - #region - - /// - /// 没有返回值 - /// - /// - /// - [HttpPost("Demo/WithoutReturnObject")] - public async Task WithoutReturnObject() - { - return null; - } - - #endregion - - #region 主从关系实体存储 - - /// - /// 主从关系实体存储 - /// - /// - /// - [HttpPost("InterFace/EntityRelationSave")] - public async Task EntityRelationSave(DemoDetailSaveInput input) - { - var obj = ObjectMapper.Map(input); - var res = await _demoRepository.EntityRelationSave(obj); - - return new UnifyResultDto(res); - } - - #endregion - - #region 数据缓存 - - /// - /// 数据缓存 - /// - /// - /// - [HttpPost("InterFace/GetDataCache")] - public async Task GetDataCache(IdBaseDto input) - { - var res = await _demoRepository.GetDataCache(input.Id); - return res; - } - - #endregion - - //[HttpPost("InterFace/AAAA")] - //public async Task AAAA() - //{ - // var result = await _httpClientProxy.Service.GetSystemTokenAsync("Track"); - - // return result; - //} -} \ No newline at end of file diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs similarity index 83% rename from src/SJZY.Track.Application/ApplicationModule.cs rename to src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 94127ff2..97b9337f 100644 --- a/src/SJZY.Track.Application/ApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -1,4 +1,5 @@ using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract; using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; using SJZY.UserCenter.SharedModel; @@ -19,25 +20,26 @@ namespace SJZY.Track.Application typeof(AbpLocalizationModule), typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), - typeof(SJZYTrackDomainModule), - typeof(SjzyUserCenterHttpApiModule) + typeof(SjzyUserCenterHttpApiModule), + typeof(SjzyTrackDomainModule), + typeof(SjzyTrackApplicationContractModule) )] - public class ApplicationModule : AbpModule + public class SjzyTrackApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); - Configure(options => { options.AddMaps(true); }); + Configure(options => { options.AddMaps(true); }); Configure(options => { - options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly); //创建动态api + options.ConventionalControllers.Create(typeof(SjzyTrackApplicationModule).Assembly); //创建动态api }); //添加虚拟文件系统 Configure(options => { - options.FileSets.AddEmbedded("SJZY.Track.Application"); + options.FileSets.AddEmbedded("SJZY.Track.Application"); }); //添加多语言 diff --git a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs b/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs deleted file mode 100644 index a14bc02f..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/SimpleValidateInputValidation.cs +++ /dev/null @@ -1,67 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Contract.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()); - } - } -} \ No newline at end of file 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 68c7441b..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/UserInfoInputValidation.cs +++ /dev/null @@ -1,13 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Contract.Dtos.Demo; - -namespace SJZY.Track.Application.Validations.Demo -{ - public class UserInfoInputValidation : AbstractValidator, IValidationEnabled - { - public UserInfoInputValidation() - { - RuleFor(x => x.QQ).NotNull().WithMessage("QQ号码不能为空"); - } - } -} \ No newline at end of file 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 dda21ddf..00000000 --- a/src/SJZY.Track.Application/Validations/Demo/UserRoleInputValidation.cs +++ /dev/null @@ -1,13 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Contract.Dtos.Demo; - -namespace SJZY.Track.Application.Validations.Demo -{ - public class UserRoleInputValidation : AbstractValidator, IValidationEnabled - { - public UserRoleInputValidation() - { - RuleFor(m => m.Id).GreaterThan(0).WithMessage("角色ID必须大于0!"); - } - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs index 8e9baed2..3824c2eb 100644 --- a/src/SJZY.Track.Domain/IBasicRepository.cs +++ b/src/SJZY.Track.Domain/IBasicRepository.cs @@ -10,7 +10,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要忽略更新的列 /// - Task UpdateAsync(T entity, Expression> ignoreColumns); + Task UpdateAsync(T entity, Expression>? ignoreColumns); /// /// update @@ -18,7 +18,7 @@ public interface IBasicRepository : IBasicQuery where T : IAggregateRoot /// /// 要更新的列 /// - Task UpdateColumnAsync(T entity, Expression> updateColumns); + Task UpdateColumnAsync(T entity, Expression>? updateColumns); /// /// update diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj index aac0e12d..b1f4dc63 100644 --- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj +++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj @@ -10,9 +10,5 @@ - - - - diff --git a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs index e9c743d8..792e7844 100644 --- a/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs +++ b/src/SJZY.Track.Domain/SJZYTrackDomainModule.cs @@ -2,6 +2,6 @@ namespace SJZY.Track.Domain; -public class SJZYTrackDomainModule : AbpModule +public class SjzyTrackDomainModule : AbpModule { } \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs index a776fd88..7480b9f3 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs @@ -12,14 +12,14 @@ namespace SJZY.Track.Infrastructure.Repositories; /// public class BasicRepository : BasicQuery, IBasicRepository where T : class, IAggregateRoot, new() { - public async Task UpdateAsync(T entity, Expression> ignoreColumns) + public async Task UpdateAsync(T entity, Expression>? ignoreColumns) { return await Context.Updateable(entity) .IgnoreColumnsIF(ignoreColumns != null, ignoreColumns) .ExecuteCommandHasChangeAsync(); } - public async Task UpdateColumnAsync(T entity, Expression> updateColumns) + public async Task UpdateColumnAsync(T entity, Expression>? updateColumns) { return await Context.Updateable(entity) .UpdateColumnsIF(updateColumns != null, updateColumns) @@ -40,15 +40,13 @@ public class BasicRepository : BasicQuery, IBasicRepository where T : c .ExecuteCommandHasChangeAsync(); } + // tips: required where public async Task SoftDeleteAsync(Expression> where) { if (!typeof(T).IsAssignableTo()) throw new BusinessException( message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}"); - // tips: required where - if (where == default) return false; - return await Context.Updateable() .Where(where) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs index a9218613..bf0325bc 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs @@ -6,10 +6,6 @@ namespace SJZY.Track.Infrastructure.Repositories; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { - public TrackStatusRepository() - { - } - /// /// 获取轨迹状态明细 /// @@ -41,8 +37,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS /// public async Task> GetPageTrackStatus(GetPageTrackStatusVO input) { - UnifyPageResultDto pagedList = new UnifyPageResultDto(); - pagedList = await Context.Queryable() + UnifyPageResultDto pagedList = await Context.Queryable() .LeftJoin((a, b) => a.SubSystemId == b.Id) .LeftJoin((a, b, c) => a.CreateUserId == c.Id) .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) @@ -57,9 +52,10 @@ public class TrackStatusRepository : BasicRepository, ITrackS EntrackStatus = a.EnStatus, TrackStatus = a.Status, NodeId = a.Node, - Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3).Return("清关") - .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") - .End(""), + Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3) + .Return("清关") + .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") + .End(""), CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, diff --git a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj index f1e677f8..f9bee800 100644 --- a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj +++ b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj @@ -1,37 +1,20 @@  - - - net7.0 - True - preview - + + + net7.0 + True + preview + - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - + + + diff --git a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs index c412b69c..048d60fb 100644 --- a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs +++ b/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs @@ -15,8 +15,8 @@ namespace SJZY.Track.Infrastructure; /// 仓储模块 /// [DependsOn(typeof(AbpAutofacModule))] -[DependsOn(typeof(SJZYTrackDomainModule))] -public class SJZYTrackInfrastructureModule : AbpModule +[DependsOn(typeof(SjzyTrackDomainModule))] +public class SjzyTrackInfrastructureModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { @@ -28,7 +28,7 @@ public class SJZYTrackInfrastructureModule : AbpModule { new() { - ConnectionString = configuration["ConnectionStrings:DefaultConnection"], + ConnectionString = configuration["ConnectionStrings:DefaultConnection"]!, DbType = DbType.MySql, IsAutoCloseConnection = true, ConfigId = "default", OpenSqlLog = true @@ -39,10 +39,10 @@ public class SJZYTrackInfrastructureModule : AbpModule context.Services.AddElasticSearch(options => { - options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>(); - options.LoginName = configuration["ElasticSearch:LoginName"]; - options.Password = configuration["ElasticSearch:Password"]; - options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]; + options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get>()!; + options.LoginName = configuration["ElasticSearch:LoginName"]!; + options.Password = configuration["ElasticSearch:Password"]!; + options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]!; }); } diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs index 32615bba..345e7335 100644 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -36,13 +36,13 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys /// 推送内容 /// [SugarColumn(ColumnName = "PushContent")] - public string PushContent { get; set; } + public string PushContent { get; set; } = null!; /// /// 接口通请求id /// [SugarColumn(ColumnName = "RequestId")] - public string RequestId { get; set; } + public string RequestId { get; set; } = null!; /// /// 服务商id @@ -54,6 +54,6 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys /// 推送轨迹总数 /// [SugarColumn(ColumnName = "TrackTotal")] - public string TrackTotal { get; set; } + public int TrackTotal { get; set; } } } \ No newline at end of file diff --git a/test/SJZY.Track.Test/Demo/DemoTest.cs b/test/SJZY.Track.Test/Demo/DemoTest.cs deleted file mode 100644 index 47e60be3..00000000 --- a/test/SJZY.Track.Test/Demo/DemoTest.cs +++ /dev/null @@ -1,29 +0,0 @@ -using SJZY.Track.Application.Contract.Dtos.Demo; -using SJZY.Track.Application.Services.Demo; - -namespace SJZY.OpenApi.Test.Demo -{ - public class DemoTest : TestModuleTestBase - { - #region 构造函数 - - private InterFaceDemoService _interFaceDemoService; - - public DemoTest() - { - _interFaceDemoService = GetRequiredService(); - } - - #endregion - - [Fact] - public async Task Test() - { - var data = new DemoInput(); - - var res = await _interFaceDemoService.Edit(data); - - Assert.NotNull(res); - } - } -} \ No newline at end of file diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs index 43bc8f71..6bace7fa 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -13,22 +13,21 @@ using Volo.Abp.Modularity; using Volo.Abp.Threading; [assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] + namespace SJZY.Track.Test; [DependsOn( typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAutofacModule), typeof(AbpAuthorizationModule), - typeof(SJZYTrackInfrastructureModule), - typeof(ApplicationModule), - typeof(SJZYTrackApiModule), + typeof(SjzyTrackInfrastructureModule), + 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(); From 2ea78adbb7bcd42d7fee2e6d9e9bb7b4b13c02f4 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 10:36:25 +0800 Subject: [PATCH 073/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 3 +- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 12 +++--- .../Repositories/OrderRepository.cs | 43 +++++++++++-------- .../Repositories/TrackStatusRepository.cs | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index a8d93386..57ad4da9 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -4,6 +4,7 @@ using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Dtos.Order; using System.Diagnostics; +using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.AutoMapper; @@ -21,6 +22,6 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap, UnifyPageResultDto>(MemberList.None); + CreateMap, UnifyPageResultDto>(MemberList.None); } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index c95fae3e..44027d12 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -16,7 +16,7 @@ namespace SJZY.Track.Domain.Dtos.Order /// /// 单号 /// - public List OrderNos { get; set; } + public List? OrderNos { get; set; } /// /// 创建时间开始 @@ -26,7 +26,7 @@ namespace SJZY.Track.Domain.Dtos.Order /// /// 创建时间截止 /// - public DateTime? createTimeEnd { get; set; } + public DateTime? CreateTimeEnd { get; set; } } /// @@ -64,10 +64,10 @@ namespace SJZY.Track.Domain.Dtos.Order /// public string? CustomerCode { get; set; } - /// - /// 订单明细(json) - /// - public string? OrderDetails { get; set; } + ///// + ///// 订单明细(json) + ///// + //public string? OrderDetails { get; set; } /// /// 最新轨迹内容 diff --git a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs index 9b556ecb..2771e10c 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs @@ -88,6 +88,11 @@ public class OrderRepository : BasicRepository, IOrderRepository, I var pageList = await Context.Queryable() .LeftJoin((a, b) => a.CustomId==b.Id) .LeftJoin((a, b, c) => a.SubSystemId==c.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) + .WhereIF(input.CreateTimeStart.HasValue&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime>= input.CreateTimeStart && a.CreateTime<= input.CreateTimeEnd) + .WhereIF(input.CreateTimeStart.HasValue&& (!input.CreateTimeEnd.HasValue), (a, b, c) => a.CreateTime>= input.CreateTimeStart) + .WhereIF((!input.CreateTimeStart.HasValue)&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime<= input.CreateTimeEnd) .Select((a, b, c) => new TrackOrderVO { Id = a.Id, @@ -95,8 +100,8 @@ public class OrderRepository : BasicRepository, IOrderRepository, I OrderType = a.OrderType, CustomerShortName= b.Abbreviation, CustomerCode= b.Code, - TrackTemplateNames = "", - OrderDetails="", + TrackTemplateNames = SqlFunc.Subqueryable().LeftJoin((aa, bb) => aa.TrackTemplateId==bb.Id) + .Where((aa, bb) => a.Id==aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","), NewestTrackContent= a.LatestTrackContent, NewestTrackEnContent= a.LatestTrackEnContent, NewestTrackPlace= a.LatestTrackPlace, @@ -105,26 +110,26 @@ public class OrderRepository : BasicRepository, IOrderRepository, I SubSystem= c.CnName }) .ToPagedListAsync(input.PageIndex, input.PageSize); - - if (pageList.List.Any()) - { - var orderIds = pageList.List.Select(a => a.Id); - //查询轨迹模版 + #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(","); - }); - } + // 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; } diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs index a9218613..f87df9ee 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs @@ -35,7 +35,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS } /// - /// 分页获取轨迹模版 + /// 分页获取轨迹状态 /// /// /// From 8161c8bca27f00c1182fa02981cd1020d03639e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 11:50:41 +0800 Subject: [PATCH 074/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=AD=97=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs index 9cf11c60..2e58c378 100644 --- a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -10,7 +10,7 @@ public class KeywordsInputVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } /// /// 选中项 From ee05cc8cff6155541f4e108bf98a5cf47afcbfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 11:53:29 +0800 Subject: [PATCH 075/196] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/SjzyTrackApiModule.cs | 2 +- .../Dtos/ProvideServices/TrackUpsertEvent.cs | 6 ++ .../Services/ProvideServices/TrackCustomer.cs | 2 +- .../Services/ProvideServices/TrackService.cs | 1 + .../OrderAggregate/IOrderRepository.cs | 38 +++++--- .../OrderAggregate/OrderLinkEntity.cs | 13 +++ .../Repositories/OrderRepository.cs | 92 +++++++++++-------- .../SJZY.Track.Infrastructure.csproj | 1 + 8 files changed, 104 insertions(+), 51 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs diff --git a/src/SJZY.Track.Api/SjzyTrackApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs index 443495ce..102be9d7 100644 --- a/src/SJZY.Track.Api/SjzyTrackApiModule.cs +++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs @@ -37,6 +37,7 @@ namespace SJZY.Track.Api var environment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); context.Services.AddSwagger(); + //过滤器相关配置 context.Services.AddMvc(options => { @@ -60,7 +61,6 @@ namespace SJZY.Track.Api Configure(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss"); Configure(options => { options.IsEnabled = false; }); - context.Services.AddRedis(); } diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs new file mode 100644 index 00000000..b6f64a7a --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; + +public class TrackUpsertEvent +{ + public int Order { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs index d4c57f4c..9f722217 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs @@ -5,5 +5,5 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackCustomer : ITransientDependency, ICapSubscribe { - public const string CapSubscribe = "SJZY.FMC.VoucherRedundantCalc"; + public const string CapSubscribe = "SJZY.Track.Upsert"; } \ 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 index a6a5f932..0210a0ac 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -81,6 +81,7 @@ public class TrackService : ApplicationService } // 根据订单关联关系向下刷,不同子系统还需要做内容映射 + var links = await _orderRepository.GetLinkedOrderIdsAsync(orderId); // 推送 return true; diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 93d162e2..136375c5 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -20,6 +20,30 @@ public interface IOrderRepository : IBasicRepository /// Task> GetPageTrackOrder(GetPageTrackOrderInputVO input); + /// + /// 更新订单 + /// + /// + /// + Task UpdateOrderAsync(OrderEntity order); + + /// + /// 删除订单 + /// + /// + /// + Task DeleteOrderAsync(int orderId); + + + #region 订单关联 + + /// + /// 根据订单id,获取关联的订单id集合 + /// + /// + /// + Task> GetLinkedOrderIdsAsync(int orderId); + /// /// 关联订单 /// @@ -34,17 +58,5 @@ public interface IOrderRepository : IBasicRepository /// Task UnLinkByIdsAsync(List linkIds); - /// - /// 更新订单 - /// - /// - /// - Task UpdateOrderAsync(OrderEntity order); - - /// - /// 删除订单 - /// - /// - /// - Task DeleteOrderAsync(int orderId); + #endregion } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs index 112fc472..71231e99 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs @@ -12,6 +12,18 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } + /// + /// 订单id + /// + [SugarColumn(ColumnName = "OrderId")] + public int OrderId { get; set; } + + /// + /// 关联的订单id + /// + [SugarColumn(ColumnName = "LinkOrderId")] + public int LinkOrderId { get; set; } + /// /// 订单类型 /// @@ -24,6 +36,7 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit [SugarColumn(ColumnName = "OrderNo")] public string OrderNo { get; set; } = null!; + /// /// 关联的订单类型 /// diff --git a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs index 2771e10c..7fb36b99 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs @@ -1,5 +1,4 @@ -using Nest; -using SJZY.Track.Domain; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -18,16 +17,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .ExecuteCommandAsync(); } - public async Task LinkOrderAsync(List orderLinkEntities) - { - await Context.Insertable(orderLinkEntities).ExecuteCommandAsync(); - } - - public async Task UnLinkByIdsAsync(List linkIds) - { - await Context.Deleteable(linkIds).ExecuteCommandAsync(); - } - public async Task UpdateOrderAsync(OrderEntity order) { using var tran = TransactionHelper.GetReadCommitted(); @@ -62,6 +51,29 @@ public class OrderRepository : BasicRepository, IOrderRepository, I tran.Complete(); } + #region 订单关联 + + public async Task> GetLinkedOrderIdsAsync(int orderId) + { + return await Context.Queryable() + .LeftJoin((a, b) => a.Id == b.OrderId) + .Where(a => a.Id == orderId) + .Select((a, b) => b.LinkOrderId) + .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 轨迹订单明细 /// @@ -86,31 +98,37 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { var pageList = await Context.Queryable() - .LeftJoin((a, b) => a.CustomId==b.Id) - .LeftJoin((a, b, c) => a.SubSystemId==c.Id) - .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) - .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) - .WhereIF(input.CreateTimeStart.HasValue&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime>= input.CreateTimeStart && a.CreateTime<= input.CreateTimeEnd) - .WhereIF(input.CreateTimeStart.HasValue&& (!input.CreateTimeEnd.HasValue), (a, b, c) => a.CreateTime>= input.CreateTimeStart) - .WhereIF((!input.CreateTimeStart.HasValue)&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime<= input.CreateTimeEnd) - .Select((a, b, c) => new TrackOrderVO - { - Id = a.Id, - OrderNumber= a.OrderNo, - OrderType = a.OrderType, - CustomerShortName= b.Abbreviation, - CustomerCode= b.Code, - TrackTemplateNames = SqlFunc.Subqueryable().LeftJoin((aa, bb) => aa.TrackTemplateId==bb.Id) - .Where((aa, bb) => a.Id==aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","), - NewestTrackContent= a.LatestTrackContent, - NewestTrackEnContent= a.LatestTrackEnContent, - NewestTrackPlace= a.LatestTrackPlace, - IsFinish=a.IsCompleted, - CreateTime=a.CreateTime, - SubSystem= c.CnName - }) - .ToPagedListAsync(input.PageIndex, input.PageSize); + .LeftJoin((a, b) => a.CustomId == b.Id) + .LeftJoin((a, b, c) => a.SubSystemId == c.Id) + .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) + .WhereIF(input.CreateTimeStart.HasValue && input.CreateTimeEnd.HasValue, + (a, b, c) => a.CreateTime >= input.CreateTimeStart && a.CreateTime <= input.CreateTimeEnd) + .WhereIF(input.CreateTimeStart.HasValue && (!input.CreateTimeEnd.HasValue), + (a, b, c) => a.CreateTime >= input.CreateTimeStart) + .WhereIF((!input.CreateTimeStart.HasValue) && input.CreateTimeEnd.HasValue, + (a, b, c) => a.CreateTime <= input.CreateTimeEnd) + .Select((a, b, c) => new TrackOrderVO + { + Id = a.Id, + OrderNumber = a.OrderNo, + OrderType = a.OrderType, + CustomerShortName = b.Abbreviation, + CustomerCode = b.Code, + TrackTemplateNames = SqlFunc.Subqueryable() + .LeftJoin((aa, bb) => aa.TrackTemplateId == bb.Id) + .Where((aa, bb) => a.Id == aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","), + NewestTrackContent = a.LatestTrackContent, + NewestTrackEnContent = a.LatestTrackEnContent, + NewestTrackPlace = a.LatestTrackPlace, + IsFinish = a.IsCompleted, + CreateTime = a.CreateTime, + SubSystem = c.CnName + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + #region 暂时注释 + //if (pageList.List.Any()) //{ // var orderIds = pageList.List.Select(a => a.Id); @@ -129,7 +147,9 @@ public class OrderRepository : BasicRepository, IOrderRepository, I // a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(","); // }); //} + #endregion + return pageList; } diff --git a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj index f9bee800..938fe9a1 100644 --- a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj +++ b/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj @@ -4,6 +4,7 @@ net7.0 True preview + SJZY.Track.Repository From 6580831a4ad1425ae947e0ac420ec3601c81626b Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 11:54:22 +0800 Subject: [PATCH 076/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AE=A2=E5=8D=95id=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ITrackDetailsRepository.cs | 1 + .../Repositories/TrackDetailsRepository.cs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 444dd072..89d812a1 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -13,4 +13,5 @@ public interface ITrackDetailsRepository Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); + Task> GetListAsync(int orderId); } \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs index 2737c39d..c23a28fd 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs @@ -37,7 +37,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!response.IsValid) throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); @@ -73,6 +73,21 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract> GetListAsync(int orderId) + { + var data = await Context.SearchAsync(x => x + .Source(s => s.Includes(fd => fd + .Field(f => f.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TraceTimeZone) + )).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)))); + + return data?.Documents?.ToList(); + } + public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) { if (input.OrderNos.Count < 1) return default; From a54f071769f720133534afe85df5c1b3fad93f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 14:10:37 +0800 Subject: [PATCH 077/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 11 ++++ .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushContentDetailOutputVO.cs | 61 +++++++++++++++++++ .../Repositories/TrackPushConfigRepository.cs | 13 ++++ 4 files changed, 87 insertions(+) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index f303cc4c..a862e224 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -57,4 +57,15 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetDetailAsync(id); } + + /// + /// 轨迹推送配置内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackPushConfigRepository.GetContentDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 9050f090..39b19ad2 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -10,4 +10,6 @@ public interface ITrackPushConfigRepository : IBasicRepository> GetContentPageAsync(GetTrackPushContentPageInputVO input); Task GetDetailAsync(int id); + + Task GetContentDetailAsync(int id); } \ 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..2bad0d5a --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs @@ -0,0 +1,61 @@ +namespace SJZY.Track.Domain.Dtos.TrackPush; + +public class GetTrackPushContentDetailOutputVO +{ + /// + /// 轨迹内容代码 + /// + public string Code { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsValue { get; set; } + + public int Id { get; set; } + + /// + /// 推送单号类型 + /// + public int OrderNoType { get; set; } + + /// + /// 推送轨迹排序 + /// + public int Sort { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentValue { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentValue { get; set; } + + /// + /// 轨迹推送配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusValue { get; set; } + + /// + /// 推送轨迹时区 + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs index d5180da1..d1ce352b 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs @@ -69,4 +69,17 @@ public class TrackPushConfigRepository : BasicRepository, }, true) .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(); + } } \ No newline at end of file From 60c2b221eaa2975064811b0c412663a4a5fee538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 14:21:54 +0800 Subject: [PATCH 078/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/TrackUpsertEvent.cs | 6 ++++++ .../Services/ProvideServices/TrackService.cs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs 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..48784974 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -0,0 +1,6 @@ +namespace SJZY.Track.Application.Contract.Events; + +public class TrackUpsertEvent +{ + public int OrderId { get; set; } +} \ 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 index 0210a0ac..fad211a8 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -81,7 +81,12 @@ public class TrackService : ApplicationService } // 根据订单关联关系向下刷,不同子系统还需要做内容映射 - var links = await _orderRepository.GetLinkedOrderIdsAsync(orderId); + var linkedOrderIds = await _orderRepository.GetLinkedOrderIdsAsync(orderId); + + if (linkedOrderIds.Count > 0) + { + await _capPublisher.PublishAsync(TrackCustomer.CapSubscribe, new TrackUpsertEvent { }); + } // 推送 return true; From 766e243ca0aa1d6ae093539c1bc08d359c92bd99 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 14:26:52 +0800 Subject: [PATCH 079/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/OrderService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 38eb9466..0f5fa583 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -1,6 +1,8 @@ using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; +using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.Services.ProvideServices; @@ -11,10 +13,14 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class OrderService : ApplicationService { private readonly IOrderRepository _orderRepository; + private readonly ITrackDetailsRepository _trackDetailsRepository; - public OrderService(IOrderRepository orderRepository) + public OrderService(IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository + ) { _orderRepository = orderRepository; + this._trackDetailsRepository=trackDetailsRepository; } /// @@ -75,7 +81,14 @@ public class OrderService : ApplicationService [HttpPost("/Order/GetDetails")] public async Task> GetOrderDetails(GetOrderDetailsInput input) { - return null; + var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); + if (!trackDetails.IsNullOrEmpty()) + { + var list = ObjectMapper.Map, List>(trackDetails); + return list; + } + + return new List(); } #endregion From ef8ee7acb660defe115315041480a82a82f14209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 15:07:40 +0800 Subject: [PATCH 080/196] =?UTF-8?q?=E9=80=82=E9=85=8Dvs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SJZY.Track.Api.sln | 2 +- src/SJZY.Track.Api/SJZY.Track.Api.csproj | 16 ++++++++-------- src/SJZY.Track.Api/SjzyTrackApiModule.cs | 4 ++-- .../Services/ITrackPushRecordRepository.cs | 8 -------- .../Services/TrackPushRecordRepository.cs | 10 ---------- .../ITrackPushRecordDetailsRepository.cs | 8 -------- .../Services/TrackPushRecordDetailsRepository.cs | 10 ---------- .../DataBaseContext.cs | 2 +- .../GlobalUsing.cs | 0 .../Queries/BasicQuery.cs | 2 +- .../Queries/TrackQueries.cs | 2 +- .../Repositories/BasicRepository.cs | 4 ++-- .../Repositories/DemoRepository.cs | 2 +- .../Repositories/OrderRepository.cs | 2 +- .../Repositories/TrackContentRepository.cs | 2 +- .../Repositories/TrackDetailsRepository.cs | 2 +- .../Repositories/TrackFlagRepository.cs | 2 +- .../Repositories/TrackPullConfigRepository.cs | 2 +- .../Repositories/TrackPushConfigRepository.cs | 2 +- .../Repositories/TrackStatusRepository.cs | 2 +- .../Repositories/TrackTemplateRepository.cs | 2 +- .../SJZY.Track.Repository.csproj} | 13 ++++++------- .../SjzyTrackRepositoryModule.cs} | 8 ++++---- .../Entitys/TrackPushRecordEntity.cs | 2 +- .../Services/ITrackPushRecordRepository.cs | 8 ++++++++ .../Services/TrackPushRecordRepository.cs | 10 ++++++++++ .../Entitys/TrackPushRecordDetailsEntity.cs | 2 +- .../ITrackPushRecordDetailsRepository.cs | 8 ++++++++ .../Services/TrackPushRecordDetailsRepository.cs | 10 ++++++++++ test/SJZY.Track.Test/TestModule.cs | 4 ++-- 30 files changed, 75 insertions(+), 76 deletions(-) delete mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs delete mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs delete mode 100644 src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/DataBaseContext.cs (98%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/GlobalUsing.cs (100%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Queries/BasicQuery.cs (95%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Queries/TrackQueries.cs (98%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/BasicRepository.cs (95%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/DemoRepository.cs (99%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/OrderRepository.cs (99%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackContentRepository.cs (98%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackDetailsRepository.cs (98%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackFlagRepository.cs (97%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackPullConfigRepository.cs (99%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackPushConfigRepository.cs (99%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackStatusRepository.cs (98%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/Repositories/TrackTemplateRepository.cs (99%) rename src/{SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj => SJZY.Track.Repository/SJZY.Track.Repository.csproj} (78%) rename src/{SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs => SJZY.Track.Repository/SjzyTrackRepositoryModule.cs} (91%) rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/TrackPushRecord/Entitys/TrackPushRecordEntity.cs (96%) create mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs rename src/{SJZY.Track.Infrastructure => SJZY.Track.Repository}/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs (94%) create mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs create mode 100644 src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln index 3de8a025..0c457eb0 100644 --- a/SJZY.Track.Api.sln +++ b/SJZY.Track.Api.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DAC93270-5A2 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Application.Contract", "src\SJZY.Track.Application.Contract\SJZY.Track.Application.Contract.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}" EndProject diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj index a2a8fad3..be47c0cf 100644 --- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj +++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj @@ -1,6 +1,6 @@  - + net7.0 @@ -10,16 +10,16 @@ - - - - - + + + + + - - + + diff --git a/src/SJZY.Track.Api/SjzyTrackApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs index 102be9d7..13d9633a 100644 --- a/src/SJZY.Track.Api/SjzyTrackApiModule.cs +++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs @@ -9,7 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus; using SJZY.Expand.ABP.Core.Redis; using SJZY.Expand.ABP.Core.Swagger; using SJZY.Track.Application; -using SJZY.Track.Infrastructure; +using SJZY.Track.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; @@ -28,7 +28,7 @@ namespace SJZY.Track.Api typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreSerilogModule), typeof(SjzyTrackApplicationModule), - typeof(SjzyTrackInfrastructureModule) + typeof(SjzyTrackRepositoryModule) )] public class SjzyTrackApiModule : AbpModule { diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs deleted file mode 100644 index 7b2e515e..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/ITrackPushRecordRepository.cs +++ /dev/null @@ -1,8 +0,0 @@ -using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecord.Services -{ - public interface ITrackPushRecordRepository : ISimpleClient - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs deleted file mode 100644 index 22529060..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Services/TrackPushRecordRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SJZY.Track.Infrastructure.Repositories; -using SJZY.Track.Infrastructure.TrackPushRecord.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecord.Services -{ - public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs deleted file mode 100644 index 6f29bbc3..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,8 +0,0 @@ -using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services -{ - public interface ITrackPushRecordDetailsRepository : ISimpleClient - { - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs deleted file mode 100644 index 157dc8bd..00000000 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using SJZY.Track.Infrastructure.Repositories; -using SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys; - -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Services -{ - public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency - { - - } -} diff --git a/src/SJZY.Track.Infrastructure/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/DataBaseContext.cs rename to src/SJZY.Track.Repository/DataBaseContext.cs index 9fbb7d44..88539836 100644 --- a/src/SJZY.Track.Infrastructure/DataBaseContext.cs +++ b/src/SJZY.Track.Repository/DataBaseContext.cs @@ -2,7 +2,7 @@ #pragma warning disable 1591 -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Repository; /// /// Sqlsugar 上下文对象 diff --git a/src/SJZY.Track.Infrastructure/GlobalUsing.cs b/src/SJZY.Track.Repository/GlobalUsing.cs similarity index 100% rename from src/SJZY.Track.Infrastructure/GlobalUsing.cs rename to src/SJZY.Track.Repository/GlobalUsing.cs diff --git a/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs b/src/SJZY.Track.Repository/Queries/BasicQuery.cs similarity index 95% rename from src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs rename to src/SJZY.Track.Repository/Queries/BasicQuery.cs index fbb511c7..60a234ef 100644 --- a/src/SJZY.Track.Infrastructure/Queries/BasicQuery.cs +++ b/src/SJZY.Track.Repository/Queries/BasicQuery.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.Queries; +namespace SJZY.Track.Repository.Queries; #pragma warning disable CS8613 public class BasicQuery : SimpleClient, IBasicQuery where T : class, IEntity, new() diff --git a/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs rename to src/SJZY.Track.Repository/Queries/TrackQueries.cs index 413c38fe..da7c4dab 100644 --- a/src/SJZY.Track.Infrastructure/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -7,7 +7,7 @@ using SJZY.Track.Domain.Dtos.TrackDetails; using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Queries; -namespace SJZY.Track.Infrastructure.Queries; +namespace SJZY.Track.Repository.Queries; public class TrackQueries : ISugarRepository, ITrackQueries, ITransientDependency diff --git a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs similarity index 95% rename from src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs rename to src/SJZY.Track.Repository/Repositories/BasicRepository.cs index 7480b9f3..965bd5d7 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/BasicRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/BasicRepository.cs @@ -1,10 +1,10 @@ using System.Linq.Expressions; using SJZY.Track.Domain; using SJZY.Track.Domain.SeedWork; -using SJZY.Track.Infrastructure.Queries; +using SJZY.Track.Repository.Queries; using Volo.Abp; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; /// /// 仓储基类实现 diff --git a/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs rename to src/SJZY.Track.Repository/Repositories/DemoRepository.cs index 9acceca7..8334ea44 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/DemoRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/DemoRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Dtos.Demo; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class DemoRepository : BasicRepository, IDemoRepository, IScopedDependency { diff --git a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs rename to src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 7fb36b99..8e9106da 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -5,7 +5,7 @@ using SJZY.Track.Domain.Dtos.Order; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.VData.Entitys; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency { diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index eac2265f..bbde4d6f 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -4,7 +4,7 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index c23a28fd..b5632055 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -3,7 +3,7 @@ using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs similarity index 97% rename from src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index 12c29447..2a2a4ba6 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Dtos.TrackFlags; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackFlagRepository : BasicRepository, ITrackFlagRepository, IScopedDependency { diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index 796e6778..076671d5 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -6,7 +6,7 @@ using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index d1ce352b..999a2732 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -7,7 +7,7 @@ using SJZY.Track.Domain.Dtos.TrackPush; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.VData.Entitys; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackPushConfigRepository : BasicRepository, ITrackPushConfigRepository, IScopedDependency diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs similarity index 98% rename from src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index 6ac36ade..703eb8c4 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -2,7 +2,7 @@ using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackStatusRepository : BasicRepository, ITrackStatusRepository, IScopedDependency { diff --git a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs similarity index 99% rename from src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs rename to src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d4ae27a6..04cd6e0e 100644 --- a/src/SJZY.Track.Infrastructure/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -8,7 +8,7 @@ using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Enums; using SJZY.Track.Domain.VEntities; -namespace SJZY.Track.Infrastructure.Repositories; +namespace SJZY.Track.Repository.Repositories; public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency { diff --git a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj similarity index 78% rename from src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj rename to src/SJZY.Track.Repository/SJZY.Track.Repository.csproj index 938fe9a1..b2285e0b 100644 --- a/src/SJZY.Track.Infrastructure/SJZY.Track.Infrastructure.csproj +++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj @@ -1,21 +1,20 @@  - + net7.0 True preview - SJZY.Track.Repository - - - - + + + + - + diff --git a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs similarity index 91% rename from src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs rename to src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs index 048d60fb..546d80d9 100644 --- a/src/SJZY.Track.Infrastructure/SJZYTrackInfrastructureModule.cs +++ b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs @@ -4,19 +4,19 @@ using SJZY.Expand.ABP.Core.SqlSugar.Options; using SJZY.Expand.ElasticSearch; using SJZY.Track.Domain; using SJZY.Track.Domain.Queries; -using SJZY.Track.Infrastructure.Queries; -using SJZY.Track.Infrastructure.Repositories; +using SJZY.Track.Repository.Queries; +using SJZY.Track.Repository.Repositories; using Volo.Abp.Autofac; using Volo.Abp.Modularity; -namespace SJZY.Track.Infrastructure; +namespace SJZY.Track.Repository; /// /// 仓储模块 /// [DependsOn(typeof(AbpAutofacModule))] [DependsOn(typeof(SjzyTrackDomainModule))] -public class SjzyTrackInfrastructureModule : AbpModule +public class SjzyTrackRepositoryModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) { diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs similarity index 96% rename from src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs rename to src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs index 345e7335..b3c2ff5b 100644 --- a/src/SJZY.Track.Infrastructure/TrackPushRecord/Entitys/TrackPushRecordEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecord/Entitys/TrackPushRecordEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys +namespace SJZY.Track.Repository.TrackPushRecord.Entitys { /// /// 轨迹推送记录 diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs new file mode 100644 index 00000000..686a3402 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/ITrackPushRecordRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Repository.TrackPushRecord.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecord.Services +{ + public interface ITrackPushRecordRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs new file mode 100644 index 00000000..e8e16ab9 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecord/Services/TrackPushRecordRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Repository.Repositories; +using SJZY.Track.Repository.TrackPushRecord.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecord.Services +{ + public class TrackPushRecordRepository : BasicRepository, ITrackPushRecordRepository, IScopedDependency + { + + } +} diff --git a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs similarity index 94% rename from src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs rename to src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs index 796e3e47..64208102 100644 --- a/src/SJZY.Track.Infrastructure/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Entitys/TrackPushRecordDetailsEntity.cs @@ -1,6 +1,6 @@ using SJZY.Track.Domain.SeedWork; -namespace SJZY.Track.Infrastructure.TrackPushRecordDetails.Entitys +namespace SJZY.Track.Repository.TrackPushRecordDetails.Entitys { /// /// 轨迹推送明细表 diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..f84fafa7 --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/ITrackPushRecordDetailsRepository.cs @@ -0,0 +1,8 @@ +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public interface ITrackPushRecordDetailsRepository : ISimpleClient + { + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs new file mode 100644 index 00000000..3a8c025b --- /dev/null +++ b/src/SJZY.Track.Repository/TrackPushRecordDetails/Services/TrackPushRecordDetailsRepository.cs @@ -0,0 +1,10 @@ +using SJZY.Track.Repository.Repositories; +using SJZY.Track.Repository.TrackPushRecordDetails.Entitys; + +namespace SJZY.Track.Repository.TrackPushRecordDetails.Services +{ + public class TrackPushRecordDetailsRepository : BasicRepository, ITrackPushRecordDetailsRepository, IScopedDependency + { + + } +} diff --git a/test/SJZY.Track.Test/TestModule.cs b/test/SJZY.Track.Test/TestModule.cs index 6bace7fa..aa5f8d90 100644 --- a/test/SJZY.Track.Test/TestModule.cs +++ b/test/SJZY.Track.Test/TestModule.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using SJZY.Track.Api; using SJZY.Track.Application; -using SJZY.Track.Infrastructure; +using SJZY.Track.Repository; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Authorization; @@ -20,7 +20,7 @@ namespace SJZY.Track.Test; typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAutofacModule), typeof(AbpAuthorizationModule), - typeof(SjzyTrackInfrastructureModule), + typeof(SjzyTrackRepositoryModule), typeof(SjzyTrackApplicationModule), typeof(SjzyTrackApiModule), typeof(AbpHttpClientModule) //添加abp的http代理模块 From 205526e37023253feed289670477ad476fec7175 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 15:40:33 +0800 Subject: [PATCH 081/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=EF=BC=8C=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E4=B8=AD=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackStatus/GetTrackStatusListDto.cs | 7 ++++++- .../Dtos/TrackTemplates/GetPageTrackTemplateInput.cs | 9 +++++++-- .../Dtos/TrackStatus/GetPageTrackStatusVO.cs | 7 ++++++- .../Dtos/TrackTemplate/GetPageTrackTemplateVO.cs | 10 ++-------- .../Repositories/TrackStatusRepository.cs | 1 + .../Repositories/TrackTemplateRepository.cs | 8 ++++---- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs index 8cadc1ea..c505aa72 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs @@ -64,6 +64,11 @@ /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; } + + /// + /// 选中的轨迹状态id + /// + public List? SelectIds { get; set;} } } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index ba54db15..e4e901df 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -15,9 +15,14 @@ /// public string Keywords { get; set; } = ""; + ///// + ///// 轨迹模版id,轨迹映射的查询使用 + ///// + //public int TrackTemplateId { get; set; } + /// - /// 轨迹模版id,轨迹映射的查询使用 + /// 选中的轨迹模版id /// - public int TrackTemplateId { get; set; } + public List? SelectIds { get; set; } } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs index 6c5d3b46..f19fb8c5 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackStatus/GetPageTrackStatusVO.cs @@ -10,5 +10,10 @@ public class GetPageTrackStatusVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } + + /// + /// 选中的轨迹状态id + /// + public List? SelectIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs index e4fa7963..99005db7 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs @@ -12,13 +12,7 @@ public class GetPageTrackTemplateVO : PageInfoInput /// public string Keywords { get; set; } - ///// - ///// 是否置顶 - ///// - //public bool IsTop { get; set; }=false; - - /// - /// 轨迹模版id + /// 选中的轨迹模版id /// - public int TrackTemplateId { get; set; } + public List? SelectIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index 703eb8c4..831e80e5 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -45,6 +45,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS .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) => 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, diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 04cd6e0e..6e254c16 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -47,9 +47,7 @@ public class TrackTemplateRepository : BasicRepository, ITr .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.TrackTemplateId > 0, - (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), - a.CreateTime), OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(),(a,b)=> SqlFunc.IIF(input.SelectIds.Contains(a.Id),SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, @@ -59,7 +57,9 @@ public class TrackTemplateRepository : BasicRepository, ITr SubSystem = b.CnName }) .ToPagedListAsync(input.PageIndex, input.PageSize); - + //.OrderByIF(input.TrackTemplateId > 0, + // (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), + //a.CreateTime), OrderByType.Desc) return pagedList; } From b0bdc7111bf5ae5f828359cd6cc6787322a37bef Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 15:45:39 +0800 Subject: [PATCH 082/196] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20=3F=E5=8F=AF?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackContents/GetPageTrackContentInput.cs | 2 +- .../Dtos/TrackTemplates/GetPageTrackTemplateInput.cs | 2 +- .../Dtos/TrackContents/GetPageTrackContentVO.cs | 2 +- .../Dtos/TrackTemplate/GetPageTrackTemplateVO.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 9628067c..22b646d3 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -10,7 +10,7 @@ /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; }; } public class GetTrackContentListDto diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index e4e901df..b75213fd 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -13,7 +13,7 @@ /// /// 关键字 /// - public string Keywords { get; set; } = ""; + public string? Keywords { get; set; }; ///// ///// 轨迹模版id,轨迹映射的查询使用 diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs index f093836d..4f62c3a9 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -16,7 +16,7 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } } public class GetTrackContentListVO diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs index 99005db7..35c4fe8a 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetPageTrackTemplateVO.cs @@ -10,7 +10,7 @@ public class GetPageTrackTemplateVO : PageInfoInput /// /// 关键字 /// - public string Keywords { get; set; } + public string? Keywords { get; set; } /// 选中的轨迹模版id /// From 2c28dafdb62423ffaab91bf07803d3db24102adf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 15:46:07 +0800 Subject: [PATCH 083/196] =?UTF-8?q?bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackContents/GetPageTrackContentInput.cs | 2 +- .../Dtos/TrackTemplates/GetPageTrackTemplateInput.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 22b646d3..9f7d68f2 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -10,7 +10,7 @@ /// /// 关键字 /// - public string? Keywords { get; set; }; + public string? Keywords { get; set; } } public class GetTrackContentListDto diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs index b75213fd..27d3dfc3 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs @@ -13,7 +13,7 @@ /// /// 关键字 /// - public string? Keywords { get; set; }; + public string? Keywords { get; set; } ///// ///// 轨迹模版id,轨迹映射的查询使用 From e3a8a94e1e1b6ca86eba27e72d30f3adc82c4d77 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 16:38:41 +0800 Subject: [PATCH 084/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E4=B9=9F=E6=B7=BB=E5=8A=A0=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 5 +++++ .../Dtos/TrackFlags/GetPageTrackFlagVO.cs | 5 +++++ .../Repositories/TrackContentRepository.cs | 1 + .../Repositories/TrackFlagRepository.cs | 5 +++-- .../Repositories/TrackStatusRepository.cs | 3 ++- .../Repositories/TrackTemplateRepository.cs | 17 +++++++++-------- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs index 1ca2c4df..4280f8d2 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -55,6 +55,11 @@ /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs index 20f7c40f..d3699b75 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -13,6 +13,11 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index bbde4d6f..a7bb1b6a 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -62,6 +62,7 @@ public class TrackContentRepository : BasicRepository, ITrac (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) || a.EnContent.Contains(input.Keywords) ) + .OrderByDescending((a, b, c, d, e, f) => a.CreateTime) .Select((a, b, c, d, e, f) => new GetTrackContentListVO { Id = a.Id, diff --git a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index 2a2a4ba6..2a710641 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -46,6 +46,8 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR .LeftJoin((a, b, c) => a.CreateUserId == c.Id) .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b, c, d) => new GetTrackFlagListVO { Id = a.Id, @@ -56,8 +58,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, - UpdateUser = d.Name, - + UpdateUser = d.Name }) .ToPagedListAsync(input.PageIndex, input.PageSize); diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index 831e80e5..dacc6947 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -45,7 +45,8 @@ public class TrackStatusRepository : BasicRepository, ITrackS .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) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .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, diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 6e254c16..57d3ab38 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -24,13 +24,13 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -47,7 +47,8 @@ public class TrackTemplateRepository : BasicRepository, ITr .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)=> SqlFunc.IIF(input.SelectIds.Contains(a.Id),SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b) => a.CreateTime,OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id, From 3505a4dbcc97195d92fa28b342caba48dee538e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 17:07:11 +0800 Subject: [PATCH 085/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackPush/EditTrackPushConfigInput.cs | 81 +++++++++++++ .../SJZY.Track.Application.Contract.csproj | 6 +- .../AutoMapper/TrackPushAutoMapperProfile.cs | 8 ++ .../Services/TrackPush/TrackPushService.cs | 110 +++++++++++++++++- .../ITrackPushConfigRepository.cs | 2 + .../GetTrackPushConfigDetailOutputVO.cs | 2 +- .../Repositories/TrackPushConfigRepository.cs | 9 ++ 7 files changed, 211 insertions(+), 7 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs new file mode 100644 index 00000000..cf3cb8ee --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs @@ -0,0 +1,81 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; + +public class EditTrackPushConfigInput +{ + /// + /// 客户id + /// + public int CustomId { get; set; } + + /// + /// 推送扩展字段 + /// + public string ExpandFieldsName { get; set; } + + public int? Id { get; set; } + + /// + /// 是否自动推送 + /// + public bool IsAutoPush { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 推送轨迹订单号 + /// + public string OrderNoName { get; set; } + + /// + /// 服务商id + /// + public int ServiceProviderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 推送轨迹时区 + /// + public string TackTimeZoneName { get; set; } + + /// + /// 推送轨迹内容代码 + /// + public string TrackContentCodeName { get; set; } + + /// + /// 推送轨迹内容 + /// + public string TrackContentName { get; set; } + + /// + /// 推送轨迹内容英文 + /// + public string TrackEnContentName { get; set; } + + /// + /// 推送轨迹发生地 + /// + public string TrackPlaceName { get; set; } + + /// + /// 推送轨迹状态 + /// + public string TrackStatusName { get; set; } + + /// + /// 轨迹模板id + /// + public List TrackTemplateIds { get; set; } + + /// + /// 推送轨迹发生时间 + /// + public string TrackTimeName { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj index a7a570d0..de5d1421 100644 --- a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj +++ b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj @@ -1,14 +1,14 @@ - + net7.0 0.0.2 - - + + diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs index 420b0e23..351f5321 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -1,4 +1,8 @@ using AutoMapper; +using SJZY.Track.Application.Contract.Dtos.TrackPush; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using Volo.Abp.AutoMapper; namespace SJZY.Track.Application.AutoMapper; @@ -6,5 +10,9 @@ 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)); } } \ 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 index a862e224..cd4567f6 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -1,8 +1,15 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; +using SqlSugar; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPush; @@ -16,13 +23,19 @@ public class TrackPushService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackPushConfigRepository _trackPushConfigRepository; + private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; public TrackPushService( IStringLocalizer stringLocalizer, - ITrackPushConfigRepository trackPushConfigRepository) + ITrackPushConfigRepository trackPushConfigRepository, + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository) { _stringLocalizer = stringLocalizer; _trackPushConfigRepository = trackPushConfigRepository; + _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository = trackPullConfigRepository; } /// @@ -53,9 +66,18 @@ public class TrackPushService : ApplicationService, ITransientDependency /// /// [HttpGet("GetDetail")] - public async Task GetDetailAsync(int id) + public async Task GetDetailAsync(int id) { - return await _trackPushConfigRepository.GetDetailAsync(id); + var res = await _trackPushConfigRepository.GetDetailAsync(id); + if (res is null) return null; + + List trackTemplateIds = res.TrackTemplateId.Split(',').Select(int.Parse).ToList(); + + var trackTemplateEntities = await _trackTemplateRepository.GetListAsync(x => trackTemplateIds.Contains(x.Id)); + + trackTemplateEntities.ForEach(item => { (res.TrackTemplate ??= new()).Add(new() { Value = item.Id, Key = item.Name }); }); + + return res; } /// @@ -68,4 +90,86 @@ public class TrackPushService : ApplicationService, ITransientDependency { return await _trackPushConfigRepository.GetContentDetailAsync(id); } + + /// + /// 轨迹推送配置编辑 + /// + /// + /// + [HttpPost("Edit")] + public async Task EditAsync([FromBody] EditTrackPushConfigInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isAnyExp = x => + x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; + if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + + var trackTemplateIdExp = Expressionable.Create(); + foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); } + + if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp.And(trackTemplateIdExp.ToExpression()))) + throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPushEntity = ObjectMapper.Map(input); + var trackPushParamsEntity = ObjectMapper.Map(input); + + using (var ts = TransactionScopeHelper.Create()) + { + int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity); + + trackPushParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.修改: + { + var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + 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); + + ts.Complete(); + } + } + break; + + case OptionTypeNoNull.删除: + 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); + + ts.Complete(); + } + + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPushConfigInput.Options)]); + } + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 39b19ad2..9c82ef1c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -12,4 +12,6 @@ public interface ITrackPushConfigRepository : IBasicRepository GetDetailAsync(int id); Task GetContentDetailAsync(int id); + + Task SoftDeleteContentAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs index 6e9cd961..900c74bc 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -89,7 +89,7 @@ public class GetTrackPushConfigDetailOutputVO /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public string TrackTemplateId { get; set; } /// /// 推送轨迹发生时间 diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 999a2732..07cbedc7 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -6,6 +6,7 @@ using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPush; using SJZY.Track.Domain.VEntities; using SJZY.Track.Repository.VData.Entitys; +using System.Linq.Expressions; namespace SJZY.Track.Repository.Repositories; @@ -82,4 +83,12 @@ public class TrackPushConfigRepository : BasicRepository, }, true) .SingleAsync(); } + + public async Task SoftDeleteContentAsync(Expression> whereExpression) + { + return await Context.Updateable() + .Where(whereExpression) + .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) + .ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file From 545efbeaf3636c89860fa248d080cc4ec93275bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Fri, 1 Mar 2024 17:49:20 +0800 Subject: [PATCH 086/196] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/TrackUpsertEvent.cs | 6 - .../Dtos/ProvideServices/UpsertTrackInput.cs | 4 +- .../Events/TrackUpsertEvent.cs | 19 ++- .../SJZY.Track.Application.Contract.csproj | 6 +- .../AutoMapper/TrackAutoMapperProfile.cs | 13 +++ .../EventHandlers/TrackUpsertEventHandler.cs | 108 ++++++++++++++++++ .../SJZY.Track.Application.csproj | 14 +-- .../Services/ProvideServices/TrackCustomer.cs | 9 -- .../ProvideServices/TrackPushService.cs | 10 ++ .../Services/ProvideServices/TrackService.cs | 79 +++---------- .../OrderAggregate/IOrderRepository.cs | 4 +- .../Aggregates/OrderAggregate/OrderEntity.cs | 6 + .../TrackContentMapEntity.cs | 30 ++++- .../ITrackDetailsRepository.cs | 4 +- .../TrackDetailsIndex.cs | 22 ++-- .../Dtos/Order/LinkedOrderVO.cs | 14 +++ .../Dtos/TrackDetails/MatchTrackContentDto.cs | 6 +- src/SJZY.Track.Domain/GlobalConst.cs | 14 +++ .../Queries/ITrackQueries.cs | 9 ++ .../Queries/TrackQueries.cs | 9 ++ .../Repositories/OrderRepository.cs | 8 +- .../Repositories/TrackDetailsRepository.cs | 17 +-- 22 files changed, 284 insertions(+), 127 deletions(-) delete mode 100644 src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs create mode 100644 src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs delete mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs create mode 100644 src/SJZY.Track.Domain/GlobalConst.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs deleted file mode 100644 index b6f64a7a..00000000 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/TrackUpsertEvent.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; - -public class TrackUpsertEvent -{ - public int Order { 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 index 91d5429c..ef0e67a4 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -5,12 +5,12 @@ public class UpsertTrackInput : OrderNoInfo /// /// 轨迹内容代码 /// - public string TrackCode { get; set; } + public string TrackCode { get; set; } = null!; /// /// 轨迹发生地 /// - public string TrackPlace { get; set; } + public string TrackPlace { get; set; } = null!; /// /// 轨迹发生时间 diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs index 48784974..ad0fe356 100644 --- a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -1,6 +1,21 @@ -namespace SJZY.Track.Application.Contract.Events; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; -public class TrackUpsertEvent +namespace SJZY.Track.Application.Contract.Events; + +public class TrackUpsertEvent : UpsertTrackInput { + /// + /// 订单id + /// public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 上游子系统id + /// + public int UpSubSystemId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj index a7a570d0..de5d1421 100644 --- a/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj +++ b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj @@ -1,14 +1,14 @@ - + net7.0 0.0.2 - - + + 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/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs new file mode 100644 index 00000000..220607ab --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -0,0 +1,108 @@ +using DotNetCore.CAP; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using SJZY.UserCenter.HttpApi.Services; +using Volo.Abp.DependencyInjection; + +namespace SJZY.Track.Application.EventHandlers; + +public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe +{ + private readonly IOrderRepository _orderRepository; + private readonly ITrackQueries _trackQueries; + private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ICapPublisher _capPublisher; + + public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher, + ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository) + { + _orderRepository = orderRepository; + _capPublisher = capPublisher; + _trackQueries = trackQueries; + _trackDetailsRepository = trackDetailsRepository; + } + + [NonAction] + [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] + public async Task ConsumerAsync(TrackUpsertEvent @event) + { + // 不同子系统需要做内容映射 + if (@event.UpSubSystemId != @event.SubSystemId) + { + var mapCode = await _trackQueries.MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); + + if (mapCode == default) + { + throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + } + + @event.TrackCode = mapCode; + } + + await UpsertTrackAsync(@event); + } + + internal async Task UpsertTrackAsync(TrackUpsertEvent @event) + { + // 不存在则新增轨迹,存在则更新 + var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode); + + var isPush = false; // 推送只做新增的,更新和删除的不做先 + if (track == default) + { + // 根据轨迹code在订单模板内容中寻找匹配的 + var trackContent = await _trackQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); + if (trackContent == default) + { + throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); + } + + track = new TrackDetailsIndex + { + OrderId = @event.OrderId, + OrderNo = @event.OrderNo, + OrderType = @event.OrderType, + TrackStatus = trackContent.Status, + TrackCode = @event.TrackCode, + TrackContent = trackContent.Content, + TrackEnContent = trackContent.EnContent, + TrackPlace = @event.TrackPlace, + TrackTime = @event.TrackTime, + TraceTimeZone = @event.TraceTimeZone, + CreateUserId = CurrentUserRequest.CurrentUser.UserId, + CreateTime = DateTime.Now + }; + + isPush = true; + } + else + { + track.TrackPlace = @event.TrackPlace; + track.TrackTime = @event.TrackTime; + track.TraceTimeZone = @event.TraceTimeZone; + track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; + track.UpdateTime = DateTime.Now; + } + + await _trackDetailsRepository.UpsertAsync(track); + + // 根据订单关联关系异步向下刷 + var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); + foreach (var linkedOrder in linkedOrders) + { + var nextEvent = @event.DeepCopy(); + nextEvent.OrderId = linkedOrder.OrderId; + nextEvent.SubSystemId = linkedOrder.SubSystemId; + nextEvent.UpSubSystemId = @event.SubSystemId; + await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent); + } + + if (isPush) + { + //await PushTrack(); + } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index fa25c565..cb744d89 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -1,6 +1,6 @@  - + net7.0 @@ -8,14 +8,14 @@ - - - - + + + + - - + + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs deleted file mode 100644 index 9f722217..00000000 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackCustomer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using DotNetCore.CAP; -using Volo.Abp.DependencyInjection; - -namespace SJZY.Track.Application.Services.ProvideServices; - -public class TrackCustomer : ITransientDependency, ICapSubscribe -{ - public const string CapSubscribe = "SJZY.Track.Upsert"; -} \ 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..5474a9be --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs @@ -0,0 +1,10 @@ +namespace SJZY.Track.Application.Services.ProvideServices; + +/// +/// 轨迹推送服务 +/// +[ApiExplorerSettings(GroupName = "提供接口")] +public class TrackPushService: ApplicationService +{ + +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index fad211a8..d7cc59e3 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,9 +1,7 @@ -using DotNetCore.CAP; -using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Application.EventHandlers; using SJZY.Track.Domain.Aggregates.OrderAggregate; -using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -using SJZY.Track.Domain.Queries; -using SJZY.UserCenter.HttpApi.Services; namespace SJZY.Track.Application.Services.ProvideServices; @@ -14,17 +12,12 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackService : ApplicationService { private readonly IOrderRepository _orderRepository; - private readonly ITrackDetailsRepository _trackDetailsRepository; - private readonly ITrackQueries _trackQueries; - private readonly ICapPublisher _capPublisher; + private readonly TrackUpsertEventHandler _trackUpsertEventHandler; - public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher) + public TrackService(IOrderRepository orderRepository, TrackUpsertEventHandler trackUpsertEventHandler) { - _trackQueries = trackQueries; _orderRepository = orderRepository; - _trackDetailsRepository = trackDetailsRepository; - _capPublisher = capPublisher; + _trackUpsertEventHandler = trackUpsertEventHandler; } /// @@ -36,59 +29,21 @@ public class TrackService : ApplicationService [HttpPost("Track/Upsert")] public async Task UpsertTrackAsync(UpsertTrackInput input) { - var orderId = await _orderRepository.GetFirstAsync(x => - x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); - if (orderId == default) + var order = await _orderRepository.GetFirstAsync(x => + x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new + { + x.Id, x.SubSystemId, x.IsPushCompleted + }); + if (order == default) { throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); } - // 不存在则新增轨迹,存在则更新 - var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode); - if (track == default) - { - var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode); - if (trackContent == default) - { - throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}"); - } - - track = new TrackDetailsIndex - { - OrderId = orderId, - OrderNo = input.OrderNo, - OrderType = input.OrderType, - TrackStatus = trackContent.Status, - TrackCode = input.TrackCode, - TrackContent = trackContent.Content, - TrackEnContent = trackContent.EnContent, - TrackPlace = input.TrackPlace, - TrackTime = input.TrackTime, - TraceTimeZone = input.TraceTimeZone, - CreateUserId = CurrentUserRequest.CurrentUser.UserId, - CreateTime = DateTime.Now - }; - await _trackDetailsRepository.CreateAsync(track); - } - else - { - track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; - track.UpdateTime = DateTime.Now; - track.TrackPlace = input.TrackPlace; - track.TrackTime = input.TrackTime; - track.TraceTimeZone = input.TraceTimeZone; - await _trackDetailsRepository.UpdateAsync(track); - } - - // 根据订单关联关系向下刷,不同子系统还需要做内容映射 - var linkedOrderIds = await _orderRepository.GetLinkedOrderIdsAsync(orderId); - - if (linkedOrderIds.Count > 0) - { - await _capPublisher.PublishAsync(TrackCustomer.CapSubscribe, new TrackUpsertEvent { }); - } - - // 推送 + // 新增/更新轨迹 + var @event = ObjectMapper.Map(input); + @event.OrderId = order.Id; + @event.SubSystemId = order.SubSystemId; + await _trackUpsertEventHandler.UpsertTrackAsync(@event); return true; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 136375c5..29b8ae37 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -38,11 +38,11 @@ public interface IOrderRepository : IBasicRepository #region 订单关联 /// - /// 根据订单id,获取关联的订单id集合 + /// 根据订单id,获取关联的订单集合 /// /// /// - Task> GetLinkedOrderIdsAsync(int orderId); + Task> GetLinkedOrdersAsync(int orderId); /// /// 关联订单 diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index 33e44303..88de3765 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -41,6 +41,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot /// [SugarColumn(ColumnName = "IsCompleted")] public bool IsCompleted { get; set; } + + /// + /// 订单是否推送完成(异步维护) + /// + [SugarColumn(ColumnName = "IsPushCompleted")] + public bool IsPushCompleted { get; set; } /// /// 最新轨迹内容(异步维护) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs index fbeb2e9c..2ce468ed 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs @@ -13,14 +13,38 @@ public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity public int Id { get; set; } /// - /// 映射轨迹内容id + /// 源子系统id /// - [SugarColumn(ColumnName = "MapTrackContentId")] - public int MapTrackContentId { get; set; } + [SugarColumn(ColumnName = "SubSystemId")] + public int SubSystemId { get; set; } /// /// 源轨迹内容id /// [SugarColumn(ColumnName = "TrackContentId")] public int TrackContentId { get; set; } + + /// + /// 源轨迹内容code + /// + [SugarColumn(ColumnName = "TrackContentCode")] + public string TrackContentCode { get; set; } = null!; + + /// + /// 映射子系统id + /// + [SugarColumn(ColumnName = "MapSubSystemId")] + public int MapSubSystemId { get; set; } + + /// + /// 映射轨迹内容id + /// + [SugarColumn(ColumnName = "MapTrackContentId")] + public int MapTrackContentId { get; set; } + + /// + /// 映射轨迹内容code + /// + [SugarColumn(ColumnName = "MapTrackContentCode")] + public string MapTrackContentCode { get; set; } = null!; } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 89d812a1..3ab152d1 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -6,9 +6,7 @@ public interface ITrackDetailsRepository { Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode); - Task UpdateAsync(TrackDetailsIndex index); - - Task CreateAsync(TrackDetailsIndex index); + Task UpsertAsync(TrackDetailsIndex index); Task> GetListAsync(int orderType, List orderNos); diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index a8160da6..35857507 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -3,11 +3,9 @@ using SJZY.Expand.ElasticSearch; namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; -[ElasticsearchType(RelationName = IndexName)] +[ElasticsearchType(RelationName = GlobalConst.TrackIndex)] public class TrackDetailsIndex : IdBaseIndex { - public const string IndexName = "sjzy_track_details"; - /// /// 订单Id /// @@ -16,7 +14,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 订单号 /// - public string OrderNo { get; set; } + public string OrderNo { get; set; } = null!; /// /// 订单类型(主数据枚举TrackOrderType) @@ -26,42 +24,42 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 轨迹状态 /// - public string TrackStatus { get; set; } + public string TrackStatus { get; set; } = null!; /// /// 原轨迹状态 /// - public string OriginTrackStatus { get; set; } + public string? OriginTrackStatus { get; set; } /// /// 轨迹内容代码 /// - public string TrackCode { get; set; } + public string TrackCode { get; set; } = null!; /// /// 轨迹内容 /// - public string TrackContent { get; set; } + public string TrackContent { get; set; } = null!; /// /// 原轨迹内容 /// - public string OriginTrackContent { get; set; } + public string? OriginTrackContent { get; set; } /// /// 原轨迹报文 /// - public string OriginTrackData { get; set; } + public string? OriginTrackData { get; set; } /// /// 轨迹内容英文 /// - public string TrackEnContent { get; set; } + public string TrackEnContent { get; set; } = null!; /// /// 轨迹发生地 /// - public string TrackPlace { get; set; } + public string? TrackPlace { get; set; } /// /// 轨迹发生时间 diff --git a/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs new file mode 100644 index 00000000..5d1c7327 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain.Dtos.Order; + +public class LinkedOrderVO +{ + /// + /// 关联订单id + /// + public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs index c6e07352..ced59e19 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -5,15 +5,15 @@ public class MatchTrackContentDto /// /// 轨迹内容 /// - public string Content { get; set; } + public string Content { get; set; } = null!; /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string EnContent { get; set; } = null!; /// /// 轨迹状态 /// - public string Status { get; set; } + public string Status { get; set; } = null!; } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs new file mode 100644 index 00000000..77881f20 --- /dev/null +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -0,0 +1,14 @@ +namespace SJZY.Track.Domain; + +public class GlobalConst +{ + /// + /// 轨迹明细es索引名称 + /// + public const string TrackIndex = "sjzy_track_details"; + + /// + /// 轨迹新增/更新cap订阅名称 + /// + public const string TrackUpsertSubscribe = "SJZY.Track.Upsert"; +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs index df41882c..53a9720e 100644 --- a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs +++ b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs @@ -31,4 +31,13 @@ public interface ITrackQueries /// 轨迹代码 /// Task MatchTrackContentAsync(int orderId, string code); + + /// + /// 根据子系统内容映射,得到映射后的轨迹code + /// + /// + /// + /// + /// + Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs index da7c4dab..a1e5168a 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -75,4 +75,13 @@ public class TrackQueries : ISugarRepository, ITrackQueries, }) .FirstAsync(); } + + public async Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode) + { + return await Context.Queryable() + .Where(x => x.SubSystemId == upSubSystemId && x.MapSubSystemId == subSystemId && + x.TrackContentCode == trackCode) + .Select(x => x.MapTrackContentCode) + .FirstAsync(); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 8e9106da..8be1ec1a 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -53,12 +53,16 @@ public class OrderRepository : BasicRepository, IOrderRepository, I #region 订单关联 - public async Task> GetLinkedOrderIdsAsync(int orderId) + public async Task> GetLinkedOrdersAsync(int orderId) { return await Context.Queryable() .LeftJoin((a, b) => a.Id == b.OrderId) .Where(a => a.Id == orderId) - .Select((a, b) => b.LinkOrderId) + .Select((a, b) => new LinkedOrderVO + { + OrderId = b.LinkOrderId, + SubSystemId = a.SubSystemId + }) .ToListAsync(); } diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index b5632055..c0ca92e4 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -1,5 +1,6 @@ using Nest; using SJZY.Expand.ElasticSearch.Services; +using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; @@ -8,7 +9,7 @@ namespace SJZY.Track.Repository.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency { - public string IndexName => $"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}"; + public string IndexName => $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}"; public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) { @@ -17,7 +18,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract GetFirstOrDefaultAsync(int orderId, string trackCode) { var r = await Context.SearchAsync(s => s - .Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}") + .Index(IndexName) .Query(q => q.Term(t => t.Field(f => f.OrderId).Value(orderId)) && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) @@ -32,24 +33,18 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + .DocAsUpsert() + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!response.IsValid) throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); } - public async Task CreateAsync(TrackDetailsIndex index) - { - var response = await Context.IndexAsync(index, request => request.Index(IndexName)); - if (!response.IsValid) - throw new Exception($"数据添加失败,原因:{response.DebugInformation}"); - } - public async Task> GetListAsync(int orderType, List orderNos) { if (orderNos.Count < 1) return new List(); From d8065bb9d12906243db66ff3194be78ad4c501d2 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 17:53:15 +0800 Subject: [PATCH 087/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/GetPageTrackContentInput.cs | 5 +++++ .../Localization/Resources/en.json | 5 ++++- .../Localization/Resources/zh.json | 5 ++++- .../Services/TrackFlags/TrackFlagService.cs | 13 ++++++++++++- .../Services/TrackStatus/TrackStatusService.cs | 13 ++++++++++++- .../TrackTemplates/TrackTemplateService.cs | 18 ++++++++++++------ .../TrackContents/GetPageTrackContentVO.cs | 5 +++++ .../Repositories/TrackContentRepository.cs | 3 ++- 8 files changed, 56 insertions(+), 11 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 9f7d68f2..de3844b5 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -11,6 +11,11 @@ /// 关键字 /// public string? Keywords { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } } public class GetTrackContentListDto diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json index 9e31fad8..c7d369bc 100644 --- a/src/SJZY.Track.Application/Localization/Resources/en.json +++ b/src/SJZY.Track.Application/Localization/Resources/en.json @@ -7,6 +7,9 @@ "TemplateExist": "The template code already exists under the currently selected subsystem", "TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English", "TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem", - "TrackFlagExist": "Duplicate code or flag in the current subsystem" + "TrackFlagExist": "Duplicate code or flag in the current subsystem", + "IsExistTrackPullConfig": "Track Pull The template has been bound. Delete the track pull before deleting the template", + "IsExistTrackStatus": "The trajectory content has been bound to the trajectory status. Delete the trajectory content before deleting the trajectory status", + "IsExistTrackFlag": "The track content has been bound to the track mark. Delete the track content before deleting the track mark" } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Localization/Resources/zh.json b/src/SJZY.Track.Application/Localization/Resources/zh.json index 24a80165..38db9ebb 100644 --- a/src/SJZY.Track.Application/Localization/Resources/zh.json +++ b/src/SJZY.Track.Application/Localization/Resources/zh.json @@ -7,6 +7,9 @@ "TemplateExist": "模板代码已存在于当前选择的子系统下", "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复", - "TrackFlagExist": "当前子系统下代码或标记重复" + "TrackFlagExist": "当前子系统下代码或标记重复", + "IsExistTrackPullConfig": "轨迹拉取已绑定了该模版,请先删除轨迹拉取再删除该模版", + "IsExistTrackStatus": "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态", + "IsExistTrackFlag": "轨迹内容已经绑定了该轨迹标记,请先删除轨迹内容后再删除该轨迹标记" } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index a6117f0d..01e9acd4 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -1,6 +1,7 @@ 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; @@ -16,14 +17,17 @@ namespace SJZY.Track.Application.Services.TrackFlags { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackFlagRepository _trackFlagRepository; + private readonly ITrackContentRepository _trackContentRepository; public TrackFlagService( IStringLocalizer stringLocalizer, - ITrackFlagRepository trackFlagRepository + ITrackFlagRepository trackFlagRepository, + ITrackContentRepository trackContentRepository ) { this._stringLocalizer = stringLocalizer; this._trackFlagRepository = trackFlagRepository; + this._trackContentRepository=trackContentRepository; } /// @@ -121,6 +125,13 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task DeleteAsync(EditTrackFlagInput input) { + #region 业务校验 + var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id); + if (isExistContent!=null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]); + } + #endregion var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index f7ba0720..686854db 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -1,6 +1,7 @@ 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; @@ -16,14 +17,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackStatusRepository _trackStatusRepository; + private readonly ITrackContentRepository _trackContentRepository; public TrackStatusService( IStringLocalizer stringLocalizer, - ITrackStatusRepository trackStatusRepository + ITrackStatusRepository trackStatusRepository, + ITrackContentRepository trackContentRepository ) { this._stringLocalizer = stringLocalizer; this._trackStatusRepository = trackStatusRepository; + this._trackContentRepository=trackContentRepository; } /// @@ -122,6 +126,13 @@ public class TrackStatusService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackStatusInput input) { + #region 业务校验 + var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id); + if (isExistStatus!=null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + } + #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 5afc3992..367f2cda 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackTemplate; using Volo.Abp.DependencyInjection; @@ -18,14 +19,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackTemplateRepository _trackTemplateRepository; + private readonly ITrackPullConfigRepository _trackPullConfigRepository; /// public TrackTemplateService( IStringLocalizer stringLocalizer, - ITrackTemplateRepository trackTemplateRepository) + ITrackTemplateRepository trackTemplateRepository, + ITrackPullConfigRepository trackPullConfigRepository + ) { _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; + _trackPullConfigRepository=trackPullConfigRepository; } /// @@ -105,14 +110,12 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackTemplateInput input) { #region 业务校验 - var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } - #endregion var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); @@ -125,9 +128,12 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackTemplateInput input) { #region 业务校验 - - //到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示 - + //查询看看在轨迹拉取里面有没有被占用 + var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId==input.Id); + if (isExisistTrackPullConfig!=null) + { + throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + } #endregion var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs index 4f62c3a9..f4b3c65c 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -17,6 +17,11 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// 关键字 /// public string? Keywords { get; set; } + + /// + /// 选中的轨迹内容id + /// + public List? SelectIds { get; set; } } public class GetTrackContentListVO diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index a7bb1b6a..f177629e 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -62,7 +62,8 @@ public class TrackContentRepository : BasicRepository, ITrac (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) || a.EnContent.Contains(input.Keywords) ) - .OrderByDescending((a, b, c, d, e, f) => a.CreateTime) + .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, From a8b0892ab601f9f4ba78520a33ed21e5df92f658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 18:00:15 +0800 Subject: [PATCH 088/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E7=BC=96?= =?UTF-8?q?=E8=BE=91=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackPush/EditTrackPushContentInput.cs | 61 +++++++++++++++++++ .../AutoMapper/TrackPushAutoMapperProfile.cs | 1 + .../Services/TrackPush/TrackPushService.cs | 58 +++++++++++++++++- .../ITrackPushConfigRepository.cs | 8 +++ .../Repositories/TrackPushConfigRepository.cs | 20 ++++++ 5 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs 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..0773f3dc --- /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 string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs index 351f5321..3a42d0e4 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs @@ -14,5 +14,6 @@ public class TrackPushAutoMapperProfile : Profile .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/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index cd4567f6..46d10cce 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -1,6 +1,9 @@ -using Microsoft.Extensions.Localization; +using AutoMapper.Internal.Mappers; +using Microsoft.Extensions.Localization; +using Nito.AsyncEx; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; @@ -102,7 +105,7 @@ public class TrackPushService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isAnyExp = x => - x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; + x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); var trackTemplateIdExp = Expressionable.Create(); @@ -172,4 +175,55 @@ public class TrackPushService : ApplicationService, ITransientDependency return true; } + + /// + /// 轨迹推送配置内容编辑 + /// + /// + /// + [HttpPost("EditContent")] + public async Task EditContentAsync([FromBody] EditTrackPushContentInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isContentAnyExp = x => + x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId; + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); + + if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + { + var trackPushContentEntity = ObjectMapper.Map(input); + + await _trackPushConfigRepository.InsertContentAsync(trackPushContentEntity); + } + break; + + case OptionTypeNoNull.修改: + { + var oldTrackPushContentEntity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldTrackPushContentEntity); + + await _trackPushConfigRepository.UpdateContentAsync(oldTrackPushContentEntity); + } + break; + + case OptionTypeNoNull.删除: + await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id); + + break; + + default: + throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, + nameof(EditTrackPushContentInput.Options)]); + } + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 9c82ef1c..808cc3ac 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -14,4 +14,12 @@ public interface ITrackPushConfigRepository : IBasicRepository GetContentDetailAsync(int id); Task SoftDeleteContentAsync(Expression> whereExpression); + + Task IsContentAnyAsync(Expression> whereExpression); + + Task InsertContentAsync(TrackPushContentConfigEntity insertObj); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPushContentConfigEntity updateObj); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 07cbedc7..9c2cb3d2 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -91,4 +91,24 @@ public class TrackPushConfigRepository : BasicRepository, .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .ExecuteCommandHasChangeAsync(); } + + public async Task IsContentAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } + + public async Task InsertContentAsync(TrackPushContentConfigEntity insertObj) + { + return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0; + } + + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateContentAsync(TrackPushContentConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file From 8ac687a9be59cc74a7210c77ae043bfbe7875a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 18:09:00 +0800 Subject: [PATCH 089/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackPull/UpdateTrackPullContentInput.cs | 2 +- .../TrackPush/EditTrackPushContentInput.cs | 2 +- .../Services/TrackPull/TrackPullService.cs | 116 +++++++++--------- .../Services/TrackPush/TrackPushService.cs | 5 +- .../TrackContentMapEntity.cs | 2 +- .../TrackPullContentConfigEntity.cs | 2 +- .../TrackPushContentConfigEntity.cs | 2 +- .../GetTrackPullContentDetailOutputVO.cs | 2 +- .../GetTrackPushContentDetailOutputVO.cs | 2 +- 9 files changed, 66 insertions(+), 69 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs index 84d7e335..077f8e0a 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -47,5 +47,5 @@ public class UpdateTrackPullContentInput /// /// 轨迹时区GMT /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs index 0773f3dc..ef22fc85 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs @@ -57,5 +57,5 @@ public class EditTrackPushContentInput /// /// 轨迹时区GMT /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 4210a46c..7f1ad2de 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -100,83 +100,83 @@ public class TrackPullService : ApplicationService, ITransientDependency 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); + var trackPullEntity = ObjectMapper.Map(input); + var trackPullParamsEntity = + ObjectMapper.Map(input); - trackPullParamsEntity.PullOrPushConfigId = id; - await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); - foreach (var item in trackTemplateContentEntities) + var trackPullContentEntities = new List(); + + using (var ts = TransactionScopeHelper.Create()) { - trackPullContentEntities.Add(new() + int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); + + trackPullParamsEntity.PullOrPushConfigId = id; + await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity); + + foreach (var item in trackTemplateContentEntities) { - TrackPullConfigId = id, - TrackContentId = item.TrackContentId - }); + trackPullContentEntities.Add(new() + { + TrackPullConfigId = id, + TrackContentId = item.TrackContentId + }); + } + + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + + ts.Complete(); } - - 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); + var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); - foreach (var item in trackTemplateContentEntities) - { - trackPullContentEntities.Add(new() - { - TrackPullConfigId = oldTrackPullEntity.Id, - TrackContentId = item.TrackContentId - }); - } - } + var oldTrackPullParamsEntity = + await _trackPullConfigRepository.GetParamsSingleAsync(x => + x.PullOrPushConfigId == input.Id && !x.IsPush); - ObjectMapper.Map(input, oldTrackPullEntity); - ObjectMapper.Map(input, oldTrackPullParamsEntity); - - using (var ts = TransactionScopeHelper.Create()) - { - await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); - await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); + var trackPullContentEntities = new List(); if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) { - await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); - await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + var trackTemplateContentEntities = + await _trackTemplateRepository.GetContentListAsync(x => + x.TrackTemplateId == input.TrackTemplateId); + + foreach (var item in trackTemplateContentEntities) + { + trackPullContentEntities.Add(new() + { + TrackPullConfigId = oldTrackPullEntity.Id, + TrackContentId = item.TrackContentId + }); + } } - ts.Complete(); + ObjectMapper.Map(input, oldTrackPullEntity); + ObjectMapper.Map(input, oldTrackPullParamsEntity); + + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); + await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); + + if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + { + await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); + await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); + } + + ts.Complete(); + } } - } break; case OptionTypeNoNull.删除: diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 46d10cce..7c8489ed 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -1,9 +1,6 @@ -using AutoMapper.Internal.Mappers; -using Microsoft.Extensions.Localization; -using Nito.AsyncEx; +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.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs index 2ce468ed..1c20048f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentMapEntity.cs @@ -41,7 +41,7 @@ public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity /// [SugarColumn(ColumnName = "MapTrackContentId")] public int MapTrackContentId { get; set; } - + /// /// 映射轨迹内容code /// diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs index f9de867c..2a9d53ab 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -64,5 +64,5 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 轨迹时区GMT /// [SugarColumn(ColumnName = "TrackTimeZone")] - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs index a1223bb0..1c392d52 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/TrackPushContentConfigEntity.cs @@ -70,5 +70,5 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 轨迹时区GMT /// [SugarColumn(ColumnName = "TrackTimeZone")] - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs index af51f0cf..f29ab75f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -52,5 +52,5 @@ public class GetTrackPullContentDetailOutputVO /// /// 拉取轨迹时区 /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs index 2bad0d5a..f0980524 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs @@ -57,5 +57,5 @@ public class GetTrackPushContentDetailOutputVO /// /// 推送轨迹时区 /// - public string TrackTimeZone { get; set; } + public double? TrackTimeZone { get; set; } } \ No newline at end of file From 6e487a60c380b1ca12cf58426cf996f8a6d11473 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 18:34:05 +0800 Subject: [PATCH 090/196] =?UTF-8?q?=E5=B7=A6=E8=BF=9E=E6=8E=A5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8A=A0isdeleted=3D=3Dfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 5 +++-- .../Repositories/OrderRepository.cs | 4 ++-- .../Repositories/TrackContentRepository.cs | 20 +++++++++++-------- .../Repositories/TrackFlagRepository.cs | 8 ++++---- .../Repositories/TrackStatusRepository.cs | 8 ++++---- .../Repositories/TrackTemplateRepository.cs | 6 +++--- 6 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index c7493cec..dfd3d7dd 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -20,6 +20,7 @@ namespace SJZY.Track.Application.Services.TrackContents public TrackContentService( IStringLocalizer stringLocalizer, ITrackContentRepository trackContentRepository + ) { this._stringLocalizer = stringLocalizer; @@ -103,7 +104,6 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task UpdateAsync(EditTrackContentInput input) { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Content == input.Content || a.EnContent == input.EnContent)); @@ -111,7 +111,8 @@ namespace SJZY.Track.Application.Services.TrackContents { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - + //更新的时候需要覆盖内容映射轨迹代码 + #endregion var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 8be1ec1a..7d4e4c90 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -102,8 +102,8 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { var pageList = await Context.Queryable() - .LeftJoin((a, b) => a.CustomId == b.Id) - .LeftJoin((a, b, c) => a.SubSystemId == c.Id) + .LeftJoin((a, b) => a.CustomId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.SubSystemId == c.Id && c.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) .WhereIF(input.CreateTimeStart.HasValue && input.CreateTimeEnd.HasValue, diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index f177629e..e4f2e387 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -22,9 +22,9 @@ public class TrackContentRepository : BasicRepository, ITrac public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.TrackStatusId==b.Id) - .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) + .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 { @@ -52,11 +52,11 @@ public class TrackContentRepository : BasicRepository, ITrac { UnifyPageResultDto pagedList = new UnifyPageResultDto(); pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.TrackStatusId==b.Id) - .LeftJoin((a, b, c) => a.TrackFlagId==c.Id) - .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id) - .LeftJoin((a, b, c, d, e) => a.CreateUserId == e.Id) - .LeftJoin((a, b, c, d, e, f) => a.UpdateUserId == f.Id) + .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) @@ -83,6 +83,10 @@ public class TrackContentRepository : BasicRepository, ITrac }) .ToPagedListAsync(input.PageIndex, input.PageSize); + var ff = await Context.Queryable().Where(a => 1==1).ToListAsync(); + + + return pagedList; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index 2a710641..eb6b8ca1 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -18,7 +18,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackFlagDetailVO { @@ -42,9 +42,9 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR { UnifyPageResultDto pagedList = new UnifyPageResultDto(); pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId == c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id && d.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index dacc6947..7279e1e1 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -14,7 +14,7 @@ public class TrackStatusRepository : BasicRepository, ITrackS public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackStatusDetailVO { @@ -38,9 +38,9 @@ public class TrackStatusRepository : BasicRepository, ITrackS public async Task> GetPageTrackStatus(GetPageTrackStatusVO input) { UnifyPageResultDto pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) - .LeftJoin((a, b, c) => a.CreateUserId == c.Id) - .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) + .LeftJoin((a, b, c) => a.CreateUserId == c.Id && c.IsDeleted == false) + .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id && d.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b, c, d) => a.Status.Contains(input.Keywords) || a.EnStatus.Contains(input.Keywords) || diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 57d3ab38..6fe279f7 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -20,7 +20,7 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO @@ -43,11 +43,11 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input) { UnifyPageResultDto pagedList = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b) => a.CreateTime,OrderByType.Desc) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b) => a.CreateTime, OrderByType.Desc) .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { From 56875e923a0564a8d9f4cf5fcb0697c562b1f29d Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 18:36:43 +0800 Subject: [PATCH 091/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=8E=BB=E6=8E=89=E8=BD=A8=E8=BF=B9=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 3 +++ .../OrderAggregate/IOrderRepository.cs | 2 +- .../Repositories/OrderRepository.cs | 18 +++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index b176cf6e..d0ead552 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,6 +1,8 @@ using AutoMapper; +using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; using System.Diagnostics; @@ -21,5 +23,6 @@ public class OrderAutoMapperProfile : Profile 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.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 29b8ae37..225605cc 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -11,7 +11,7 @@ public interface IOrderRepository : IBasicRepository /// Task CreateOrderAsync(OrderEntity order); - Task> GetOrderDetails(GetOrderDetailsInputVO input); + //Task> GetOrderDetails(GetOrderDetailsInputVO input); /// /// 获取分页的轨迹订单 diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 7d4e4c90..935a4c51 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -80,15 +80,15 @@ public class OrderRepository : BasicRepository, IOrderRepository, I #region 轨迹订单明细 - /// - /// 根据轨迹订单id获取轨迹明细列表 - /// - /// - /// - public async Task> GetOrderDetails(GetOrderDetailsInputVO input) - { - return null; - } + ///// + ///// 根据轨迹订单id获取轨迹明细列表 + ///// + ///// + ///// + //public async Task> GetOrderDetails(GetOrderDetailsInputVO input) + //{ + // return null; + //} #endregion From 61cc6aafc5d6a35aaf13bb0e216d4c90f4911248 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 19:02:21 +0800 Subject: [PATCH 092/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackContents/TrackContentService.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index dfd3d7dd..281fed37 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -20,7 +20,7 @@ namespace SJZY.Track.Application.Services.TrackContents public TrackContentService( IStringLocalizer stringLocalizer, ITrackContentRepository trackContentRepository - + ) { this._stringLocalizer = stringLocalizer; @@ -111,10 +111,8 @@ namespace SJZY.Track.Application.Services.TrackContents { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - //更新的时候需要覆盖内容映射轨迹代码 - #endregion - + //更新的时候需要覆盖内容映射轨迹代码 var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); @@ -124,6 +122,9 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { + #region 业务校验 + //需要加个判断,存在内容映射,则出提示 + #endregion var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); From 375de5268d177297d433f99f5473bf7877d1659c Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 19:14:20 +0800 Subject: [PATCH 093/196] =?UTF-8?q?=E5=88=86=E9=A1=B5=E7=9A=84=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs | 5 +++++ src/SJZY.Track.Repository/Repositories/OrderRepository.cs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 44027d12..44567900 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -44,6 +44,11 @@ namespace SJZY.Track.Domain.Dtos.Order /// public int OrderType { get; set; } + /// + /// 订单名称 + /// + public string OrderTypeName { get; set; } + /// /// 订单号 /// diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 935a4c51..05fc2db1 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -117,6 +117,8 @@ public class OrderRepository : BasicRepository, IOrderRepository, I 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() From 81a8e077fc1663c3ad72a46dda742343a757da48 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 19:18:23 +0800 Subject: [PATCH 094/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95=E7=B1=BB=E5=9E=8B=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetPageTrackOrderInput.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 2f8d31e0..be5dbb69 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -38,6 +38,11 @@ public class TrackOrderDto /// public int OrderType { get; set; } + /// + /// 订单名称 + /// + public string? OrderTypeName { get; set; } + /// /// 订单号 /// From 3d91f9c632c80e9a5c503122732be25b625ade80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 20:30:17 +0800 Subject: [PATCH 095/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=A0=E5=B0=84=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 26 +++++++-- .../ITrackContentRepository.cs | 4 +- .../GetTrackContentMapPageInputVO.cs | 11 ++++ .../GetTrackContentMapPageOutputVO.cs | 56 +++++++++++++++++++ .../Repositories/TrackContentRepository.cs | 56 ++++++++++++++----- 5 files changed, 134 insertions(+), 19 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageInputVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapPageOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 281fed37..52c01e40 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core.Common.Dto; using SJZY.Track.Application.Contract.Dtos.TrackContents; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; @@ -93,7 +94,7 @@ namespace SJZY.Track.Application.Services.TrackContents throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - #endregion + #endregion 业务逻辑校验 var entity = ObjectMapper.Map(input); var isTrue = await _trackContentRepository.InsertAsync(entity); @@ -104,6 +105,7 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task UpdateAsync(EditTrackContentInput input) { #region 业务逻辑校验 + var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Content == input.Content || a.EnContent == input.EnContent)); @@ -111,7 +113,9 @@ namespace SJZY.Track.Application.Services.TrackContents { throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); } - #endregion + + #endregion 业务逻辑校验 + //更新的时候需要覆盖内容映射轨迹代码 var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); @@ -123,13 +127,27 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { #region 业务校验 + //需要加个判断,存在内容映射,则出提示 - #endregion + + #endregion 业务校验 + var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); return new UnifyResultDto("200", "删除成功", isTrue); } - #endregion + #endregion 私有方法 + + /// + /// 轨迹内容映射列表 + /// + /// + /// + [HttpPost("GetMapPage")] + public async Task> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input) + { + return await _trackContentRepository.GetMapPageAsync(input); + } } } \ 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 index fbd0e412..fe1ab55c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -1,10 +1,12 @@ using SJZY.Track.Domain.Dtos.TrackContents; -using SJZY.Track.Domain.Dtos.TrackStatus; namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; public interface ITrackContentRepository : IBasicRepository { Task GetDetailAsync(int id); + Task> GetPageTrackContent(GetPageTrackContentVO input); + + Task> GetMapPageAsync(GetTrackContentMapPageInputVO input); } \ 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.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index e4f2e387..50f6a2d2 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -8,10 +8,8 @@ namespace SJZY.Track.Repository.Repositories; public class TrackContentRepository : BasicRepository, ITrackContentRepository, IScopedDependency { - public TrackContentRepository() { - } /// @@ -24,20 +22,20 @@ public class TrackContentRepository : BasicRepository, ITrac 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) + .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, + TrackStatusId = a.TrackStatusId, + TrackStatus = b.Status, Code = a.Code, Content = a.Content, EnContent = a.EnContent, - TrackFlagId=a.TrackFlagId, - TrackFlag=c.Name + TrackFlagId = a.TrackFlagId, + TrackFlag = c.Name }) .FirstAsync(); return detail; @@ -52,8 +50,8 @@ public class TrackContentRepository : BasicRepository, ITrac { 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) => 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) @@ -71,11 +69,11 @@ public class TrackContentRepository : BasicRepository, ITrac Code = a.Code, Content = a.Content, EnContent = a.EnContent, - TrackStatus= b.Status, + TrackStatus = b.Status, Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关") .ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送") .End(""), - TrackFlag= c.Name, + TrackFlag = c.Name, CreateTime = a.CreateTime, CreateUser = e.Name, UpdateTime = a.UpdateTime, @@ -83,10 +81,40 @@ public class TrackContentRepository : BasicRepository, ITrac }) .ToPagedListAsync(input.PageIndex, input.PageSize); - var ff = await Context.Queryable().Where(a => 1==1).ToListAsync(); - - + var ff = await Context.Queryable().Where(a => 1 == 1).ToListAsync(); return pagedList; } + + public async Task> GetMapPageAsync(GetTrackContentMapPageInputVO input) + { + return await Context.Queryable() + .InnerJoin((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted) + .InnerJoin((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus) => sourceContent.TrackStatusId == sourceStatus.Id && !sourceStatus.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => targetContent.TrackStatusId == targetStatus.Id && !targetStatus.IsDeleted) + .Filter(null, true) + .Where(contentMap => !contentMap.IsDeleted) + .WhereIF(input.SubSystemId.HasValue, contentMap => contentMap.SubSystemId == input.SubSystemId) + .WhereIF(input.MapSubSystemId.HasValue, contentMap => contentMap.MapSubSystemId == input.MapSubSystemId) + .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (contentMap, sourceContent) => sourceContent.Code.Contains(input.Keywords) || sourceContent.Content.Contains(input.Keywords) || sourceContent.EnContent.Contains(input.Keywords)) + .OrderByDescending(contentMap => contentMap.CreateTime) + .Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => new GetTrackContentMapPageOutputVO + { + Id = contentMap.Id, + SubSystem = sourceSystem.CnName, + Code = contentMap.TrackContentCode, + TrackStatus = sourceStatus.Status, + Content = sourceContent.Content, + EnContent = sourceContent.EnContent, + MapSubSystem = targetSystem.CnName, + MapCode = contentMap.MapTrackContentCode, + MapTrackStatus = targetStatus.Status, + MapContent = targetContent.Content, + MapEnContent = targetContent.EnContent + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + } } \ No newline at end of file From 867b987f9a79a526f9dae79348fa2574e1dc0e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 20:42:06 +0800 Subject: [PATCH 096/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=A0=E5=B0=84=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 11 +++++ .../ITrackContentRepository.cs | 2 + .../GetTrackContentMapDetailOutputVO.cs | 46 +++++++++++++++++++ .../Repositories/TrackContentRepository.cs | 21 +++++++++ 4 files changed, 80 insertions(+) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 52c01e40..542b0612 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -149,5 +149,16 @@ namespace SJZY.Track.Application.Services.TrackContents { return await _trackContentRepository.GetMapPageAsync(input); } + + /// + /// 轨迹内容映射详情 + /// + /// + /// + [HttpGet("GetMapDetail")] + public async Task GetMapDetailAsync(int id) + { + return await _trackContentRepository.GetMapDetailAsync(id); + } } } \ 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 index fe1ab55c..cb4c9a4f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -9,4 +9,6 @@ public interface ITrackContentRepository : IBasicRepository Task> GetPageTrackContent(GetPageTrackContentVO input); Task> GetMapPageAsync(GetTrackContentMapPageInputVO input); + + Task GetMapDetailAsync(int id); } \ No newline at end of file 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..b5755d21 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs @@ -0,0 +1,46 @@ +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; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 50f6a2d2..a186543a 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -117,4 +117,25 @@ public class TrackContentRepository : BasicRepository, ITrac }) .ToPagedListAsync(input.PageIndex, input.PageSize); } + + public async Task GetMapDetailAsync(int id) + { + return await Context.Queryable() + .InnerJoin((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted) + .InnerJoin((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted) + .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted) + .Filter(null, true) + .Where(contentMap => !contentMap.IsDeleted) + .Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => new GetTrackContentMapDetailOutputVO + { + Id = contentMap.Id, + SubSystemId = contentMap.SubSystemId, + SubSystem = sourceSystem.CnName, + TrackContent = contentMap.TrackContentCode + "-" + sourceContent.Content, + MapSubSystem = targetSystem.CnName, + MapTrackContent = contentMap.MapTrackContentCode + "-" + targetContent.Content + }, true) + .SingleAsync(); + } } \ No newline at end of file From 2292b7433d2ffb8db8b85490c2652a7a56a244be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 20:58:48 +0800 Subject: [PATCH 097/196] =?UTF-8?q?=E5=88=9B=E5=BB=BA=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=A0=E5=B0=84=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentMapInput.cs | 41 +++++++++++++++++++ .../TrackContents/TrackContentService.cs | 41 +++++++++++++++++++ .../ITrackContentRepository.cs | 2 + .../GetTrackContentMapDetailOutputVO.cs | 10 +++++ .../Repositories/TrackContentRepository.cs | 6 +++ 5 files changed, 100 insertions(+) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs new file mode 100644 index 00000000..e952cc62 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs @@ -0,0 +1,41 @@ +namespace SJZY.Track.Application.Contract.Dtos.TrackContents; + +public class EditTrackContentMapInput +{ + public int? Id { get; set; } + + /// + /// 映射子系统id + /// + public int MapSubSystemId { get; set; } + + /// + /// 映射轨迹内容代码 + /// + public string MapTrackContentCode { get; set; } + + /// + /// 映射轨迹内容id + /// + public int MapTrackContentId { get; set; } + + /// + /// 操作类型 + /// + public OptionTypeNoNull Options { get; set; } + + /// + /// 源子系统id + /// + public int SubSystemId { get; set; } + + /// + /// 源轨迹内容代码 + /// + public string TrackContentCode { get; set; } + + /// + /// 源轨迹内容id + /// + public int TrackContentId { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 542b0612..9201b16f 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,9 +1,13 @@ using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Common.Dto; +using SJZY.Expand.ABP.Core.Localization; using SJZY.Track.Application.Contract.Dtos.TrackContents; +using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Dtos.TrackContents; +using System.Linq.Expressions; using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackContents @@ -160,5 +164,42 @@ namespace SJZY.Track.Application.Services.TrackContents { return await _trackContentRepository.GetMapDetailAsync(id); } + + /// + /// 轨迹内容映射编辑 + /// + /// + /// + [HttpPost("EditMap")] + public async Task EditMapAsync([FromBody] EditTrackContentMapInput input) + { + if (input.Options != OptionTypeNoNull.删除) + { + Expression> isMapAnyExp = x => + x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId; + if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id); + + if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp)) + throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]); + } + + switch (input.Options) + { + case OptionTypeNoNull.新增: + break; + + case OptionTypeNoNull.删除: + break; + + case OptionTypeNoNull.修改: + 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.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index cb4c9a4f..30439f50 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -11,4 +11,6 @@ public interface ITrackContentRepository : IBasicRepository Task> GetMapPageAsync(GetTrackContentMapPageInputVO input); Task GetMapDetailAsync(int id); + + Task IsMapAnyAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs index b5755d21..dce4eff9 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentMapDetailOutputVO.cs @@ -43,4 +43,14 @@ public class GetTrackContentMapDetailOutputVO /// 源轨迹内容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.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index a186543a..d21dad20 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -3,6 +3,7 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.VEntities; +using System.Linq.Expressions; namespace SJZY.Track.Repository.Repositories; @@ -138,4 +139,9 @@ public class TrackContentRepository : BasicRepository, ITrac }, true) .SingleAsync(); } + + public async Task IsMapAnyAsync(Expression> whereExpression) + { + return await Context.Queryable().Where(whereExpression).AnyAsync(); + } } \ No newline at end of file From ad56431c397a675fbcdcf889067bb022795521a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 21:11:43 +0800 Subject: [PATCH 098/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=A0=E5=B0=84=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContentAutoMapperProfile.cs | 1 + .../TrackContents/TrackContentService.cs | 17 ++++++++++++-- .../ITrackContentRepository.cs | 8 +++++++ .../Repositories/TrackContentRepository.cs | 23 +++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs index 25f17ab6..bf20809b 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -15,6 +15,7 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>( MemberList.None); + CreateMap(MemberList.None); } } } \ 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 index 9201b16f..50546355 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -186,12 +186,25 @@ namespace SJZY.Track.Application.Services.TrackContents switch (input.Options) { case OptionTypeNoNull.新增: - break; + { + var trackContentMapEntity = ObjectMapper.Map(input); - case OptionTypeNoNull.删除: + 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: diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index 30439f50..2f04f35b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -13,4 +13,12 @@ public interface ITrackContentRepository : IBasicRepository Task GetMapDetailAsync(int id); Task IsMapAnyAsync(Expression> whereExpression); + + Task InsertMapAsync(TrackContentMapEntity insertObj); + + Task GetMapByIdAsync(int id); + + Task UpdateMapAsync(TrackContentMapEntity updateObj); + + Task SoftDeleteMapAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index d21dad20..41c51ae7 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -144,4 +144,27 @@ public class TrackContentRepository : BasicRepository, ITrac { 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(); + } } \ No newline at end of file From e40ea3bdbab25a47ab0facd2577cafc024e69fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 21:42:32 +0800 Subject: [PATCH 099/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 30 +++++++++++++++++-- .../ITrackContentRepository.cs | 2 ++ .../Repositories/TrackContentRepository.cs | 7 +++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 50546355..b746323f 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Common.Dto; using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Contract.Dtos.TrackContents; using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; @@ -122,8 +123,33 @@ namespace SJZY.Track.Application.Services.TrackContents //更新的时候需要覆盖内容映射轨迹代码 var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); - ObjectMapper.Map(input, templateEntity); - var isTrue = await _trackContentRepository.UpdateAsync(templateEntity); + + bool isTrue = false; + + using (var ts = TransactionScopeHelper.Create()) + { + // 如果轨迹内容的子系统和code发生变化,同步到轨迹映射表 + if (templateEntity.SubSystemId != input.SubSystemId || templateEntity.Code != input.Code) + { + await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity + { + SubSystemId = input.SubSystemId, + TrackContentCode = input.Code + }, x => x.TrackContentId == input.Id); + + await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity + { + MapSubSystemId = input.SubSystemId, + MapTrackContentCode = input.Code + }, x => x.MapTrackContentId == input.Id); + } + + ObjectMapper.Map(input, templateEntity); + + isTrue = await _trackContentRepository.UpdateAsync(templateEntity); + + ts.Complete(); + } return new UnifyResultDto("200", "修改成功", isTrue); } diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index 2f04f35b..cc7a54e9 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -21,4 +21,6 @@ public interface ITrackContentRepository : IBasicRepository Task UpdateMapAsync(TrackContentMapEntity updateObj); Task SoftDeleteMapAsync(Expression> whereExpression); + + Task UpdateMapAsync(Expression> columns, Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 41c51ae7..6946391e 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -3,6 +3,7 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.VEntities; +using System.Linq; using System.Linq.Expressions; namespace SJZY.Track.Repository.Repositories; @@ -167,4 +168,10 @@ public class TrackContentRepository : BasicRepository, ITrac .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 From 777cf29baa2695fd3cee06d3c6131973c70743f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 22:11:45 +0800 Subject: [PATCH 100/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushService.cs | 30 ++++++++++++++----- .../GetTrackPushConfigDetailOutputVO.cs | 5 ++++ src/SJZY.Track.Domain/GlobalConst.cs | 7 ++++- .../Repositories/TrackPushConfigRepository.cs | 1 + 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 7c8489ed..02a09ce4 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -1,8 +1,10 @@ using Microsoft.Extensions.Localization; +using SJZY.Expand.ABP.Core; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; +using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; @@ -66,7 +68,7 @@ public class TrackPushService : ApplicationService, ITransientDependency /// /// [HttpGet("GetDetail")] - public async Task GetDetailAsync(int id) + public async Task GetDetailAsync(int id) { var res = await _trackPushConfigRepository.GetDetailAsync(id); if (res is null) return null; @@ -126,6 +128,8 @@ public class TrackPushService : ApplicationService, ITransientDependency trackPushParamsEntity.PullOrPushConfigId = id; await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity); + if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + ts.Complete(); } } @@ -135,6 +139,8 @@ public class TrackPushService : ApplicationService, ITransientDependency { 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); @@ -147,22 +153,30 @@ public class TrackPushService : ApplicationService, ITransientDependency await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity); await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity); + await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldCustomId); + if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + ts.Complete(); } } break; case OptionTypeNoNull.删除: - 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); + var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); - ts.Complete(); + using (var ts = TransactionScopeHelper.Create()) + { + await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id); + await _trackPullConfigRepository.SoftDeleteParamsAsync(x => + x.PullOrPushConfigId == input.Id && x.IsPush); + await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id); + + await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId); + + ts.Complete(); + } } - break; default: diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs index 900c74bc..ced23f75 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigDetailOutputVO.cs @@ -91,6 +91,11 @@ public class GetTrackPushConfigDetailOutputVO /// public string TrackTemplateId { get; set; } + /// + /// 轨迹模板ids + /// + public List TrackTemplateIds { get; set; } + /// /// 推送轨迹发生时间 /// diff --git a/src/SJZY.Track.Domain/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs index 77881f20..8db2300c 100644 --- a/src/SJZY.Track.Domain/GlobalConst.cs +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -6,9 +6,14 @@ public class GlobalConst /// 轨迹明细es索引名称 /// public const string TrackIndex = "sjzy_track_details"; - + /// /// 轨迹新增/更新cap订阅名称 /// public const string TrackUpsertSubscribe = "SJZY.Track.Upsert"; + + /// + /// 自动推送名单RedisKey + /// + public const string AutoPushRosterRedisKey = "AutoPushRoster"; } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 9c2cb3d2..1cec950d 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -68,6 +68,7 @@ public class TrackPushConfigRepository : BasicRepository, CustomName = externalSubject.Abbreviation, ServiceProvider = service.Name, }, true) + .Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); }) .SingleAsync(); } From a327f0bcbf0209f8ed59a79a1db2e0011f1c0ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 23:08:25 +0800 Subject: [PATCH 101/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPull/EditTrackPullConfigInput.cs | 12 ++++++------ .../Dtos/TrackPush/SortTrackPushContentInput.cs | 9 +++++++++ .../Services/TrackPush/TrackPushService.cs | 11 +++++++++++ .../TrackTemplates/TrackTemplateService.cs | 16 ++++++++++------ .../Dtos/Common/KeywordsInputVO.cs | 2 +- .../TrackPush/GetTrackPushConfigPageOutputVO.cs | 10 ++++++++++ .../GetTrackTemplateContentPageInputVO.cs | 2 +- .../GetTrackTemplateContentPageOutputVO.cs | 5 +++++ .../Repositories/TrackPushConfigRepository.cs | 2 ++ .../Repositories/TrackTemplateRepository.cs | 5 ++--- 10 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs index 61e15c3e..0b69d4a5 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -37,27 +37,27 @@ public class EditTrackPullConfigInput /// /// 拉取轨迹时区 /// - public string TackTimeZoneName { get; set; } + public string? TackTimeZoneName { get; set; } /// /// 拉取轨迹内容代码 /// - public string TrackContentCodeName { get; set; } + public string? TrackContentCodeName { get; set; } /// /// 拉取轨迹内容 /// - public string TrackContentName { get; set; } + public string? TrackContentName { get; set; } /// /// 拉取轨迹发生地 /// - public string TrackPlaceName { get; set; } + public string? TrackPlaceName { get; set; } /// /// 拉取轨迹状态 /// - public string TrackStatusName { get; set; } + public string? TrackStatusName { get; set; } /// /// 轨迹模板id @@ -67,5 +67,5 @@ public class EditTrackPullConfigInput /// /// 拉取轨迹发生时间 /// - public string TrackTimeName { get; set; } + public string? TrackTimeName { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs new file mode 100644 index 00000000..9d68df98 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -0,0 +1,9 @@ +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/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 02a09ce4..cbb9a835 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -237,4 +237,15 @@ public class TrackPushService : ApplicationService, ITransientDependency return true; } + + /// + /// 轨迹推送配置内容排序 + /// + /// + /// + [HttpPost("SortContent")] + public async Task SortContentAsync([FromBody] SortTrackPushContentInput input) + { + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 367f2cda..78a5401d 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -30,7 +30,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; - _trackPullConfigRepository=trackPullConfigRepository; + _trackPullConfigRepository = trackPullConfigRepository; } /// @@ -99,7 +99,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } - #endregion + #endregion 业务校验 var entity = ObjectMapper.Map(input); var isTrue = await _trackTemplateRepository.InsertAsync(entity); @@ -110,13 +110,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task UpdateAsync(EditTrackTemplateInput input) { #region 业务校验 + var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { throw new BusinessException(message: _stringLocalizer["TemplateExist"]); } - #endregion + + #endregion 业务校验 var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); ObjectMapper.Map(input, templateEntity); @@ -128,13 +130,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency private async Task DeleteAsync(EditTrackTemplateInput input) { #region 业务校验 + //查询看看在轨迹拉取里面有没有被占用 - var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId==input.Id); - if (isExisistTrackPullConfig!=null) + var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id); + if (isExisistTrackPullConfig != null) { throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); } - #endregion + + #endregion 业务校验 var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs index 2e58c378..f46e3c41 100644 --- a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -15,5 +15,5 @@ public class KeywordsInputVO : PageInfoInput /// /// 选中项 /// - public int? SelectedId { get; set; } + public List? SelectedId { 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 index 9b2e3a83..e0095b23 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs @@ -23,4 +23,14 @@ public class GetTrackPushConfigPageOutputVO /// 模板名称 /// public string TrackTemplate { get; set; } + + /// + /// 轨迹模板id + /// + public string TrackTemplateId { get; set; } + + /// + /// 轨迹模板ids + /// + public List TrackTemplateIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs index d08ad492..09e8f51f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -5,5 +5,5 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public List TrackTemplateIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs index dd3a27d4..18d6ddcc 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs @@ -68,4 +68,9 @@ public class GetTrackTemplateContentPageOutputVO /// 修改人 /// public string UpdateUser { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 1cec950d..472a8908 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -32,9 +32,11 @@ public class TrackPushConfigRepository : BasicRepository, TrackTemplate = SqlFunc.Subqueryable() .Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted) .SelectStringJoin(template => template.Name, ","), + TrackTemplateId = trackPush.TrackTemplateId, CreateTime = trackPush.CreateTime }) .Distinct() + .Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 6fe279f7..af67ce40 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -20,7 +20,7 @@ public class TrackTemplateRepository : BasicRepository, ITr public async Task GetDetailAsync(int id) { var detail = await Context.Queryable() - .LeftJoin((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false) + .LeftJoin((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false) .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO @@ -84,8 +84,7 @@ public class TrackTemplateRepository : BasicRepository, ITr (templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) .Filter(null, true) - .Where(templateContent => - templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted) + .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) .OrderByDescending(templateContent => templateContent.CreateTime) .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO From a4718386f1cad7b0961bdc6e1948bd5a09500a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Fri, 1 Mar 2024 23:21:49 +0800 Subject: [PATCH 102/196] =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPush/SortTrackPushContentInput.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs index 9d68df98..f4ecab4c 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -2,8 +2,4 @@ public class SortTrackPushContentInput { - /// - /// 排序信息 - /// - public List> SortInfo { get; set; } } \ No newline at end of file From e2802de99ebaddf7ca8978e24adb7444a21e7e59 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:10:00 +0800 Subject: [PATCH 103/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackTemplates/TrackTemplateService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 367f2cda..2365b632 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -96,7 +96,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency a => a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (templateEntity != null) { - throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + throw new BusinessException("轨迹代码重复"); } #endregion From 6d7c28652b217e43fd96f10e1ccd91781961ab87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 09:13:43 +0800 Subject: [PATCH 104/196] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPush/SortTrackPushContentInput.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs index f4ecab4c..9d68df98 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -2,4 +2,8 @@ public class SortTrackPushContentInput { + /// + /// 排序信息 + /// + public List> SortInfo { get; set; } } \ No newline at end of file From 4e6b9671e1c7174ffabd950d54631993607e6cc5 Mon Sep 17 00:00:00 2001 From: dingenwen <543338760@qq.com> Date: Sat, 2 Mar 2024 09:17:16 +0800 Subject: [PATCH 105/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 17cba222..ee14984d 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -5,7 +5,7 @@ "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" ] } From 6ab8472a4cf8cd76b2c98cedddb4673188ecf922 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:41:05 +0800 Subject: [PATCH 106/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 6fdf4498..8d51d3e9 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -4,6 +4,7 @@ using SJZY.Expand.ABP.Core.Localization; 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; @@ -20,17 +21,20 @@ 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 + ITrackPullConfigRepository trackPullConfigRepository, + ITrackPushConfigRepository trackPushConfigRepository ) { _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; _trackPullConfigRepository = trackPullConfigRepository; + _trackPushConfigRepository=trackPushConfigRepository; } /// @@ -97,7 +101,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (templateEntity != null) { //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); - throw new BusinessException("轨迹代码重复"); + throw new BusinessException("模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -116,7 +120,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) { - throw new BusinessException(message: _stringLocalizer["TemplateExist"]); + throw new BusinessException(message: _stringLocalizer["模板代码已存在于当前选择的子系统下"]); } #endregion 业务校验 @@ -133,10 +137,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency #region 业务校验 //查询看看在轨迹拉取里面有没有被占用 - var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id); - if (isExisistTrackPullConfig != null) + var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); + if (isExisistTrackPullConfigs.Any()) { - throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + throw new BusinessException(message: _stringLocalizer["轨迹拉取配置里已经绑定模版,请检查"]); + } + //轨迹推送里看看是否被占用 + var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); + if (isExisistTrackPushConfigs.Any()) + { + throw new BusinessException(message: _stringLocalizer["轨迹推送配置里已经绑定模版,请检查"]); } #endregion 业务校验 From 2dc9c7f31b8e15df40e60b7a8e677b2980016e91 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:50:31 +0800 Subject: [PATCH 107/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 686854db..b742ae81 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -92,7 +92,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); if (trackStatusEntity != null) { - throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -112,7 +113,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); if (trackStatusEntity != null) { - throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); + throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -130,7 +132,8 @@ public class TrackStatusService : ApplicationService, ITransientDependency var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id); if (isExistStatus!=null) { - throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); + throw new BusinessException("轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); From e9128e1985ab134fecbad2476b0e12b8db2323bf Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:54:40 +0800 Subject: [PATCH 108/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index b742ae81..50bbbdae 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -87,10 +87,10 @@ public class TrackStatusService : ApplicationService, ITransientDependency { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId && + var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); @@ -108,10 +108,10 @@ public class TrackStatusService : ApplicationService, ITransientDependency { #region 业务校验 - var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id && + 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 (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); From e1958fe96e45cc1a8e782ce6ed86d7e9074076cb Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:59:04 +0800 Subject: [PATCH 109/196] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackStatus/TrackStatusService.cs | 6 +++--- .../Services/TrackTemplates/TrackTemplateService.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 50bbbdae..5dad92e8 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -93,7 +93,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -114,7 +114,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException("当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); } #endregion @@ -133,7 +133,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (isExistStatus!=null) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); - throw new BusinessException("轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); + throw new BusinessException(message: "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 8d51d3e9..f084dc2c 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -101,7 +101,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (templateEntity != null) { //throw new BusinessException(message: _stringLocalizer["TemplateExist"]); - throw new BusinessException("模板代码已存在于当前选择的子系统下"); + throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -119,8 +119,8 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) - { - throw new BusinessException(message: _stringLocalizer["模板代码已存在于当前选择的子系统下"]); + { + throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); } #endregion 业务校验 @@ -140,14 +140,14 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); if (isExisistTrackPullConfigs.Any()) { - //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); - throw new BusinessException(message: _stringLocalizer["轨迹拉取配置里已经绑定模版,请检查"]); + //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: _stringLocalizer["轨迹推送配置里已经绑定模版,请检查"]); + throw new BusinessException(message: "轨迹推送配置里已经绑定模版,请检查"); } #endregion 业务校验 From 92f61e1a1bea4a4e3f49dc3a8f4a155a774f2d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 10:00:08 +0800 Subject: [PATCH 110/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPush/SortTrackPushContentInput.cs | 6 ++++-- .../Services/TrackPush/TrackPushService.cs | 12 +++++++++++- .../TrackPushAggregate/ITrackPushConfigRepository.cs | 4 ++++ .../Repositories/TrackPushConfigRepository.cs | 10 ++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs index 9d68df98..ed095f3e 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs @@ -1,9 +1,11 @@ -namespace SJZY.Track.Application.Contract.Dtos.TrackPush; +using SJZY.Expand.ABP.Core.PublicMethords; + +namespace SJZY.Track.Application.Contract.Dtos.TrackPush; public class SortTrackPushContentInput { /// /// 排序信息 /// - public List> SortInfo { get; set; } + public List SortInfo { get; set; } } \ 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 index cbb9a835..85ef0633 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -4,7 +4,6 @@ using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Localization; -using SJZY.Track.Domain.Aggregates.DemoAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; @@ -246,6 +245,17 @@ public class TrackPushService : ApplicationService, ITransientDependency [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.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 808cc3ac..3d33a4ee 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -22,4 +22,8 @@ public interface ITrackPushConfigRepository : IBasicRepository GetContentByIdAsync(int id); Task UpdateContentAsync(TrackPushContentConfigEntity updateObj); + + Task> GetContentListAsync(Expression> whereExpression); + + Task UpdateContentRangeAsync(List updateObjs); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 472a8908..29300b59 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -114,4 +114,14 @@ public class TrackPushConfigRepository : BasicRepository, { 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(); + } } \ No newline at end of file From 6c10a6e21c5bee22f368cadf12cb9090cb495b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 10:07:59 +0800 Subject: [PATCH 111/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E6=8E=92=E5=BA=8F=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SortTrackTemplateContentInput.cs | 11 +++++++ .../TrackTemplates/TrackTemplateService.cs | 29 +++++++++++++++++-- .../ITrackTemplateRepository.cs | 2 ++ .../Repositories/TrackTemplateRepository.cs | 5 ++++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs 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/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index f084dc2c..a250f22b 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,6 +1,7 @@ using System.Linq.Expressions; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; +using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; @@ -34,7 +35,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency _stringLocalizer = stringLocalizer; _trackTemplateRepository = trackTemplateRepository; _trackPullConfigRepository = trackPullConfigRepository; - _trackPushConfigRepository=trackPushConfigRepository; + _trackPushConfigRepository = trackPushConfigRepository; } /// @@ -119,7 +120,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); if (isExist != null) - { + { throw new BusinessException(message: "模板代码已存在于当前选择的子系统下"); } @@ -140,7 +141,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id); if (isExisistTrackPullConfigs.Any()) { - //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查"); } //轨迹推送里看看是否被占用 @@ -234,4 +235,26 @@ public class TrackTemplateService : ApplicationService, ITransientDependency 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.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index 13d2ff0a..3654043b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -35,4 +35,6 @@ public interface ITrackTemplateRepository : IBasicRepository> GetContentListAsync( Expression> whereExpression); + + Task UpdateContentRangeAsync(List updateObjs); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index af67ce40..21eef31e 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -158,4 +158,9 @@ public class TrackTemplateRepository : BasicRepository, ITr { return await Context.Queryable().Where(whereExpression).ToListAsync(); } + + public async Task UpdateContentRangeAsync(List updateObjs) + { + return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file From f569a16f60d3139ea672260f0e9bf9070e6d6f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 10:44:24 +0800 Subject: [PATCH 112/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs | 2 +- .../Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs | 5 +++++ .../Repositories/TrackTemplateRepository.cs | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs index f46e3c41..8cbe4413 100644 --- a/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs @@ -15,5 +15,5 @@ public class KeywordsInputVO : PageInfoInput /// /// 选中项 /// - public List? SelectedId { 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 index 09e8f51f..14b1f0ee 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -6,4 +6,9 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput /// 轨迹模板id /// public List TrackTemplateIds { get; set; } + + /// + /// 选中项 + /// + public List? SelectedIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 21eef31e..0bcc56c2 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -85,7 +85,8 @@ public class TrackTemplateRepository : BasicRepository, ITr templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) .Filter(null, true) .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) - .OrderByDescending(templateContent => templateContent.CreateTime) + .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, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO { From 925bf307b96b9d81e7955ed7f51a056d48ef6b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 11:03:12 +0800 Subject: [PATCH 113/196] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 14 +++++++------- .../GetTrackTemplateContentDetailOutputVO.cs | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 17cba222..676973d6 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -1,6 +1,6 @@ { "Configuration": { - "UseLocalConfiguration": true, //是否使用本地配置文件 + "UseLocalConfiguration": false, //是否使用本地配置文件 "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration时生效 "Apollo": { "AppId": "SJZY.Track.Configuration", @@ -9,12 +9,12 @@ "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.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs index 4e8a8f45..c4474ba2 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDetailOutputVO.cs @@ -38,4 +38,9 @@ public class GetTrackTemplateContentDetailOutputVO /// 轨迹状态id /// public int TrackStatusId { get; set; } + + /// + /// 轨迹模板id + /// + public int TrackTemplateId { get; set; } } \ No newline at end of file From 0352b77dcfc26ce4ebf1d58361b4750f6f27229a Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 11:03:33 +0800 Subject: [PATCH 114/196] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetPageTrackOrderInput.cs | 5 +++++ .../Services/TrackContents/TrackContentService.cs | 15 ++++++++------- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 7 ++++++- .../Repositories/OrderRepository.cs | 1 + .../Repositories/TrackContentRepository.cs | 6 ++---- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index be5dbb69..7ae6fd7a 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -83,6 +83,11 @@ public class TrackOrderDto /// public string? NewestTrackPlace { get; set; } + /// + /// 最新轨迹时间 + /// + public DateTime? NewestTrackTime { get; set; } + /// /// 是否完结 /// diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index b746323f..82e7bba1 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -91,12 +91,13 @@ namespace SJZY.Track.Application.Services.TrackContents { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => + var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Content == input.Content || a.EnContent == input.EnContent)); - if (trackContentEntity != null) + if (trackContentEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } #endregion 业务逻辑校验 @@ -111,14 +112,14 @@ namespace SJZY.Track.Application.Services.TrackContents { #region 业务逻辑校验 - var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id && + 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 (trackContentEntity != null) + if (trackContentEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); + throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } - #endregion 业务逻辑校验 //更新的时候需要覆盖内容映射轨迹代码 diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 44567900..35ad2966 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -47,7 +47,7 @@ namespace SJZY.Track.Domain.Dtos.Order /// /// 订单名称 /// - public string OrderTypeName { get; set; } + public string OrderTypeName { get; set; } /// /// 订单号 @@ -89,6 +89,11 @@ namespace SJZY.Track.Domain.Dtos.Order /// public string? NewestTrackPlace { get; set; } + /// + /// 最新轨迹时间 + /// + public DateTime? NewestTrackTime { get; set; } + /// /// 是否完结 /// diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 05fc2db1..ac5b7f61 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -127,6 +127,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I NewestTrackContent = a.LatestTrackContent, NewestTrackEnContent = a.LatestTrackEnContent, NewestTrackPlace = a.LatestTrackPlace, + NewestTrackTime = a.LatestTrackTime, IsFinish = a.IsCompleted, CreateTime = a.CreateTime, SubSystem = c.CnName diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 6946391e..673bb0b5 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -72,8 +72,8 @@ public class TrackContentRepository : BasicRepository, ITrac 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("派送") + 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, @@ -83,8 +83,6 @@ public class TrackContentRepository : BasicRepository, ITrac }) .ToPagedListAsync(input.PageIndex, input.PageSize); - var ff = await Context.Queryable().Where(a => 1 == 1).ToListAsync(); - return pagedList; } From 92ca158be8afb6c568613d0adc0c4dc1e7fe2521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 11:11:20 +0800 Subject: [PATCH 115/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9isany?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 2 +- .../Services/TrackPush/TrackPushService.cs | 8 +++++--- .../Services/TrackTemplates/TrackTemplateService.cs | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 7f1ad2de..5f9bd451 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -91,7 +91,7 @@ public class TrackPullService : ApplicationService, ITransientDependency Expression> isAnyExp = x => x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 85ef0633..0577b1cf 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -104,12 +104,14 @@ public class TrackPushService : ApplicationService, ITransientDependency { Expression> isAnyExp = x => x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); var trackTemplateIdExp = Expressionable.Create(); foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); } - if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp.And(trackTemplateIdExp.ToExpression()))) + isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression()); + + if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]); } @@ -198,7 +200,7 @@ public class TrackPushService : ApplicationService, ITransientDependency { Expression> isContentAnyExp = x => x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId; - if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index a250f22b..621ae61a 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -193,11 +193,11 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { if (input.Options != OptionTypeNoNull.删除) { - Expression> isAnyExp = x => + Expression> isContentAnyExp = x => x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId; - if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); - if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp)) + if (await _trackTemplateRepository.IsContentAnyAsync(isContentAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]); } From 756268cb060f0e61ed7a500df36a14b442c8ef68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 11:25:40 +0800 Subject: [PATCH 116/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPull/EditTrackPullConfigInput.cs | 2 +- .../Dtos/TrackPush/EditTrackPushConfigInput.cs | 18 +++++++++--------- .../TrackPush/EditTrackPushContentInput.cs | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs index 0b69d4a5..f525e755 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -12,7 +12,7 @@ public class EditTrackPullConfigInput /// /// 拉取轨迹订单号 /// - public string OrderNoName { get; set; } + public string? OrderNoName { get; set; } /// /// 返参解析对象 diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs index cf3cb8ee..06b75472 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs @@ -10,7 +10,7 @@ public class EditTrackPushConfigInput /// /// 推送扩展字段 /// - public string ExpandFieldsName { get; set; } + public string? ExpandFieldsName { get; set; } public int? Id { get; set; } @@ -27,7 +27,7 @@ public class EditTrackPushConfigInput /// /// 推送轨迹订单号 /// - public string OrderNoName { get; set; } + public string? OrderNoName { get; set; } /// /// 服务商id @@ -42,32 +42,32 @@ public class EditTrackPushConfigInput /// /// 推送轨迹时区 /// - public string TackTimeZoneName { get; set; } + public string? TackTimeZoneName { get; set; } /// /// 推送轨迹内容代码 /// - public string TrackContentCodeName { get; set; } + public string? TrackContentCodeName { get; set; } /// /// 推送轨迹内容 /// - public string TrackContentName { get; set; } + public string? TrackContentName { get; set; } /// /// 推送轨迹内容英文 /// - public string TrackEnContentName { get; set; } + public string? TrackEnContentName { get; set; } /// /// 推送轨迹发生地 /// - public string TrackPlaceName { get; set; } + public string? TrackPlaceName { get; set; } /// /// 推送轨迹状态 /// - public string TrackStatusName { get; set; } + public string? TrackStatusName { get; set; } /// /// 轨迹模板id @@ -77,5 +77,5 @@ public class EditTrackPushConfigInput /// /// 推送轨迹发生时间 /// - public string TrackTimeName { 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 index ef22fc85..ec85498a 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs @@ -5,7 +5,7 @@ public class EditTrackPushContentInput /// /// 扩展字段参数值 /// - public string ExpandFieldsValue { get; set; } + public string? ExpandFieldsValue { get; set; } public int? Id { get; set; } @@ -27,7 +27,7 @@ public class EditTrackPushContentInput /// /// 轨迹代码参数值 /// - public string TrackContentCodeValue { get; set; } + public string? TrackContentCodeValue { get; set; } /// /// 轨迹内容id @@ -37,12 +37,12 @@ public class EditTrackPushContentInput /// /// 轨迹内容参数值 /// - public string TrackContentValue { get; set; } + public string? TrackContentValue { get; set; } /// /// 轨迹内容英文参数值 /// - public string TrackEnContentValue { get; set; } + public string? TrackEnContentValue { get; set; } /// /// 轨迹推送配置id @@ -52,7 +52,7 @@ public class EditTrackPushContentInput /// /// 轨迹状态参数值 /// - public string TrackStatusValue { get; set; } + public string? TrackStatusValue { get; set; } /// /// 轨迹时区GMT From c977cd1c35e4c9e34da949fbbea20add019d1197 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 11:34:26 +0800 Subject: [PATCH 117/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackContents/GetPageTrackContentInput.cs | 5 +++++ .../Services/TrackContents/TrackContentService.cs | 1 - .../Dtos/TrackContents/GetPageTrackContentVO.cs | 5 +++++ .../Repositories/TrackContentRepository.cs | 4 ++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index de3844b5..7cf94770 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -12,6 +12,11 @@ /// public string? Keywords { get; set; } + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + /// /// 选中的轨迹内容id /// diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 82e7bba1..2e2b8ae7 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -158,7 +158,6 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { #region 业务校验 - //需要加个判断,存在内容映射,则出提示 #endregion 业务校验 diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs index f4b3c65c..d2dc5e29 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -18,6 +18,11 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// public string? Keywords { get; set; } + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + /// /// 选中的轨迹内容id /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 673bb0b5..fe0283e4 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -60,8 +60,8 @@ public class TrackContentRepository : BasicRepository, ITrac .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) - ) + || 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 From d0e25fe708ac3745097653ee043676badd8afd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 11:52:09 +0800 Subject: [PATCH 118/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackPull/GetTrackPullContentPageOutputVO.cs | 16 ++++++++-------- .../Repositories/TrackPullConfigRepository.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs index c05a0375..50ebbe5f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs @@ -22,40 +22,40 @@ public class GetTrackPullContentPageOutputVO /// /// 拉取轨迹内容代码 /// - public string TrackContentCodeValue { get; set; } + public string? TrackContentCodeValue { get; set; } /// /// 拉取轨迹内容 /// - public bool? TrackContentValue { get; set; } + public string? TrackContentValue { get; set; } /// /// 拉取轨迹关键字(正向) /// - public string TrackKeyword { get; set; } + public string? TrackKeyword { get; set; } /// /// 拉取轨迹关键字(正向) /// - public List TrackKeywords { get; set; } + public List? TrackKeywords { get; set; } /// /// 拉取轨迹关键字(反向) /// - public string TrackKeywordReverse { get; set; } + public string? TrackKeywordReverse { get; set; } /// /// 拉取轨迹关键字(反向) /// - public List TrackKeywordsReverse { get; set; } + public List? TrackKeywordsReverse { get; set; } /// /// 轨迹发生地 /// - public string TrackPlaceValue { get; set; } + public string? TrackPlaceValue { get; set; } /// /// 拉取轨迹状态 /// - public string TrackStatusValue { get; set; } + public string? TrackStatusValue { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index 076671d5..f7b735be 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -47,8 +47,8 @@ public class TrackPullConfigRepository : BasicRepository, }, true) .Mapper(x => { - x.TrackKeywords = x.TrackKeyword.Split(',').ToList(); - x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList(); + x.TrackKeywords = x.TrackKeyword?.Split(',').ToList(); + x.TrackKeywordsReverse = x.TrackKeywordReverse?.Split(',').ToList(); }) .ToPagedListAsync(input.PageIndex, input.PageSize); } From cbdba985c2e4dd0b45fe7d793d5a9aa668dc4bd2 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 12:07:11 +0800 Subject: [PATCH 119/196] =?UTF-8?q?=E9=AA=8C=E8=AF=81=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=20=E9=A1=B5=E9=9D=A2=20=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E6=98=BE=E7=A4=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE-=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8C=89=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackFlags/TrackFlagService.cs | 16 ++++++++-------- .../Repositories/OrderRepository.cs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index 01e9acd4..d46b6d96 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -86,14 +86,13 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task AddAsync(EditTrackFlagInput input) { #region 业务校验 - - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => + var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); } - #endregion var entity = ObjectMapper.Map(input); @@ -106,12 +105,13 @@ namespace SJZY.Track.Application.Services.TrackFlags { #region 业务校验 - var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id && + var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntity != null) + if (trackStatusEntitys.Any()) { - throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); + throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); } #endregion diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index ac5b7f61..ed618ea4 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -112,6 +112,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I (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, From b21b6402e95fc0dafbb5df19fe91edb99457a33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 12:42:48 +0800 Subject: [PATCH 120/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 3 +++ .../Services/TrackPush/TrackPushService.cs | 2 +- .../TrackPullAggregate/ITrackPullConfigRepository.cs | 2 ++ .../Repositories/TrackPullConfigRepository.cs | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 5f9bd451..65cb52d7 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -208,6 +208,9 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { + if (await _trackPullConfigRepository.IsContentAnyAsync(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == input.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackKeyword == input.TrackKeyword))) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]); + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 0577b1cf..75aa1231 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -199,7 +199,7 @@ public class TrackPushService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isContentAnyExp = x => - x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId; + x.TrackPushConfigId == input.TrackPushConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == x.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackEnContentValue == input.TrackEnContentValue); if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index c7a36732..7b7dec1f 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -48,4 +48,6 @@ public interface ITrackPullConfigRepository : IBasicRepository GetContentByIdAsync(int id); Task UpdateContentAsync(TrackPullContentConfigEntity updateObj); + + Task IsContentAnyAsync(Expression> whereExpression); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index f7b735be..0792d7b0 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -130,4 +130,9 @@ public class TrackPullConfigRepository : BasicRepository, { 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 From 884a802481e87db022d3b4cf935e74bfd31abfb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 12:47:20 +0800 Subject: [PATCH 121/196] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPush/EditTrackPushConfigInput.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs index 06b75472..b462f6a4 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs @@ -72,7 +72,7 @@ public class EditTrackPushConfigInput /// /// 轨迹模板id /// - public List TrackTemplateIds { get; set; } + public List? TrackTemplateIds { get; set; } /// /// 推送轨迹发生时间 From fefc52638a6153cc342cf470aef57221f882b93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 13:01:35 +0800 Subject: [PATCH 122/196] =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackTemplateRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 0bcc56c2..d97ef892 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -99,6 +99,7 @@ public class TrackTemplateRepository : BasicRepository, ITr UpdateTime = templateContent.UpdateTime, UpdateUser = updateUser.Name }, true) + .Distinct() .ToPagedListAsync(input.PageIndex, input.PageSize); } From bed691aa71569b01ee9e9f9d2367a82366fd973f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 13:52:51 +0800 Subject: [PATCH 123/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPull/UpdateTrackPullContentInput.cs | 14 +++++++------- .../AutoMapper/TrackPullAutoMapperProfile.cs | 12 +++++++++++- .../Services/TrackPull/TrackPullService.cs | 13 ++++++++++++- .../TrackPull/GetTrackPullContentDetailOutputVO.cs | 10 ++++++++++ .../TrackPull/GetTrackPullContentPageOutputVO.cs | 10 ---------- .../Repositories/TrackPullConfigRepository.cs | 10 +++++----- 6 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs index 077f8e0a..6f3c76dd 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -7,7 +7,7 @@ public class UpdateTrackPullContentInput /// /// 服务商轨迹代码参数值 /// - public string TrackContentCodeValue { get; set; } + public string? TrackContentCodeValue { get; set; } /// /// 轨迹内容id @@ -17,17 +17,17 @@ public class UpdateTrackPullContentInput /// /// 服务商轨迹内容参数值 /// - public string TrackContentValue { 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; } /// /// 轨迹发生地参数值 @@ -42,7 +42,7 @@ public class UpdateTrackPullContentInput /// /// 服务商轨迹状态参数值 /// - public string TrackStatusValue { get; set; } + public string? TrackStatusValue { get; set; } /// /// 轨迹时区GMT diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 2af35a86..dbd0f338 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -12,6 +12,16 @@ public class TrackPullAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None).Ignore(dest => dest.Id) .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); - CreateMap(MemberList.None); + CreateMap(MemberList.None) + .ForMember(dest => dest.TrackKeyword, opt => + { + opt.Condition(src => !src.TrackKeywords.IsNullOrEmpty()); + opt.MapFrom(src => string.Join(',', src.TrackKeywords)); + }) + .ForMember(dest => dest.TrackKeywordReverse, opt => + { + opt.Condition(src => !src.TrackKeywordReverses.IsNullOrEmpty()); + opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)); + }); } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 65cb52d7..e78dc0ad 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -5,9 +5,11 @@ 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.TrackPushAggregate; 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; @@ -208,7 +210,16 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { - if (await _trackPullConfigRepository.IsContentAnyAsync(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == input.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackKeyword == input.TrackKeyword))) + Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId; + + var trackKeywordExp = Expressionable.Create() + .And(x => x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == input.TrackStatusValue || x.TrackContentValue == input.TrackContentValue); + + input.TrackKeywords?.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); + + isContentAnyExp = isContentAnyExp.And(trackKeywordExp.ToExpression()); + + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]); var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs index f29ab75f..a4193512 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -29,11 +29,21 @@ public class GetTrackPullContentDetailOutputVO /// public string TrackKeyword { get; set; } + /// + /// 拉取轨迹关键字(正向) + /// + public List? TrackKeywords { get; set; } + /// /// 拉取轨迹关键字(反向) /// public string TrackKeywordReverse { get; set; } + /// + /// 拉取轨迹关键字(反向) + /// + public List? TrackKeywordReverses { get; set; } + /// /// 拉取轨迹发生地 /// diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs index 50ebbe5f..a1c52026 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentPageOutputVO.cs @@ -34,21 +34,11 @@ public class GetTrackPullContentPageOutputVO /// public string? TrackKeyword { get; set; } - /// - /// 拉取轨迹关键字(正向) - /// - public List? TrackKeywords { get; set; } - /// /// 拉取轨迹关键字(反向) /// public string? TrackKeywordReverse { get; set; } - /// - /// 拉取轨迹关键字(反向) - /// - public List? TrackKeywordsReverse { get; set; } - /// /// 轨迹发生地 /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index 0792d7b0..aaf3f8b9 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -45,11 +45,6 @@ public class TrackPullConfigRepository : BasicRepository, { Id = pullContent.Id }, true) - .Mapper(x => - { - x.TrackKeywords = x.TrackKeyword?.Split(',').ToList(); - x.TrackKeywordsReverse = x.TrackKeywordReverse?.Split(',').ToList(); - }) .ToPagedListAsync(input.PageIndex, input.PageSize); } @@ -82,6 +77,11 @@ public class TrackPullConfigRepository : BasicRepository, Id = pullContent.Id, Code = trackContent.Code + "-" + trackContent.Content, }, true) + .Mapper(x => + { + x.TrackKeywords = x.TrackKeyword?.Split(',').ToList(); + x.TrackKeywordsReverse = x.TrackKeywordReverse?.Split(',').ToList(); + }) .SingleAsync(); } From 046999c208bddc2c8877689ca58f9600ece76eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 13:54:26 +0800 Subject: [PATCH 124/196] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackPullConfigRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs index aaf3f8b9..3a381a0f 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPullConfigRepository.cs @@ -80,7 +80,7 @@ public class TrackPullConfigRepository : BasicRepository, .Mapper(x => { x.TrackKeywords = x.TrackKeyword?.Split(',').ToList(); - x.TrackKeywordsReverse = x.TrackKeywordReverse?.Split(',').ToList(); + x.TrackKeywordReverses = x.TrackKeywordReverse?.Split(',').ToList(); }) .SingleAsync(); } From b95ca01d620cdf1be516f9af30a9317597da8801 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 14:20:23 +0800 Subject: [PATCH 125/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20=20=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E6=94=B9=E6=88=90=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetPageTrackOrderInput.cs | 7 ++++++- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 8 +++++++- src/SJZY.Track.Repository/Repositories/OrderRepository.cs | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 7ae6fd7a..ee323b86 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -7,10 +7,15 @@ public class GetPageTrackOrderInput : PageInfoInput /// public int SubSystemId { get; set; } + ///// + ///// 单号 + ///// + //public List? OrderNos { get; set; } + /// /// 单号 /// - public List? OrderNos { get; set; } + public string? OrderNos { get; set; } /// /// 创建时间开始 diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 35ad2966..b32b1327 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -13,10 +13,16 @@ namespace SJZY.Track.Domain.Dtos.Order /// public int SubSystemId { get; set; } + ///// + ///// 单号 + ///// + //public List? OrderNos { get; set; } + + /// /// 单号 /// - public List? OrderNos { get; set; } + public string? OrderNos { get; set; } /// /// 创建时间开始 diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index ed618ea4..77fd218d 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -101,11 +101,17 @@ public class OrderRepository : BasicRepository, IOrderRepository, I /// 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(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo)) + .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), From 904b44e26223471d01535a0c44d7b991e734ca64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 14:41:15 +0800 Subject: [PATCH 126/196] =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/EditTrackContentMapInput.cs | 12 ++-- .../TrackPull/EditTrackPullConfigInput.cs | 10 +-- .../EditTrackTemplateContentInput.cs | 13 ++-- .../TrackContents/TrackContentService.cs | 6 +- .../EditTrackContentMapInputValidation.cs | 45 +++++++++++++ .../EditTrackPullConfigInputValidation.cs | 64 +++++++++++++++++++ ...EditTrackTemplateContentInputValidation.cs | 37 +++++++++++ 7 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs create mode 100644 src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs create mode 100644 src/SJZY.Track.Application/Validations/TrackTemplates/EditTrackTemplateContentInputValidation.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs index e952cc62..e207654d 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs @@ -7,17 +7,17 @@ public class EditTrackContentMapInput /// /// 映射子系统id /// - public int MapSubSystemId { get; set; } + public int? MapSubSystemId { get; set; } /// /// 映射轨迹内容代码 /// - public string MapTrackContentCode { get; set; } + public string? MapTrackContentCode { get; set; } /// /// 映射轨迹内容id /// - public int MapTrackContentId { get; set; } + public int? MapTrackContentId { get; set; } /// /// 操作类型 @@ -27,15 +27,15 @@ public class EditTrackContentMapInput /// /// 源子系统id /// - public int SubSystemId { get; set; } + public int? SubSystemId { get; set; } /// /// 源轨迹内容代码 /// - public string TrackContentCode { get; set; } + public string? TrackContentCode { get; set; } /// /// 源轨迹内容id /// - public int TrackContentId { get; set; } + public int? TrackContentId { 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 index f525e755..2803a4b3 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs @@ -17,22 +17,22 @@ public class EditTrackPullConfigInput /// /// 返参解析对象 /// - public int ParseMethod { get; set; } + public int? ParseMethod { get; set; } /// /// 定时任务(分钟) /// - public int PullInterval { get; set; } + public int? PullInterval { get; set; } /// /// 服务商id /// - public int ServiceProviderId { get; set; } + public int? ServiceProviderId { get; set; } /// /// 子系统id /// - public int SubSystemId { get; set; } + public int? SubSystemId { get; set; } /// /// 拉取轨迹时区 @@ -62,7 +62,7 @@ public class EditTrackPullConfigInput /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public int? TrackTemplateId { get; set; } /// /// 拉取轨迹发生时间 diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs index 0c7144fc..62ae5922 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs @@ -14,25 +14,20 @@ public class EditTrackTemplateContentInput /// /// 是否可删 /// - public bool IsCanDelete { get; set; } + public bool? IsCanDelete { get; set; } /// /// 是否对外 /// - public bool IsExternal { get; set; } - - /// - /// 排序 - /// - public int Sort { get; set; } + public bool? IsExternal { get; set; } /// /// 轨迹内容id /// - public int TrackContentId { get; set; } + public int? TrackContentId { get; set; } /// /// 轨迹模板id /// - public int TrackTemplateId { get; set; } + public int? TrackTemplateId { get; set; } } \ 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 index 2e2b8ae7..97c1c0fc 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -120,6 +120,7 @@ namespace SJZY.Track.Application.Services.TrackContents //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } + #endregion 业务逻辑校验 //更新的时候需要覆盖内容映射轨迹代码 @@ -158,6 +159,7 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { #region 业务校验 + //需要加个判断,存在内容映射,则出提示 #endregion 业务校验 @@ -201,12 +203,14 @@ namespace SJZY.Track.Application.Services.TrackContents { if (input.Options != OptionTypeNoNull.删除) { + if (input.TrackContentId == input.MapTrackContentId) throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]); + 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"]); + throw new BusinessException(message: _stringLocalizer["NotAllowedToMapOneself"]); } switch (input.Options) 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/TrackPull/EditTrackPullConfigInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs new file mode 100644 index 00000000..fc540b38 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs @@ -0,0 +1,64 @@ +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).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.PullInterval), 0]); + + 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/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 From a2e558007066daaa445032d600700096d5c90f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 14:46:16 +0800 Subject: [PATCH 127/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackContents/TrackContentService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 97c1c0fc..67097d55 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -203,14 +203,14 @@ namespace SJZY.Track.Application.Services.TrackContents { if (input.Options != OptionTypeNoNull.删除) { - if (input.TrackContentId == input.MapTrackContentId) throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]); + 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["NotAllowedToMapOneself"]); + throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]); } switch (input.Options) From af49cb7bda6abb70b544d1f5fa75046071db5d93 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 14:47:28 +0800 Subject: [PATCH 128/196] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackContents/TrackContentService.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 2e2b8ae7..3ffe9f33 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -8,6 +8,7 @@ using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Queries; using System.Linq.Expressions; using Volo.Abp.DependencyInjection; @@ -22,15 +23,17 @@ namespace SJZY.Track.Application.Services.TrackContents { private readonly IStringLocalizer _stringLocalizer; private readonly ITrackContentRepository _trackContentRepository; + private readonly IBasicQuery _trackContentMapBasicQuery; public TrackContentService( IStringLocalizer stringLocalizer, - ITrackContentRepository trackContentRepository - + ITrackContentRepository trackContentRepository, + IBasicQuery trackContentMapBasicQuery ) { this._stringLocalizer = stringLocalizer; this._trackContentRepository = trackContentRepository; + this._trackContentMapBasicQuery=trackContentMapBasicQuery; } /// @@ -99,7 +102,6 @@ namespace SJZY.Track.Application.Services.TrackContents //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } - #endregion 业务逻辑校验 var entity = ObjectMapper.Map(input); @@ -111,7 +113,6 @@ namespace SJZY.Track.Application.Services.TrackContents 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)); @@ -159,7 +160,11 @@ namespace SJZY.Track.Application.Services.TrackContents { #region 业务校验 //需要加个判断,存在内容映射,则出提示 - + 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); From 3e908cb7efe70da2842b6149bf0cadcb726afcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 15:07:49 +0800 Subject: [PATCH 129/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs index a4193512..f9bbdaba 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPull/GetTrackPullContentDetailOutputVO.cs @@ -47,7 +47,7 @@ public class GetTrackPullContentDetailOutputVO /// /// 拉取轨迹发生地 /// - public int TrackPlaceValue { get; set; } + public int? TrackPlaceValue { get; set; } /// /// 轨迹拉取配置id From 04733815d5964ba7c4a604a69824c53f5d768487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 15:29:08 +0800 Subject: [PATCH 130/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 5 ++++- .../Services/TrackPush/TrackPushService.cs | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index e78dc0ad..df2e40bd 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -213,7 +213,10 @@ public class TrackPullService : ApplicationService, ITransientDependency Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId; var trackKeywordExp = Expressionable.Create() - .And(x => x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == input.TrackStatusValue || x.TrackContentValue == input.TrackContentValue); + .And(x => x.TrackContentId == input.TrackContentId + || (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue) + || (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue) + || (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue)); input.TrackKeywords?.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 75aa1231..4514d8cd 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -199,7 +199,12 @@ public class TrackPushService : ApplicationService, ITransientDependency if (input.Options != OptionTypeNoNull.删除) { Expression> isContentAnyExp = x => - x.TrackPushConfigId == input.TrackPushConfigId && (x.TrackContentId == input.TrackContentId || x.TrackContentCodeValue == input.TrackContentCodeValue || x.TrackStatusValue == x.TrackStatusValue || x.TrackContentValue == input.TrackContentValue || x.TrackEnContentValue == input.TrackEnContentValue); + x.TrackPushConfigId == input.TrackPushConfigId + && (x.TrackContentId == input.TrackContentId + || (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue) + || (input.TrackStatusValue != null && x.TrackStatusValue == x.TrackStatusValue) + || (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue) + || (input.TrackEnContentValue != null && x.TrackEnContentValue == input.TrackEnContentValue)); if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) From 5fa20966ab43a6c9133b781dbed0ab9ec98b4af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Sat, 2 Mar 2024 15:34:26 +0800 Subject: [PATCH 131/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=8F=91=E7=94=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/TrackUpsertEvent.cs | 12 ++++- .../Events/UpdateOrderTrackEvent.cs | 34 +++++++++++++ .../Services/ITrackPushCacheService.cs | 18 +++++++ .../EventHandlers/TrackUpsertEventHandler.cs | 51 +++++++++++++------ .../UpdateOrderTrackEventHandler.cs | 38 ++++++++++++++ .../ProvideServices/OrderLinkService.cs | 20 +++++--- .../Services/ProvideServices/TrackService.cs | 4 +- .../TrackPush/TrackPushCacheService.cs | 38 ++++++++++++++ .../TrackDetailsIndex.cs | 8 +-- .../Dtos/Order/LinkedOrderVO.cs | 20 ++++++++ .../Dtos/TrackDetails/MatchTrackContentDto.cs | 5 ++ src/SJZY.Track.Domain/GlobalConst.cs | 17 +++++-- .../Queries/TrackQueries.cs | 7 ++- .../Repositories/OrderRepository.cs | 15 ++++-- 14 files changed, 248 insertions(+), 39 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs create mode 100644 src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs create mode 100644 src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs create mode 100644 src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs index ad0fe356..16d8c9ce 100644 --- a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -8,12 +8,22 @@ 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 /// 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..a92678d7 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs @@ -0,0 +1,34 @@ +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; } +} \ 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/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 220607ab..5f8d9466 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -1,6 +1,7 @@ using DotNetCore.CAP; 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; @@ -14,29 +15,33 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe private readonly IOrderRepository _orderRepository; private readonly ITrackQueries _trackQueries; private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackPushCacheService _trackPushCacheService; private readonly ICapPublisher _capPublisher; public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher, - ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository) + ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository, + ITrackPushCacheService trackPushCacheService) { _orderRepository = orderRepository; _capPublisher = capPublisher; _trackQueries = trackQueries; _trackDetailsRepository = trackDetailsRepository; + _trackPushCacheService = trackPushCacheService; } - [NonAction] [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] public async Task ConsumerAsync(TrackUpsertEvent @event) { // 不同子系统需要做内容映射 if (@event.UpSubSystemId != @event.SubSystemId) { - var mapCode = await _trackQueries.MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); + var mapCode = await _trackQueries + .MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); if (mapCode == default) { - throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + //throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + return; } @event.TrackCode = mapCode; @@ -50,15 +55,17 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe // 不存在则新增轨迹,存在则更新 var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode); - var isPush = false; // 推送只做新增的,更新和删除的不做先 + var orderIsCompleted = false; if (track == default) { // 根据轨迹code在订单模板内容中寻找匹配的 var trackContent = await _trackQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); if (trackContent == default) { - throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); + //throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); + return; } + orderIsCompleted = trackContent.IsCompleted; track = new TrackDetailsIndex { @@ -72,22 +79,37 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe TrackPlace = @event.TrackPlace, TrackTime = @event.TrackTime, TraceTimeZone = @event.TraceTimeZone, - CreateUserId = CurrentUserRequest.CurrentUser.UserId, + CreateUser = CurrentUserRequest.CurrentUser.Name, CreateTime = DateTime.Now }; - - isPush = true; + + // todo:推送只做新增的,更新和删除的不做先 + if (!@event.IsPushCompleted && await _trackPushCacheService.IsPushAsync(@event.CustomId)) + { + //await PushTrack(); + } } else { track.TrackPlace = @event.TrackPlace; track.TrackTime = @event.TrackTime; track.TraceTimeZone = @event.TraceTimeZone; - track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId; + 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 + }); // 根据订单关联关系异步向下刷 var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); @@ -95,14 +117,13 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe { 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); } - - if (isPush) - { - //await PushTrack(); - } } } \ 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..b9ec2dd6 --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs @@ -0,0 +1,38 @@ +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; + + if (order.LatestTrackTime > @event.TrackTime) return; + + order.LatestTrackContent = @event.TrackContent; + order.LatestTrackEnContent = @event.TrackEnContent; + order.LatestTrackPlace = @event.TrackPlace; + order.LatestTrackTime = @event.TrackTime; + if (@event.IsCompleted) order.IsCompleted = true; + + await _orderRepository.UpdateColumnAsync(order, x => new + { + x.IsCompleted, x.LatestTrackContent, x.LatestTrackEnContent, x.LatestTrackPlace, x.LatestTrackTime + }); + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index f0261697..50490d04 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -27,9 +27,11 @@ public class OrderLinkService : ApplicationService [HttpPost("Order/Link")] public async Task LinkOrderAsync(LinkOrderInput input) { - if (!await _orderRepository.IsAnyAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo)) + 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}不存在"); + throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); } if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; @@ -41,10 +43,10 @@ public class OrderLinkService : ApplicationService if (!input.IsLink) return await UnLinkOrderAsync(input); // 关联订单 - return await DoLinkOrderAsync(input); + return await DoLinkOrderAsync(input, orderId); } - private async Task DoLinkOrderAsync(LinkOrderInput input) + private async Task DoLinkOrderAsync(LinkOrderInput input, int orderId) { // 获取已关联的订单 var linkOrderNos = await _orderLinkQuery.GetListAsync(x => @@ -55,15 +57,17 @@ public class OrderLinkService : ApplicationService var noLinkOrderNos = input.LinkOrderNos.Except(linkOrderNos); // 过滤掉不存在的订单 - var canLinkOrderNos = await _orderRepository.GetListAsync(x => + var canLinkOrders = await _orderRepository.GetListAsync(x => x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo), - x => x.OrderNo); + x => new { x.Id, x.OrderNo }); - await _orderRepository.LinkOrderAsync(canLinkOrderNos.Select(x => new OrderLinkEntity + await _orderRepository.LinkOrderAsync(canLinkOrders.Select(x => new OrderLinkEntity { + OrderId = orderId, OrderNo = input.OrderNo, OrderType = input.OrderType, - LinkOrderNo = x, + LinkOrderId = x.Id, + LinkOrderNo = x.OrderNo, LinkOrderType = input.LinkOrderType }).ToList()); diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index d7cc59e3..dacb87fe 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -32,7 +32,7 @@ public class TrackService : ApplicationService var order = await _orderRepository.GetFirstAsync(x => x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new { - x.Id, x.SubSystemId, x.IsPushCompleted + x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId }); if (order == default) { @@ -43,6 +43,8 @@ public class TrackService : ApplicationService var @event = ObjectMapper.Map(input); @event.OrderId = order.Id; @event.SubSystemId = order.SubSystemId; + @event.IsPushCompleted = order.IsPushCompleted; + @event.CustomId = order.CustomId; await _trackUpsertEventHandler.UpsertTrackAsync(@event); return true; } 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..468d69a8 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs @@ -0,0 +1,38 @@ +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.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 35857507..6a330083 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -74,14 +74,14 @@ public class TrackDetailsIndex : IdBaseIndex /// 删除标记 0正常 1 已删除 public bool IsDeleted { get; set; } - /// 创建人id - public int CreateUserId { get; set; } + /// 创建人 + public string? CreateUser { get; set; } /// 创建时间 public DateTime CreateTime { get; set; } - /// 修改人id - public int? UpdateUserId { get; set; } + /// 修改人 + public string? UpdateUser { get; set; } /// 修改时间 public DateTime? UpdateTime { get; set; } diff --git a/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs index 5d1c7327..c0344880 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/LinkedOrderVO.cs @@ -6,9 +6,29 @@ 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/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs index ced59e19..2c2a366d 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -16,4 +16,9 @@ public class MatchTrackContentDto /// 轨迹状态 /// public string Status { get; set; } = null!; + + /// + /// 是否意味着完成 + /// + public bool IsCompleted { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs index 77881f20..f4ae0ff0 100644 --- a/src/SJZY.Track.Domain/GlobalConst.cs +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -3,12 +3,23 @@ public class GlobalConst { /// - /// 轨迹明细es索引名称 + /// 轨迹明细 es索引名称 /// public const string TrackIndex = "sjzy_track_details"; /// - /// 轨迹新增/更新cap订阅名称 + /// 轨迹新增/更新 mq订阅名称 /// - public const string TrackUpsertSubscribe = "SJZY.Track.Upsert"; + public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert"; + + /// + /// 轨迹新增/更新后触发更新订单轨迹 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.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs index a1e5168a..814649fe 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -1,5 +1,6 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; 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.Order; @@ -66,12 +67,14 @@ public class TrackQueries : ISugarRepository, ITrackQueries, .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId) .LeftJoin((x, a, b) => a.TrackContentId == b.Id) .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id) + .LeftJoin((x, a, b, c, d) => b.TrackFlagId == d.Id) .Where((x, a, b) => x.OrderId == orderId && b.Code == code) - .Select((x, a, b, c) => new MatchTrackContentDto + .Select((x, a, b, c,d) => new MatchTrackContentDto { Content = b.Content, EnContent = b.EnContent, - Status = c.Status + Status = c.Status, + IsCompleted = d.IsCompleted }) .FirstAsync(); } diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 8be1ec1a..a590a496 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -55,13 +55,18 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetLinkedOrdersAsync(int orderId) { - return await Context.Queryable() - .LeftJoin((a, b) => a.Id == b.OrderId) + return await Context.Queryable() + .LeftJoin((a , b) => a.Id == b.OrderId) + .LeftJoin((a, b, c) => b.LinkOrderId == c.Id) .Where(a => a.Id == orderId) - .Select((a, b) => new LinkedOrderVO + .Select((a, b,c) => new LinkedOrderVO { - OrderId = b.LinkOrderId, - SubSystemId = a.SubSystemId + OrderId = c.Id, + OrderType = c.OrderType, + OrderNo = c.OrderNo, + SubSystemId = c.SubSystemId, + IsPushCompleted = c.IsPushCompleted, + CustomId = c.CustomId }) .ToListAsync(); } From 6da3e0748ce6c1931795771bc072165f3504e9db Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 15:52:12 +0800 Subject: [PATCH 132/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackContents/TrackContentService.cs | 13 ++++++++++++- .../EditTrackContentMapInputValidation.cs | 10 +++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 9c872bf2..9490f1d3 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -7,6 +7,7 @@ using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; +using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Queries; using System.Linq.Expressions; @@ -24,16 +25,19 @@ namespace SJZY.Track.Application.Services.TrackContents 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 trackContentMapBasicQuery, + IBasicQuery trackTemplateContentBasicQuery ) { this._stringLocalizer = stringLocalizer; this._trackContentRepository = trackContentRepository; this._trackContentMapBasicQuery=trackContentMapBasicQuery; + this._trackTemplateContentBasicQuery=trackTemplateContentBasicQuery; } /// @@ -161,6 +165,13 @@ namespace SJZY.Track.Application.Services.TrackContents { #region 业务校验 + //查询是否关联了轨迹模版内容 + 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()) diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs index b4cf3ed8..90a334a9 100644 --- a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs @@ -12,7 +12,7 @@ public class EditTrackContentMapInputValidation : AbstractValidator 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.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]); @@ -22,10 +22,10 @@ public class EditTrackContentMapInputValidation : AbstractValidator 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.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.Id)]); + //}); When(x => x.Options != OptionTypeNoNull.删除, () => { From 570ffbbdf1c62e87c5b53bce7813ede58717438e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 15:54:15 +0800 Subject: [PATCH 133/196] 1 --- .../Services/TrackPush/TrackPushService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index 4514d8cd..ff0c193d 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -202,7 +202,7 @@ public class TrackPushService : ApplicationService, ITransientDependency x.TrackPushConfigId == input.TrackPushConfigId && (x.TrackContentId == input.TrackContentId || (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue) - || (input.TrackStatusValue != null && x.TrackStatusValue == x.TrackStatusValue) + || (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue) || (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue) || (input.TrackEnContentValue != null && x.TrackEnContentValue == input.TrackEnContentValue)); if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); From ea288979b48ee5698627f200573abf9c6b4cf3b1 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 16:19:50 +0800 Subject: [PATCH 134/196] =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=80=BC=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackStatusRepository.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index 7279e1e1..a4abd5b5 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -54,10 +54,8 @@ public class TrackStatusRepository : BasicRepository, ITrackS EntrackStatus = a.EnStatus, TrackStatus = a.Status, NodeId = a.Node, - Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3) - .Return("清关") - .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") - .End(""), + Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("清关").ElseIF(a.Node == 3) + .Return("干线").ElseIF(a.Node == 4).Return("派送").ElseIF(a.Node == 5).Return("其他").End(""), CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, From 4cd66079d08ce861fe2c628d4c68119af136b24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 16:21:04 +0800 Subject: [PATCH 135/196] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 12 ++++++++++++ .../ITrackTemplateRepository.cs | 5 ++++- .../GetTrackTemplateContentDropDownListVO.cs | 14 ++++++++++++++ .../GetTrackTemplateContentPageInputVO.cs | 5 ----- .../Repositories/TrackTemplateRepository.cs | 19 ++++++++++++++++--- 5 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 621ae61a..1beb3bed 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -1,6 +1,7 @@ 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.TrackPush; using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; @@ -183,6 +184,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency return await _trackTemplateRepository.GetContentDetailAsync(id); } + /// + /// 轨迹模板内容下拉框 + /// + /// + /// + [HttpPost("GetContentDropDownList")] + public async Task> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input) + { + return await _trackTemplateRepository.GetContentDropDownListAsync(input); + } + /// /// 轨迹模板内容编辑 /// diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index 3654043b..86e3041b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -1,4 +1,5 @@ -using SJZY.Track.Domain.Dtos.TrackTemplate; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Domain.Dtos.TrackTemplate; namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; @@ -37,4 +38,6 @@ public interface ITrackTemplateRepository : IBasicRepository> whereExpression); Task UpdateContentRangeAsync(List updateObjs); + + Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input); } \ 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 index 14b1f0ee..09e8f51f 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs @@ -6,9 +6,4 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput /// 轨迹模板id /// public List TrackTemplateIds { get; set; } - - /// - /// 选中项 - /// - public List? SelectedIds { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d97ef892..ed1c75f4 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -85,8 +85,6 @@ public class TrackTemplateRepository : BasicRepository, ITr templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) .Filter(null, true) .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) - .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, trackStatus, enumValue, trackFlag, createUser, updateUser) => new GetTrackTemplateContentPageOutputVO { @@ -99,7 +97,6 @@ public class TrackTemplateRepository : BasicRepository, ITr UpdateTime = templateContent.UpdateTime, UpdateUser = updateUser.Name }, true) - .Distinct() .ToPagedListAsync(input.PageIndex, input.PageSize); } @@ -165,4 +162,20 @@ public class TrackTemplateRepository : BasicRepository, ITr { 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() + .ToListAsync(); + } } \ No newline at end of file From 569f566fe262b313c96ff927e8c29d46ea934c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 16:41:07 +0800 Subject: [PATCH 136/196] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs | 2 +- .../Repositories/TrackTemplateRepository.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs index 18d6ddcc..b6d43291 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageOutputVO.cs @@ -47,7 +47,7 @@ public class GetTrackTemplateContentPageOutputVO /// /// 排序 /// - public long Sort { get; set; } + public int Sort { get; set; } /// /// 轨迹标记 diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index ed1c75f4..1f243a33 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -97,6 +97,7 @@ public class TrackTemplateRepository : BasicRepository, ITr UpdateTime = templateContent.UpdateTime, UpdateUser = updateUser.Name }, true) + .OrderBy(templateContent => templateContent.Sort) .ToPagedListAsync(input.PageIndex, input.PageSize); } From 131bf857089ef3225ee7b3a860cb543c127230f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 16:58:58 +0800 Subject: [PATCH 137/196] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackTemplates/TrackTemplateService.cs | 2 +- .../TrackTemplateAggregate/ITrackTemplateRepository.cs | 2 +- .../Repositories/TrackTemplateRepository.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 1beb3bed..99cf36dc 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -190,7 +190,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency /// /// [HttpPost("GetContentDropDownList")] - public async Task> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input) + public async Task> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input) { return await _trackTemplateRepository.GetContentDropDownListAsync(input); } diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index 86e3041b..5c738f78 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -39,5 +39,5 @@ public interface ITrackTemplateRepository : IBasicRepository UpdateContentRangeAsync(List updateObjs); - Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input); + Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 1f243a33..37d27a78 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -164,7 +164,7 @@ public class TrackTemplateRepository : BasicRepository, ITr return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); } - public async Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input) + public async Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input) { return await Context.Queryable() .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id) @@ -177,6 +177,6 @@ public class TrackTemplateRepository : BasicRepository, ITr Key = trackContent.Code + "-" + trackContent.Content }) .Distinct() - .ToListAsync(); + .ToPagedListAsync(input.PageIndex, input.PageSize); } } \ No newline at end of file From 51fe08f607597d0adcc9169e1fdf9a89424d9641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Sat, 2 Mar 2024 18:02:06 +0800 Subject: [PATCH 138/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackContentRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index fe0283e4..9274e41b 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -61,7 +61,7 @@ public class TrackContentRepository : BasicRepository, ITrac .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) + .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 @@ -126,7 +126,7 @@ public class TrackContentRepository : BasicRepository, ITrac .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted) .LeftJoin((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted) .Filter(null, true) - .Where(contentMap => !contentMap.IsDeleted) + .Where(contentMap => contentMap.Id == id && !contentMap.IsDeleted) .Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => new GetTrackContentMapDetailOutputVO { Id = contentMap.Id, From 2905b47d1a7175d4b1a88384a945c2ba176e976d Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Mon, 4 Mar 2024 09:26:59 +0800 Subject: [PATCH 139/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackFlags/TrackFlagService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index d46b6d96..bc3f68ad 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -129,7 +129,8 @@ namespace SJZY.Track.Application.Services.TrackFlags var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id); if (isExistContent!=null) { - throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]); + //throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]); + throw new BusinessException(message: "该标记关联轨迹内容,禁止删除"); } #endregion var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id); From 28462ffc8331b204bf7adab6e1557a7110942bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Mon, 4 Mar 2024 10:20:02 +0800 Subject: [PATCH 140/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 14 +++---- .../Services/TrackPull/TrackPullService.cs | 1 - .../Services/TrackPush/TrackPushService.cs | 34 ++++++++++++----- .../TrackTemplates/TrackTemplateService.cs | 37 +++++++++++++------ .../ITrackPushConfigRepository.cs | 4 ++ .../ITrackTemplateRepository.cs | 4 ++ .../Repositories/TrackPushConfigRepository.cs | 10 +++++ .../Repositories/TrackTemplateRepository.cs | 10 +++++ 8 files changed, 86 insertions(+), 28 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 9490f1d3..cac9a7a6 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -1,12 +1,9 @@ using Microsoft.Extensions.Localization; -using SJZY.Expand.ABP.Core.Common.Dto; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Contract.Dtos.TrackContents; -using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; -using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Queries; @@ -36,8 +33,8 @@ namespace SJZY.Track.Application.Services.TrackContents { this._stringLocalizer = stringLocalizer; this._trackContentRepository = trackContentRepository; - this._trackContentMapBasicQuery=trackContentMapBasicQuery; - this._trackTemplateContentBasicQuery=trackTemplateContentBasicQuery; + this._trackContentMapBasicQuery = trackContentMapBasicQuery; + this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery; } /// @@ -106,6 +103,7 @@ namespace SJZY.Track.Application.Services.TrackContents //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } + #endregion 业务逻辑校验 var entity = ObjectMapper.Map(input); @@ -117,6 +115,7 @@ namespace SJZY.Track.Application.Services.TrackContents 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)); @@ -166,18 +165,19 @@ namespace SJZY.Track.Application.Services.TrackContents #region 业务校验 //查询是否关联了轨迹模版内容 - var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId==input.Id); + 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); + 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); diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index df2e40bd..f1bc092a 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -5,7 +5,6 @@ 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.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.TrackPull; diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index ff0c193d..dfdeba35 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -215,26 +215,42 @@ public class TrackPushService : ApplicationService, ITransientDependency { case OptionTypeNoNull.新增: { - var trackPushContentEntity = ObjectMapper.Map(input); + int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort, x => x.TrackPushConfigId == input.TrackPushConfigId); - await _trackPushConfigRepository.InsertContentAsync(trackPushContentEntity); + var entity = ObjectMapper.Map(input); + entity.Sort = maxSort + 1; + + await _trackPushConfigRepository.InsertContentAsync(entity); + + break; } - break; case OptionTypeNoNull.修改: { - var oldTrackPushContentEntity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); - ObjectMapper.Map(input, oldTrackPushContentEntity); + ObjectMapper.Map(input, entity); - await _trackPushConfigRepository.UpdateContentAsync(oldTrackPushContentEntity); + await _trackPushConfigRepository.UpdateContentAsync(entity); + + break; } - break; case OptionTypeNoNull.删除: - await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id); + { + var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); - break; + 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, diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 99cf36dc..831a17e0 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; -using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Localization; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; @@ -216,29 +215,45 @@ public class TrackTemplateService : ApplicationService, ITransientDependency switch (input.Options) { case OptionTypeNoNull.新增: + { + int maxSort = await _trackTemplateRepository.ContentMaxAsync(x => x.Sort, x => x.TrackTemplateId == input.TrackTemplateId); - var entity = ObjectMapper.Map(input); + var entity = ObjectMapper.Map(input); + entity.Sort = maxSort + 1; - await _trackTemplateRepository.InsertContentAsync(entity); + await _trackTemplateRepository.InsertContentAsync(entity); - break; + break; + } case OptionTypeNoNull.修改: - - var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? + { + var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); - ObjectMapper.Map(input, oldEntity); + ObjectMapper.Map(input, entity); - await _trackTemplateRepository.UpdateContentAsync(oldEntity); + await _trackTemplateRepository.UpdateContentAsync(entity); - break; + break; + } case OptionTypeNoNull.删除: + { + var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ?? + throw new BusinessException(message: _stringLocalizer["NotFindData"]); - await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value); + using (var ts = TransactionScopeHelper.Create()) + { + await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value); - break; + 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, diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs index 3d33a4ee..80013967 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs @@ -26,4 +26,8 @@ public interface ITrackPushConfigRepository : IBasicRepository> 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/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs index 5c738f78..e6ab4b0b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -40,4 +40,8 @@ public interface ITrackTemplateRepository : IBasicRepository 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.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 29300b59..2531f141 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -124,4 +124,14 @@ public class TrackPushConfigRepository : BasicRepository, { 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/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 37d27a78..d414e5c8 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -179,4 +179,14 @@ public class TrackTemplateRepository : BasicRepository, ITr .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 From 8e915891861f280775665a855385fb5ace5a9474 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Mon, 4 Mar 2024 10:31:49 +0800 Subject: [PATCH 141/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6=E5=AE=8C=E7=BB=93=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackContents/EditTrackContentInput.cs | 10 ++++++++++ .../TrackContents/GetPageTrackContentInput.cs | 5 +++++ .../Dtos/TrackFlags/EditTrackFlagInput.cs | 16 ++++++++-------- .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 8 ++++---- .../AutoMapper/TrackContentAutoMapperProfile.cs | 3 ++- .../AutoMapper/TrackFlagAutoMapperProfile.cs | 8 ++------ .../TrackContentAggregate/TrackContentEntity.cs | 6 ++++++ .../TrackFlagAggregate/TrackFlagEntity.cs | 10 +++++----- .../Dtos/TrackContents/GetPageTrackContentVO.cs | 5 +++++ .../TrackContents/GetTrackContentDetailVO.cs | 5 +++++ .../Dtos/TrackFlags/GetPageTrackFlagVO.cs | 8 ++++---- .../Dtos/TrackFlags/GetTrackFlagDetailVO.cs | 8 ++++---- .../Queries/TrackQueries.cs | 2 +- .../Repositories/TrackContentRepository.cs | 6 ++++-- .../Repositories/TrackFlagRepository.cs | 6 +++--- 15 files changed, 68 insertions(+), 38 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs index d2a829ca..f13eac46 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs @@ -41,6 +41,11 @@ /// 轨迹标记id /// public int TrackFlagId { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } } public class GetTrackContentDetailDto @@ -94,5 +99,10 @@ /// 轨迹标记 /// 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/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs index 7cf94770..8c0b6b05 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs @@ -84,5 +84,10 @@ /// 修改人 /// 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 index f4c1083e..49bb942a 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs @@ -27,10 +27,10 @@ /// public string? Code { get; set; } - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } } public class GetTrackFlagDetailDto @@ -60,9 +60,9 @@ /// public string Flag { get; set; } - /// - /// 是否完结 - /// - public bool IsFinish { 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 index 4280f8d2..3964caea 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -22,10 +22,10 @@ /// public string Flag { get; set; } - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } /// /// 创建时间 diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs index bf20809b..77b0c47d 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs @@ -9,7 +9,8 @@ namespace SJZY.Track.Application.AutoMapper { public TrackContentAutoMapperProfile() { - CreateMap(MemberList.None); + CreateMap(MemberList.None) + .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap(MemberList.None); diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs index a08aa0a0..bf72f035 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs @@ -10,16 +10,12 @@ namespace SJZY.Track.Application.AutoMapper public TrackFlagAutoMapperProfile() { CreateMap(MemberList.None) - .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) - .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); + .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)); + //.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); CreateMap(MemberList.None); - - //var pageResultDto = - // ObjectMapper.Map, UnifyPageResultDto>( - // resultDto); } } } \ 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 index 02fac985..44d00b9d 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs @@ -47,4 +47,10 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot /// [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/TrackFlagAggregate/TrackFlagEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs index 886b458c..225c8f85 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackFlagAggregate/TrackFlagEntity.cs @@ -30,9 +30,9 @@ public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot [SugarColumn(ColumnName = "SubSystemId")] public int SubSystemId { get; set; } - /// - /// 是否完结 - /// - [SugarColumn(ColumnName = "IsCompleted")] - public bool IsCompleted { get; set; } + ///// + ///// 是否完结 + ///// + //[SugarColumn(ColumnName = "IsCompleted")] + //public bool IsCompleted { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs index d2dc5e29..4fff79ed 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetPageTrackContentVO.cs @@ -90,5 +90,10 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// 修改人 /// 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 index b58df450..eb5a22b9 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackContents/GetTrackContentDetailVO.cs @@ -57,5 +57,10 @@ namespace SJZY.Track.Domain.Dtos.TrackContents /// 轨迹标记 /// public string TrackFlag { get; set; } + + /// + /// 是否完结 + /// + public bool IsFinish { get; set; } } } diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs index d3699b75..adbf1a5d 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -46,10 +46,10 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags /// public string Flag { get; set; } - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } /// /// 创建时间 diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs index b88c7afd..d2984d4a 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetTrackFlagDetailVO.cs @@ -33,9 +33,9 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags /// public string Flag { get; set; } - /// - /// 是否完结 - /// - public bool IsFinish { get; set; } + ///// + ///// 是否完结 + ///// + //public bool IsFinish { get; set; } } } diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs index 814649fe..95e8855f 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs @@ -74,7 +74,7 @@ public class TrackQueries : ISugarRepository, ITrackQueries, Content = b.Content, EnContent = b.EnContent, Status = c.Status, - IsCompleted = d.IsCompleted + IsCompleted = b.IsCompleted }) .FirstAsync(); } diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 9274e41b..fcd51bd1 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -37,7 +37,8 @@ public class TrackContentRepository : BasicRepository, ITrac Content = a.Content, EnContent = a.EnContent, TrackFlagId = a.TrackFlagId, - TrackFlag = c.Name + TrackFlag = c.Name, + IsFinish = a.IsCompleted }) .FirstAsync(); return detail; @@ -79,7 +80,8 @@ public class TrackContentRepository : BasicRepository, ITrac CreateTime = a.CreateTime, CreateUser = e.Name, UpdateTime = a.UpdateTime, - UpdateUser = f.Name + UpdateUser = f.Name, + IsFinish= a.IsCompleted }) .ToPagedListAsync(input.PageIndex, input.PageSize); diff --git a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index eb6b8ca1..d2227924 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -26,8 +26,8 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR SubSystemId = a.SubSystemId, SubSystem = b.CnName, Code = a.Code, - Flag = a.Name, - IsFinish=a.IsCompleted + Flag = a.Name + //,IsFinish=a.IsCompleted }) .FirstAsync(); return detail; @@ -54,7 +54,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR SubSystem = b.CnName, Code = a.Code, Flag = a.Name, - IsFinish=a.IsCompleted, + //IsFinish=a.IsCompleted, CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, From 3298d3cb886a418e170f0f6125080c3e538f1a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Mon, 4 Mar 2024 11:43:29 +0800 Subject: [PATCH 142/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPush/TrackPushCacheService.cs | 7 ++++--- .../Services/TrackPush/TrackPushService.cs | 14 +++++++++----- src/SJZY.Track.Domain/GlobalConst.cs | 5 ----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs index 468d69a8..62df4046 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs @@ -6,16 +6,17 @@ using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.Services.TrackPush; -public class TrackPushCacheService:ITrackPushCacheService, ITransientDependency +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 = @@ -30,7 +31,7 @@ public class TrackPushCacheService:ITrackPushCacheService, ITransientDependency return (bool)isPush; } - + public async Task UpdateAsync(int customId, bool isPush) { await RedisHelper.Client.SetAsync(RedisKey(customId), isPush); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index dfdeba35..fa106f23 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -3,6 +3,7 @@ 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; @@ -26,17 +27,20 @@ public class TrackPushService : ApplicationService, ITransientDependency 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) + ITrackPullConfigRepository trackPullConfigRepository, + ITrackPushCacheService trackPushCacheService) { _stringLocalizer = stringLocalizer; _trackPushConfigRepository = trackPushConfigRepository; _trackTemplateRepository = trackTemplateRepository; _trackPullConfigRepository = trackPullConfigRepository; + _trackPushCacheService = trackPushCacheService; } /// @@ -129,7 +133,7 @@ public class TrackPushService : ApplicationService, ITransientDependency trackPushParamsEntity.PullOrPushConfigId = id; await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity); - if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId); ts.Complete(); } @@ -154,8 +158,8 @@ public class TrackPushService : ApplicationService, ITransientDependency await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity); await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity); - await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldCustomId); - if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId); + await _trackPushCacheService.UpdateAsync(oldCustomId, false); + if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId); ts.Complete(); } @@ -173,7 +177,7 @@ public class TrackPushService : ApplicationService, ITransientDependency x.PullOrPushConfigId == input.Id && x.IsPush); await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id); - await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId); + await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false); ts.Complete(); } diff --git a/src/SJZY.Track.Domain/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs index fcf3d893..91cbeca4 100644 --- a/src/SJZY.Track.Domain/GlobalConst.cs +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -21,9 +21,4 @@ public class GlobalConst /// 轨迹要推送的客户redis key前缀 /// public const string TrackPushKeyPrefix = "TrackPush:"; - - /// - /// 自动推送名单RedisKey - /// - public const string AutoPushRosterRedisKey = "AutoPushRoster"; } \ No newline at end of file From 4b46eb92bd4af2ae77ee20269b1a09eef3a4efcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Mon, 4 Mar 2024 12:00:09 +0800 Subject: [PATCH 143/196] =?UTF-8?q?=E6=8E=A8=E6=8B=89=E5=81=9A=E4=B8=8D?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.Development.json | 5 ++ .../Dtos/ProvideServices/RefreshTrackInput.cs | 9 +++ .../Events/UpdateOrderTrackEvent.cs | 5 ++ .../InterfaceRelayTrackRefreshEventHandler.cs | 35 ++++++++++++ .../EventHandlers/TrackUpsertEventHandler.cs | 10 ++-- .../UpdateOrderTrackEventHandler.cs | 7 ++- .../SJZY.Track.Application.csproj | 1 + .../ProvideServices/TrackPullService.cs | 56 +++++++++++++++++++ .../ProvideServices/TrackQueryService.cs | 10 ++-- .../SjzyTrackApplicationModule.cs | 7 +++ .../OrderAggregate/IOrderRepository.cs | 8 +++ .../Aggregates/OrderAggregate/OrderEntity.cs | 6 ++ .../TrackPullContentConfigEntity.cs | 12 ++-- .../Dtos/Order/OrderTemplateVO.cs | 15 +++++ .../Dtos/Order/TrackPullContentConfigVO.cs | 44 +++++++++++++++ src/SJZY.Track.Domain/GlobalConst.cs | 5 ++ .../{ITrackQueries.cs => IProvideQueries.cs} | 10 +++- .../{TrackQueries.cs => ProvideQueries.cs} | 23 +++++++- .../Repositories/OrderRepository.cs | 25 +++++++-- 19 files changed, 267 insertions(+), 26 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs create mode 100644 src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs create mode 100644 src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/OrderTemplateVO.cs create mode 100644 src/SJZY.Track.Domain/Dtos/Order/TrackPullContentConfigVO.cs rename src/SJZY.Track.Domain/Queries/{ITrackQueries.cs => IProvideQueries.cs} (81%) rename src/SJZY.Track.Repository/Queries/{TrackQueries.cs => ProvideQueries.cs} (79%) diff --git a/src/SJZY.Track.Api/appsettings.Development.json b/src/SJZY.Track.Api/appsettings.Development.json index 900166d1..671ae998 100644 --- a/src/SJZY.Track.Api/appsettings.Development.json +++ b/src/SJZY.Track.Api/appsettings.Development.json @@ -68,6 +68,11 @@ "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.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/Events/UpdateOrderTrackEvent.cs b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs index a92678d7..f04cd86c 100644 --- a/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs +++ b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs @@ -31,4 +31,9 @@ public class UpdateOrderTrackEvent /// 轨迹发生时间 /// public DateTime TrackTime { get; set; } + + /// + /// 轨迹时区 + /// + public float TrackTimeZone { get; set; } } \ No newline at end of file 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/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 5f8d9466..f354d19b 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -13,18 +13,18 @@ namespace SJZY.Track.Application.EventHandlers; public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe { private readonly IOrderRepository _orderRepository; - private readonly ITrackQueries _trackQueries; + private readonly IProvideQueries _provideQueries; private readonly ITrackDetailsRepository _trackDetailsRepository; private readonly ITrackPushCacheService _trackPushCacheService; private readonly ICapPublisher _capPublisher; public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher, - ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository, + IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository, ITrackPushCacheService trackPushCacheService) { _orderRepository = orderRepository; _capPublisher = capPublisher; - _trackQueries = trackQueries; + _provideQueries = provideQueries; _trackDetailsRepository = trackDetailsRepository; _trackPushCacheService = trackPushCacheService; } @@ -35,7 +35,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe // 不同子系统需要做内容映射 if (@event.UpSubSystemId != @event.SubSystemId) { - var mapCode = await _trackQueries + var mapCode = await _provideQueries .MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); if (mapCode == default) @@ -59,7 +59,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe if (track == default) { // 根据轨迹code在订单模板内容中寻找匹配的 - var trackContent = await _trackQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); + var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode); if (trackContent == default) { //throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); diff --git a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs index b9ec2dd6..dfbafc42 100644 --- a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs @@ -21,14 +21,15 @@ public class UpdateOrderTrackEventHandler : ITransientDependency, ICapSubscribe if (order == default) return; if (order.IsCompleted) return; - - if (order.LatestTrackTime > @event.TrackTime) 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 { diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index cb744d89..1e027d10 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -8,6 +8,7 @@ + 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..07dd84d3 --- /dev/null +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs @@ -0,0 +1,56 @@ +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 = "提供接口")] +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/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 79f0cb2e..02f6d9b0 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -11,13 +11,13 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; - private readonly ITrackQueries _trackQueries; + private readonly IProvideQueries _provideQueries; public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, - ITrackQueries trackQueries) + IProvideQueries provideQueries) { _trackDetailsRepository = trackDetailsRepository; - _trackQueries = trackQueries; + _provideQueries = provideQueries; } /// @@ -75,10 +75,10 @@ public class TrackQueryService : ApplicationService list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time))); break; case SortMethod.ByTemplate: - var orderTemplates = await _trackQueries + var orderTemplates = await _provideQueries .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos); var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList(); - var templateContent = await _trackQueries.GetOrderedTrackCodesAsync(distinctTemplateIds); + var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds); list.ForEach(item => { var codes = new List(); diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 97b9337f..3c9197f2 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -1,4 +1,5 @@ using SJZY.Expand.ABP.Core.Localization; +using SJZY.InterfaceRelay.Application.Contracts; using SJZY.Track.Application.Contract; using SJZY.Track.Application.Localization; using SJZY.UserCenter.Contracts; @@ -21,6 +22,7 @@ namespace SJZY.Track.Application typeof(AbpVirtualFileSystemModule), typeof(AbpHttpClientModule), typeof(SjzyUserCenterHttpApiModule), + typeof(SJZYInterfaceRelayApplicationContractsModule), typeof(SjzyTrackDomainModule), typeof(SjzyTrackApplicationContractModule) )] @@ -58,6 +60,11 @@ namespace SJZY.Track.Application //用户中心 context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); + context.Services.AddHttpClient("InterfaceForward").AddHttpMessageHandler(); + context.Services.AddHttpClientProxy( + remoteServiceConfigurationName: "InterfaceForward", + asDefaultService: false + ); } public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index 225605cc..e039c01e 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -59,4 +59,12 @@ public interface IOrderRepository : IBasicRepository 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 index 88de3765..e21d6a04 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -65,6 +65,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot /// [SugarColumn(ColumnName = "LatestTrackTime")] public DateTime? LatestTrackTime { get; set; } + + /// + /// 最新轨迹时区(异步维护) + /// + [SugarColumn(ColumnName = "LatestTrackTimeZone")] + public float? LatestTrackTimeZone { get; set; } /// /// 最新轨迹发生地(异步维护) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs index 2a9d53ab..13d74a83 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/TrackPullContentConfigEntity.cs @@ -16,7 +16,7 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 服务商轨迹代码参数值 /// [SugarColumn(ColumnName = "TrackContentCodeValue")] - public string TrackContentCodeValue { get; set; } + public string? TrackContentCodeValue { get; set; } /// /// 轨迹内容id @@ -28,19 +28,19 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 服务商轨迹内容参数值 /// [SugarColumn(ColumnName = "TrackContentValue")] - public string TrackContentValue { get; set; } + public string? TrackContentValue { get; set; } /// /// 轨迹关键词(正向),多个逗分隔 /// [SugarColumn(ColumnName = "TrackKeyword")] - public string TrackKeyword { get; set; } + public string? TrackKeyword { get; set; } /// /// 轨迹关键词(反向),多个逗分隔 /// [SugarColumn(ColumnName = "TrackKeywordReverse")] - public string TrackKeywordReverse { get; set; } + public string? TrackKeywordReverse { get; set; } /// /// 轨迹发生地参数值(主数据枚举) @@ -58,11 +58,11 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity /// 服务商轨迹状态参数值 /// [SugarColumn(ColumnName = "TrackStatusValue")] - public string TrackStatusValue { get; set; } + public string? TrackStatusValue { get; set; } /// /// 轨迹时区GMT /// [SugarColumn(ColumnName = "TrackTimeZone")] - public double? TrackTimeZone { get; set; } + public float? TrackTimeZone { 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/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs index fcf3d893..6e2969e0 100644 --- a/src/SJZY.Track.Domain/GlobalConst.cs +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -12,6 +12,11 @@ public class GlobalConst /// public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert"; + /// + /// 接口通批量轨迹刷新订阅 + /// + public const string InterfaceRelayTrackRefreshSubscribe = "SJZY.Track.TrackRefresh"; + /// /// 轨迹新增/更新后触发更新订单轨迹 mq订阅名称 /// diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs similarity index 81% rename from src/SJZY.Track.Domain/Queries/ITrackQueries.cs rename to src/SJZY.Track.Domain/Queries/IProvideQueries.cs index 53a9720e..7814e949 100644 --- a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs +++ b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs @@ -1,3 +1,4 @@ +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Dtos.Order; using SJZY.Track.Domain.Dtos.TrackDetails; using SJZY.Track.Domain.Dtos.TrackTemplate; @@ -7,7 +8,7 @@ namespace SJZY.Track.Domain.Queries; /// /// 提供接口专用查询 /// -public interface ITrackQueries +public interface IProvideQueries { /// /// 根据订单号,获取订单模板 @@ -40,4 +41,11 @@ public interface ITrackQueries /// /// Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode); + + /// + /// 获取服务商模板配置 + /// + /// + /// + Task> GetPullContentConfigsAsync(int serviceProviderId); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs similarity index 79% rename from src/SJZY.Track.Repository/Queries/TrackQueries.cs rename to src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 814649fe..07daaf0e 100644 --- a/src/SJZY.Track.Repository/Queries/TrackQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -1,6 +1,7 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; +using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Dtos.Order; @@ -10,12 +11,12 @@ using SJZY.Track.Domain.Queries; namespace SJZY.Track.Repository.Queries; -public class TrackQueries : ISugarRepository, ITrackQueries, +public class ProvideQueries : ISugarRepository, IProvideQueries, ITransientDependency { public ISqlSugarClient Context { get; set; } - public TrackQueries() + public ProvideQueries() { Context = SqlsugarScopeBasic.GetContextSafely("default"); } @@ -87,4 +88,22 @@ public class TrackQueries : ISugarRepository, ITrackQueries, .Select(x => x.MapTrackContentCode) .FirstAsync(); } + + 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/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 05c154ff..f8cd7136 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -56,10 +56,10 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetLinkedOrdersAsync(int orderId) { return await Context.Queryable() - .LeftJoin((a , b) => a.Id == b.OrderId) + .LeftJoin((a, b) => a.Id == b.OrderId) .LeftJoin((a, b, c) => b.LinkOrderId == c.Id) .Where(a => a.Id == orderId) - .Select((a, b,c) => new LinkedOrderVO + .Select((a, b, c) => new LinkedOrderVO { OrderId = c.Id, OrderType = c.OrderType, @@ -109,7 +109,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I List orderNoList = new List(); if (!input.OrderNos.IsNullOrWhiteSpace()) { - orderNoList = input.OrderNos.Split(new char[] { ',', ',', ':', ':' }).ToList(); + orderNoList = input.OrderNos.Split(new char[] { ',', ',', ':', ':' }).ToList(); } var pageList = await Context.Queryable() @@ -129,7 +129,8 @@ public class OrderRepository : BasicRepository, IOrderRepository, I 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) + 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, @@ -173,4 +174,20 @@ public class OrderRepository : BasicRepository, IOrderRepository, I } #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 From 8e5ffc06521a3a98dfb28cf9377c6eb14bb3f146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Mon, 4 Mar 2024 14:51:22 +0800 Subject: [PATCH 144/196] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditTrackContentMapInputValidation.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs index 90a334a9..b4cf3ed8 100644 --- a/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackContents/EditTrackContentMapInputValidation.cs @@ -12,7 +12,7 @@ public class EditTrackContentMapInputValidation : AbstractValidator 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.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]); @@ -22,10 +22,10 @@ public class EditTrackContentMapInputValidation : AbstractValidator 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.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.Id)]); + }); When(x => x.Options != OptionTypeNoNull.删除, () => { From 5d5c7843b7c87ef1ab40e5d54aedfe2732f351fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Mon, 4 Mar 2024 15:05:03 +0800 Subject: [PATCH 145/196] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index f1bc092a..47baadb0 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -169,7 +169,7 @@ public class TrackPullService : ApplicationService, ITransientDependency await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity); - if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) + if (trackPullContentEntities.Count > 0) { await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); From d3dea7dd9e3a0fa7a6d00f8c811c4614cd616adb Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Mon, 4 Mar 2024 15:09:53 +0800 Subject: [PATCH 146/196] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackContents/TrackContentService.cs | 34 +++++++++++++++- .../Services/TrackFlags/TrackFlagService.cs | 32 ++++++++++++--- .../TrackStatus/TrackStatusService.cs | 34 +++++++++++++++- .../TrackTemplates/TrackTemplateService.cs | 39 ++++++++++++++----- 4 files changed, 120 insertions(+), 19 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index cac9a7a6..6e8d42e7 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -101,7 +101,22 @@ namespace SJZY.Track.Application.Services.TrackContents if (trackContentEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); - throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); + var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code); + if (codes!=null) + { + throw new BusinessException(message: "该子系统下轨迹代码已存在"); + } + var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content); + if (contents!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容已存在"); + } + var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent); + if (contentEns!=null) + { + throw new BusinessException(message: "该子系统下轨迹内容英文已存在"); + } + //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); } #endregion 业务逻辑校验 @@ -122,7 +137,22 @@ namespace SJZY.Track.Application.Services.TrackContents if (trackContentEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); - throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); + //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在"); + var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code); + if (codes!=null) + { + 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 业务逻辑校验 diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs index bc3f68ad..9e7d4056 100644 --- a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs +++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs @@ -86,12 +86,22 @@ namespace SJZY.Track.Application.Services.TrackFlags private async Task AddAsync(EditTrackFlagInput input) { #region 业务校验 - var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => + var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntitys.Any()) + if (trackFlagsEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); - throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); + //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 @@ -105,13 +115,23 @@ namespace SJZY.Track.Application.Services.TrackFlags { #region 业务校验 - var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id && + var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag)); - if (trackStatusEntitys.Any()) + if (trackFlagsEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); - throw new BusinessException(message: "当前子系统下已存在轨迹标记代码"); + //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 diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index 5dad92e8..c1f22afb 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -93,7 +93,22 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + //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 @@ -114,7 +129,22 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (trackStatusEntitys.Any()) { //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); - throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在"); + //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 diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 831a17e0..6981c6ed 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -96,13 +96,24 @@ public class TrackTemplateService : ApplicationService, ITransientDependency #region 业务校验 //校验模版代码唯一性 - var templateEntity = - await _trackTemplateRepository.GetFirstAsync( - a => a.SubSystemId == input.SubSystemId && a.Code == input.Code); - if (templateEntity != null) + //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: "模板代码已存在于当前选择的子系统下"); + //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 业务校验 @@ -117,11 +128,21 @@ public class TrackTemplateService : ApplicationService, ITransientDependency { #region 业务校验 - var isExist = await _trackTemplateRepository.GetFirstAsync(a => - a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code); - if (isExist != null) + 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: "模板代码已存在于当前选择的子系统下"); + //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 业务校验 From c9772299a513a04fdd0574f9a4b0f2608042955a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Mon, 4 Mar 2024 15:25:20 +0800 Subject: [PATCH 147/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackPull/EditTrackPullConfigInputValidation.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs index fc540b38..9b0a4503 100644 --- a/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs +++ b/src/SJZY.Track.Application/Validations/TrackPull/EditTrackPullConfigInputValidation.cs @@ -16,7 +16,8 @@ public class EditTrackPullConfigInputValidation : AbstractValidator x.ParseMethod).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.ParseMethod), 0]); - RuleFor(x => x.PullInterval).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.PullInterval), 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]); From 4f72a4405c8f0349bf90b3badde92cdd9fed5984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Mon, 4 Mar 2024 15:30:57 +0800 Subject: [PATCH 148/196] =?UTF-8?q?add=20=E5=88=A0=E9=99=A4=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/DeleteOrderInput.cs | 8 +++ .../Events/TrackDeleteEvent.cs | 24 +++++++ .../EventHandlers/TrackDeleteEventHandler.cs | 67 +++++++++++++++++++ .../EventHandlers/TrackUpsertEventHandler.cs | 14 ++-- .../Services/ProvideServices/OrderService.cs | 6 +- .../Services/ProvideServices/TrackService.cs | 53 +++++++++++++-- .../ITrackDetailsRepository.cs | 10 ++- .../TrackDetails/MatchTrackContentsDto.cs | 14 ++++ src/SJZY.Track.Domain/GlobalConst.cs | 5 ++ .../Queries/IProvideQueries.cs | 12 +++- .../Queries/ProvideQueries.cs | 19 ++++-- .../Repositories/TrackDetailsRepository.cs | 48 +++++++++---- 12 files changed, 245 insertions(+), 35 deletions(-) create mode 100644 src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs create mode 100644 src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs create mode 100644 src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentsDto.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs index 7d8d79c0..0e318811 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs @@ -2,4 +2,12 @@ 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/Events/TrackDeleteEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs new file mode 100644 index 00000000..c88d5837 --- /dev/null +++ b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs @@ -0,0 +1,24 @@ +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; } +} \ 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..d4e48a10 --- /dev/null +++ b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs @@ -0,0 +1,67 @@ +using DotNetCore.CAP; +using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Track.Application.Contract.Events; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Queries; +using 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.TrackUpsertSubscribe)] + public async Task ConsumerAsync(TrackDeleteEvent @event) + { + // 不同子系统需要做内容映射 + 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 index f354d19b..d8e480ef 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -33,10 +33,11 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe public async Task ConsumerAsync(TrackUpsertEvent @event) { // 不同子系统需要做内容映射 - if (@event.UpSubSystemId != @event.SubSystemId) + if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId) { - var mapCode = await _provideQueries - .MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode); + var mapCode = (await _provideQueries + .MapTrackCodesAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode)) + .FirstOrDefault(); if (mapCode == default) { @@ -50,7 +51,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe await UpsertTrackAsync(@event); } - internal async Task UpsertTrackAsync(TrackUpsertEvent @event) + private async Task UpsertTrackAsync(TrackUpsertEvent @event) { // 不存在则新增轨迹,存在则更新 var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode); @@ -65,6 +66,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe //throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}"); return; } + orderIsCompleted = trackContent.IsCompleted; track = new TrackDetailsIndex @@ -82,7 +84,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe CreateUser = CurrentUserRequest.CurrentUser.Name, CreateTime = DateTime.Now }; - + // todo:推送只做新增的,更新和删除的不做先 if (!@event.IsPushCompleted && await _trackPushCacheService.IsPushAsync(@event.CustomId)) { @@ -99,7 +101,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe } await _trackDetailsRepository.UpsertAsync(track); - + // 触发订单主表更新事件 await _capPublisher.PublishAsync(GlobalConst.UpdateOrderTrackSubscribe, new UpdateOrderTrackEvent { diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 0f5fa583..007e06d0 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -16,11 +16,11 @@ public class OrderService : ApplicationService private readonly ITrackDetailsRepository _trackDetailsRepository; public OrderService(IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository - ) + ITrackDetailsRepository trackDetailsRepository + ) { _orderRepository = orderRepository; - this._trackDetailsRepository=trackDetailsRepository; + _trackDetailsRepository = trackDetailsRepository; } /// diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index dacb87fe..9fdbb37e 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -1,7 +1,8 @@ -using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using DotNetCore.CAP; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Events; -using SJZY.Track.Application.EventHandlers; using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -12,12 +13,14 @@ namespace SJZY.Track.Application.Services.ProvideServices; public class TrackService : ApplicationService { private readonly IOrderRepository _orderRepository; - private readonly TrackUpsertEventHandler _trackUpsertEventHandler; + private readonly IProvideQueries _provideQueries; + private readonly ICapPublisher _capPublisher; - public TrackService(IOrderRepository orderRepository, TrackUpsertEventHandler trackUpsertEventHandler) + public TrackService(IOrderRepository orderRepository, IProvideQueries provideQueries, ICapPublisher capPublisher) { _orderRepository = orderRepository; - _trackUpsertEventHandler = trackUpsertEventHandler; + _provideQueries = provideQueries; + _capPublisher = capPublisher; } /// @@ -45,7 +48,45 @@ public class TrackService : ApplicationService @event.SubSystemId = order.SubSystemId; @event.IsPushCompleted = order.IsPushCompleted; @event.CustomId = order.CustomId; - await _trackUpsertEventHandler.UpsertTrackAsync(@event); + 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.TrackUpsertSubscribe, @event); + return true; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 3ab152d1..185f0874 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -4,7 +4,7 @@ namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; public interface ITrackDetailsRepository { - Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode); + Task GetFirstOrDefaultAsync(int orderId, string trackCode); Task UpsertAsync(TrackDetailsIndex index); @@ -12,4 +12,12 @@ public interface ITrackDetailsRepository Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); Task> GetListAsync(int orderId); + + /// + /// 删除轨迹 + /// + /// + /// + /// + Task DeleteTrackAsync(int orderId, List trackCodes); } \ 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/GlobalConst.cs b/src/SJZY.Track.Domain/GlobalConst.cs index 023db1aa..92545ea9 100644 --- a/src/SJZY.Track.Domain/GlobalConst.cs +++ b/src/SJZY.Track.Domain/GlobalConst.cs @@ -11,6 +11,11 @@ public class GlobalConst /// 轨迹新增/更新 mq订阅名称 /// public const string TrackUpsertSubscribe = "SJZY.Track.TrackUpsert"; + + /// + /// 轨迹删除 mq订阅名称 + /// + public const string TrackDeleteSubscribe = "SJZY.Track.TrackDelete"; /// /// 接口通批量轨迹刷新订阅 diff --git a/src/SJZY.Track.Domain/Queries/IProvideQueries.cs b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs index 7814e949..9c17d1d4 100644 --- a/src/SJZY.Track.Domain/Queries/IProvideQueries.cs +++ b/src/SJZY.Track.Domain/Queries/IProvideQueries.cs @@ -32,15 +32,23 @@ public interface IProvideQueries /// 轨迹代码 /// Task MatchTrackContentAsync(int orderId, string code); + + /// + /// 获取可删除的订单轨迹代码 + /// + /// + /// + /// + Task> GetCanDeleteTrackCodesAsync(int orderId, List trackCodes); /// /// 根据子系统内容映射,得到映射后的轨迹code /// /// /// - /// + /// /// - Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode); + Task> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes); /// /// 获取服务商模板配置 diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 0cb54b99..064f9445 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -70,7 +70,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id) .LeftJoin((x, a, b, c, d) => b.TrackFlagId == d.Id) .Where((x, a, b) => x.OrderId == orderId && b.Code == code) - .Select((x, a, b, c,d) => new MatchTrackContentDto + .Select((x, a, b, c, d) => new MatchTrackContentDto { Content = b.Content, EnContent = b.EnContent, @@ -80,13 +80,24 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .FirstAsync(); } - public async Task MapTrackContentCodeAsync(int upSubSystemId, int subSystemId, string trackCode) + 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)) + .Select((x, a, b) => b.Code) + .ToListAsync(); + } + + public async Task> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes) { return await Context.Queryable() .Where(x => x.SubSystemId == upSubSystemId && x.MapSubSystemId == subSystemId && - x.TrackContentCode == trackCode) + trackCodes.Contains(x.TrackContentCode)) .Select(x => x.MapTrackContentCode) - .FirstAsync(); + .ToListAsync(); } public async Task> GetPullContentConfigsAsync(int serviceProviderId) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index c0ca92e4..590cb749 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -22,6 +22,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract q.Term(t => t.Field(f => f.OrderId).Value(orderId)) && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) ) ); @@ -39,7 +40,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract t .Field(f => f.OrderNo) .Terms(orderNos)) - && q.Term(f => f.OrderType, orderType)) + && q.Term(f => f.OrderType, orderType) + && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + ) ); return data.Documents.ToList(); @@ -71,18 +74,34 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract> GetListAsync(int orderId) { var data = await Context.SearchAsync(x => x - .Source(s => s.Includes(fd => fd - .Field(f => f.TrackStatus) - .Field(f => f.TrackCode) - .Field(f => f.TrackContent) - .Field(f => f.TrackPlace) - .Field(f => f.TrackTime) - .Field(f => f.TraceTimeZone) - )).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)))); + .Source(s => s.Includes(fd => fd + .Field(f => f.TrackStatus) + .Field(f => f.TrackCode) + .Field(f => f.TrackContent) + .Field(f => f.TrackPlace) + .Field(f => f.TrackTime) + .Field(f => f.TraceTimeZone) + )).Query(q => + q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + ) + ); return data?.Documents?.ToList(); } + public async Task DeleteTrackAsync(int orderId, List trackCodes) + { + await Context.UpdateByQueryAsync(x => x + .Query( + q => + q.Term(t => t.OrderId, orderId) + && q.Terms(t => t.Field(f => f.TrackCode).Terms(trackCodes))) + .Script(s => s + .Source("ctx._source.IsDeleted = true")) + ); + } + public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) { if (input.OrderNos.Count < 1) return default; @@ -91,9 +110,12 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract 500 ? 500 : input.PageSize; var data = await Context.SearchAsync(x => x - .Query(q => q.Terms(t => t - .Field(f => f.OrderNo) - .Terms(distinctOrderNumbers))) + .Query(q => + q.Terms(t => t + .Field(f => f.OrderNo) + .Terms(distinctOrderNumbers)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + ) .Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)) .From((input.PageIndex - 1) * input.PageSize) .Size(finalSize) From cc325aa4968e74a0dcd0b2b2c615ec84a6fa5c78 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Mon, 4 Mar 2024 16:42:52 +0800 Subject: [PATCH 149/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.Test.json | 4 +-- .../TrackContents/TrackContentService.cs | 21 ++++++++------- .../TrackStatus/TrackStatusService.cs | 2 +- .../TrackTemplates/TrackTemplateService.cs | 4 +-- .../ITrackContentRepository.cs | 1 + .../Repositories/TrackContentRepository.cs | 27 +++++++++++++++++++ 6 files changed, 45 insertions(+), 14 deletions(-) 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.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs index 6e8d42e7..f4946435 100644 --- a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs +++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs @@ -193,21 +193,24 @@ namespace SJZY.Track.Application.Services.TrackContents private async Task DeleteAsync(EditTrackContentInput input) { #region 业务校验 - //查询是否关联了轨迹模版内容 - var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); - if (trackTemplateContents.Any()) + 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: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查"); - } - + //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); diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs index c1f22afb..979d412d 100644 --- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs +++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs @@ -163,7 +163,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency if (isExistStatus!=null) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); - throw new BusinessException(message: "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); + throw new BusinessException(message: "该状态关联轨迹内容,禁止删除"); } #endregion var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index 6981c6ed..525add23 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -163,13 +163,13 @@ public class TrackTemplateService : ApplicationService, ITransientDependency if (isExisistTrackPullConfigs.Any()) { //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); - throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查"); + throw new BusinessException(message: "该模板存在映射,禁止删除"); } //轨迹推送里看看是否被占用 var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); if (isExisistTrackPushConfigs.Any()) { - throw new BusinessException(message: "轨迹推送配置里已经绑定模版,请检查"); + throw new BusinessException(message: "该模板存在映射,禁止删除"); } #endregion 业务校验 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index cc7a54e9..511d4feb 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -23,4 +23,5 @@ public interface ITrackContentRepository : IBasicRepository Task SoftDeleteMapAsync(Expression> whereExpression); Task UpdateMapAsync(Expression> columns, Expression> whereExpression); + Task GetTemplateIsExist(int trackContentId); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index fcd51bd1..b1a0cda0 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -1,6 +1,7 @@ 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.VEntities; using System.Linq; @@ -88,6 +89,32 @@ public class TrackContentRepository : BasicRepository, ITrac return pagedList; } + /// + /// 获取轨迹模版是否存在 + /// + /// + /// + 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() From 9ba82664803c3574118e707a6e85e2a51feac894 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Mon, 4 Mar 2024 18:05:41 +0800 Subject: [PATCH 150/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2=E6=B7=BB=E5=8A=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AD=90=E7=B3=BB=E7=BB=9Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackTemplates/GetTrackDetailDto.cs | 5 +++ .../Services/ProvideServices/OrderService.cs | 2 - .../ProvideServices/TrackQueryService.cs | 42 +++++++++++++++++++ .../TrackTemplate/GetTrackTemplateDetailVO.cs | 5 +++ .../Repositories/TrackTemplateRepository.cs | 3 +- 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs index 86e5db45..08f7824d 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs @@ -56,6 +56,11 @@ /// public string SubSystem { set; get; } + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + /// /// 创建时间 /// diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 007e06d0..aaf59008 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -94,7 +94,6 @@ public class OrderService : ApplicationService #endregion #region 轨迹订单列表 - /// /// 获取分页的轨迹订单 /// @@ -109,7 +108,6 @@ public class OrderService : ApplicationService ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } - #endregion private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 02f6d9b0..aa554a9a 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,5 +1,7 @@ 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.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -11,12 +13,15 @@ namespace SJZY.Track.Application.Services.ProvideServices; 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; } @@ -63,6 +68,43 @@ public class TrackQueryService : ApplicationService return res; } + #region 轨迹订单明细列表 + /// + /// 根据轨迹订单id获取轨迹订单明细列表 + /// + /// + /// + [HttpPost("/Track/GetDetails")] + public async Task> GetOrderDetails(GetOrderDetailsInput input) + { + var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); + if (!trackDetails.IsNullOrEmpty()) + { + var list = ObjectMapper.Map, List>(trackDetails); + return list; + } + + return new List(); + } + #endregion + + #region 轨迹订单分页 + /// + /// 获取分页的轨迹订单 + /// + /// + /// + [HttpPost("/Track/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 + private async Task TrackDetailSort(List list, GetTrackInput input) { switch (input.SortMethod) diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs index 1fa28d92..46677e0e 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateDetailVO.cs @@ -56,6 +56,11 @@ public class GetTrackTemplateListVO /// public string SubSystem { set; get; } + /// + /// 子系统id + /// + public int SubSystemId { set; get; } + /// /// 创建时间 /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d414e5c8..3bb1cfd9 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -55,7 +55,8 @@ public class TrackTemplateRepository : BasicRepository, ITr Code = a.Code, CreateTime = a.CreateTime, Name = a.Name, - SubSystem = b.CnName + SubSystem = b.CnName, + SubSystemId = b.Id }) .ToPagedListAsync(input.PageIndex, input.PageSize); //.OrderByIF(input.TrackTemplateId > 0, From 999c7d77ba76bb5777850c8024be07c6b84335ab Mon Sep 17 00:00:00 2001 From: dingenwen <543338760@qq.com> Date: Mon, 4 Mar 2024 18:23:47 +0800 Subject: [PATCH 151/196] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Application/SjzyTrackApplicationModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 3c9197f2..2e4e0454 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -45,11 +45,13 @@ namespace SJZY.Track.Application }); //添加多语言 + var languageConfig = configuration.GetSection("Language"); Configure(options => { options.Resources .Add("zh") .AddBaseTypes(typeof(SjzyBasicLocalization)) + .AddRedisResource(languageConfig) .AddVirtualJson("/Localization/Resources"); }); //授权拦截提示 From 22dd02507f300ee180471413542e97f9c153c26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Mon, 4 Mar 2024 18:48:43 +0800 Subject: [PATCH 152/196] =?UTF-8?q?test=20=E8=BD=A8=E8=BF=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E3=80=81=E6=96=B0=E5=A2=9E=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E3=80=81=E8=BD=AF=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EventHandlers/TrackDeleteEventHandler.cs | 2 +- .../SJZY.Track.Application.csproj | 4 ++ .../ProvideServices/OrderLinkService.cs | 6 ++ .../Services/ProvideServices/TrackService.cs | 2 +- .../SjzyTrackApplicationModule.cs | 33 ++++++++-- .../OrderAggregate/IOrderRepository.cs | 4 +- .../Aggregates/OrderAggregate/OrderEntity.cs | 5 +- .../ITrackDetailsRepository.cs | 2 +- .../TrackDetailsIndex.cs | 2 +- .../Repositories/OrderRepository.cs | 15 +++-- .../Repositories/TrackDetailsRepository.cs | 62 ++++++++++++------- .../SjzyTrackRepositoryModule.cs | 4 ++ 12 files changed, 98 insertions(+), 43 deletions(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs index d4e48a10..f70492f4 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs @@ -23,7 +23,7 @@ public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe _capPublisher = capPublisher; } - [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] + [CapSubscribe(GlobalConst.TrackDeleteSubscribe)] public async Task ConsumerAsync(TrackDeleteEvent @event) { // 不同子系统需要做内容映射 diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 1e027d10..d2b2eafd 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -13,6 +13,10 @@ + + + + diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index 50490d04..6446ccb7 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -34,6 +34,12 @@ public class OrderLinkService : ApplicationService 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; // 单号去重 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 9fdbb37e..10668f5a 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -85,7 +85,7 @@ public class TrackService : ApplicationService TrackCodes = codes, SubSystemId = order.SubSystemId, }; - await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event); + await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event); return true; } diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 3c9197f2..b876d5bd 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -1,4 +1,7 @@ -using SJZY.Expand.ABP.Core.Localization; +using DotNetCore.CAP; +using Microsoft.Extensions.Configuration; +using SJZY.Expand.ABP.Core.Localization; +using SJZY.Expand.ABP.Core.Logger; using SJZY.InterfaceRelay.Application.Contracts; using SJZY.Track.Application.Contract; using SJZY.Track.Application.Localization; @@ -65,19 +68,41 @@ namespace SJZY.Track.Application 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 => + { + LogHelper.Error($@"{faileCalback.MessageType} 失败了,消息名称: {faileCalback.Message}"); + }; + }); } public override void PreConfigureServices(ServiceConfigurationContext context) { - var configuration = context.Services.GetConfiguration(); PreConfigure(options => { - options.ProxyClientActions.Add(async (remoteName, serviceProvider, httpClient) => + options.ProxyClientActions.Add((_, _, httpClient) => { //如果设置Token,前端需要传入Token 否则引发异常 httpClient.SetTokenHeader(); httpClient.Timeout = TimeSpan.FromMinutes(3); - await Task.CompletedTask; }); }); } diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs index e039c01e..9e8d59eb 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs @@ -9,9 +9,7 @@ public interface IOrderRepository : IBasicRepository /// /// /// - Task CreateOrderAsync(OrderEntity order); - - //Task> GetOrderDetails(GetOrderDetailsInputVO input); + Task CreateOrderAsync(OrderEntity order); /// /// 获取分页的轨迹订单 diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs index e21d6a04..04432d30 100644 --- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs +++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderEntity.cs @@ -114,9 +114,8 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot [SugarColumn(ColumnName = "LeavePort")] public string? LeavePort { get; set; } - [Navigate(NavigateType.OneToMany, nameof(OrderFlightEntity.OrderId))] + [SugarColumn(IsIgnore = true)] public List OrderFlights { get; set; } - - [Navigate(NavigateType.OneToMany, nameof(OrderFlightEntity.OrderId))] + [SugarColumn(IsIgnore = true)] public List OrderTemplates { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index 185f0874..d79c78df 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -11,7 +11,7 @@ public interface ITrackDetailsRepository Task> GetListAsync(int orderType, List orderNos); Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input); - Task> GetListAsync(int orderId); + Task?> GetListAsync(int orderId); /// /// 删除轨迹 diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 6a330083..0004343c 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -59,7 +59,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 轨迹发生地 /// - public string? TrackPlace { get; set; } + public string TrackPlace { get; set; } = null!; /// /// 轨迹发生时间 diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index f8cd7136..728a0606 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -9,12 +9,17 @@ namespace SJZY.Track.Repository.Repositories; public class OrderRepository : BasicRepository, IOrderRepository, ITransientDependency { - public async Task CreateOrderAsync(OrderEntity order) + public async Task CreateOrderAsync(OrderEntity order) { - return await Context.InsertNav(order) - .Include(x => x.OrderFlights) - .Include(x => x.OrderTemplates) - .ExecuteCommandAsync(); + 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) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 590cb749..71779e5d 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -1,4 +1,6 @@ using Nest; +using SJZY.Expand.ABP.Core.Logger; +using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; @@ -9,8 +11,6 @@ namespace SJZY.Track.Repository.Repositories; internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository, ITransientDependency { - public string IndexName => $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}"; - public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory) { } @@ -18,32 +18,46 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract GetFirstOrDefaultAsync(int orderId, string trackCode) { var r = await Context.SearchAsync(s => s - .Index(IndexName) + .Source() .Query(q => - q.Term(t => t.Field(f => f.OrderId).Value(orderId)) - && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode)) - && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + q.Term(f => f.OrderId, orderId) + && q.Term(f => f.TrackCode.Suffix("keyword"), trackCode) + && q.Term(f => f.IsDeleted, false) ) ); - - if (r.IsValid) + + var res= r.Documents.FirstOrDefault(); + if (r.Hits.FirstOrDefault() != default && res != default) { - return r.Documents.FirstOrDefault(); + res.Id = r.Hits.FirstOrDefault()!.Id; } - return default; + return res; } public async Task UpsertAsync(TrackDetailsIndex index) { - var response = await Context.UpdateAsync(index.Id, u => u - .Index(IndexName) - .Doc(index) - .DocAsUpsert() - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 - ); - if (!response.IsValid) - throw new Exception($"数据修改失败,原因:{response.DebugInformation}"); + try + { + if (index.Id.IsNullOrWhiteSpace()) + { + // 按天写入es + await Context.IndexAsync(index, request => request + .Index($"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}") + ); + } + else + { + await Context.UpdateAsync(index.Id, u => u + .Doc(index) + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + ); + } + } + catch (Exception ex) + { + LogHelper.Error($"轨迹数据新增/修改失败,原因:{ex.Message}。\n{index.ToJson()}"); + } } public async Task> GetListAsync(int orderType, List orderNos) @@ -61,17 +75,17 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract q.Terms(t => t - .Field(f => f.OrderNo) + .Field(f => f.OrderNo.Suffix("keyword")) .Terms(orderNos)) && q.Term(f => f.OrderType, orderType) - && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) ) ); return data.Documents.ToList(); } - public async Task> GetListAsync(int orderId) + public async Task?> GetListAsync(int orderId) { var data = await Context.SearchAsync(x => x .Source(s => s.Includes(fd => fd @@ -83,7 +97,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TraceTimeZone) )).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)) - && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) ) ); @@ -98,7 +112,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract t.OrderId, orderId) && q.Terms(t => t.Field(f => f.TrackCode).Terms(trackCodes))) .Script(s => s - .Source("ctx._source.IsDeleted = true")) + .Source("ctx._source.isDeleted = true")) ); } @@ -114,7 +128,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract t .Field(f => f.OrderNo) .Terms(distinctOrderNumbers)) - && q.Term(t => t.Field(f => f.IsDeleted).Value(true)) + && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) ) .Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)) .From((input.PageIndex - 1) * input.PageSize) diff --git a/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs index 546d80d9..e7ca3b6b 100644 --- a/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs +++ b/src/SJZY.Track.Repository/SjzyTrackRepositoryModule.cs @@ -39,6 +39,10 @@ public class SjzyTrackRepositoryModule : AbpModule 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"]!; From e7b80fb1fdf2918851ad47e731ce7966bfe2a199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Mon, 4 Mar 2024 18:51:56 +0800 Subject: [PATCH 153/196] =?UTF-8?q?change=20=E6=B7=BB=E5=8A=A0=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=8E=A5=E5=8F=A3=E8=B7=AF=E7=94=B1=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/OrderLinkService.cs | 1 + .../Services/ProvideServices/OrderService.cs | 2 +- .../Services/ProvideServices/TrackPullService.cs | 1 + .../Services/ProvideServices/TrackPushService.cs | 1 + .../Services/ProvideServices/TrackQueryService.cs | 1 + .../Services/ProvideServices/TrackService.cs | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index 6446ccb7..73c08dd9 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -8,6 +8,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 订单关联服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class OrderLinkService : ApplicationService { private readonly IOrderRepository _orderRepository; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index aaf59008..42c94f23 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -2,7 +2,6 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; -using Volo.Abp.ObjectMapping; namespace SJZY.Track.Application.Services.ProvideServices; @@ -10,6 +9,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 订单服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class OrderService : ApplicationService { private readonly IOrderRepository _orderRepository; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs index 07dd84d3..53cdfd57 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs @@ -9,6 +9,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 轨迹拉取服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class TrackPullService : ApplicationService { private readonly IOrderRepository _orderRepository; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs index 5474a9be..f2b5320f 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs @@ -4,6 +4,7 @@ /// 轨迹推送服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class TrackPushService: ApplicationService { diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index aa554a9a..96bb5de5 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -10,6 +10,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 轨迹查询服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class TrackQueryService : ApplicationService { private readonly ITrackDetailsRepository _trackDetailsRepository; diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs index 10668f5a..18adf7fa 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs @@ -10,6 +10,7 @@ namespace SJZY.Track.Application.Services.ProvideServices; /// 轨迹服务 /// [ApiExplorerSettings(GroupName = "提供接口")] +[Route("/ProviderService")] public class TrackService : ApplicationService { private readonly IOrderRepository _orderRepository; From 9d8cdadc9c52dd759238738c9848d453f84f559f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 5 Mar 2024 10:50:07 +0800 Subject: [PATCH 154/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=92=8C=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 29 +++++++++++-------- .../Services/TrackPush/TrackPushService.cs | 23 ++++++++------- .../GetTrackPushContentDetailOutputVO.cs | 2 +- .../Enums/EnumPropertyEnums.cs | 5 ++++ .../Repositories/TrackPushConfigRepository.cs | 12 +++++--- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 47baadb0..a562670d 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -209,20 +209,25 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { - Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId; + var isContentAnyExp = Expressionable.Create() + .And(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId); - var trackKeywordExp = Expressionable.Create() - .And(x => x.TrackContentId == input.TrackContentId - || (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue) - || (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue) - || (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue)); - - input.TrackKeywords?.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); - - isContentAnyExp = isContentAnyExp.And(trackKeywordExp.ToExpression()); - - if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp)) + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId).ToExpression())) throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]); + else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]); + else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]); + else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]); + else if (!input.TrackKeywords.IsNullOrEmpty()) + { + var trackKeywordExp = Expressionable.Create(); + input.TrackKeywords!.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); + + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp.ToExpression()).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]); + } var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index fa106f23..a66a58c0 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -111,7 +111,7 @@ public class TrackPushService : ApplicationService, ITransientDependency if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id); var trackTemplateIdExp = Expressionable.Create(); - foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); } + input.TrackTemplateIds?.ForEach(item => { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, item.ToString())); }); isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression()); @@ -202,17 +202,20 @@ public class TrackPushService : ApplicationService, ITransientDependency { if (input.Options != OptionTypeNoNull.删除) { - Expression> isContentAnyExp = x => - x.TrackPushConfigId == input.TrackPushConfigId - && (x.TrackContentId == input.TrackContentId - || (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue) - || (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue) - || (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue) - || (input.TrackEnContentValue != null && x.TrackEnContentValue == input.TrackEnContentValue)); - if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id); + var isContentAnyExp = Expressionable.Create() + .And(x => x.TrackPushConfigId == input.TrackPushConfigId); + if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); - if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp)) + if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId).ToExpression())) throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]); + else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]); + else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]); + else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]); + else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue).ToExpression())) + throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]); } switch (input.Options) diff --git a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs index f0980524..ace2b3df 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushContentDetailOutputVO.cs @@ -47,7 +47,7 @@ public class GetTrackPushContentDetailOutputVO /// /// 轨迹推送配置id /// - public int TrackPullConfigId { get; set; } + public int TrackPushConfigId { get; set; } /// /// 推送轨迹状态 diff --git a/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs index e1c08aaf..a0b74b22 100644 --- a/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs +++ b/src/SJZY.Track.Domain/Enums/EnumPropertyEnums.cs @@ -11,4 +11,9 @@ public enum EnumPropertyEnums /// 节点 /// [Description("ServiceNode")] 节点, + + /// + /// 单号类型 + /// + [Description("TrackOrderType")] 单号类型 } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs index 2531f141..f6a325fd 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs @@ -1,9 +1,11 @@ -using SJZY.Track.Domain.Aggregates.TrackContentAggregate; +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; @@ -44,12 +46,14 @@ public class TrackPushConfigRepository : BasicRepository, { 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, trackContent) => pushContent.Sort) - .Select((pushContent, trackContent) => new GetTrackPushContentPageOutputVO + .OrderBy(pushContent => pushContent.Sort) + .Select((pushContent, trackContent, enumValue) => new GetTrackPushContentPageOutputVO { Id = pushContent.Id, - Sort = pushContent.Sort + Sort = pushContent.Sort, + OrderNoType = enumValue.Disp }, true) .ToPagedListAsync(input.PageIndex, input.PageSize); } From d21c83243921c74c7e85699f0ed60f40ead30844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 5 Mar 2024 11:18:49 +0800 Subject: [PATCH 155/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 20 +++++++++---------- .../Services/TrackPush/TrackPushService.cs | 15 +++++++------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index a562670d..df09c551 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -1,4 +1,5 @@ -using System.Linq.Expressions; +using System; +using System.Linq.Expressions; using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.PublicMethords; @@ -209,23 +210,22 @@ public class TrackPullService : ApplicationService, ITransientDependency [HttpPost("UpdateContent")] public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) { - var isContentAnyExp = Expressionable.Create() - .And(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId); + Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId; - if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId).ToExpression())) + 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).ToExpression())) + 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).ToExpression())) + 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).ToExpression())) + 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()) { - var trackKeywordExp = Expressionable.Create(); - input.TrackKeywords!.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); + Expression> trackKeywordExp = _ => true; + input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); - if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp.ToExpression()).ToExpression())) + if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp))) throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]); } diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs index a66a58c0..1b009a95 100644 --- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs +++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs @@ -202,19 +202,18 @@ public class TrackPushService : ApplicationService, ITransientDependency { if (input.Options != OptionTypeNoNull.删除) { - var isContentAnyExp = Expressionable.Create() - .And(x => x.TrackPushConfigId == input.TrackPushConfigId); - if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id); + 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).ToExpression())) + 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).ToExpression())) + 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).ToExpression())) + 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).ToExpression())) + 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).ToExpression())) + else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue))) throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]); } From 415360ef8d68d45e7b379f71ab1ee99b280b3c2f 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, 5 Mar 2024 11:34:29 +0800 Subject: [PATCH 156/196] =?UTF-8?q?change=20=E8=88=AA=E7=8F=AD=E3=80=81?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E5=8F=AF=E4=BC=A0null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpdateOrderInput.cs | 4 ++-- .../Dtos/ProvideServices/UpsertOrderInput.cs | 2 +- .../AutoMapper/OrderAutoMapperProfile.cs | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs index a6faf08b..7d9feb90 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -35,10 +35,10 @@ public class UpdateOrderInput : OrderNoInfo /// /// 订单模板(传全量) /// - public List Templates { get; set; } = new(); + public List? Templates { get; set; } = new(); /// /// 订单航班信息 /// - public List FlightInfos { 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 index f6c7cb78..880c43a5 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -24,7 +24,7 @@ public class OrderTemplateInfo public int? ServiceProviderId { get; set; } } -public class OrderFligthInfo +public class OrderFlightInfo { /// /// 航班号 diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index d0ead552..f79ef0b8 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,10 +1,8 @@ using AutoMapper; -using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; -using System.Diagnostics; namespace SJZY.Track.Application.AutoMapper; @@ -18,7 +16,7 @@ public class OrderAutoMapperProfile : Profile 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(MemberList.None); From f62cb2cf56b52aeec10e9beb4c10c644ccf9c6a8 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, 5 Mar 2024 11:36:56 +0800 Subject: [PATCH 157/196] attach --- .../Services/ProvideServices/OrderService.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 42c94f23..b05e3f68 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -43,8 +43,8 @@ public class OrderService : ApplicationService order = ObjectMapper.Map(input); order.SubSystemId = 1; - order.OrderTemplates = ObjectMapper.Map, List>(input.Templates); - order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); await _orderRepository.CreateOrderAsync(order); return "创建成功"; @@ -94,6 +94,7 @@ public class OrderService : ApplicationService #endregion #region 轨迹订单列表 + /// /// 获取分页的轨迹订单 /// @@ -108,13 +109,14 @@ public class OrderService : ApplicationService ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } + #endregion 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); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos); await _orderRepository.UpdateOrderAsync(order); } } \ No newline at end of file From 86ae365a817a9f0b812b80807f7a39c2902e48a6 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, 5 Mar 2024 11:39:44 +0800 Subject: [PATCH 158/196] =?UTF-8?q?fix=E3=80=90S1-=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=A8=E8=BF=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E6=96=87=E6=A1=A3=EF=BC=8C=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E6=97=B6=E9=97=B4=E5=92=8C=E6=97=B6=E5=8C=BA?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E5=BF=85=E5=A1=AB=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E4=B8=8D=E5=A1=AB=E5=86=99=E4=B9=9F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=88=90=E5=8A=9F=E4=BA=86=E3=80=91https://www.tapd.c?= =?UTF-8?q?n/60863849/bugtrace/bugs/view=3Fbug=5Fid=3D1160863849001029729?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpsertTrackInput.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs index ef0e67a4..c2c7b4c6 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -1,24 +1,32 @@ -namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; +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] public float TraceTimeZone { get; set; } } \ No newline at end of file From 8f2d9cf708771be4a48480c4b13fc30e2d770465 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, 5 Mar 2024 11:43:15 +0800 Subject: [PATCH 159/196] =?UTF-8?q?fix=E3=80=90S1-=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95=E6=97=B6=EF=BC=8C=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=9B=BD=E5=AE=B6=E3=80=81=E7=9B=AE=E7=9A=84=E5=9F=8E?= =?UTF-8?q?=E5=B8=82=E3=80=81=E8=B5=B7=E8=BF=90=E5=9B=BD=E5=AE=B6=E3=80=81?= =?UTF-8?q?=E8=B5=B7=E8=BF=90=E5=9F=8E=E5=B8=82=E8=BF=994=E4=B8=AA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=83=BD=E6=98=AF=E5=BF=85=E5=A1=AB=E7=9A=84?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=98=AF=E4=B8=8D=E5=A1=AB=E5=86=99=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=83=BD=E5=8F=AF=E4=BB=A5=E5=88=9B=E5=BB=BA=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E3=80=91https://www.tapd.cn/60863849/bugtrace/bugs/vi?= =?UTF-8?q?ew=3Fbug=5Fid=3D1160863849001029724?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpdateOrderInput.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs index 7d9feb90..69ad9a0b 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs @@ -1,4 +1,6 @@ -namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; +using System.ComponentModel.DataAnnotations; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class UpdateOrderInput : OrderNoInfo { @@ -15,22 +17,30 @@ public class UpdateOrderInput : OrderNoInfo /// /// 目的国家,必填 /// - public string ArrivalCountry { get; set; } + [Required] + [MaxLength(200)] + public string ArrivalCountry { get; set; } = null!; /// /// 起运国家,必填 /// - public string LeaveCountry { get; set; } + [Required] + [MaxLength(200)] + public string LeaveCountry { get; set; } = null!; /// /// 目的城市,必填 /// - public string ArrivalCity { get; set; } + [Required] + [MaxLength(200)] + public string ArrivalCity { get; set; } = null!; /// /// 起运城市,必填 /// - public string LeaveCity { get; set; } + [Required] + [MaxLength(200)] + public string LeaveCity { get; set; } = null!; /// /// 订单模板(传全量) From c2e06e1201eaeb63db94d3e2a77d1c1308f49898 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, 5 Mar 2024 11:49:16 +0800 Subject: [PATCH 160/196] =?UTF-8?q?fix=E3=80=90S1-=E8=B0=83=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=88=90=E5=8A=9F=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E7=9B=B8=E5=90=8C=E5=8D=95=E5=8F=B7=E4=B8=94=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=B1=BB=E5=9E=8B=E4=B8=BA=E7=A9=BA=E7=9A=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E3=80=91https://www.tapd.cn/60863849/bugtrace/bugs/vi?= =?UTF-8?q?ew=3Fbug=5Fid=3D1160863849001029721?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/OrderNoInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs index b4283022..eda65e4a 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs @@ -8,6 +8,7 @@ public class OrderNoInfo /// 订单类型,必填 /// [Required] + [Range(1, int.MaxValue)] public int OrderType { get; set; } /// From 3c14a3857804ec5822b7190f64903428220784ca 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, 5 Mar 2024 14:46:26 +0800 Subject: [PATCH 161/196] =?UTF-8?q?change=20=E6=9B=B4=E6=96=B0=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EventHandlers/TrackUpsertEventHandler.cs | 3 ++- .../EventHandlers/UpdateOrderTrackEventHandler.cs | 3 ++- .../Services/ProvideServices/OrderService.cs | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index d8e480ef..7b0901e1 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -110,7 +110,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe TrackContent = track.TrackContent, TrackEnContent = track.TrackEnContent, TrackPlace = track.TrackPlace, - TrackTime = track.TrackTime + TrackTime = track.TrackTime, + TrackTimeZone = track.TraceTimeZone }); // 根据订单关联关系异步向下刷 diff --git a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs index dfbafc42..0901b2a0 100644 --- a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs @@ -33,7 +33,8 @@ public class UpdateOrderTrackEventHandler : ITransientDependency, ICapSubscribe await _orderRepository.UpdateColumnAsync(order, x => new { - x.IsCompleted, x.LatestTrackContent, x.LatestTrackEnContent, x.LatestTrackPlace, x.LatestTrackTime + 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/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index b05e3f68..226be0ef 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -115,8 +115,8 @@ public class OrderService : ApplicationService 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); + order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); + order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); await _orderRepository.UpdateOrderAsync(order); } } \ No newline at end of file From 362ea52f2e5f89f3959489bb9375d10418ddd9a9 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, 5 Mar 2024 15:07:08 +0800 Subject: [PATCH 162/196] =?UTF-8?q?change=20=E4=BF=AE=E6=94=B9=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EventHandlers/TrackUpsertEventHandler.cs | 1 + .../TrackDetailsIndex.cs | 5 +++ .../Repositories/TrackDetailsRepository.cs | 42 ++++++++++--------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 7b0901e1..08969864 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -71,6 +71,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe track = new TrackDetailsIndex { + IndexName = $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}", OrderId = @event.OrderId, OrderNo = @event.OrderNo, OrderType = @event.OrderType, diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 0004343c..b885e11b 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -16,6 +16,11 @@ public class TrackDetailsIndex : IdBaseIndex /// public string OrderNo { get; set; } = null!; + /// + /// 索引名称 + /// + public string IndexName { get; set; } = null!; + /// /// 订单类型(主数据枚举TrackOrderType) /// diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 71779e5d..a0e6cead 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -1,8 +1,6 @@ using Nest; using SJZY.Expand.ABP.Core.Logger; -using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ElasticSearch.Services; -using SJZY.Track.Domain; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; @@ -25,9 +23,9 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.IsDeleted, false) ) ); - - var res= r.Documents.FirstOrDefault(); - if (r.Hits.FirstOrDefault() != default && res != default) + + var res = r.Documents.FirstOrDefault(); + if (res != default && r.Hits.FirstOrDefault() != default) { res.Id = r.Hits.FirstOrDefault()!.Id; } @@ -37,26 +35,30 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract request + .Index(index.IndexName) + ); + + if (!r.IsValid) { - // 按天写入es - await Context.IndexAsync(index, request => request - .Index($"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}") - ); - } - else - { - await Context.UpdateAsync(index.Id, u => u - .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 - ); + LogHelper.Error($"轨迹数据新增失败,原因:{r.DebugInformation}。"); } } - catch (Exception ex) + else { - LogHelper.Error($"轨迹数据新增/修改失败,原因:{ex.Message}。\n{index.ToJson()}"); + var r = await Context.UpdateAsync(index.Id, u => u + .Index(index.IndexName) + .Doc(index) + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + ); + + if (!r.IsValid) + { + LogHelper.Error($"轨迹数据更新失败,原因:{r.DebugInformation}。"); + } } } From 0bfc8708be1ca0b4ae4c34bc6e243d59eb403d0b 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, 5 Mar 2024 16:01:52 +0800 Subject: [PATCH 163/196] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4by=E6=9F=A5=E8=AF=A2=EF=BC=8Ccode=E6=9C=AA=E5=8A=A0?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackDetailsRepository.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index a0e6cead..c2dd6340 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -44,7 +44,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract trackCodes) { - await Context.UpdateByQueryAsync(x => x + var r = await Context.UpdateByQueryAsync(x => x .Query( q => q.Term(t => t.OrderId, orderId) - && q.Terms(t => t.Field(f => f.TrackCode).Terms(trackCodes))) + && q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))) .Script(s => s .Source("ctx._source.isDeleted = true")) ); + + if (!r.IsValid) + throw new Exception($"轨迹数据删除失败,原因:{r.DebugInformation}"); } public async Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input) From 8eca00c66bd185b1555a050ba5e0153095bddfd2 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 16:08:52 +0800 Subject: [PATCH 164/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86es?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 6 +++++- .../Repositories/TrackDetailsRepository.cs | 17 +++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index f79ef0b8..27f73eda 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -21,6 +21,10 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); - CreateMap(MemberList.None); + CreateMap(MemberList.None).ForMember(dest => dest.Id, opt => opt.MapFrom(m => m.OrderId)) + .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.TrackTimeZone, opt => opt.MapFrom(m => m.TraceTimeZone.ToString())); } } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index a0e6cead..98a4d7d3 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -52,7 +52,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(index.IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!r.IsValid) @@ -89,19 +89,8 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(int orderId) { - var data = await Context.SearchAsync(x => x - .Source(s => s.Includes(fd => fd - .Field(f => f.TrackStatus) - .Field(f => f.TrackCode) - .Field(f => f.TrackContent) - .Field(f => f.TrackPlace) - .Field(f => f.TrackTime) - .Field(f => f.TraceTimeZone) - )).Query(q => - q.Terms(t => t.Field(f => f.OrderId).Terms(orderId)) - && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) - ) - ); + 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(); } From 9f2667ac6e823c4cf69d76959929b406ad2d9636 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, 5 Mar 2024 16:21:19 +0800 Subject: [PATCH 165/196] =?UTF-8?q?fix=E3=80=90S1-=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=B7=E8=8E=B7=E5=8F=96=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3-=E6=97=B6=E5=8C=BA=E4=B8=8D=E5=A1=AB?= =?UTF-8?q?=E5=86=99=EF=BC=8C=E6=B2=A1=E6=9C=89=E9=BB=98=E8=AE=A4=20+8?= =?UTF-8?q?=EF=BC=8C=E6=8C=89=E6=A8=A1=E6=9D=BF=E9=A1=BA=E5=BA=8F=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=B2=A1=E6=9C=89=E7=BB=93=E6=9E=9C=E3=80=91https://w?= =?UTF-8?q?ww.tapd.cn/60863849/bugtrace/bugs/view=3Fbug=5Fid=3D11608638490?= =?UTF-8?q?01029746?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetTrackInput.cs | 8 +++++++- .../Services/ProvideServices/TrackQueryService.cs | 13 ++++++++----- src/SJZY.Track.Repository/Queries/ProvideQueries.cs | 2 +- .../Repositories/TrackDetailsRepository.cs | 8 +++++--- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs index 578c31b2..7f6898d7 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -1,3 +1,5 @@ +using System.ComponentModel.DataAnnotations; + namespace SJZY.Track.Application.Contract.Dtos.ProvideServices; public class GetTrackInput @@ -5,6 +7,8 @@ public class GetTrackInput /// /// 订单类型 /// + [Required] + [Range(1, int.MaxValue)] public int OrderType { get; set; } /// @@ -14,12 +18,14 @@ public class GetTrackInput /// /// 时区 +8 +8.25 -8.5 -9 + /// 不传默认+8 /// - public float TimeZone { get; set; } + public float? TimeZone { get; set; } = 8; /// /// 排序方式 /// + [Required] public SortMethod SortMethod { get; set; } } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 96bb5de5..1abafb1b 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -22,7 +22,7 @@ public class TrackQueryService : ApplicationService IProvideQueries provideQueries) { _trackDetailsRepository = trackDetailsRepository; - _orderRepository=orderRepository; + _orderRepository = orderRepository; _provideQueries = provideQueries; } @@ -44,7 +44,6 @@ public class TrackQueryService : ApplicationService input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重 var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos); - var isTurn = input.TimeZone != 0; foreach (var group in details.GroupBy(x => x.OrderId)) { var item = new GetTrackOutput(); @@ -57,8 +56,8 @@ public class TrackQueryService : ApplicationService Status = x.TrackStatus, Content = x.TrackContent, Location = x.TrackPlace, - Time = isTurn ? x.TrackTime.AddHours(input.TimeZone - x.TraceTimeZone) : x.TrackTime, - TimeZone = isTurn ? input.TimeZone : x.TraceTimeZone + Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TraceTimeZone), + TimeZone = input.TimeZone!.Value }).ToList(); res.Add(item); @@ -70,6 +69,7 @@ public class TrackQueryService : ApplicationService } #region 轨迹订单明细列表 + /// /// 根据轨迹订单id获取轨迹订单明细列表 /// @@ -87,9 +87,11 @@ public class TrackQueryService : ApplicationService return new List(); } + #endregion - #region 轨迹订单分页 + #region 轨迹订单分页 + /// /// 获取分页的轨迹订单 /// @@ -104,6 +106,7 @@ public class TrackQueryService : ApplicationService ObjectMapper.Map, UnifyPageResultDto>(pageList); return pageResultDto; } + #endregion private async Task TrackDetailSort(List list, GetTrackInput input) diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 064f9445..a44a15bc 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -56,7 +56,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .OrderBy(a => a.Sort) .Select((a, b) => new OrderedTrackCodeDto { - TemplateId = a.Id, + TemplateId = a.TrackTemplateId, Code = b.Code }) .ToListAsync(); diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 3470f3d7..cf78c66f 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -52,7 +52,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(index.IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!r.IsValid) @@ -68,6 +68,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(x => x .Source(s => s.Includes(fd => fd + .Field(f => f.OrderNo) .Field(f => f.TrackStatus) .Field(f => f.TrackCode) .Field(f => f.TrackContent) @@ -89,8 +90,9 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> 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))); + 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(); } From 4622906c297e95ca24d17ab767b0d09691d380d8 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 16:53:51 +0800 Subject: [PATCH 166/196] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetOrderDetailsInput.cs | 17 +++-- .../AutoMapper/OrderAutoMapperProfile.cs | 3 +- .../Services/ProvideServices/OrderService.cs | 5 ++ .../ProvideServices/TrackQueryService.cs | 37 ---------- .../Services/TrackOrders/TrackOrderService.cs | 74 +++++++++++++++++++ 5 files changed, 92 insertions(+), 44 deletions(-) create mode 100644 src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index c82bf122..50572e48 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -11,29 +11,34 @@ public class TrackOrderDetailDto { /// - /// 轨迹订单id + /// Id es主键 /// public int Id { get; set; } + /// + /// 轨迹订单id + /// + public int OrderId { set; get; } + /// /// 轨迹代码 /// - public string Code { get; set; } + public string? Code { get; set; } /// /// 轨迹内容 /// - public string Content { get; set; } + public string? Content { get; set; } /// /// 轨迹内容英文 /// - public string EnContent { get; set; } + public string? EnContent { get; set; } /// /// 轨迹发生地 /// - public string TrackPlace { get; set; } + public string? TrackPlace { get; set; } /// /// 轨迹发生时间 @@ -43,6 +48,6 @@ /// /// 轨迹发生时区 /// - public string TrackTimeZone { get; set; } + public string? TrackTimeZone { get; set; } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 27f73eda..dc814b49 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -21,7 +21,8 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); - CreateMap(MemberList.None).ForMember(dest => dest.Id, opt => opt.MapFrom(m => m.OrderId)) + CreateMap(MemberList.None) + .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)) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 226be0ef..0498150a 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -85,6 +85,11 @@ public class OrderService : ApplicationService if (!trackDetails.IsNullOrEmpty()) { var list = ObjectMapper.Map, List>(trackDetails); + int id = 1; + list.ForEach(a => + { + a.Id = id++; + }); return list; } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 96bb5de5..c3739029 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -69,43 +69,6 @@ public class TrackQueryService : ApplicationService return res; } - #region 轨迹订单明细列表 - /// - /// 根据轨迹订单id获取轨迹订单明细列表 - /// - /// - /// - [HttpPost("/Track/GetDetails")] - public async Task> GetOrderDetails(GetOrderDetailsInput input) - { - var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); - if (!trackDetails.IsNullOrEmpty()) - { - var list = ObjectMapper.Map, List>(trackDetails); - return list; - } - - return new List(); - } - #endregion - - #region 轨迹订单分页 - /// - /// 获取分页的轨迹订单 - /// - /// - /// - [HttpPost("/Track/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 - private async Task TrackDetailSort(List list, GetTrackInput input) { switch (input.SortMethod) 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..b0c86ec2 --- /dev/null +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -0,0 +1,74 @@ +using SJZY.Track.Application.Contract.Dtos.ProvideServices; +using SJZY.Track.Domain.Aggregates.OrderAggregate; +using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; +using SJZY.Track.Domain.Dtos.Order; +using System; +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; + + public TrackOrderService( + IOrderRepository orderRepository, + ITrackDetailsRepository trackDetailsRepository + ) + { + this._orderRepository=orderRepository; + this._trackDetailsRepository=trackDetailsRepository; + + } + + #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); + int id = 1; + list.ForEach(a => + { + a.Id = id++; + }); + 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 + } +} From 272e740dacb4ccc54dc97afdb1f2da1a4b4b9de8 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, 5 Mar 2024 16:56:18 +0800 Subject: [PATCH 167/196] =?UTF-8?q?change=20=E5=88=9B=E5=BB=BA=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=EF=BC=8C=E5=AD=90=E7=B3=BB=E7=BB=9Fid=E4=BB=8Eheader?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/OrderService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index 226be0ef..edf429d7 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -2,6 +2,7 @@ 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; @@ -42,7 +43,7 @@ public class OrderService : ApplicationService } order = ObjectMapper.Map(input); - order.SubSystemId = 1; + order.SubSystemId = CurrentUserRequest.SubSystemId; order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!); order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!); From 327db0fab16e3072fcb6fd807c1cf25e2e88220d 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, 5 Mar 2024 16:58:00 +0800 Subject: [PATCH 168/196] =?UTF-8?q?fix=E3=80=90S1-=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E4=B8=8D=E5=A1=AB=E5=86=99=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=BB=99=E5=87=BA=E5=BF=85=E5=A1=AB=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E3=80=91https://www.tapd.cn/60863849/bugtrac?= =?UTF-8?q?e/bugs/view=3Fbug=5Fid=3D1160863849001029771?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/OrderLinkService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index 73c08dd9..77805cf7 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -43,8 +43,8 @@ public class OrderLinkService : ApplicationService if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; - // 单号去重 - input.LinkOrderNos = input.LinkOrderNos.Distinct().ToList(); + // 单号去重,去空 + input.LinkOrderNos = input.LinkOrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 解绑 if (!input.IsLink) return await UnLinkOrderAsync(input); From a4a04bf5a64d6185a77765fe3a904e82a87d0770 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, 5 Mar 2024 17:25:07 +0800 Subject: [PATCH 169/196] =?UTF-8?q?fix=20=E8=AE=A2=E5=8D=95=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E8=AF=A2sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/Repositories/OrderRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 728a0606..5647fc4a 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -63,7 +63,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I return await Context.Queryable() .LeftJoin((a, b) => a.Id == b.OrderId) .LeftJoin((a, b, c) => b.LinkOrderId == c.Id) - .Where(a => a.Id == orderId) + .Where(a => a.OrderId == orderId) .Select((a, b, c) => new LinkedOrderVO { OrderId = c.Id, From 2b299fb70903c2130b08503b4a7a76835f543626 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, 5 Mar 2024 17:42:34 +0800 Subject: [PATCH 170/196] =?UTF-8?q?fix=20=E8=AE=A2=E5=8D=95=E5=85=B3?= =?UTF-8?q?=E8=81=94sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpsertOrderInput.cs | 1 + .../Repositories/OrderRepository.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs index 880c43a5..91ae6d11 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs @@ -7,6 +7,7 @@ public class UpsertOrderInput : UpdateOrderInput /// /// 客户id /// + [Required] public int CustomId { get; set; } } diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 5647fc4a..b1bb6476 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -61,17 +61,16 @@ public class OrderRepository : BasicRepository, IOrderRepository, I public async Task> GetLinkedOrdersAsync(int orderId) { return await Context.Queryable() - .LeftJoin((a, b) => a.Id == b.OrderId) - .LeftJoin((a, b, c) => b.LinkOrderId == c.Id) + .LeftJoin((a, b) => a.LinkOrderId == b.Id) .Where(a => a.OrderId == orderId) - .Select((a, b, c) => new LinkedOrderVO + .Select((a, b) => new LinkedOrderVO { - OrderId = c.Id, - OrderType = c.OrderType, - OrderNo = c.OrderNo, - SubSystemId = c.SubSystemId, - IsPushCompleted = c.IsPushCompleted, - CustomId = c.CustomId + OrderId = b.Id, + OrderType = b.OrderType, + OrderNo = b.OrderNo, + SubSystemId = b.SubSystemId, + IsPushCompleted = b.IsPushCompleted, + CustomId = b.CustomId }) .ToListAsync(); } From 5f60f1ee06880e4a7a7def0cd508936dc3fbf3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 5 Mar 2024 19:01:59 +0800 Subject: [PATCH 171/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackPull/TrackPullService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index df09c551..34998b29 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -222,7 +222,7 @@ public class TrackPullService : ApplicationService, ITransientDependency throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]); else if (!input.TrackKeywords.IsNullOrEmpty()) { - Expression> trackKeywordExp = _ => true; + Expression> trackKeywordExp = _ => false; input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); }); if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp))) From 3be84b4a403c01e175402f6e5f21d4fe59d74e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 5 Mar 2024 19:13:23 +0800 Subject: [PATCH 172/196] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index dbd0f338..d8dad310 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -13,15 +13,7 @@ public class TrackPullAutoMapperProfile : Profile 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.Condition(src => !src.TrackKeywords.IsNullOrEmpty()); - opt.MapFrom(src => string.Join(',', src.TrackKeywords)); - }) - .ForMember(dest => dest.TrackKeywordReverse, opt => - { - opt.Condition(src => !src.TrackKeywordReverses.IsNullOrEmpty()); - opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)); - }); + .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 From d76e7c29a167482badc9d075f2645d969345af60 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 20:06:09 +0800 Subject: [PATCH 173/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 2 +- .../ProvideServices/GetOrderDetailsInput.cs | 20 +++++++ .../Services/TrackOrders/TrackOrderService.cs | 39 +++++++++++- .../ITrackContentRepository.cs | 2 + ...GetTemplateContentAttributeValueInputVO.cs | 59 +++++++++++++++++++ .../Repositories/TrackContentRepository.cs | 28 +++++++++ .../Repositories/TrackDetailsRepository.cs | 6 +- .../Repositories/TrackTemplateRepository.cs | 11 ++++ 8 files changed, 161 insertions(+), 6 deletions(-) create mode 100644 src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index d69cb0c1..676973d6 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -5,7 +5,7 @@ "Apollo": { "AppId": "SJZY.Track.Configuration", "Env": "DEV", - "Namespace": "Test", + "Namespace": "Dev", "MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080", "ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ] } diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index 50572e48..ca1e5ee8 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -6,6 +6,11 @@ /// 轨迹订单id /// public int OrderId { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } } public class TrackOrderDetailDto @@ -49,5 +54,20 @@ /// 轨迹发生时区 /// public string? TrackTimeZone { get; set; } + + /// + /// 时区的值 + /// + public float TrackTimeZoneValue { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } } } \ 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 index b0c86ec2..9c6457fe 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -1,7 +1,9 @@ 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; @@ -17,19 +19,20 @@ namespace SJZY.Track.Application.Services.TrackOrders { private readonly IOrderRepository _orderRepository; private readonly ITrackDetailsRepository _trackDetailsRepository; + private readonly ITrackContentRepository _trackContentRepository; public TrackOrderService( IOrderRepository orderRepository, - ITrackDetailsRepository trackDetailsRepository + ITrackDetailsRepository trackDetailsRepository, + ITrackContentRepository trackContentRepository ) { this._orderRepository=orderRepository; this._trackDetailsRepository=trackDetailsRepository; - + this._trackContentRepository=trackContentRepository; } #region 轨迹订单明细 - /// /// 根据轨迹订单id获取轨迹订单明细列表 /// @@ -42,10 +45,40 @@ namespace SJZY.Track.Application.Services.TrackOrders if (!trackDetails.IsNullOrEmpty()) { var list = ObjectMapper.Map, List>(trackDetails); + var trackCodes = list.Where(a => !a.Code.IsNullOrWhiteSpace()).Select(a => a.Code).ToList(); + + var trackContents = await _trackContentRepository.GetTrackContentAttributeValue(new GetTemplateContentAttributeValueInputVO + { + SubSystemId =input.SubSystemId, + TrackCodes=trackCodes + }); + int id = 1; list.ForEach(a => { a.Id = id++; + var trackContent = trackContents.FirstOrDefault(a => a.SubSystemId==input.SubSystemId&& a.TrackCode==a.TrackCode); + if (trackContent!=null) + { + a.IsCanDelete=trackContent.IsCanDelete; + a.IsExternal = trackContent.IsExternal; + } + a.TrackTimeZoneValue=8f; + if (a.TrackTimeZoneValue==0) + { + 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; } diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs index 511d4feb..400b7363 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/ITrackContentRepository.cs @@ -1,4 +1,5 @@ using SJZY.Track.Domain.Dtos.TrackContents; +using SJZY.Track.Domain.Dtos.TrackTemplate; namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; @@ -24,4 +25,5 @@ public interface ITrackContentRepository : IBasicRepository 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/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs new file mode 100644 index 00000000..1ba46bf4 --- /dev/null +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs @@ -0,0 +1,59 @@ +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 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.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index b1a0cda0..5d4db71f 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -3,6 +3,7 @@ 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; @@ -89,6 +90,31 @@ public class TrackContentRepository : BasicRepository, ITrac 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) + .Where((a, b, c) => c.Id>0) + .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; + } + /// /// 获取轨迹模版是否存在 /// @@ -115,6 +141,8 @@ public class TrackContentRepository : BasicRepository, ITrac return false; } + + public async Task> GetMapPageAsync(GetTrackContentMapPageInputVO input) { return await Context.Queryable() diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index cf78c66f..31d9fc36 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -52,7 +52,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(index.IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!r.IsValid) @@ -90,7 +90,9 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(int orderId) { - var data = await Context.SearchAsync(x => x.Query(q => q.Term(t => t.OrderId, orderId)) + var data = await Context.SearchAsync(x => x.Query(q => q.Term(t => t.OrderId, orderId) + && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) + ) .Size(1000) .Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending))); diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 3bb1cfd9..21b72d53 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -65,6 +65,17 @@ public class TrackTemplateRepository : BasicRepository, ITr return pagedList; } + /// + /// 获取轨迹内容属性值 + /// + /// + public async Task GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input) + { + + + return null; + } + /// public async Task> GetContentPageAsync( GetTrackTemplateContentPageInputVO input) From 140ba7465a2f19cdde5cdb94d5347c9ffb8ab0c0 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 20:11:49 +0800 Subject: [PATCH 174/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/OrderAutoMapperProfile.cs | 5 +++-- .../Services/TrackOrders/TrackOrderService.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index dc814b49..5ae0e71d 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -3,6 +3,7 @@ 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; @@ -21,11 +22,11 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); CreateMap, UnifyPageResultDto>(MemberList.None); - CreateMap(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.TrackTimeZone, opt => opt.MapFrom(m => m.TraceTimeZone.ToString())); + .ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TraceTimeZone)); } } \ 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 index 9c6457fe..670fb853 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -63,7 +63,7 @@ namespace SJZY.Track.Application.Services.TrackOrders a.IsCanDelete=trackContent.IsCanDelete; a.IsExternal = trackContent.IsExternal; } - a.TrackTimeZoneValue=8f; + //a.TrackTimeZoneValue=8f; if (a.TrackTimeZoneValue==0) { a.TrackTimeZone=$"GTM{" "}+00:00"; From 25e3172275fe0156bb375b45425f397d87e6efdd Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 20:12:39 +0800 Subject: [PATCH 175/196] 1 --- .../Services/TrackOrders/TrackOrderService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs index 670fb853..2f04bb41 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -70,7 +70,6 @@ namespace SJZY.Track.Application.Services.TrackOrders } else { - // 将小数形式的小时转换为时区偏移量 int hours = (int)a.TrackTimeZoneValue; // 提取整数部分作为小时 int minutes = (int)((a.TrackTimeZoneValue - hours) * 60); // 将小数部分乘以 60 转换为分钟 From 317d59861a0ad99126798552b414c4ea42ebccb4 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 20:46:00 +0800 Subject: [PATCH 176/196] =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E8=BD=A8=E8=BF=B9=E9=9C=80=E8=A6=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ITrackDetailsRepository.cs | 1 + .../Dtos/Order/GetPageTrackOrderInputVO.cs | 5 ++ .../Repositories/OrderRepository.cs | 50 ++++++++++++++++++- .../Repositories/TrackDetailsRepository.cs | 12 +++++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs index d79c78df..f6578023 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs @@ -20,4 +20,5 @@ public interface ITrackDetailsRepository /// /// Task DeleteTrackAsync(int orderId, List trackCodes); + Task?> GetListAsync(List orderIds); } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index b32b1327..b596a5e1 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -114,5 +114,10 @@ namespace SJZY.Track.Domain.Dtos.Order /// 子系统 /// public string SubSystem { get; set; } + + /// + /// 子系统id + /// + public int SubSystemId { get; set; } } } diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index b1bb6476..3910ce84 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -1,5 +1,6 @@ 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; @@ -9,6 +10,15 @@ 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(); @@ -147,10 +157,48 @@ public class OrderRepository : BasicRepository, IOrderRepository, I NewestTrackTime = a.LatestTrackTime, IsFinish = a.IsCompleted, CreateTime = a.CreateTime, - SubSystem = c.CnName + 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 esTrackDetails = await _trackDetailsRepository.GetListAsync(orderIds); + if (!esTrackDetails.IsNullOrEmpty()) + { + pageList.List.ForEach(a => + { + var esDetails = esTrackDetails.Where(a => a.OrderId== a.OrderId).OrderByDescending(a => a.TrackTime); + var trackDetail = esDetails.FirstOrDefault(); + if (trackDetail!=null) + { + if (trackDetail.TrackContent!=a.NewestTrackContent) + { + a.NewestTrackContent=trackDetail.TrackContent; + } + if (trackDetail.TrackEnContent!=a.NewestTrackEnContent) + { + a.NewestTrackContent=trackDetail.TrackEnContent; + } + if (trackDetail.TrackPlace!=a.NewestTrackPlace) + { + a.NewestTrackPlace=trackDetail.TrackPlace; + } + if (trackDetail.TrackTime!= trackDetail.TrackTime) + { + a.NewestTrackTime=trackDetail.TrackTime; + } + } + }); + } + } + + + + #region 暂时注释 //if (pageList.List.Any()) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 31d9fc36..136020cc 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -3,6 +3,7 @@ using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; +using SJZY.UserCenter.SharedModel.Dtos.PHP.User; namespace SJZY.Track.Repository.Repositories; @@ -99,6 +100,17 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(List orderIds) + { + var data = await Context.SearchAsync(x => x.Query(q => q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) + && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) + ) + .Size(100000) + .Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending))); + + return data?.Documents?.ToList(); + } + public async Task DeleteTrackAsync(int orderId, List trackCodes) { var r = await Context.UpdateByQueryAsync(x => x From 78f6edbbeb9b8cd92c54e23f08dacdb6dba6040e Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 21:04:30 +0800 Subject: [PATCH 177/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/TrackDetailsRepository.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 136020cc..191de929 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -103,11 +103,11 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(List orderIds) { var data = await Context.SearchAsync(x => x.Query(q => q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) - && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) - ) - .Size(100000) - .Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending))); - + && q.Term(a => a.Field(d => d.IsDeleted).Value(false)) + ) + .Size(10000) + .Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending)) + ); return data?.Documents?.ToList(); } From 8f96886eda4427b47ce9b5378b952b9a4d2fb06e Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Tue, 5 Mar 2024 21:16:07 +0800 Subject: [PATCH 178/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0=E5=AD=90?= =?UTF-8?q?=E7=B3=BB=E7=BB=9Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Api/appsettings.json | 2 +- .../Dtos/ProvideServices/GetPageTrackOrderInput.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json index 676973d6..d69cb0c1 100644 --- a/src/SJZY.Track.Api/appsettings.json +++ b/src/SJZY.Track.Api/appsettings.json @@ -5,7 +5,7 @@ "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" ] } diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index ee323b86..5b2220d2 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -107,4 +107,6 @@ public class TrackOrderDto /// 子系统 /// public string SubSystem { get; set; } + + public int SubSystemId { get;set; } } \ No newline at end of file From 369eb3708b5a38b1bd83be1d91604e527a8a69ef Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 09:01:32 +0800 Subject: [PATCH 179/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BA=E4=BA=BA?= =?UTF-8?q?=E5=92=8C=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetOrderDetailsInput.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index ca1e5ee8..d16e10fe 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -69,5 +69,15 @@ /// 是否对外 /// public bool IsExternal { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public string? CreateUser { get; set; } } } \ No newline at end of file From d9905878ae93852e3e9f266161cfd80b20618eef Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 10:02:05 +0800 Subject: [PATCH 180/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/Repositories/OrderRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 3910ce84..aa55ea33 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -171,7 +171,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { pageList.List.ForEach(a => { - var esDetails = esTrackDetails.Where(a => a.OrderId== a.OrderId).OrderByDescending(a => a.TrackTime); + var esDetails = esTrackDetails.Where(b => b.OrderId== a.Id).OrderByDescending(a => a.TrackTime); var trackDetail = esDetails.FirstOrDefault(); if (trackDetail!=null) { From 0b224b8379d76b9b069116c1c36a9e92620daaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 10:26:07 +0800 Subject: [PATCH 181/196] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=BE=AA=E7=8E=AF=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=81=E6=A8=A1=E6=9D=BF=E6=98=8E=E7=BB=86=E5=AF=B9=E5=A4=96?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/TrackUpsertEvent.cs | 9 +++++++-- .../EventHandlers/TrackUpsertEventHandler.cs | 3 +++ .../Services/ProvideServices/OrderLinkService.cs | 8 ++++++-- .../Services/ProvideServices/TrackQueryService.cs | 4 ++-- .../ProviderService/UpsertTrackInputValidation.cs | 13 +++++++++++++ .../Dtos/TrackTemplate/OrderedTrackCodeDto.cs | 7 ++++++- src/SJZY.Track.Repository/Queries/ProvideQueries.cs | 3 ++- 7 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs index 16d8c9ce..04f91415 100644 --- a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs +++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs @@ -18,14 +18,19 @@ public class TrackUpsertEvent : UpsertTrackInput /// 子系统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/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 08969864..fd15e042 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -32,6 +32,9 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] public async Task ConsumerAsync(TrackUpsertEvent @event) { + if (@event.Visited.Contains(@event.OrderId)) return; + @event.Visited.Add(@event.OrderId); + // 不同子系统需要做内容映射 if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId) { diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs index 77805cf7..c4a6d1db 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs @@ -43,8 +43,10 @@ public class OrderLinkService : ApplicationService if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true; - // 单号去重,去空 - input.LinkOrderNos = input.LinkOrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); + // 单号去重,去空,去自己 + input.LinkOrderNos = input.LinkOrderNos + .Where(x => !x.IsNullOrWhiteSpace() && x != input.OrderNo) + .Distinct().ToList(); // 解绑 if (!input.IsLink) return await UnLinkOrderAsync(input); @@ -78,6 +80,8 @@ public class OrderLinkService : ApplicationService LinkOrderType = input.LinkOrderType }).ToList()); + // todo:补轨迹 + return true; } diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 8b6fd2cc..6980ef05 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -1,7 +1,6 @@ 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.Track.Domain.Queries; namespace SJZY.Track.Application.Services.ProvideServices; @@ -91,7 +90,8 @@ public class TrackQueryService : ApplicationService foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo)) { codes.AddRange(templateContent - .Where(t => t.TemplateId == orderTemplate.TemplateId) + .Where(t => t.TemplateId == orderTemplate.TemplateId) // 按模板 + .Where(t => t.IsExternal) // 过滤不对外的 .Select(t => t.Code)); } diff --git a/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs b/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs new file mode 100644 index 00000000..ba7e6366 --- /dev/null +++ b/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs @@ -0,0 +1,13 @@ +using FluentValidation; +using SJZY.Track.Application.Contract.Dtos.ProvideServices; + +namespace SJZY.Track.Application.Validations.ProviderService; + +public class UpsertTrackInputValidation : AbstractValidator, IValidationEnabled +{ + public UpsertTrackInputValidation() + { + RuleFor(x => x.TrackTime).NotNull(); + RuleFor(x => x.TraceTimeZone).NotNull(); + } +} \ 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 index 60362986..cb31744d 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs @@ -10,5 +10,10 @@ public class OrderedTrackCodeDto /// /// 轨迹内容代码 /// - public string Code { 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.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index a44a15bc..119ba0aa 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -57,7 +57,8 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .Select((a, b) => new OrderedTrackCodeDto { TemplateId = a.TrackTemplateId, - Code = b.Code + Code = b.Code, + IsExternal = a.IsExternal }) .ToListAsync(); } From de42e9e5cfb9e7363f01c066bfe2dc84b5acb17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 10:48:15 +0800 Subject: [PATCH 182/196] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8D=95=E5=8F=B7=E5=8E=BB=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/TrackQueryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 6980ef05..a995067c 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -40,7 +40,7 @@ public class TrackQueryService : ApplicationService } var res = new List(); - input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重 + 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)) From 447ea8ae8f964a809678f566892b4888019a5100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 10:56:00 +0800 Subject: [PATCH 183/196] =?UTF-8?q?fix=E3=80=90S1-=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8C=E6=97=B6?= =?UTF-8?q?=E5=8C=BA=E6=B2=A1=E6=9C=89=E6=8C=89=E7=85=A7=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E6=9D=A5=E5=AD=98=E5=82=A8=E3=80=91https://www.tapd.cn/6086384?= =?UTF-8?q?9/bugtrace/bugs/view=3Fbug=5Fid=3D1160863849001029832?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/UpsertTrackInput.cs | 19 ++++++++++++++++-- .../AutoMapper/OrderAutoMapperProfile.cs | 10 +++++----- .../EventHandlers/TrackUpsertEventHandler.cs | 10 +++++----- .../ProvideServices/TrackQueryService.cs | 2 +- .../UpsertTrackInputValidation.cs | 13 ------------ .../TrackDetailsIndex.cs | 2 +- .../Repositories/TrackDetailsRepository.cs | 20 +++++++++---------- 7 files changed, 39 insertions(+), 37 deletions(-) delete mode 100644 src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs index c2c7b4c6..b62cf77b 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs @@ -22,11 +22,26 @@ public class UpsertTrackInput : OrderNoInfo /// 轨迹发生时间 /// [Required] - public DateTime TrackTime { get; set; } + public DateTime? TrackTime { get; set; } /// /// 轨迹发生时区 /// [Required] - public float TraceTimeZone { get; set; } + [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/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 5ae0e71d..25cb3b57 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -23,10 +23,10 @@ public class OrderAutoMapperProfile : Profile 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.TraceTimeZone)); + .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/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index fd15e042..67eb29a5 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -83,8 +83,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe TrackContent = trackContent.Content, TrackEnContent = trackContent.EnContent, TrackPlace = @event.TrackPlace, - TrackTime = @event.TrackTime, - TraceTimeZone = @event.TraceTimeZone, + TrackTime = @event.TrackTime!.Value, + TrackTimeZone = @event.TrackTimeZone!.Value, CreateUser = CurrentUserRequest.CurrentUser.Name, CreateTime = DateTime.Now }; @@ -98,8 +98,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe else { track.TrackPlace = @event.TrackPlace; - track.TrackTime = @event.TrackTime; - track.TraceTimeZone = @event.TraceTimeZone; + track.TrackTime = @event.TrackTime!.Value; + track.TrackTimeZone = @event.TrackTimeZone!.Value; track.UpdateUser = CurrentUserRequest.CurrentUser.Name; track.UpdateTime = DateTime.Now; } @@ -115,7 +115,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe TrackEnContent = track.TrackEnContent, TrackPlace = track.TrackPlace, TrackTime = track.TrackTime, - TrackTimeZone = track.TraceTimeZone + TrackTimeZone = track.TrackTimeZone }); // 根据订单关联关系异步向下刷 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index a995067c..7b53a713 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -55,7 +55,7 @@ public class TrackQueryService : ApplicationService Status = x.TrackStatus, Content = x.TrackContent, Location = x.TrackPlace, - Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TraceTimeZone), + Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TrackTimeZone), TimeZone = input.TimeZone!.Value }).ToList(); diff --git a/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs b/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs deleted file mode 100644 index ba7e6366..00000000 --- a/src/SJZY.Track.Application/Validations/ProviderService/UpsertTrackInputValidation.cs +++ /dev/null @@ -1,13 +0,0 @@ -using FluentValidation; -using SJZY.Track.Application.Contract.Dtos.ProvideServices; - -namespace SJZY.Track.Application.Validations.ProviderService; - -public class UpsertTrackInputValidation : AbstractValidator, IValidationEnabled -{ - public UpsertTrackInputValidation() - { - RuleFor(x => x.TrackTime).NotNull(); - RuleFor(x => x.TraceTimeZone).NotNull(); - } -} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index b885e11b..8974dac3 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -74,7 +74,7 @@ public class TrackDetailsIndex : IdBaseIndex /// /// 轨迹发生时区 /// - public float TraceTimeZone { get; set; } + public float TrackTimeZone { get; set; } /// 删除标记 0正常 1 已删除 public bool IsDeleted { get; set; } diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 191de929..25dee126 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -3,7 +3,6 @@ using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ElasticSearch.Services; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.TrackDetails; -using SJZY.UserCenter.SharedModel.Dtos.PHP.User; namespace SJZY.Track.Repository.Repositories; @@ -53,7 +52,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(index.Id, u => u .Index(index.IndexName) .Doc(index) - //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 + //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见 ); if (!r.IsValid) @@ -75,7 +74,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TrackContent) .Field(f => f.TrackPlace) .Field(f => f.TrackTime) - .Field(f => f.TraceTimeZone) + .Field(f => f.TrackTimeZone) )) .Query(q => q.Terms(t => t @@ -92,8 +91,8 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(int orderId) { var data = await Context.SearchAsync(x => x.Query(q => q.Term(t => t.OrderId, orderId) - && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) - ) + && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) + ) .Size(1000) .Sort(s => s.Field(f => f.TrackTime, SortOrder.Descending))); @@ -102,11 +101,12 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(List orderIds) { - var data = await Context.SearchAsync(x => x.Query(q => q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) - && q.Term(a => a.Field(d => d.IsDeleted).Value(false)) - ) - .Size(10000) - .Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending)) + var data = await Context.SearchAsync(x => x.Query(q => + q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) + && q.Term(a => a.Field(d => d.IsDeleted).Value(false)) + ) + .Size(10000) + .Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending)) ); return data?.Documents?.ToList(); } From b337ea937b190c5413d2e89092895d4e39b91dcd Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 11:02:10 +0800 Subject: [PATCH 184/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=80=E4=B8=AA=E5=8F=98=E9=87=8F=E5=86=99?= =?UTF-8?q?=E9=94=99=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackOrders/TrackOrderService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs index 2f04bb41..587ba728 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -57,13 +57,12 @@ namespace SJZY.Track.Application.Services.TrackOrders list.ForEach(a => { a.Id = id++; - var trackContent = trackContents.FirstOrDefault(a => a.SubSystemId==input.SubSystemId&& a.TrackCode==a.TrackCode); + var trackContent = trackContents.FirstOrDefault(b => b.SubSystemId==input.SubSystemId&& b.TrackCode==a.Code); if (trackContent!=null) { a.IsCanDelete=trackContent.IsCanDelete; a.IsExternal = trackContent.IsExternal; } - //a.TrackTimeZoneValue=8f; if (a.TrackTimeZoneValue==0) { a.TrackTimeZone=$"GTM{" "}+00:00"; From 279bfcd1a410c34ebd6d184c0e5eda2fd254c7b5 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 11:03:13 +0800 Subject: [PATCH 185/196] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20=20=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=92=8C=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ProvideServices/OrderService.cs | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs index ffb67836..a021cd41 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs @@ -72,52 +72,6 @@ public class OrderService : ApplicationService return true; } - #region 轨迹订单明细 - - /// - /// 根据轨迹订单id获取轨迹订单明细列表 - /// - /// - /// - [HttpPost("/Order/GetDetails")] - public async Task> GetOrderDetails(GetOrderDetailsInput input) - { - var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId); - if (!trackDetails.IsNullOrEmpty()) - { - var list = ObjectMapper.Map, List>(trackDetails); - int id = 1; - list.ForEach(a => - { - a.Id = id++; - }); - return list; - } - - return new List(); - } - - #endregion - - #region 轨迹订单列表 - - /// - /// 获取分页的轨迹订单 - /// - /// - /// - [HttpPost("/Order/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 - private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) { order = ObjectMapper.Map(input, order); From 7365a23f634b84aca1840ba0ae318f3240e56dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 11:03:25 +0800 Subject: [PATCH 186/196] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=97=B6=E5=8C=BA=E4=B8=8D=E4=BC=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA+8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/ProvideServices/GetTrackInput.cs | 8 +++++++- .../Services/ProvideServices/TrackQueryService.cs | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs index 7f6898d7..598ee759 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs @@ -20,7 +20,13 @@ public class GetTrackInput /// 时区 +8 +8.25 -8.5 -9 /// 不传默认+8 /// - public float? TimeZone { get; set; } = 8; + private float? _timeZone; + + public float? TimeZone + { + get => _timeZone ?? 8; + set => _timeZone = value; + } /// /// 排序方式 diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs index 7b53a713..241d9030 100644 --- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs +++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs @@ -55,8 +55,8 @@ public class TrackQueryService : ApplicationService Status = x.TrackStatus, Content = x.TrackContent, Location = x.TrackPlace, - Time = x.TrackTime.AddHours(input.TimeZone!.Value - x.TrackTimeZone), - TimeZone = input.TimeZone!.Value + Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone), + TimeZone = input.TimeZone ?? 8 }).ToList(); res.Add(item); From f14bed991f0aa44942fac6780a73c571f8715145 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 11:15:41 +0800 Subject: [PATCH 187/196] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E5=AD=97=E6=AE=B5=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/Repositories/OrderRepository.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index aa55ea33..21beff94 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -171,7 +171,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { pageList.List.ForEach(a => { - var esDetails = esTrackDetails.Where(b => b.OrderId== a.Id).OrderByDescending(a => a.TrackTime); + var esDetails = esTrackDetails.Where(b => b.OrderId== a.Id).OrderByDescending(b => b.TrackTime); var trackDetail = esDetails.FirstOrDefault(); if (trackDetail!=null) { @@ -181,13 +181,13 @@ public class OrderRepository : BasicRepository, IOrderRepository, I } if (trackDetail.TrackEnContent!=a.NewestTrackEnContent) { - a.NewestTrackContent=trackDetail.TrackEnContent; + a.NewestTrackEnContent=trackDetail.TrackEnContent; } if (trackDetail.TrackPlace!=a.NewestTrackPlace) { a.NewestTrackPlace=trackDetail.TrackPlace; } - if (trackDetail.TrackTime!= trackDetail.TrackTime) + if (trackDetail.TrackTime!= a.NewestTrackTime) { a.NewestTrackTime=trackDetail.TrackTime; } From fd5455093753ae3a5bc46465d4f5a99b2d0eda7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 11:24:08 +0800 Subject: [PATCH 188/196] =?UTF-8?q?fix=E3=80=90S1-=E8=B7=A8=E5=AD=90?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=9A=84=E8=AE=A2=E5=8D=95=E6=9C=89=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=85=B3=E7=B3=BB=EF=BC=8C=E4=BD=86=E6=98=AF=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E6=9D=A5=E5=90=91=E4=B8=8B=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E3=80=91https://www.tapd.cn/60863849/bugtrac?= =?UTF-8?q?e/bugs/view=3Fbug=5Fid=3D1160863849001029806?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/Queries/ProvideQueries.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 119ba0aa..bbb186f9 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -94,10 +94,11 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, public async Task> MapTrackCodesAsync(int upSubSystemId, int subSystemId, params string[] trackCodes) { + // 根据上游code得到下游code return await Context.Queryable() - .Where(x => x.SubSystemId == upSubSystemId && x.MapSubSystemId == subSystemId && - trackCodes.Contains(x.TrackContentCode)) - .Select(x => x.MapTrackContentCode) + .Where(x => x.SubSystemId == subSystemId && x.MapSubSystemId == upSubSystemId && + trackCodes.Contains(x.MapTrackContentCode)) + .Select(x => x.TrackContentCode) .ToListAsync(); } From 3b5a915df8184277cf135a3a2d7fdfc492ec2e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 11:33:52 +0800 Subject: [PATCH 189/196] =?UTF-8?q?add=20=E8=AE=A2=E5=8D=95=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E4=BE=9D=E8=B5=96=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EventHandlers/TrackUpsertEventHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 67eb29a5..94c5b61a 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -1,4 +1,5 @@ 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; @@ -44,7 +45,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe if (mapCode == default) { - //throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员"); + LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}"); return; } From a127285d18a8608d0406e1780cbca0749af18221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 11:47:48 +0800 Subject: [PATCH 190/196] =?UTF-8?q?add=20cap=E6=B6=88=E8=B4=B9=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SjzyTrackApplicationModule.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs index 2bea18a6..ba706085 100644 --- a/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs +++ b/src/SJZY.Track.Application/SjzyTrackApplicationModule.cs @@ -1,7 +1,9 @@ -using DotNetCore.CAP; +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; @@ -70,7 +72,7 @@ namespace SJZY.Track.Application remoteServiceConfigurationName: "InterfaceForward", asDefaultService: false ); - + //CAP context.Services.AddCapTableNameService(); context.Services.AddCap(options => @@ -87,11 +89,24 @@ namespace SJZY.Track.Application options.FailedRetryCount = 10; options.UseDashboard(dashboardOptions => { - dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached ? "" : configuration["Swagger:JsonUrlPrefix"]; + dashboardOptions.PathBase = System.Diagnostics.Debugger.IsAttached + ? "" + : configuration["Swagger:JsonUrlPrefix"]; }); options.FailedThresholdCallback = faileCalback => { - LogHelper.Error($@"{faileCalback.MessageType} 失败了,消息名称: {faileCalback.Message}"); + 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); + } }; }); } From e2a34ede159c3fc02b3fdcbb26c5eb6625fe66ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 14:21:30 +0800 Subject: [PATCH 191/196] attach --- .../EventHandlers/TrackUpsertEventHandler.cs | 8 ++++++-- src/SJZY.Track.Repository/Queries/ProvideQueries.cs | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 94c5b61a..1c3c8e92 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -33,7 +33,12 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe [CapSubscribe(GlobalConst.TrackUpsertSubscribe)] public async Task ConsumerAsync(TrackUpsertEvent @event) { - if (@event.Visited.Contains(@event.OrderId)) return; + if (@event.Visited.Contains(@event.OrderId)) + { + LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}"); + return; + } + @event.Visited.Add(@event.OrderId); // 不同子系统需要做内容映射 @@ -45,7 +50,6 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe if (mapCode == default) { - LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}"); return; } diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index bbb186f9..95a4ac9d 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -1,6 +1,5 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackContentAggregate; -using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; @@ -69,9 +68,8 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId) .LeftJoin((x, a, b) => a.TrackContentId == b.Id) .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id) - .LeftJoin((x, a, b, c, d) => b.TrackFlagId == d.Id) .Where((x, a, b) => x.OrderId == orderId && b.Code == code) - .Select((x, a, b, c, d) => new MatchTrackContentDto + .Select((x, a, b, c) => new MatchTrackContentDto { Content = b.Content, EnContent = b.EnContent, From 8922d98ba45cb3fc236b91b0b68143ee28c0d63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 14:51:41 +0800 Subject: [PATCH 192/196] =?UTF-8?q?fix=20=E8=BD=A8=E8=BF=B9=E5=8F=AF?= =?UTF-8?q?=E5=88=A0=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SJZY.Track.Repository/Queries/ProvideQueries.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index 95a4ac9d..e1ff71d4 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -85,7 +85,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, .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)) + && trackCodes.Contains(b.Code) && a.IsCanDelete) .Select((x, a, b) => b.Code) .ToListAsync(); } From 769fb8b66a6adb265a52afa0cb3f681a67bf8213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 15:18:08 +0800 Subject: [PATCH 193/196] =?UTF-8?q?change=20=E8=BD=A8=E8=BF=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/TrackDeleteEvent.cs | 7 ++++++- .../EventHandlers/TrackDeleteEventHandler.cs | 21 +++++++++++++------ .../EventHandlers/TrackUpsertEventHandler.cs | 2 ++ .../TrackDetailsIndex.cs | 4 ++-- .../Dtos/TrackDetails/MatchTrackContentDto.cs | 7 ++++++- .../Queries/ProvideQueries.cs | 3 ++- .../Repositories/TrackDetailsRepository.cs | 13 ++++-------- 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs index c88d5837..eccbe955 100644 --- a/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs +++ b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs @@ -16,9 +16,14 @@ public class TrackDeleteEvent /// 子系统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/EventHandlers/TrackDeleteEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs index f70492f4..55bb5b1d 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs @@ -1,5 +1,5 @@ using DotNetCore.CAP; -using SJZY.Expand.ABP.Core.PublicMethords; +using SJZY.Expand.ABP.Core.Logger; using SJZY.Track.Application.Contract.Events; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; @@ -8,14 +8,15 @@ using Volo.Abp.DependencyInjection; namespace SJZY.Track.Application.EventHandlers; -public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe +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) + public TrackDeleteEventHandler(IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository, + IOrderRepository orderRepository, ICapPublisher capPublisher) { _provideQueries = provideQueries; _trackDetailsRepository = trackDetailsRepository; @@ -26,6 +27,14 @@ public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe [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) { @@ -40,7 +49,7 @@ public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe @event.TrackCodes = mapCodes; } - + await DeleteTrackAsync(@event); } @@ -48,7 +57,7 @@ public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe { // 删除轨迹 await _trackDetailsRepository.DeleteTrackAsync(@event.OrderId, @event.TrackCodes); - + // 根据订单关联关系异步向下刷 var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId); foreach (var linkedOrder in linkedOrders) @@ -60,7 +69,7 @@ public class TrackDeleteEventHandler: ITransientDependency, ICapSubscribe SubSystemId = linkedOrder.SubSystemId, UpSubSystemId = @event.SubSystemId }; - + await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, nextEvent); } } diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs index 1c3c8e92..29e14bc2 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs @@ -50,6 +50,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe if (mapCode == default) { + // 跨子系统没做映射的轨迹不处理 return; } @@ -90,6 +91,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe TrackPlace = @event.TrackPlace, TrackTime = @event.TrackTime!.Value, TrackTimeZone = @event.TrackTimeZone!.Value, + IsCanDelete = trackContent.IsCanDelete, CreateUser = CurrentUserRequest.CurrentUser.Name, CreateTime = DateTime.Now }; diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs index 8974dac3..d4f5c9e1 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs @@ -76,8 +76,8 @@ public class TrackDetailsIndex : IdBaseIndex /// public float TrackTimeZone { get; set; } - /// 删除标记 0正常 1 已删除 - public bool IsDeleted { get; set; } + /// 是否可删 + public bool IsCanDelete { get; set; } /// 创建人 public string? CreateUser { get; set; } diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs index 2c2a366d..adb51944 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs @@ -16,9 +16,14 @@ public class MatchTrackContentDto /// 轨迹状态 /// 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.Repository/Queries/ProvideQueries.cs b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs index e1ff71d4..526d5e3d 100644 --- a/src/SJZY.Track.Repository/Queries/ProvideQueries.cs +++ b/src/SJZY.Track.Repository/Queries/ProvideQueries.cs @@ -74,7 +74,8 @@ public class ProvideQueries : ISugarRepository, IProvideQueries, Content = b.Content, EnContent = b.EnContent, Status = c.Status, - IsCompleted = b.IsCompleted + IsCompleted = b.IsCompleted, + IsCanDelete = a.IsCanDelete }) .FirstAsync(); } diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 25dee126..0b1da83b 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -20,7 +20,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract q.Term(f => f.OrderId, orderId) && q.Term(f => f.TrackCode.Suffix("keyword"), trackCode) - && q.Term(f => f.IsDeleted, false) ) ); @@ -81,7 +80,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.OrderNo.Suffix("keyword")) .Terms(orderNos)) && q.Term(f => f.OrderType, orderType) - && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) ) ); @@ -90,8 +88,9 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract?> GetListAsync(int orderId) { - var data = await Context.SearchAsync(x => x.Query(q => q.Term(t => t.OrderId, orderId) - && q.Term(a => a.Field(g => g.IsDeleted).Value(false)) + 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))); @@ -103,7 +102,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract(x => x.Query(q => q.Terms(t => t.Field(g => g.OrderId).Terms(orderIds)) - && q.Term(a => a.Field(d => d.IsDeleted).Value(false)) ) .Size(10000) .Sort(s => s.Field(c => c.TrackTime, SortOrder.Descending)) @@ -113,13 +111,11 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract trackCodes) { - var r = await Context.UpdateByQueryAsync(x => x + var r = await Context.DeleteByQueryAsync(x => x .Query( q => q.Term(t => t.OrderId, orderId) && q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))) - .Script(s => s - .Source("ctx._source.isDeleted = true")) ); if (!r.IsValid) @@ -138,7 +134,6 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract t .Field(f => f.OrderNo) .Terms(distinctOrderNumbers)) - && q.Term(t => t.Field(f => f.IsDeleted).Value(false)) ) .Sort(s => s.Field(f => f.CreateTime, SortOrder.Descending)) .From((input.PageIndex - 1) * input.PageSize) From 7f43cbfe662ebf1da0ab601592aa4c7a2f10d4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 6 Mar 2024 15:31:50 +0800 Subject: [PATCH 194/196] attach --- src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs index 0b1da83b..70f62f7e 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackDetailsRepository.cs @@ -115,6 +115,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract q.Term(t => t.OrderId, orderId) + && q.Term(t => t.IsCanDelete, true) && q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes))) ); From cd60b420accb1b0bb24a23c1c6493d19ea517cbd Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 17:44:26 +0800 Subject: [PATCH 195/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProvideServices/GetOrderDetailsInput.cs | 9 ++- .../ProvideServices/GetPageTrackOrderInput.cs | 9 ++- .../Services/TrackOrders/TrackOrderService.cs | 10 ++- .../Dtos/Order/GetPageTrackOrderInputVO.cs | 5 ++ ...GetTemplateContentAttributeValueInputVO.cs | 9 ++- .../Repositories/OrderRepository.cs | 63 +++++++++++-------- .../Repositories/TrackContentRepository.cs | 1 + 7 files changed, 72 insertions(+), 34 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs index d16e10fe..3920f5c1 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs @@ -1,4 +1,6 @@ -namespace SJZY.Track.Application.Contract.Dtos.ProvideServices +using System.Reflection.Metadata.Ecma335; + +namespace SJZY.Track.Application.Contract.Dtos.ProvideServices { public class GetOrderDetailsInput { @@ -11,6 +13,11 @@ /// 子系统id /// public int SubSystemId { get; set; } + + /// + /// 轨迹模板Id + /// + public List? TrackTemplateIds { get; set; } = new List(); } public class TrackOrderDetailDto diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index 5b2220d2..81aa553e 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -15,7 +15,7 @@ public class GetPageTrackOrderInput : PageInfoInput /// /// 单号 /// - public string? OrderNos { get; set; } + public string? OrderNos { get; set; } /// /// 创建时间开始 @@ -58,6 +58,11 @@ public class TrackOrderDto /// public string? TrackTemplateNames { get; set; } + /// + /// 轨迹模板Id数组 + /// + public List? TrackTemplateIds { get; set; } + /// /// 客户简称 /// @@ -108,5 +113,5 @@ public class TrackOrderDto /// public string SubSystem { get; set; } - public int SubSystemId { get;set; } + public int SubSystemId { get; set; } } \ 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 index 587ba728..1c37f744 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -45,11 +45,12 @@ namespace SJZY.Track.Application.Services.TrackOrders if (!trackDetails.IsNullOrEmpty()) { var list = ObjectMapper.Map, List>(trackDetails); - var trackCodes = list.Where(a => !a.Code.IsNullOrWhiteSpace()).Select(a => a.Code).ToList(); + 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 }); @@ -57,13 +58,16 @@ namespace SJZY.Track.Application.Services.TrackOrders list.ForEach(a => { a.Id = id++; - var trackContent = trackContents.FirstOrDefault(b => b.SubSystemId==input.SubSystemId&& b.TrackCode==a.Code); + + var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId==input.SubSystemId && b.TrackCode==a.Code + && input.TrackTemplateIds.Contains(b.TrackTemplateId)); + var trackContent = trackContentsOfTemplates.FirstOrDefault(); if (trackContent!=null) { a.IsCanDelete=trackContent.IsCanDelete; a.IsExternal = trackContent.IsExternal; } - if (a.TrackTimeZoneValue==0) + if (a.TrackTimeZoneValue==0f) { a.TrackTimeZone=$"GTM{" "}+00:00"; } diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index b596a5e1..c1b97cc5 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -119,5 +119,10 @@ namespace SJZY.Track.Domain.Dtos.Order /// 子系统id /// public int SubSystemId { get; set; } + + /// + /// 轨迹模板Id数组 + /// + public List? TrackTemplateIds { get; set; } } } diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs index 1ba46bf4..d8b295a9 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTemplateContentAttributeValueInputVO.cs @@ -16,7 +16,12 @@ namespace SJZY.Track.Domain.Dtos.TrackTemplate /// /// 轨迹代码 /// - public List? TrackCodes { get; set; } + public List? TrackCodes { get; set; } + + /// + /// 轨迹模板Id + /// + public List? TrackTemplateIds { get; set; } ///// ///// 订单id @@ -34,7 +39,7 @@ namespace SJZY.Track.Domain.Dtos.TrackTemplate /// /// 模版id /// - public int TrackTemplateId { get; set; } + public int TrackTemplateId { get; set; } /// /// 轨迹内容代码 diff --git a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs index 21beff94..481a5c87 100644 --- a/src/SJZY.Track.Repository/Repositories/OrderRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/OrderRepository.cs @@ -148,9 +148,13 @@ public class OrderRepository : BasicRepository, IOrderRepository, I .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, ","), + //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, @@ -166,34 +170,41 @@ public class OrderRepository : BasicRepository, IOrderRepository, I { //查询也需要最新的轨迹 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); - if (!esTrackDetails.IsNullOrEmpty()) + pageList.List.ForEach(a => { - pageList.List.ForEach(a => + var esDetails = esTrackDetails?.Where(b => b.OrderId== a.Id).OrderByDescending(b => b.TrackTime); + var trackDetail = esDetails?.FirstOrDefault(); + if (trackDetail!=null) { - 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) { - 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.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(); + }); + } diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 5d4db71f..72cf57ba 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -101,6 +101,7 @@ public class TrackContentRepository : BasicRepository, ITrac .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) .Select((a, b, c) => new GetTemplateContentAttributeValueVO { From 62c43ab14686cd7c5e5d5749145a74c53264428d Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Wed, 6 Mar 2024 19:48:43 +0800 Subject: [PATCH 196/196] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=88=A0=E9=99=A4=E5=92=8C=E5=AF=B9=E5=A4=96?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/TrackOrders/TrackOrderService.cs | 10 ++++++++-- .../Repositories/TrackContentRepository.cs | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs index 1c37f744..908d7227 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -53,7 +53,7 @@ namespace SJZY.Track.Application.Services.TrackOrders TrackTemplateIds = input.TrackTemplateIds, TrackCodes=trackCodes }); - + input.TrackTemplateIds =input.TrackTemplateIds.Where(a => a>0).ToList(); int id = 1; list.ForEach(a => { @@ -61,7 +61,13 @@ namespace SJZY.Track.Application.Services.TrackOrders var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId==input.SubSystemId && b.TrackCode==a.Code && input.TrackTemplateIds.Contains(b.TrackTemplateId)); - var trackContent = trackContentsOfTemplates.FirstOrDefault(); + 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; diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 72cf57ba..7609c5a6 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -103,6 +103,7 @@ public class TrackContentRepository : BasicRepository, ITrac .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,