change:拉取配置,接口通返回参数化
This commit is contained in:
parent
b14a52776b
commit
06ee271dac
@ -1,4 +1,5 @@
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
@ -82,9 +83,11 @@ public class TrackPullService : ApplicationService
|
||||
/// 轨迹拉取配置编辑
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
[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;
|
||||
|
||||
@ -104,6 +107,27 @@ public class TrackPullService : ApplicationService
|
||||
{
|
||||
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
|
||||
|
||||
if (input.ParseMethod == (int) ParseMethod.InterfaceRelay)
|
||||
{
|
||||
var paramsConfig = configuration.GetSection("InterfaceRelayParamsConfig")
|
||||
.Get<Dictionary<string, string>>();
|
||||
if (paramsConfig == null)
|
||||
{
|
||||
throw new BusinessException(message: "未找到接口通参数配置,联系管理员添加");
|
||||
}
|
||||
|
||||
trackPullEntity.OrderPath = paramsConfig[nameof(trackPullEntity.OrderPath)];
|
||||
trackPullEntity.OrderNoName = paramsConfig[nameof(trackPullEntity.OrderNoName)];
|
||||
trackPullEntity.TrackDetailsPath = paramsConfig[nameof(trackPullEntity.TrackDetailsPath)];
|
||||
trackPullEntity.TrackContentCodeName =
|
||||
paramsConfig[nameof(trackPullEntity.TrackContentCodeName)];
|
||||
trackPullEntity.TrackStatusName = paramsConfig[nameof(trackPullEntity.TrackStatusName)];
|
||||
trackPullEntity.TrackContentName = paramsConfig[nameof(trackPullEntity.TrackContentName)];
|
||||
trackPullEntity.TrackPlaceName = paramsConfig[nameof(trackPullEntity.TrackPlaceName)];
|
||||
trackPullEntity.TrackTimeName = paramsConfig[nameof(trackPullEntity.TrackTimeName)];
|
||||
trackPullEntity.TrackTimeZoneName = paramsConfig[nameof(trackPullEntity.TrackTimeZoneName)];
|
||||
}
|
||||
|
||||
var id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
|
||||
|
||||
await _trackPullCacheService.SetPullConfigAsync(id);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using FluentValidation;
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 解析方式
|
||||
/// </summary>
|
||||
public enum ParseMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// 接口通映射后
|
||||
/// </summary>
|
||||
InterfaceRelay = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 服务商原返回
|
||||
/// </summary>
|
||||
ServiceProviderOriginal = 2
|
||||
}
|
||||
@ -34,7 +34,7 @@ public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
||||
/// 解析方式,1取接口通返参映射后的,2取服务商原返参
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "ParseMethod")]
|
||||
public int ParseMethod { get; set; }
|
||||
public ParseMethod ParseMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单路径
|
||||
|
||||
Loading…
Reference in New Issue
Block a user