Merge remote-tracking branch 'origin/S01-轨迹中台' into S01-轨迹中台

This commit is contained in:
李鹏军 2024-03-01 14:22:07 +08:00
commit cf76f52ecc
6 changed files with 104 additions and 1 deletions

View File

@ -57,4 +57,15 @@ public class TrackPushService : ApplicationService, ITransientDependency
{
return await _trackPushConfigRepository.GetDetailAsync(id);
}
/// <summary>
/// 轨迹推送配置内容详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("GetContentDetail")]
public async Task<GetTrackPushContentDetailOutputVO> GetContentDetailAsync(int id)
{
return await _trackPushConfigRepository.GetContentDetailAsync(id);
}
}

View File

@ -13,4 +13,5 @@ public interface ITrackDetailsRepository
Task<List<TrackDetailsIndex>> GetListAsync(int orderType, List<string> orderNos);
Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input);
Task<List<TrackDetailsIndex>> GetListAsync(int orderId);
}

View File

@ -10,4 +10,6 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(GetTrackPushContentPageInputVO input);
Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id);
Task<GetTrackPushContentDetailOutputVO> GetContentDetailAsync(int id);
}

View File

@ -0,0 +1,61 @@
namespace SJZY.Track.Domain.Dtos.TrackPush;
public class GetTrackPushContentDetailOutputVO
{
/// <summary>
/// 轨迹内容代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 推送扩展字段
/// </summary>
public string ExpandFieldsValue { get; set; }
public int Id { get; set; }
/// <summary>
/// 推送单号类型
/// </summary>
public int OrderNoType { get; set; }
/// <summary>
/// 推送轨迹排序
/// </summary>
public int Sort { 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 TrackEnContentValue { get; set; }
/// <summary>
/// 轨迹推送配置id
/// </summary>
public int TrackPullConfigId { get; set; }
/// <summary>
/// 推送轨迹状态
/// </summary>
public string TrackStatusValue { get; set; }
/// <summary>
/// 推送轨迹时区
/// </summary>
public string TrackTimeZone { get; set; }
}

View File

@ -37,7 +37,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
var response = await Context.UpdateAsync<TrackDetailsIndex>(index.Id, u => u
.Index(IndexName)
.Doc(index)
//.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见
//.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见
);
if (!response.IsValid)
throw new Exception($"数据修改失败,原因:{response.DebugInformation}");
@ -73,6 +73,21 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
return data.Documents.ToList();
}
public async Task<List<TrackDetailsIndex>> GetListAsync(int orderId)
{
var data = await Context.SearchAsync<TrackDetailsIndex>(x => x
.Source(s => s.Includes(fd => fd
.Field(f => f.TrackStatus)
.Field(f => f.TrackCode)
.Field(f => f.TrackContent)
.Field(f => f.TrackPlace)
.Field(f => f.TrackTime)
.Field(f => f.TraceTimeZone)
)).Query(q => q.Terms(t => t.Field(f => f.OrderId).Terms(orderId))));
return data?.Documents?.ToList();
}
public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)
{
if (input.OrderNos.Count < 1) return default;

View File

@ -69,4 +69,17 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
}, true)
.SingleAsync();
}
public async Task<GetTrackPushContentDetailOutputVO> GetContentDetailAsync(int id)
{
return await Context.Queryable<TrackPushContentConfigEntity>()
.InnerJoin<TrackContentEntity>((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id)
.Where(pushContent => pushContent.Id == id)
.Select((pushContent, trackContent) => new GetTrackPushContentDetailOutputVO
{
Id = pushContent.Id,
Code = trackContent.Code + "-" + trackContent.Content,
}, true)
.SingleAsync();
}
}