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 01/43] =?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 02/43] =?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 03/43] =?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 04/43] =?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 05/43] =?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 06/43] =?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 07/43] =?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 08/43] =?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 09/43] =?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 10/43] =?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 11/43] =?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 12/43] =?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 13/43] =?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 14/43] =?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 15/43] =?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 16/43] =?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 17/43] =?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 18/43] =?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 6ab8472a4cf8cd76b2c98cedddb4673188ecf922 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Sat, 2 Mar 2024 09:41:05 +0800 Subject: [PATCH 19/43] =?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 20/43] =?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 21/43] =?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 22/43] =?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 23/43] =?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 24/43] =?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 25/43] =?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 26/43] =?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 27/43] =?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 28/43] =?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 29/43] =?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 30/43] =?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 31/43] =?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 32/43] =?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 33/43] =?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 34/43] =?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 35/43] =?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 36/43] =?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 37/43] =?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 38/43] =?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 39/43] =?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 40/43] =?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 41/43] =?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 42/43] =?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 43/43] =?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))