From 5ddfaf5ec34521d914bdf374086513b8e4353a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Thu, 29 Feb 2024 17:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoMapper/TrackPullAutoMapperProfile.cs | 1 + .../TrackPull/UpdateTrackPullContentInput.cs | 51 +++++++++++++++++++ .../Services/TrackPull/TrackPullService.cs | 17 +++++++ .../ITrackPullConfigRepository.cs | 4 ++ .../TrackPullConfigRepository.cs | 10 ++++ 5 files changed, 83 insertions(+) create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs index 15d39d05..3577eceb 100644 --- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs @@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper CreateMap(MemberList.None); CreateMap(MemberList.None).Ignore(dest => dest.Id) .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false)); + CreateMap(MemberList.None); } } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs new file mode 100644 index 00000000..74a54567 --- /dev/null +++ b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs @@ -0,0 +1,51 @@ +namespace SJZY.Track.Application.Dtos.TrackPull; + +public class UpdateTrackPullContentInput +{ + public int Id { get; set; } + + /// + /// 服务商轨迹代码参数值 + /// + public string TrackContentCodeValue { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 服务商轨迹内容参数值 + /// + public string TrackContentValue { get; set; } + + /// + /// 轨迹关键词(正向) + /// + public string TrackKeyword { get; set; } + + /// + /// 轨迹关键词(反向) + /// + public string TrackKeywordReverse { get; set; } + + /// + /// 轨迹发生地参数值 + /// + public int? TrackPlaceValue { get; set; } + + /// + /// 轨迹拉取配置id + /// + public int TrackPullConfigId { get; set; } + + /// + /// 服务商轨迹状态参数值 + /// + public string TrackStatusValue { get; set; } + + /// + /// 轨迹时区GMT + /// + public string TrackTimeZone { get; set; } +} \ No newline at end of file diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs index 646e439b..f76abe50 100644 --- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs +++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs @@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency return true; } + + /// + /// 轨迹拉取配置内容修改 + /// + /// + /// + [HttpPost("UpdateContent")] + public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) + { + var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); + + ObjectMapper.Map(input, oldTrackPullContentEntity); + + await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity); + + return true; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs index 3d34310a..c7a36732 100644 --- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs +++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs @@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository SoftDeleteContentAsync(Expression> whereExpression); Task SoftDeleteParamsAsync(Expression> whereExpression); + + Task GetContentByIdAsync(int id); + + Task UpdateContentAsync(TrackPullContentConfigEntity updateObj); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs index 058146bd..dbcb40be 100644 --- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs +++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs @@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository, .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .ExecuteCommandHasChangeAsync(); } + + public async Task GetContentByIdAsync(int id) + { + return await Context.Queryable().InSingleAsync(id); + } + + public async Task UpdateContentAsync(TrackPullContentConfigEntity updateObj) + { + return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync(); + } } \ No newline at end of file