完成 轨迹拉取配置详情 接口

This commit is contained in:
柳文翔 2024-02-29 09:44:36 +08:00
parent eddd529718
commit 249a77851b
7 changed files with 131 additions and 12 deletions

View File

@ -46,4 +46,15 @@ public class TrackPullService : ApplicationService, ITransientDependency
{
return await _trackPullConfigRepository.GetContentPageAsync(input);
}
/// <summary>
/// 轨迹拉取配置详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("GetDetail")]
public async Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id)
{
return await _trackPullConfigRepository.GetDetailAsync(id);
}
}

View File

@ -164,7 +164,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId;
if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
if (await _trackTemplateRepository.IsAnyAsync(isAnyExp))
if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp))
throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]);
}
@ -174,18 +174,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
var entity = ObjectMapper.Map<EditTrackTemplateContentInput, TrackTemplateContentEntity>(input);
await _trackTemplateRepository.InsertAsync(entity);
await _trackTemplateRepository.InsertContentAsync(entity);
break;
case OptionTypeNoNull.修改:
var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ??
var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldEntity);
await _trackTemplateRepository.UpdateAsync(oldEntity);
await _trackTemplateRepository.UpdateContentAsync(oldEntity);
break;

View File

@ -18,4 +18,11 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
/// <param name="input"></param>
/// <returns></returns>
Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync(GetTrackPullContentPageInputVO input);
/// <summary>
/// 轨迹拉取配置详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id);
}

View File

@ -25,13 +25,13 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
/// <returns></returns>
Task<GetTrackTemplateContentDetailOutputVO> GetContentDetailAsync(int id);
Task<bool> IsAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
Task<bool> IsContentAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
Task<bool> InsertAsync(TrackTemplateContentEntity insertObj);
Task<bool> InsertContentAsync(TrackTemplateContentEntity insertObj);
Task<TrackTemplateContentEntity> GetByIdAsync(int id);
Task<TrackTemplateContentEntity> GetContentByIdAsync(int id);
Task<bool> UpdateAsync(TrackTemplateContentEntity updateObj);
Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj);
Task<bool> SoftDeleteContentAsync(int id);
}

View File

@ -0,0 +1,82 @@
namespace SJZY.Track.Domain.Dtos.TrackPull
{
public class GetTrackPullConfigDetailOutputVO
{
public int Id { get; set; }
/// <summary>
/// 拉取轨迹订单号
/// </summary>
public string OrderNoName { get; set; }
/// <summary>
/// 返参解析对象
/// </summary>
public int ParseMethod { get; set; }
/// <summary>
/// 定时任务(分钟)
/// </summary>
public int PullInterval { get; set; }
/// <summary>
/// 服务商
/// </summary>
public string ServiceProvider { get; set; }
/// <summary>
/// 服务商id
/// </summary>
public int ServiceProviderId { get; set; }
/// <summary>
/// 子系统
/// </summary>
public string SubSystem { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 拉取轨迹时区
/// </summary>
public string TackTimeZoneName { get; set; }
/// <summary>
/// 拉取轨迹内容代码
/// </summary>
public string TrackContentCodeName { get; set; }
/// <summary>
/// 拉取轨迹内容
/// </summary>
public string TrackContentName { get; set; }
/// <summary>
/// 拉取轨迹发生地
/// </summary>
public string TrackPlaceName { get; set; }
/// <summary>
/// 拉取轨迹状态
/// </summary>
public string TrackStatusName { get; set; }
/// <summary>
/// 轨迹模板
/// </summary>
public string TrackTemplate { get; set; }
/// <summary>
/// 轨迹模板id
/// </summary>
public int TrackTemplateId { get; set; }
/// <summary>
/// 拉取轨迹发生时间
/// </summary>
public string TrackTimeName { get; set; }
}
}

View File

@ -51,4 +51,23 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
})
.ToPagedListAsync(input.PageIndex, input.PageSize);
}
public async Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id)
{
return await AsQueryable()
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
.LeftJoin<VServiceProviderEntity>((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted)
.LeftJoin<TrackTemplateEntity>((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted)
.InnerJoin<TrackPushPullParamsConfigEntity>((trackPull, system, service, template, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted)
.Filter(null, true)
.Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted)
.Select((trackPull, system, service, template, paramsConfig) => new GetTrackPullConfigDetailOutputVO
{
Id = trackPull.Id,
SubSystem = system.CnName,
ServiceProvider = service.Name,
TrackTemplate = template.Name
}, true)
.SingleAsync();
}
}

View File

@ -126,25 +126,25 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
}
/// <inheritdoc/>
public async Task<bool> IsAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
public async Task<bool> IsContentAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
{
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).AnyAsync();
}
/// <inheritdoc/>
public async Task<bool> InsertAsync(TrackTemplateContentEntity insertObj)
public async Task<bool> InsertContentAsync(TrackTemplateContentEntity insertObj)
{
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
}
/// <inheritdoc/>
public async Task<TrackTemplateContentEntity> GetByIdAsync(int id)
public async Task<TrackTemplateContentEntity> GetContentByIdAsync(int id)
{
return await Context.Queryable<TrackTemplateContentEntity>().InSingleAsync(id);
}
/// <inheritdoc/>
public async Task<bool> UpdateAsync(TrackTemplateContentEntity updateObj)
public async Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj)
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}