Merge branch 'refs/heads/S33-中台token优化' into test
This commit is contained in:
commit
654ba07fd3
@ -10,6 +10,7 @@ try
|
||||
.AddConfigurationContainer()
|
||||
.AddOptionsFromConfiguration()
|
||||
.UseSerilogDefault()
|
||||
.AddOTel() //注入OTel
|
||||
.Host.AddAppSettingsSecretsJson()
|
||||
.UseAutofac();
|
||||
|
||||
@ -17,6 +18,7 @@ try
|
||||
|
||||
var app = builder.Build();
|
||||
await app.InitializeApplicationAsync();
|
||||
app.UseOTel(); //启动WebApi的请求管道配置
|
||||
await app.RunAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackOrder;
|
||||
|
||||
public class TrackPushRecordOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单Id
|
||||
/// </summary>
|
||||
public int OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 接口通请求Id
|
||||
/// </summary>
|
||||
public Guid RequestId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信息
|
||||
/// </summary>
|
||||
public string Message { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public string OptionType { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatus { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackCode { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容
|
||||
/// </summary>
|
||||
public string TrackContent { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生地
|
||||
/// </summary>
|
||||
public string TrackPlace { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生时间
|
||||
/// </summary>
|
||||
public DateTime TrackTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生时区
|
||||
/// </summary>
|
||||
public float TrackTimeZone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生时区
|
||||
/// </summary>
|
||||
public string TrackGTMTimeZone { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 是否成功
|
||||
/// </summary>
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推送内容(json)
|
||||
/// </summary>
|
||||
public string PushContent { get; set; } = null!;
|
||||
|
||||
/// <summary>创建人</summary>
|
||||
public string? CreateUser { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
using AutoMapper;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
|
||||
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Order;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using Volo.Abp.AutoMapper;
|
||||
@ -34,6 +36,8 @@ public class OrderAutoMapperProfile : Profile
|
||||
.ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
|
||||
.ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
|
||||
.ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone));
|
||||
|
||||
CreateMap<TrackPushRecordIndex, TrackPushRecordOutput>(MemberList.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -70,6 +70,10 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
// 推送新增,需要根据上一次的推送 推断 本次推送 是否可行
|
||||
config = await _trackPushCacheService.IsValidPushAsync(order.SubSystemId, order.CustomId,
|
||||
order.LatestPushTrackCode, @event.TrackCode);
|
||||
if (config is not { IsAutoPush: true })
|
||||
{
|
||||
config = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.8"/>
|
||||
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.1.9"/>
|
||||
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
|
||||
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
|
||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.9-alpha"/>
|
||||
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" />
|
||||
<PackageReference Include="DotNetCore.CAP" Version="8.0.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="8.0.1" />
|
||||
|
||||
@ -160,8 +160,20 @@ public class TrackOrderService : ApplicationService
|
||||
/// <returns></returns>
|
||||
/// <param name="orderId">订单id</param>
|
||||
[HttpGet("GetTrackPushRecords")]
|
||||
public async Task<List<TrackPushRecordIndex>> GetTrackPushRecordsAsync(int orderId)
|
||||
public async Task<List<TrackPushRecordOutput>> GetTrackPushRecordsAsync(int orderId)
|
||||
{
|
||||
return await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
|
||||
var records = await _trackPushRecordsRepository.GetTrackPushRecordsAsync(orderId);
|
||||
|
||||
var res = ObjectMapper.Map<List<TrackPushRecordIndex>, List<TrackPushRecordOutput>>(records);
|
||||
|
||||
res.ForEach(x =>
|
||||
{
|
||||
int hours = (int)x.TrackTimeZone; // 提取整数部分作为小时
|
||||
int minutes = (int)((x.TrackTimeZone - hours) * 60); // 将小数部分乘以 60 转换为分钟
|
||||
x.TrackGTMTimeZone =
|
||||
$"GTM {(x.TrackTimeZone >= 0 ? "+" : "-")}{new TimeSpan(hours, minutes, 0).ToString().RemovePostFix(":00")}";
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -35,9 +35,11 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
||||
{
|
||||
// maybe is null
|
||||
var data = await DoGetPushContentConfigsAsync(subSystemId, customId);
|
||||
var ttl = 3 * 24 * 60 * 60;
|
||||
if (data == null) ttl = 5;
|
||||
// ttl 3days
|
||||
await RedisHelper.Client.SetAsync(TrackPushContentKey(subSystemId, customId),
|
||||
data, 3 * 24 * 60 * 60);
|
||||
data, ttl);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -66,7 +68,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
|
||||
// find swap
|
||||
cache.FirstOrDefault(x => x.TrackCode == cache[idx + 1].SwapTrackCode);
|
||||
|
||||
return matched != null && matched.TrackCode == trackCode && matched.IsAutoPush ? matched : default;
|
||||
return matched != null && matched.TrackCode == trackCode ? matched : default;
|
||||
}
|
||||
|
||||
private async Task<List<TrackPushContentConfigDto>?> DoGetPushContentConfigsAsync(int subSystemId, int customId)
|
||||
|
||||
@ -40,7 +40,7 @@ public class OrderFlightEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEnt
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CreateTime")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
|
||||
@ -59,7 +59,7 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CreateTime")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
|
||||
@ -40,7 +40,7 @@ public class OrderTemplateEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IE
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CreateTime")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SJZY.Expand.ABP.Core" Version="7.7.1" />
|
||||
<PackageReference Include="SJZY.Expand.ABP.Core" Version="7.8.6"/>
|
||||
<PackageReference Include="SJZY.Expand.ElasticSearch" Version="7.0.17" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -8,8 +8,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SJZY.LoggerCenter.HttpApi" Version="7.0.5" />
|
||||
<PackageReference Include="SJZY.OTel.Extension" Version="1.0.4"/>
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="7.0.2" />
|
||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
|
||||
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.9-alpha"/>
|
||||
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user