修改
This commit is contained in:
parent
fefc52638a
commit
bed691aa71
@ -7,7 +7,7 @@ public class UpdateTrackPullContentInput
|
||||
/// <summary>
|
||||
/// 服务商轨迹代码参数值
|
||||
/// </summary>
|
||||
public string TrackContentCodeValue { get; set; }
|
||||
public string? TrackContentCodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容id
|
||||
@ -17,17 +17,17 @@ public class UpdateTrackPullContentInput
|
||||
/// <summary>
|
||||
/// 服务商轨迹内容参数值
|
||||
/// </summary>
|
||||
public string TrackContentValue { get; set; }
|
||||
public string? TrackContentValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹关键词(正向)
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public string TrackKeyword { get; set; }
|
||||
public List<string>? TrackKeywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹关键词(反向)
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public string TrackKeywordReverse { get; set; }
|
||||
public List<string>? TrackKeywordReverses { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生地参数值
|
||||
@ -42,7 +42,7 @@ public class UpdateTrackPullContentInput
|
||||
/// <summary>
|
||||
/// 服务商轨迹状态参数值
|
||||
/// </summary>
|
||||
public string TrackStatusValue { get; set; }
|
||||
public string? TrackStatusValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹时区GMT
|
||||
|
||||
@ -12,6 +12,16 @@ public class TrackPullAutoMapperProfile : Profile
|
||||
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
|
||||
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
||||
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
|
||||
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None);
|
||||
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(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));
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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<bool> 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<Func<TrackPullContentConfigEntity, bool>> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId;
|
||||
|
||||
var trackKeywordExp = Expressionable.Create<TrackPullContentConfigEntity>()
|
||||
.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) ??
|
||||
|
||||
@ -29,11 +29,21 @@ public class GetTrackPullContentDetailOutputVO
|
||||
/// </summary>
|
||||
public string TrackKeyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public List<string>? TrackKeywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public string TrackKeywordReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public List<string>? TrackKeywordReverses { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹发生地
|
||||
/// </summary>
|
||||
|
||||
@ -34,21 +34,11 @@ public class GetTrackPullContentPageOutputVO
|
||||
/// </summary>
|
||||
public string? TrackKeyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public List<string>? TrackKeywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public string? TrackKeywordReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public List<string>? TrackKeywordsReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生地
|
||||
/// </summary>
|
||||
|
||||
@ -45,11 +45,6 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
||||
{
|
||||
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<TrackPullConfigEntity>,
|
||||
Id = pullContent.Id,
|
||||
Code = trackContent.Code + "-" + trackContent.Content,
|
||||
}, true)
|
||||
.Mapper(x =>
|
||||
{
|
||||
x.TrackKeywords = x.TrackKeyword?.Split(',').ToList();
|
||||
x.TrackKeywordsReverse = x.TrackKeywordReverse?.Split(',').ToList();
|
||||
})
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user