Merge branch 'S06' into test
This commit is contained in:
commit
8b96e1dc16
@ -21,4 +21,9 @@ public class GetPageTrackTemplateListInput : PageInfoInput
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public string? TemplateCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关键字
|
||||
/// </summary>
|
||||
public string? KeyWord { get; set; }
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public class CapFilter : SubscribeFilter
|
||||
context.DeliverMessage.Headers["sjzy-arguments-hash"] = hash;
|
||||
}
|
||||
|
||||
if (await RedisHelper.Client.ExistsAsync($"CapExecuteFilter:{hash}"))
|
||||
if (await RedisHelper.Client.ExistsAsync($"CapExecuteFilter:{hash}{DateTime.Now:G}"))
|
||||
{
|
||||
throw new BusinessException(GlobalConst.CapNoRetryErrorCode, $"检测到重复消费,消费参数:{argumentJsonStr}");
|
||||
}
|
||||
@ -41,7 +41,7 @@ public class CapFilter : SubscribeFilter
|
||||
context.DeliverMessage.Headers.TryGetValue("sjzy-arguments-hash", out var hash);
|
||||
if (!hash.IsNullOrEmpty())
|
||||
{
|
||||
await RedisHelper.Client.SetAsync($"CapExecuteFilter:{hash}", 1, TimeSpan.FromMinutes(3));
|
||||
await RedisHelper.Client.SetAsync($"CapExecuteFilter:{hash}{DateTime.Now:G}", 1, TimeSpan.FromMinutes(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,35 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
.Where(x => x.TrackTime == input.TrackTime)
|
||||
.ToList();
|
||||
|
||||
//当为更新操作时发现更新的数目为0进行重试操作
|
||||
if (!input.IsAdd && tracks.Count == 0)
|
||||
{
|
||||
var curRetryCount = 0;
|
||||
var success = false;
|
||||
while (!success && curRetryCount < GlobalConst.MaxUpdateTrackRetryCount)
|
||||
{
|
||||
try
|
||||
{
|
||||
tracks = (await _trackDetailsEsRepository.GetListAsync(new[] { order.Id }, input.TrackCode, true))
|
||||
.Where(x => x.TrackTime == input.TrackTime)
|
||||
.ToList();
|
||||
if (tracks.Count > 0)
|
||||
success = true;
|
||||
await Task.Delay(300);
|
||||
}
|
||||
finally
|
||||
{
|
||||
curRetryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (tracks.Count == 0)
|
||||
{
|
||||
throw new BusinessException(message: $"订单:{input.OrderNo},轨迹代码:{input.TrackCode}没有要更新的记录");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改
|
||||
if (!input.IsAdd && tracks.Count > 1)
|
||||
{
|
||||
@ -366,6 +395,34 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
.Where(x => x.TrackTime == input.TrackTime)
|
||||
.ToList();
|
||||
|
||||
//当为更新操作时发现更新的数目为0进行重试操作
|
||||
if (!input.IsAdd && tracks.Count == 0)
|
||||
{
|
||||
var curRetryCount = 0;
|
||||
var success = false;
|
||||
while (!success && curRetryCount < GlobalConst.MaxUpdateTrackRetryCount)
|
||||
{
|
||||
try
|
||||
{
|
||||
tracks = (await _trackDetailsEsRepository.GetListAsync(new[] { order.Id }, input.TrackCode, true))
|
||||
.Where(x => x.TrackTime == input.TrackTime)
|
||||
.ToList();
|
||||
if (tracks.Count > 0)
|
||||
success = true;
|
||||
await Task.Delay(300);
|
||||
}
|
||||
finally
|
||||
{
|
||||
curRetryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (tracks.Count == 0)
|
||||
{
|
||||
throw new BusinessException(message: $"订单:[{string.Join(",", input.OrderNos)}],轨迹代码:{input.TrackCode}没有要更新的记录");
|
||||
}
|
||||
}
|
||||
|
||||
//更新轨迹,同一时间存在多条轨迹记录,理由:不清晰到底要修改哪一条或是全部修改
|
||||
if (!input.IsAdd && tracks.Count > 1)
|
||||
{
|
||||
|
||||
@ -8,4 +8,9 @@ public partial class GlobalConst
|
||||
/// 轨迹数据来源:1外部服务商创建,2内部系统创建,3人工创建
|
||||
/// </summary>
|
||||
public static readonly ImmutableHashSet<int> SupportTrackSources = ImmutableHashSet.Create(1, 2, 3);
|
||||
|
||||
/// <summary>
|
||||
/// 最大更新轨迹重试次数
|
||||
/// </summary>
|
||||
public const int MaxUpdateTrackRetryCount = 3;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetPageTrackTemplateListInputVo :PageInfoInput
|
||||
public class GetPageTrackTemplateListInputVo : PageInfoInput
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubSystemId { get; set; }
|
||||
@ -21,4 +21,9 @@ public class GetPageTrackTemplateListInputVo :PageInfoInput
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public string? TemplateCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关键字
|
||||
/// </summary>
|
||||
public string? KeyWord { get; set; }
|
||||
}
|
||||
|
||||
@ -250,6 +250,11 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
.LeftJoin<TrackStatusEntity>((a, b, c) => b.TrackStatusId == c.Id)
|
||||
.LeftJoin<TrackNodeEntity>((a, b, c, d) => c.Node == d.Id)
|
||||
.Where(a => templateIds.Contains(a.TrackTemplateId))
|
||||
.WhereIF(!input.KeyWord.IsNullOrWhiteSpace(), (a, b, c, d) =>
|
||||
b.Code.Contains(input.KeyWord!)
|
||||
|| b.EnContent.Contains(input.KeyWord!)
|
||||
|| b.Content.Contains(input.KeyWord!)
|
||||
)
|
||||
.Select((a, b, c, d) => new TemplateContentDtoVo
|
||||
{
|
||||
TemplateId = a.TrackTemplateId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user