Merge remote-tracking branch 'origin/master'

This commit is contained in:
xiaolipro 2025-08-01 10:31:05 +08:00
commit aa2212f05e
5 changed files with 34 additions and 4 deletions

View File

@ -7,6 +7,7 @@ using Fake.RabbitMQ;
using FreeRedis; using FreeRedis;
using InterfaceForward.Application.Contracts; using InterfaceForward.Application.Contracts;
using InterfaceForward.Application.Helpers; using InterfaceForward.Application.Helpers;
using InterfaceForward.Application.HostServices;
using InterfaceForward.Domain.Shared; using InterfaceForward.Domain.Shared;
using InterfaceForward.Repositories; using InterfaceForward.Repositories;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
@ -33,6 +34,8 @@ public class InterfaceForwardApplicationModule:FakeModule
context.Services.Configure<InterfaceRelayOptions>(configuration.GetSection("InterfaceRelay")); context.Services.Configure<InterfaceRelayOptions>(configuration.GetSection("InterfaceRelay"));
context.Services.AddHostedService<AppSubscribeHostService>();
var options = configuration.GetSection("Redis").Get<ConnectionStringBuilder>(); var options = configuration.GetSection("Redis").Get<ConnectionStringBuilder>();
if (options == null) if (options == null)
throw new FakeException("未找到Redis相关配置请检查配置文件中是否包含名为Redis的节点"); throw new FakeException("未找到Redis相关配置请检查配置文件中是否包含名为Redis的节点");

View File

@ -10,6 +10,7 @@ using RabbitMQ.Client.Events;
namespace InterfaceForward.Application.Rabbit; namespace InterfaceForward.Application.Rabbit;
[ExposeServices(typeof(IRabbitHandler))]
public class BatchForwardEventHandler( public class BatchForwardEventHandler(
InterfaceForwardCommon forwardCommon, InterfaceForwardCommon forwardCommon,
RabbitClient rabbitClient, RabbitClient rabbitClient,

View File

@ -0,0 +1,19 @@
using System.ComponentModel;
namespace InterfaceForward.Domain.Shared.Enum;
public enum ParameterPlaceholder
{
[Description("$FromAccount")]
FromAccount = 1,
[Description("$FromBody")]
FromBody,
[Description("$TimeStamp")]
TimeStamp,
[Description("$DateTime")]
DateTime,
[Description("$Url")]
Url,
[Description("$token")]
Token,
}

View File

@ -65,14 +65,13 @@ ORDER BY `b`.`Sort` ASC
// 因为入参映射有多个 出参映射只有一个(挂在第一个映射) // 因为入参映射有多个 出参映射只有一个(挂在第一个映射)
return await Context.SqlQueryable<InterfaceParameterMapOutputValueObject>(@$" return await Context.SqlQueryable<InterfaceParameterMapOutputValueObject>(@$"
select `a`.`Id` AS `InterfaceMapDetailId` , `t`.`Id` AS `InterfaceMapId` , `b`.`Id` AS `Id`, b.InterfaceId, `b`.`Alias` AS `Alias` , `b`.`CnName` AS `CnName` select `a`.`Id` AS `InterfaceMapDetailId` , `t`.`Id` AS `InterfaceMapId` , `b`.`Id` AS `Id`, b.InterfaceId, `b`.`Alias` AS `Alias` , `b`.`CnName` AS `CnName`
, `e`.`Name` AS `Type`, `b`.`IsInPara` AS `IsInPara` , `b`.`IsRequired` AS `IsRequired` , `b`.`Description` AS `Description` , `d`.`Id` AS `FixedId` , `b`.`Type` AS `Type2`, `b`.`IsInPara` AS `IsInPara` , `b`.`IsRequired` AS `IsRequired` , `b`.`Description` AS `Description` , `d`.`Id` AS `FixedId`
, `d`.`FieldValue` AS `FixedValue` , `a`.`MappedParaId` AS `MapId` , `c`.`Alias` AS `MapAlias`, `c`.`CnName` AS `MapCnName` , `c`.`Description` AS `MapDescription` , `d`.`FieldValue` AS `FixedValue` , `a`.`MappedParaId` AS `MapId` , `c`.`Alias` AS `MapAlias`, `c`.`CnName` AS `MapCnName` , `c`.`Description` AS `MapDescription`
from t_interface_map t from t_interface_map t
LEFT JOIN `t_parameter` `b` ON {(isInParaMap ? "t.DownStreamId" : "t.UpStreamId")} = `b`.`InterfaceId` and b.IsInPara = {isInParaMap} AND ( `b`.`IsDeleted` = 0 ) AND ( `b`.`Type` <> 12 ) AND ( `b`.`Type` <> 10 ) LEFT JOIN `t_parameter` `b` ON {(isInParaMap ? "t.DownStreamId" : "t.UpStreamId")} = `b`.`InterfaceId` and b.IsInPara = {isInParaMap} AND ( `b`.`IsDeleted` = 0 ) AND ( `b`.`Type` <> 12 ) AND ( `b`.`Type` <> 10 )
Left JOIN `t_interface_map_detail` `a` ON ( `t`.`Id` = `a`.`InterfaceMapId` ) and b.id = a.ParaId and a.IsDeleted = 0 Left JOIN `t_interface_map_detail` `a` ON ( `t`.`Id` = `a`.`InterfaceMapId` ) and b.id = a.ParaId and a.IsDeleted = 0
Left JOIN `t_parameter` `c` ON ( `a`.`MappedParaId` = `c`.`Id` ) AND ( `c`.`IsDeleted` = 0 ) Left JOIN `t_parameter` `c` ON ( `a`.`MappedParaId` = `c`.`Id` ) AND ( `c`.`IsDeleted` = 0 )
Left JOIN `t_parameter_fixed` `d` ON d.InterfaceId = b.InterfaceId and `b`.`Alias` = `d`.`FieldName` AND `d`.`FieldPositions` like concat('%', CAST(N'Body' AS CHAR),'%') AND d.IsDeleted = 0 Left JOIN `t_parameter_fixed` `d` ON d.InterfaceId = b.InterfaceId and `b`.`Alias` = `d`.`FieldName` AND `d`.`FieldPositions` like concat('%', CAST(N'Body' AS CHAR),'%') AND d.IsDeleted = 0
Left JOIN `t_dictionary` `e` ON (( `b`.`Type` = `e`.`Id` ) AND ( `e`.`Type` = N'ParameterType' ))
WHERE {(isInParaMap ? $"t.id in ({ids})" : $"t.id = {mapIds.First()}")} and t.IsDeleted = 0 WHERE {(isInParaMap ? $"t.id in ({ids})" : $"t.id = {mapIds.First()}")} and t.IsDeleted = 0
ORDER BY `b`.`Sort` ASC").ToListAsync(); ORDER BY `b`.`Sort` ASC").ToListAsync();
} }

View File

@ -1,4 +1,7 @@
namespace InterfaceForward.Repositories.Interface.ValueObjects; using InterfaceForward.Domain.Shared.Enum;
using InterfaceForward.Domain.Shared.Helpers;
namespace InterfaceForward.Repositories.Interface.ValueObjects;
public class InterfaceParameterMapOutputValueObject public class InterfaceParameterMapOutputValueObject
{ {
@ -35,7 +38,12 @@ public class InterfaceParameterMapOutputValueObject
///<summary> ///<summary>
/// 参数类型 /// 参数类型
///</summary> ///</summary>
public string Type { get; set; } public string Type => Type2.GetDescription();
///<summary>
/// 参数类型
///</summary>
public ParameterType Type2 { get; set; }
///<summary> ///<summary>
/// 是否入参 /// 是否入参