From d37722dfb251db65ca348b3db51b8982afbd6c61 Mon Sep 17 00:00:00 2001 From: yunwei Date: Thu, 29 Feb 2024 11:26:06 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/SJZY.Track.Api/app?= =?UTF-8?q?settings.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 2/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/SJZY.Track.Api/app?= =?UTF-8?q?settings.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 3/8] =?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 205526e37023253feed289670477ad476fec7175 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 15:40:33 +0800 Subject: [PATCH 4/8] =?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 5/8] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20=3F=E5=8F=AF=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 6/8] =?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 7/8] =?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 8/8] =?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