diff --git a/src/InterfaceForward.Application/InterfaceForwardApplicationModule.cs b/src/InterfaceForward.Application/InterfaceForwardApplicationModule.cs index 14f0345..1b135da 100644 --- a/src/InterfaceForward.Application/InterfaceForwardApplicationModule.cs +++ b/src/InterfaceForward.Application/InterfaceForwardApplicationModule.cs @@ -7,6 +7,7 @@ using Fake.RabbitMQ; using FreeRedis; using InterfaceForward.Application.Contracts; using InterfaceForward.Application.Helpers; +using InterfaceForward.Application.HostServices; using InterfaceForward.Domain.Shared; using InterfaceForward.Repositories; using Microsoft.Extensions.Configuration; @@ -32,6 +33,8 @@ public class InterfaceForwardApplicationModule:FakeModule }); context.Services.Configure(configuration.GetSection("InterfaceRelay")); + + context.Services.AddHostedService(); var options = configuration.GetSection("Redis").Get(); if (options == null) diff --git a/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs b/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs index 18feae4..1116208 100644 --- a/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs +++ b/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs @@ -10,6 +10,7 @@ using RabbitMQ.Client.Events; namespace InterfaceForward.Application.Rabbit; +[ExposeServices(typeof(IRabbitHandler))] public class BatchForwardEventHandler( InterfaceForwardCommon forwardCommon, RabbitClient rabbitClient, diff --git a/src/InterfaceForward.Domain.Shared/Enum/ParameterPlaceholder.cs b/src/InterfaceForward.Domain.Shared/Enum/ParameterPlaceholder.cs new file mode 100644 index 0000000..2d5a29c --- /dev/null +++ b/src/InterfaceForward.Domain.Shared/Enum/ParameterPlaceholder.cs @@ -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, +} \ No newline at end of file diff --git a/src/InterfaceForward.Repositories/Interface/Services/InterfaceMapRepository.cs b/src/InterfaceForward.Repositories/Interface/Services/InterfaceMapRepository.cs index a54ac04..7eabc43 100644 --- a/src/InterfaceForward.Repositories/Interface/Services/InterfaceMapRepository.cs +++ b/src/InterfaceForward.Repositories/Interface/Services/InterfaceMapRepository.cs @@ -65,14 +65,13 @@ ORDER BY `b`.`Sort` ASC // 因为入参映射有多个 出参映射只有一个(挂在第一个映射) return await Context.SqlQueryable(@$" 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` 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_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_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 ORDER BY `b`.`Sort` ASC").ToListAsync(); } diff --git a/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceParameterMapOutputValueObject.cs b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceParameterMapOutputValueObject.cs index fcd8595..2a8eff4 100644 --- a/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceParameterMapOutputValueObject.cs +++ b/src/InterfaceForward.Repositories/Interface/ValueObjects/InterfaceParameterMapOutputValueObject.cs @@ -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 { @@ -35,7 +38,12 @@ public class InterfaceParameterMapOutputValueObject /// /// 参数类型 /// - public string Type { get; set; } + public string Type => Type2.GetDescription(); + + /// + /// 参数类型 + /// + public ParameterType Type2 { get; set; } /// /// 是否入参