Merge branch 'S01-轨迹中台' of http://192.168.80.50:3000/Dotnet/SJZY.Track.Api into S01-轨迹中台

This commit is contained in:
moyongzhen 2024-02-29 18:33:50 +08:00
commit dc066efed9
5 changed files with 85 additions and 2 deletions

View File

@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper
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);
}
}
}

View File

@ -0,0 +1,51 @@
namespace SJZY.Track.Application.Dtos.TrackPull;
public class UpdateTrackPullContentInput
{
public int Id { get; set; }
/// <summary>
/// 服务商轨迹代码参数值
/// </summary>
public string TrackContentCodeValue { get; set; }
/// <summary>
/// 轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 服务商轨迹内容参数值
/// </summary>
public string TrackContentValue { get; set; }
/// <summary>
/// 轨迹关键词(正向)
/// </summary>
public string TrackKeyword { get; set; }
/// <summary>
/// 轨迹关键词(反向)
/// </summary>
public string TrackKeywordReverse { get; set; }
/// <summary>
/// 轨迹发生地参数值
/// </summary>
public int? TrackPlaceValue { get; set; }
/// <summary>
/// 轨迹拉取配置id
/// </summary>
public int TrackPullConfigId { get; set; }
/// <summary>
/// 服务商轨迹状态参数值
/// </summary>
public string TrackStatusValue { get; set; }
/// <summary>
/// 轨迹时区GMT
/// </summary>
public string TrackTimeZone { get; set; }
}

View File

@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency
return true;
}
/// <summary>
/// 轨迹拉取配置内容修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("UpdateContent")]
public async Task<bool> 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;
}
}

View File

@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression);
Task<bool> SoftDeleteParamsAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
}

View File

@ -47,8 +47,8 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
}, true)
.Mapper(x =>
{
x.TrackKeywords = [.. x.TrackKeyword.Split(',')];
x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')];
x.TrackKeywords = x.TrackKeyword.Split(',').ToList();
x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList();
})
.ToPagedListAsync(input.PageIndex, input.PageSize);
}
@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync();
}
public async Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id)
{
return await Context.Queryable<TrackPullContentConfigEntity>().InSingleAsync(id);
}
public async Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj)
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
}