change:拉取配置,接口通返回参数化

This commit is contained in:
xiaolipro 2024-09-10 17:16:46 +08:00
parent b14a52776b
commit 06ee271dac
4 changed files with 44 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
@ -82,9 +83,11 @@ 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;
@ -104,6 +107,27 @@ public class TrackPullService : ApplicationService
{ {
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input); 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); var id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
await _trackPullCacheService.SetPullConfigAsync(id); await _trackPullCacheService.SetPullConfigAsync(id);

View File

@ -1,4 +1,4 @@
using FluentValidation; using FluentValidation;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;

View File

@ -0,0 +1,17 @@
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
/// <summary>
/// 解析方式
/// </summary>
public enum ParseMethod
{
/// <summary>
/// 接口通映射后
/// </summary>
InterfaceRelay = 1,
/// <summary>
/// 服务商原返回
/// </summary>
ServiceProviderOriginal = 2
}

View File

@ -34,7 +34,7 @@ public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// 解析方式,1取接口通返参映射后的,2取服务商原返参 /// 解析方式,1取接口通返参映射后的,2取服务商原返参
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ParseMethod")] [SugarColumn(ColumnName = "ParseMethod")]
public int ParseMethod { get; set; } public ParseMethod ParseMethod { get; set; }
/// <summary> /// <summary>
/// 订单路径 /// 订单路径