From 057759fe648c28a1dfea2f72c6d3ed2cec66e518 Mon Sep 17 00:00:00 2001 From: root <295172551@qq.com> Date: Sun, 6 Jul 2025 16:55:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E7=BB=9C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96=E5=92=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=8C=E5=8C=85=E6=8B=ACNetworkConfig?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=91=BD=E4=BB=A4?= =?UTF-8?q?/=E6=9F=A5=E8=AF=A2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateNetworkConfigCommand.cs | 5 --- .../CreateNetworkConfigCommandHandler.cs | 1 - .../UpdateNetworkConfigCommand.cs | 5 --- .../UpdateNetworkConfigCommandHandler.cs | 1 - .../GetNetworkConfigByIdQueryHandler.cs | 1 - .../GetNetworkConfigByIdResponse.cs | 5 --- .../GetNetworkConfigsQueryHandler.cs | 1 - .../GetNetworkConfigsResponse.cs | 5 --- .../Entities/Device/NetworkConfig.cs | 39 ++----------------- .../Specifications/NetworkConfigSamples.json | 12 ------ .../Specifications/NetworkConfig_Test.http | 4 -- .../Device/NetworkConfigConfiguration.cs | 15 ------- .../Device/NetworkConfigRepository.cs | 2 +- .../Controllers/NetworkConfigsController.cs | 1 - 14 files changed, 5 insertions(+), 92 deletions(-) diff --git a/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommand.cs b/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommand.cs index 14dab02..29f73d2 100644 --- a/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommand.cs +++ b/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommand.cs @@ -22,11 +22,6 @@ public class CreateNetworkConfigCommand : IRequest - /// 配置索引(仅对IMS和MME类型有效) - /// - public int? ConfigIndex { get; set; } - /// /// PLMN字段(移动国家代码+移动网络代码) /// diff --git a/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommandHandler.cs b/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommandHandler.cs index ec17371..7fcf13e 100644 --- a/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommandHandler.cs +++ b/src/X1.Application/Features/NetworkConfigs/Commands/CreateNetworkConfig/CreateNetworkConfigCommandHandler.cs @@ -54,7 +54,6 @@ public class CreateNetworkConfigCommandHandler : IRequestHandler - /// 配置索引(仅对IMS和MME类型有效) - /// - public int? ConfigIndex { get; set; } - /// /// PLMN字段(移动国家代码+移动网络代码) /// diff --git a/src/X1.Application/Features/NetworkConfigs/Commands/UpdateNetworkConfig/UpdateNetworkConfigCommandHandler.cs b/src/X1.Application/Features/NetworkConfigs/Commands/UpdateNetworkConfig/UpdateNetworkConfigCommandHandler.cs index f0515fd..a953b5a 100644 --- a/src/X1.Application/Features/NetworkConfigs/Commands/UpdateNetworkConfig/UpdateNetworkConfigCommandHandler.cs +++ b/src/X1.Application/Features/NetworkConfigs/Commands/UpdateNetworkConfig/UpdateNetworkConfigCommandHandler.cs @@ -60,7 +60,6 @@ public class UpdateNetworkConfigCommandHandler : IRequestHandler public string Name { get; set; } = null!; - /// - /// 配置索引 - /// - public int? ConfigIndex { get; set; } - /// /// PLMN字段 /// diff --git a/src/X1.Application/Features/NetworkConfigs/Queries/GetNetworkConfigs/GetNetworkConfigsQueryHandler.cs b/src/X1.Application/Features/NetworkConfigs/Queries/GetNetworkConfigs/GetNetworkConfigsQueryHandler.cs index 361c28e..aae0746 100644 --- a/src/X1.Application/Features/NetworkConfigs/Queries/GetNetworkConfigs/GetNetworkConfigsQueryHandler.cs +++ b/src/X1.Application/Features/NetworkConfigs/Queries/GetNetworkConfigs/GetNetworkConfigsQueryHandler.cs @@ -69,7 +69,6 @@ public class GetNetworkConfigsQueryHandler : IRequestHandler public string Name { get; set; } = null!; - /// - /// 配置索引 - /// - public int? ConfigIndex { get; set; } - /// /// PLMN字段 /// diff --git a/src/X1.Domain/Entities/Device/NetworkConfig.cs b/src/X1.Domain/Entities/Device/NetworkConfig.cs index 8564371..d425f83 100644 --- a/src/X1.Domain/Entities/Device/NetworkConfig.cs +++ b/src/X1.Domain/Entities/Device/NetworkConfig.cs @@ -44,11 +44,6 @@ public class NetworkConfig : AuditableEntity [MaxLength(100)] public string Name { get; private set; } = null!; - /// - /// 配置索引(仅对IMS和MME类型有效) - /// - public int? ConfigIndex { get; private set; } - /// /// PLMN字段(移动国家代码+移动网络代码) /// @@ -80,20 +75,18 @@ public class NetworkConfig : AuditableEntity string name, string configContent, string createdBy, - int? configIndex = null, string? plmn = null, string? description = null, bool isDisabled = false) { // 验证业务规则 - ValidateCreateParameters(configType, configIndex, plmn); + ValidateCreateParameters(configType, plmn); var networkConfig = new NetworkConfig { Id = Guid.NewGuid().ToString(), ConfigType = configType, Name = name, - ConfigIndex = configIndex, Plmn = plmn, ConfigContent = configContent, Description = description, @@ -114,16 +107,14 @@ public class NetworkConfig : AuditableEntity string name, string configContent, string updatedBy, - int? configIndex = null, string? plmn = null, string? description = null, bool isDisabled = false) { // 验证业务规则 - ValidateUpdateParameters(ConfigType, configIndex, plmn); + ValidateUpdateParameters(ConfigType, plmn); Name = name; - ConfigIndex = configIndex; Plmn = plmn; ConfigContent = configContent; Description = description; @@ -153,7 +144,7 @@ public class NetworkConfig : AuditableEntity /// /// 验证创建参数 /// - private static void ValidateCreateParameters(NetworkConfigType configType, int? configIndex, string? plmn) + private static void ValidateCreateParameters(NetworkConfigType configType, string? plmn) { // 验证PLMN字段的必填性 if (configType == NetworkConfigType.IMS || configType == NetworkConfigType.MME) @@ -163,23 +154,12 @@ public class NetworkConfig : AuditableEntity throw new ArgumentException($"PLMN字段对于{configType}类型是必填的"); } } - - // 验证配置索引 - if (configType == NetworkConfigType.RAN && configIndex.HasValue) - { - throw new ArgumentException("RAN类型不支持配置索引"); - } - - if ((configType == NetworkConfigType.IMS || configType == NetworkConfigType.MME) && !configIndex.HasValue) - { - throw new ArgumentException($"{configType}类型必须提供配置索引"); - } } /// /// 验证更新参数 /// - private static void ValidateUpdateParameters(NetworkConfigType configType, int? configIndex, string? plmn) + private static void ValidateUpdateParameters(NetworkConfigType configType, string? plmn) { // 验证PLMN字段的必填性 if (configType == NetworkConfigType.IMS || configType == NetworkConfigType.MME) @@ -189,16 +169,5 @@ public class NetworkConfig : AuditableEntity throw new ArgumentException($"PLMN字段对于{configType}类型是必填的"); } } - - // 验证配置索引 - if (configType == NetworkConfigType.RAN && configIndex.HasValue) - { - throw new ArgumentException("RAN类型不支持配置索引"); - } - - if ((configType == NetworkConfigType.IMS || configType == NetworkConfigType.MME) && !configIndex.HasValue) - { - throw new ArgumentException($"{configType}类型必须提供配置索引"); - } } } \ No newline at end of file diff --git a/src/X1.Domain/Specifications/NetworkConfigSamples.json b/src/X1.Domain/Specifications/NetworkConfigSamples.json index 8bf55cd..235dc43 100644 --- a/src/X1.Domain/Specifications/NetworkConfigSamples.json +++ b/src/X1.Domain/Specifications/NetworkConfigSamples.json @@ -3,7 +3,6 @@ { "configType": "RAN", "name": "RAN_Config_Default", - "configIndex": null, "plmn": null, "configContent": { "frequencyBands": ["B1", "B3", "B5", "B8"], @@ -30,7 +29,6 @@ { "configType": "IMS", "name": "IMS_Config_ChinaMobile", - "configIndex": 0, "plmn": "46000", "configContent": { "pCscfServers": [ @@ -85,7 +83,6 @@ { "configType": "IMS", "name": "IMS_Config_ChinaUnicom", - "configIndex": 1, "plmn": "46001", "configContent": { "pCscfServers": [ @@ -135,7 +132,6 @@ { "configType": "MME", "name": "MME_Config_Primary", - "configIndex": 0, "plmn": "46000", "configContent": { "mmeCode": "001", @@ -188,7 +184,6 @@ { "configType": "MME", "name": "MME_Config_Secondary", - "configIndex": 1, "plmn": "46000", "configContent": { "mmeCode": "002", @@ -213,13 +208,6 @@ "transport": "SCTP" } ], - "sgsnServers": [ - { - "address": "10.7.2.100", - "port": 2123, - "transport": "SCTP" - } - ], "securitySettings": { "integrityAlgorithm": ["EIA1", "EIA2", "EIA3"], "cipheringAlgorithm": ["EEA1", "EEA2", "EEA3"], diff --git a/src/X1.Domain/Specifications/NetworkConfig_Test.http b/src/X1.Domain/Specifications/NetworkConfig_Test.http index 9f81ddf..3c98dc8 100644 --- a/src/X1.Domain/Specifications/NetworkConfig_Test.http +++ b/src/X1.Domain/Specifications/NetworkConfig_Test.http @@ -8,7 +8,6 @@ Authorization: Bearer {{token}} { "configType": 1, "name": "RAN_Config_Test", - "configIndex": null, "plmn": null, "configContent": "{\"frequencyBands\":[\"B1\",\"B3\"],\"bandwidth\":\"20MHz\",\"powerControl\":{\"maxPower\":43,\"minPower\":23}}", "description": "测试RAN配置", @@ -23,7 +22,6 @@ Authorization: Bearer {{token}} { "configType": 2, "name": "IMS_Config_Test", - "configIndex": 0, "plmn": "46000", "configContent": "{\"pCscfServers\":[{\"address\":\"10.1.1.100\",\"port\":5060,\"transport\":\"UDP\"}],\"sCscfServers\":[{\"address\":\"10.2.1.100\",\"port\":5060,\"transport\":\"UDP\"}]}", "description": "测试IMS配置", @@ -38,7 +36,6 @@ Authorization: Bearer {{token}} { "configType": 3, "name": "MME_Config_Test", - "configIndex": 0, "plmn": "46000", "configContent": "{\"mmeCode\":\"001\",\"mmeGroupId\":\"001\",\"tacList\":[\"0001\",\"0002\"],\"servingGwList\":[{\"address\":\"10.5.1.100\",\"weight\":100}]}", "description": "测试MME配置", @@ -77,7 +74,6 @@ Authorization: Bearer {{token}} { "networkConfigId": "{{networkConfigId}}", "name": "RAN_Config_Updated", - "configIndex": null, "plmn": null, "configContent": "{\"frequencyBands\":[\"B1\",\"B3\",\"B5\"],\"bandwidth\":\"40MHz\",\"powerControl\":{\"maxPower\":46,\"minPower\":20}}", "description": "更新后的RAN配置", diff --git a/src/X1.Infrastructure/Configurations/Device/NetworkConfigConfiguration.cs b/src/X1.Infrastructure/Configurations/Device/NetworkConfigConfiguration.cs index be8a3d9..8612221 100644 --- a/src/X1.Infrastructure/Configurations/Device/NetworkConfigConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Device/NetworkConfigConfiguration.cs @@ -30,9 +30,6 @@ public class NetworkConfigConfiguration : IEntityTypeConfiguration x.ConfigIndex) - .IsRequired(false); - builder.Property(x => x.Plmn) .HasMaxLength(10) .IsRequired(false); @@ -74,9 +71,6 @@ public class NetworkConfigConfiguration : IEntityTypeConfiguration x.Plmn) .HasDatabaseName("IX_NetworkConfigs_Plmn"); - builder.HasIndex(x => x.ConfigIndex) - .HasDatabaseName("IX_NetworkConfigs_ConfigIndex"); - builder.HasIndex(x => x.IsDisabled) .HasDatabaseName("IX_NetworkConfigs_IsDisabled"); @@ -84,16 +78,7 @@ public class NetworkConfigConfiguration : IEntityTypeConfiguration new { x.ConfigType, x.Plmn }) .HasDatabaseName("IX_NetworkConfigs_ConfigType_Plmn"); - builder.HasIndex(x => new { x.ConfigType, x.ConfigIndex }) - .HasDatabaseName("IX_NetworkConfigs_ConfigType_ConfigIndex"); - // 约束配置 - builder.HasCheckConstraint("CK_NetworkConfigs_ConfigIndex_RAN", - "NOT (\"ConfigType\" = 1 AND \"ConfigIndex\" IS NOT NULL)"); - - builder.HasCheckConstraint("CK_NetworkConfigs_ConfigIndex_IMS_MME", - "NOT (\"ConfigType\" IN (2, 3) AND \"ConfigIndex\" IS NULL)"); - builder.HasCheckConstraint("CK_NetworkConfigs_Plmn_IMS_MME", "NOT (\"ConfigType\" IN (2, 3) AND \"Plmn\" IS NULL)"); diff --git a/src/X1.Infrastructure/Repositories/Device/NetworkConfigRepository.cs b/src/X1.Infrastructure/Repositories/Device/NetworkConfigRepository.cs index 22c4662..f593625 100644 --- a/src/X1.Infrastructure/Repositories/Device/NetworkConfigRepository.cs +++ b/src/X1.Infrastructure/Repositories/Device/NetworkConfigRepository.cs @@ -98,7 +98,7 @@ public class NetworkConfigRepository : BaseRepository, INetworkCo public async Task> GetNetworkConfigsByTypeAndPlmnAsync(NetworkConfigType configType, string plmn, CancellationToken cancellationToken = default) { var networkConfigs = await QueryRepository.FindAsync(x => x.ConfigType == configType && x.Plmn == plmn, cancellationToken: cancellationToken); - return networkConfigs.OrderBy(x => x.ConfigIndex).ThenBy(x => x.Name).ToList(); + return networkConfigs.OrderBy(x => x.Name).ToList(); } /// diff --git a/src/X1.Presentation/Controllers/NetworkConfigsController.cs b/src/X1.Presentation/Controllers/NetworkConfigsController.cs index 911b7e9..258479c 100644 --- a/src/X1.Presentation/Controllers/NetworkConfigsController.cs +++ b/src/X1.Presentation/Controllers/NetworkConfigsController.cs @@ -138,7 +138,6 @@ public class NetworkConfigsController : ApiController /// { /// "configType": 1, /// "name": "RAN_Config_Default", - /// "configIndex": null, /// "plmn": null, /// "configContent": "{\"frequencyBands\":[\"B1\",\"B3\"]}", /// "description": "默认RAN配置",