change:抽离接口通参数配置到配置文件

This commit is contained in:
xiaolipro 2024-09-25 12:11:11 +08:00
parent ed9730ed55
commit 05573fd12d
10 changed files with 122 additions and 82 deletions

View File

@ -1,4 +1,5 @@
using DotNetCore.CAP; using DotNetCore.CAP;
using Microsoft.Extensions.Options;
using Newtonsoft.Json; using Newtonsoft.Json;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.InterfaceRelay.Application.Contracts; using SJZY.InterfaceRelay.Application.Contracts;
@ -6,6 +7,7 @@ using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Events; using SJZY.Track.Application.Contract.Events;
using SJZY.Track.Application.Contract.Services; using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Application.Helpers; using SJZY.Track.Application.Helpers;
using SJZY.Track.Application.Options;
using SJZY.Track.Application.Track2InterfaceRelay; using SJZY.Track.Application.Track2InterfaceRelay;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
@ -19,6 +21,7 @@ namespace SJZY.Track.Application.CAP.EventHandlers;
public class TrackPushEventHandler : ITransientDependency, ICapSubscribe public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
{ {
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy; private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options;
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository; private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
private readonly ITrackPushCacheService _trackPushCacheService; private readonly ITrackPushCacheService _trackPushCacheService;
@ -28,13 +31,15 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy, public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
IOrderRepository orderRepository, ITrackPushCacheService trackPushCacheService, IOrderRepository orderRepository, ITrackPushCacheService trackPushCacheService,
ITrackDetailsEsRepository trackDetailsEsRepository, ITrackPushRecordEsRepository trackPushRecordEsRepository) ITrackDetailsEsRepository trackDetailsEsRepository, ITrackPushRecordEsRepository trackPushRecordEsRepository,
IOptionsMonitor<InterfaceRelayParamsConfigOptions> options)
{ {
_httpClientProxy = httpClientProxy; _httpClientProxy = httpClientProxy;
_orderRepository = orderRepository; _orderRepository = orderRepository;
_trackPushCacheService = trackPushCacheService; _trackPushCacheService = trackPushCacheService;
_trackDetailsEsRepository = trackDetailsEsRepository; _trackDetailsEsRepository = trackDetailsEsRepository;
_trackPushRecordEsRepository = trackPushRecordEsRepository; _trackPushRecordEsRepository = trackPushRecordEsRepository;
_options = options;
} }
[CapSubscribe(GlobalConst.TrackPushSubscribe, Group = GlobalConst.TrackPushSubscribe)] [CapSubscribe(GlobalConst.TrackPushSubscribe, Group = GlobalConst.TrackPushSubscribe)]
@ -155,11 +160,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
{ {
var asciiString = Base64Helper.SerializeObject(OptionType.新增.ToString()); var asciiString = Base64Helper.SerializeObject(OptionType.新增.ToString());
var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
InterfaceRelayConst.PushTrackInterfaceCode, _options.CurrentValue.PushTrackInterfaceCode,
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe, _pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
attach: asciiString); attach: asciiString);
if (r.Code != InterfaceRelayConst.SuccessCode) if (r.Code != GlobalConst.SuccessCode)
{ {
throw new BusinessException(message: $"requestId: {r.RequestId}; {r.Msg}"); throw new BusinessException(message: $"requestId: {r.RequestId}; {r.Msg}");
} }
@ -199,11 +204,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
{ {
var asciiString = Base64Helper.SerializeObject(OptionType.修改.ToString()); var asciiString = Base64Helper.SerializeObject(OptionType.修改.ToString());
var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var r = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
InterfaceRelayConst.TrackUpdateInterfaceCode, _options.CurrentValue.TrackUpdateInterfaceCode,
_pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe, _pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe,
attach: asciiString); attach: asciiString);
if (r.Code != InterfaceRelayConst.SuccessCode) if (r.Code != GlobalConst.SuccessCode)
{ {
throw new BusinessException(message: $"requestId: {r.RequestId}; {r.Msg}"); throw new BusinessException(message: $"requestId: {r.RequestId}; {r.Msg}");
} }

View File

@ -1,9 +0,0 @@
using SJZY.Expand.ABP.Core;
namespace SJZY.Track.Application.Options;
public class CustomeOptions : IOptionAutoInjection
{
public int Setting1 { get; set; }
public int Setting2 { get; set; }
}

View File

@ -0,0 +1,64 @@
namespace SJZY.Track.Application.Options;
public class InterfaceRelayParamsConfigOptions
{
/// <summary>
/// 订单路径
/// </summary>
public string OrderPath { get; set; } = null!;
/// <summary>
/// 单号参数名
/// </summary>
public string OrderNoName { get; set; } = null!;
/// <summary>
/// 轨迹明细路径
/// </summary>
public string TrackDetailsPath { get; set; } = null!;
/// <summary>
/// 轨迹代码参数名
/// </summary>
public string TrackContentCodeName { get; set; }
/// <summary>
/// 轨迹状态参数名
/// </summary>
public string TrackStatusName { get; set; }
/// <summary>
/// 轨迹内容参数名
/// </summary>
public string TrackContentName { get; set; }
/// <summary>
/// 轨迹发生地参数名
/// </summary>
public string TrackPlaceName { get; set; }
/// <summary>
/// 轨迹发生时间参数名
/// </summary>
public string TrackTimeName { get; set; }
/// <summary>
/// 轨迹时区参数名
/// </summary>
public string TrackTimeZoneName { get; set; }
/// <summary>
/// 获取轨迹接口代码
/// </summary>
public string GetTrackInterfaceCode { get; set; }
/// <summary>
/// 推送轨迹接口代码
/// </summary>
public string PushTrackInterfaceCode { get; set; }
/// <summary>
/// 更新轨迹接口代码
/// </summary>
public string TrackUpdateInterfaceCode { get; set; }
}

View File

@ -24,7 +24,7 @@ namespace SJZY.Track.Application.Services.ForewarningServices;
public class ForewarningNotifyService : IForewarningNotifyService, ITransientDependency public class ForewarningNotifyService : IForewarningNotifyService, ITransientDependency
{ {
private readonly IForewarningCacheService _forewarningCacheService; private readonly IForewarningCacheService _forewarningCacheService;
private readonly IOptionsSnapshot<TrackAppOptions> _options; private readonly IOptionsSnapshot<TrackAppOptions> _options; // not hot path
private readonly IHttpClientProxy<IRequestSendMessageService> _requestSendMessageService; private readonly IHttpClientProxy<IRequestSendMessageService> _requestSendMessageService;
private readonly IWarningQueries _warningQueries; private readonly IWarningQueries _warningQueries;
private readonly IWarningRecordEsRepository _warningRecordEsRepository; private readonly IWarningRecordEsRepository _warningRecordEsRepository;

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.InterfaceRelay.Application.Contracts; using SJZY.InterfaceRelay.Application.Contracts;
@ -6,6 +7,7 @@ using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Contract.Services.ProvideServices; using SJZY.Track.Application.Contract.Services.ProvideServices;
using SJZY.Track.Application.Helpers; using SJZY.Track.Application.Helpers;
using SJZY.Track.Application.Options;
using SJZY.Track.Application.Rabbit; using SJZY.Track.Application.Rabbit;
using SJZY.Track.Application.Track2InterfaceRelay; using SJZY.Track.Application.Track2InterfaceRelay;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;
@ -21,14 +23,16 @@ namespace SJZY.Track.Application.Services.ProvideServices;
public class TrackPullService : ApplicationService, ITrackPullService public class TrackPullService : ApplicationService, ITrackPullService
{ {
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy; private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options;
private readonly IProvideQueries _provideQueries; private readonly IProvideQueries _provideQueries;
public TrackPullService(IProvideQueries provideQueries, public TrackPullService(IProvideQueries provideQueries,
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy) IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
IOptionsMonitor<InterfaceRelayParamsConfigOptions> options)
{ {
_provideQueries = provideQueries; _provideQueries = provideQueries;
_httpClientProxy = httpClientProxy; _httpClientProxy = httpClientProxy;
_options = options;
} }
/// <summary> /// <summary>
@ -74,11 +78,11 @@ public class TrackPullService : ApplicationService, ITrackPullService
{ {
// 批量获取轨迹 // 批量获取轨迹
var res = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var res = await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data, _options.CurrentValue.GetTrackInterfaceCode, serviceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, GlobalConst.TrackRefreshSubscribe,
attach); attach);
if (res.Code != InterfaceRelayConst.SuccessCode) if (res.Code != GlobalConst.SuccessCode)
{ {
LogHelper.Error($"刷新轨迹失败:{res.ToJson()}"); LogHelper.Error($"刷新轨迹失败:{res.ToJson()}");
} }

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using SJZY.Expand.ABP.Core; using SJZY.Expand.ABP.Core;
using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
@ -6,6 +7,7 @@ using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Contract.Services; using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Application.Helpers; using SJZY.Track.Application.Helpers;
using SJZY.Track.Application.Options;
using SJZY.Track.Application.Track2InterfaceRelay; using SJZY.Track.Application.Track2InterfaceRelay;
using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.Dtos.TrackPull;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;
@ -61,7 +63,9 @@ public class TrackPullTask : ApplicationService, ISingletonDependency
var provideQueries = serviceScope.ServiceProvider.GetRequiredService<IProvideQueries>(); var provideQueries = serviceScope.ServiceProvider.GetRequiredService<IProvideQueries>();
var httpClientProxy = serviceScope.ServiceProvider var httpClientProxy = serviceScope.ServiceProvider
.GetRequiredService<IHttpClientProxy<IInterfaceForwardServiceV2>>(); .GetRequiredService<IHttpClientProxy<IInterfaceForwardServiceV2>>();
await DoRefreshAsync(config, provideQueries, httpClientProxy); var interfaceOptions = serviceScope.ServiceProvider
.GetRequiredService<IOptions<InterfaceRelayParamsConfigOptions>>();
await DoRefreshAsync(config, provideQueries, httpClientProxy, interfaceOptions.Value);
} }
catch (Exception e) catch (Exception e)
{ {
@ -72,7 +76,8 @@ public class TrackPullTask : ApplicationService, ISingletonDependency
} }
private static async Task DoRefreshAsync(TrackPullConfigVo config, IProvideQueries provideQueries, private static async Task DoRefreshAsync(TrackPullConfigVo config, IProvideQueries provideQueries,
IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy) IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
InterfaceRelayParamsConfigOptions interfaceOptionsValue)
{ {
using (Track2InterfaceRelaySubSystemContext.Use( using (Track2InterfaceRelaySubSystemContext.Use(
new Track2InterfaceRelaySubSystemContext(config.SubSystemCode))) new Track2InterfaceRelaySubSystemContext(config.SubSystemCode)))
@ -93,10 +98,10 @@ public class TrackPullTask : ApplicationService, ISingletonDependency
var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode, var attach = Base64Helper.SerializeObject(new TrackRefreshAttach(config.ServiceProviderCode,
config.SubSystemId, group.Key)); config.SubSystemId, group.Key));
var res = await httpClientProxy.Service.BatchForwardThenPushToQueueAsync( var res = await httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
InterfaceRelayConst.GetTrackInterfaceCode, serviceProviderCode, data, interfaceOptionsValue.GetTrackInterfaceCode, serviceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, attach); GlobalConst.TrackRefreshSubscribe, attach);
if (res.Code != InterfaceRelayConst.SuccessCode) if (res.Code != GlobalConst.SuccessCode)
{ {
LogHelper.Error($"刷新轨迹失败:{res.ToJson()}"); LogHelper.Error($"刷新轨迹失败:{res.ToJson()}");
} }

View File

@ -1,11 +1,12 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Contract.Services; using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Application.Options;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.Dtos.TrackPull;
@ -20,6 +21,7 @@ namespace SJZY.Track.Application.Services.TrackPull;
[Route("/Track/PullConfig")] [Route("/Track/PullConfig")]
public class TrackPullService : ApplicationService public class TrackPullService : ApplicationService
{ {
private readonly IOptionsMonitor<InterfaceRelayParamsConfigOptions> _options;
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackPullCacheService _trackPullCacheService; private readonly ITrackPullCacheService _trackPullCacheService;
private readonly ITrackPullConfigRepository _trackPullConfigRepository; private readonly ITrackPullConfigRepository _trackPullConfigRepository;
@ -27,11 +29,12 @@ public class TrackPullService : ApplicationService
public TrackPullService( public TrackPullService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackPullConfigRepository trackPullConfigRepository, ITrackPullConfigRepository trackPullConfigRepository,
ITrackPullCacheService trackPullCacheService) ITrackPullCacheService trackPullCacheService, IOptionsMonitor<InterfaceRelayParamsConfigOptions> options)
{ {
_stringLocalizer = stringLocalizer; _stringLocalizer = stringLocalizer;
_trackPullConfigRepository = trackPullConfigRepository; _trackPullConfigRepository = trackPullConfigRepository;
_trackPullCacheService = trackPullCacheService; _trackPullCacheService = trackPullCacheService;
_options = options;
} }
/// <summary> /// <summary>
@ -83,11 +86,9 @@ public class TrackPullService : ApplicationService
/// 轨迹拉取配置编辑 /// 轨迹拉取配置编辑
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <param name="configuration"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("Edit")] [HttpPost("Edit")]
public async Task<bool> EditAsync([FromBody] EditTrackPullConfigInput input, public async Task<bool> EditAsync([FromBody] EditTrackPullConfigInput input)
[FromServices] IConfiguration configuration)
{ {
if (input.PullInterval < 60) input.PullInterval = 60; if (input.PullInterval < 60) input.PullInterval = 60;
@ -109,23 +110,21 @@ public class TrackPullService : ApplicationService
if (input.ParseMethod == (int) ParseMethod.InterfaceRelay) if (input.ParseMethod == (int) ParseMethod.InterfaceRelay)
{ {
var paramsConfig = configuration.GetSection("InterfaceRelayParamsConfig") var paramsConfig = _options.CurrentValue;
.Get<Dictionary<string, string>>();
if (paramsConfig == null) if (paramsConfig == null)
{ {
throw new BusinessException(message: "未找到接口通参数配置,联系管理员添加"); throw new BusinessException(message: "未找到接口通参数配置,联系管理员添加");
} }
trackPullEntity.OrderPath = paramsConfig[nameof(trackPullEntity.OrderPath)]; trackPullEntity.OrderPath = paramsConfig.OrderPath;
trackPullEntity.OrderNoName = paramsConfig[nameof(trackPullEntity.OrderNoName)]; trackPullEntity.OrderNoName = paramsConfig.OrderNoName;
trackPullEntity.TrackDetailsPath = paramsConfig[nameof(trackPullEntity.TrackDetailsPath)]; trackPullEntity.TrackDetailsPath = paramsConfig.TrackDetailsPath;
trackPullEntity.TrackContentCodeName = trackPullEntity.TrackContentCodeName = paramsConfig.TrackContentCodeName;
paramsConfig[nameof(trackPullEntity.TrackContentCodeName)]; trackPullEntity.TrackStatusName = paramsConfig.TrackStatusName;
trackPullEntity.TrackStatusName = paramsConfig[nameof(trackPullEntity.TrackStatusName)]; trackPullEntity.TrackContentName = paramsConfig.TrackContentName;
trackPullEntity.TrackContentName = paramsConfig[nameof(trackPullEntity.TrackContentName)]; trackPullEntity.TrackPlaceName = paramsConfig.TrackPlaceName;
trackPullEntity.TrackPlaceName = paramsConfig[nameof(trackPullEntity.TrackPlaceName)]; trackPullEntity.TrackTimeName = paramsConfig.TrackTimeName;
trackPullEntity.TrackTimeName = paramsConfig[nameof(trackPullEntity.TrackTimeName)]; trackPullEntity.TrackTimeZoneName = paramsConfig.TrackTimeZoneName;
trackPullEntity.TrackTimeZoneName = paramsConfig[nameof(trackPullEntity.TrackTimeZoneName)];
} }
var id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); var id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
@ -142,24 +141,21 @@ public class TrackPullService : ApplicationService
ObjectMapper.Map(input, oldTrackPullEntity); ObjectMapper.Map(input, oldTrackPullEntity);
if (input.ParseMethod == (int) ParseMethod.InterfaceRelay) if (input.ParseMethod == (int) ParseMethod.InterfaceRelay)
{ {
var paramsConfig = configuration.GetSection("InterfaceRelayParamsConfig") var paramsConfig = _options.CurrentValue;
.Get<Dictionary<string, string>>();
if (paramsConfig == null) if (paramsConfig == null)
{ {
throw new BusinessException(message: "未找到接口通参数配置,联系管理员添加"); throw new BusinessException(message: "未找到接口通参数配置,联系管理员添加");
} }
oldTrackPullEntity.OrderPath = paramsConfig[nameof(oldTrackPullEntity.OrderPath)]; oldTrackPullEntity.OrderPath = paramsConfig.OrderPath;
oldTrackPullEntity.OrderNoName = paramsConfig[nameof(oldTrackPullEntity.OrderNoName)]; oldTrackPullEntity.OrderNoName = paramsConfig.OrderNoName;
oldTrackPullEntity.TrackDetailsPath = paramsConfig[nameof(oldTrackPullEntity.TrackDetailsPath)]; oldTrackPullEntity.TrackDetailsPath = paramsConfig.TrackDetailsPath;
oldTrackPullEntity.TrackContentCodeName = oldTrackPullEntity.TrackContentCodeName = paramsConfig.TrackContentCodeName;
paramsConfig[nameof(oldTrackPullEntity.TrackContentCodeName)]; oldTrackPullEntity.TrackStatusName = paramsConfig.TrackStatusName;
oldTrackPullEntity.TrackStatusName = paramsConfig[nameof(oldTrackPullEntity.TrackStatusName)]; oldTrackPullEntity.TrackContentName = paramsConfig.TrackContentName;
oldTrackPullEntity.TrackContentName = paramsConfig[nameof(oldTrackPullEntity.TrackContentName)]; oldTrackPullEntity.TrackPlaceName = paramsConfig.TrackPlaceName;
oldTrackPullEntity.TrackPlaceName = paramsConfig[nameof(oldTrackPullEntity.TrackPlaceName)]; oldTrackPullEntity.TrackTimeName = paramsConfig.TrackTimeName;
oldTrackPullEntity.TrackTimeName = paramsConfig[nameof(oldTrackPullEntity.TrackTimeName)]; oldTrackPullEntity.TrackTimeZoneName = paramsConfig.TrackTimeZoneName;
oldTrackPullEntity.TrackTimeZoneName =
paramsConfig[nameof(oldTrackPullEntity.TrackTimeZoneName)];
} }
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity); await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);

View File

@ -152,6 +152,8 @@ public class SjzyTrackApplicationModule : AbpModule
}, typeof(SjzyTrackApplicationModule).Assembly); }, typeof(SjzyTrackApplicationModule).Assembly);
context.Services.Configure<TrackAppOptions>(configuration.GetSection("TrackApp")); context.Services.Configure<TrackAppOptions>(configuration.GetSection("TrackApp"));
context.Services.Configure<InterfaceRelayParamsConfigOptions>(
configuration.GetSection("InterfaceRelayParamsConfig"));
} }
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)

View File

@ -8,9 +8,9 @@ public class Track2InterfaceRelayHttpMessageHandler : DelegatingHandler, ITransi
{ {
private readonly Track2InterfaceRelayOptions _options; private readonly Track2InterfaceRelayOptions _options;
public Track2InterfaceRelayHttpMessageHandler(IOptionsSnapshot<Track2InterfaceRelayOptions> options) public Track2InterfaceRelayHttpMessageHandler(IOptionsMonitor<Track2InterfaceRelayOptions> options)
{ {
_options = options.Value; _options = options.CurrentValue;
} }
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,

View File

@ -1,27 +0,0 @@
namespace SJZY.Track.Domain.Consts;
/// <summary>
/// 接口通常量
/// </summary>
public class InterfaceRelayConst
{
/// <summary>
/// 接口通成功代码
/// </summary>
public const string SuccessCode = GlobalConst.SuccessCode;
/// <summary>
/// 获取轨迹接口代码
/// </summary>
public const string GetTrackInterfaceCode = "TEST";
/// <summary>
/// 推送轨迹接口代码
/// </summary>
public const string PushTrackInterfaceCode = "A024";
/// <summary>
/// 更新轨迹接口代码
/// </summary>
public const string TrackUpdateInterfaceCode = "A040";
}