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] =?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