diff --git a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListOutput.cs b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/OneNetWorkshopProductListOutput.cs similarity index 97% rename from src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListOutput.cs rename to src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/OneNetWorkshopProductListOutput.cs index 7c9f758..c3e21fd 100644 --- a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListOutput.cs +++ b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/OneNetWorkshopProductListOutput.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace JiShe.IoT.Workshop.Dto +namespace JiShe.IoT.OneNETAggregation.Dto { /// /// 生产车间获取OneNET产品列表 diff --git a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentMessageBody.cs b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/ProductionEquipmentMessageBody.cs similarity index 92% rename from src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentMessageBody.cs rename to src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/ProductionEquipmentMessageBody.cs index 60b2c04..4d72a6d 100644 --- a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentMessageBody.cs +++ b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/Dto/ProductionEquipmentMessageBody.cs @@ -7,7 +7,7 @@ using System.Text; using System.Text.Json.Serialization; using System.Threading.Tasks; -namespace JiShe.IoT.Workshop.Dto +namespace JiShe.IoT.OneNETAggregation.Dto { /// /// 生产设备详情 @@ -18,7 +18,7 @@ namespace JiShe.IoT.Workshop.Dto /// 表计类型 /// 电表= 1,水表= 2,燃气表= 3,热能表= 4,水表流量计=5,燃气表流量计=6,特殊电表=7 /// - public MeterTypeEnum? MeterType { get; set; } + public DeviceTypeEnum? MeterType { get; set; } /// /// 设备地址 diff --git a/src/JiShe.IoT.Application.Contracts/OneNETAggregation/IOneNETAggregationService.cs b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/IOneNETAggregationService.cs new file mode 100644 index 0000000..adfa228 --- /dev/null +++ b/src/JiShe.IoT.Application.Contracts/OneNETAggregation/IOneNETAggregationService.cs @@ -0,0 +1,36 @@ +using JiShe.IoT.OneNETAggregation.Dto; +using JiShe.ServicePro; +using JiShe.ServicePro.OneNETManagement.OneNETProducts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.IoT.OneNETAggregation +{ + /// + /// OneNET聚合服务 + /// + public interface IOneNETAggregationService + { + /// + /// 接收车间生产信息 + /// + /// + /// + Task ReceiveWorkshopProductionInfoAsync(OpenApiRequest input); + + /// + /// 获取OneNET产品列表 + /// + Task>> GetProductListAsync(OpenApiRequest input); + + /// + /// 接收业务系统指令信息 + /// + /// + /// + Task ReceiveBusinessSystemCommandInfoAsync(OpenApiRequest input); + } +} diff --git a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListInput.cs b/src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListInput.cs deleted file mode 100644 index d98a11c..0000000 --- a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/OneNetWorkshopProductListInput.cs +++ /dev/null @@ -1,16 +0,0 @@ -using JiShe.ServicePro; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Workshop.Dto -{ - /// - /// 生产车间获取OneNET产品列表 - /// - public class OneNetWorkshopProductListInput : OpenApiRequest - { - } -} diff --git a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentInput.cs b/src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentInput.cs deleted file mode 100644 index 4faf3f1..0000000 --- a/src/JiShe.IoT.Application.Contracts/Workshop/Dto/ProductionEquipmentInput.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JiShe.ServicePro; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace JiShe.IoT.Workshop.Dto -{ - /// - /// 生产设备 - /// - public class ProductionEquipmentInput: OpenApiRequest - { - - } -} diff --git a/src/JiShe.IoT.Application.Contracts/Workshop/IProductionWorkshopService.cs b/src/JiShe.IoT.Application.Contracts/Workshop/IProductionWorkshopService.cs deleted file mode 100644 index 5b061a6..0000000 --- a/src/JiShe.IoT.Application.Contracts/Workshop/IProductionWorkshopService.cs +++ /dev/null @@ -1,31 +0,0 @@ -using JiShe.IoT.Workshop.Dto; -using JiShe.ServicePro; -using JiShe.ServicePro.OneNETManagement.OneNETProducts; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Workshop -{ - /// - /// 生产车间服务 - /// - public interface IProductionWorkshopService - { - /// - /// 接收车间生产设备信息 - /// - /// - /// - Task ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input); - - - - /// - /// 生产车间获取OneNET产品列表 - /// - Task>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input); - } -} diff --git a/src/JiShe.IoT.Application/CommonServices/CommonService.cs b/src/JiShe.IoT.Application/CommonServices/CommonService.cs index 5e0bdbc..cb0c906 100644 --- a/src/JiShe.IoT.Application/CommonServices/CommonService.cs +++ b/src/JiShe.IoT.Application/CommonServices/CommonService.cs @@ -1,7 +1,6 @@ using JiShe.IoT.CommonServices.Dto; using JiShe.ServicePro.Commons; using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Focuses; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; diff --git a/src/JiShe.IoT.Application/IoTApplicationModule.cs b/src/JiShe.IoT.Application/IoTApplicationModule.cs index 6ef5bf5..55a3076 100644 --- a/src/JiShe.IoT.Application/IoTApplicationModule.cs +++ b/src/JiShe.IoT.Application/IoTApplicationModule.cs @@ -1,5 +1,4 @@ using JiShe.IoT.CommonServices; -using JiShe.IoT.Jobs.ToMysql; using JiShe.IoT.Jobs.ToRedis; using JiShe.ServicePro.CTWingManagement; using JiShe.ServicePro.DeviceManagement; @@ -52,11 +51,7 @@ namespace JiShe.IoT private static void ConfigureBackgroundJob(ServiceConfigurationContext context) { - context.Services.AddHostedService(); - context.Services.AddHostedService(); - context.Services.AddHostedService(); context.Services.AddHostedService(); - context.Services.AddHostedService(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncAmmeterDataToMysqlJob.cs b/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncAmmeterDataToMysqlJob.cs deleted file mode 100644 index 3c5d7ff..0000000 --- a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncAmmeterDataToMysqlJob.cs +++ /dev/null @@ -1,41 +0,0 @@ -using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Meters; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Jobs.ToMysql -{ - /// - /// 批量同步电表 ammeter 数据到mysql - /// - public class BathSyncAmmeterDataToMysqlJob : SystemBackGroundWorkService - { - private readonly ILogger _logger; - public readonly MeterAppService _meterAppService; - public BathSyncAmmeterDataToMysqlJob(ILogger logger, MeterAppService meterAppService) : base(logger) - { - _logger = logger; - _meterAppService = meterAppService; - } - - /// - /// 定时执行 - /// - /// - /// - protected override Task DoWorkAsync(CancellationToken cancellationToken) - { - return _meterAppService.BathSyncAmmeterDataAsync(); - } - - protected override TimeSpan GetInterval() - { - // 每隔3小时执行一次 - return TimeSpan.FromHours(3); - } - } -} diff --git a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncFocusDataToMysqlJob.cs b/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncFocusDataToMysqlJob.cs deleted file mode 100644 index cf93e50..0000000 --- a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncFocusDataToMysqlJob.cs +++ /dev/null @@ -1,37 +0,0 @@ -using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Focuses; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Jobs.ToMysql -{ - /// - /// 批量同步集中器 Focus数据到Mysql - /// - public class BathSyncFocusDataToMysqlJob : SystemBackGroundWorkService - { - - private readonly ILogger _logger; - public readonly FocusAppService _focusAppService; - public BathSyncFocusDataToMysqlJob(ILogger logger, FocusAppService focusAppService) : base(logger) - { - _logger = logger; - _focusAppService = focusAppService; - } - - protected override Task DoWorkAsync(CancellationToken cancellationToken) - { - return _focusAppService.BathSyncFocusDataAsync(); - } - - protected override TimeSpan GetInterval() - { - // 每隔3小时执行一次 - return TimeSpan.FromHours(3); - } - } -} diff --git a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncWatermeterDataToMysqlJob.cs b/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncWatermeterDataToMysqlJob.cs deleted file mode 100644 index 3d67893..0000000 --- a/src/JiShe.IoT.Application/Jobs/ToMysql/BathSyncWatermeterDataToMysqlJob.cs +++ /dev/null @@ -1,41 +0,0 @@ -using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Meters; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Jobs.ToMysql -{ - /// - /// 批量同步 水表 watermeter 数据到mysql - /// - public class BathSyncWatermeterDataToMysqlJob : SystemBackGroundWorkService - { - private readonly ILogger _logger; - public readonly MeterAppService _meterAppService; - public BathSyncWatermeterDataToMysqlJob(ILogger logger, MeterAppService meterAppService) : base(logger) - { - _logger = logger; - _meterAppService = meterAppService; - } - - /// - /// 定时执行 - /// - /// - /// - protected override Task DoWorkAsync(CancellationToken cancellationToken) - { - return _meterAppService.BathSyncWatermeterDataAsync(); - } - - protected override TimeSpan GetInterval() - { - // 每隔3小时执行一次 - return TimeSpan.FromHours(3); - } - } -} diff --git a/src/JiShe.IoT.Application/Jobs/ToRedis/CacheDeviceDataToRedisJob.cs b/src/JiShe.IoT.Application/Jobs/ToRedis/CacheDeviceDataToRedisJob.cs index b7cf1e2..3f91be9 100644 --- a/src/JiShe.IoT.Application/Jobs/ToRedis/CacheDeviceDataToRedisJob.cs +++ b/src/JiShe.IoT.Application/Jobs/ToRedis/CacheDeviceDataToRedisJob.cs @@ -1,5 +1,5 @@ using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Meters; +using JiShe.ServicePro.DeviceManagement.DeviceInfos; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -15,8 +15,8 @@ namespace JiShe.IoT.Jobs.ToRedis public class CacheDeviceDataToRedisJob : SystemBackGroundWorkService { private readonly ILogger _logger; - public readonly MeterAppService _meterAppService; - public CacheDeviceDataToRedisJob(ILogger logger, MeterAppService meterAppService) : base(logger) + public readonly DeviceAppService _meterAppService; + public CacheDeviceDataToRedisJob(ILogger logger, DeviceAppService meterAppService) : base(logger) { _logger = logger; _meterAppService = meterAppService; diff --git a/src/JiShe.IoT.Application/Jobs/ToRedis/CacheFocusDataToRedisJob.cs b/src/JiShe.IoT.Application/Jobs/ToRedis/CacheFocusDataToRedisJob.cs deleted file mode 100644 index 4372aa5..0000000 --- a/src/JiShe.IoT.Application/Jobs/ToRedis/CacheFocusDataToRedisJob.cs +++ /dev/null @@ -1,37 +0,0 @@ -using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Focuses; -using JiShe.ServicePro.DeviceManagement.Meters; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Jobs.ToRedis -{ - /// - /// 缓存集中器数据到Redis - /// - public class CacheFocusDataToRedisJob : SystemBackGroundWorkService - { - - private readonly ILogger _logger; - public readonly FocusAppService _focusAppService; - public CacheFocusDataToRedisJob(ILogger logger, FocusAppService focusAppService) : base(logger) - { - _logger = logger; - _focusAppService= focusAppService; - } - - protected override Task DoWorkAsync(CancellationToken cancellationToken) - { - return _focusAppService.CacheFocusDataToRedisAsync(); - } - - protected override TimeSpan GetInterval() - { - return TimeSpan.FromHours(1); - } - } -} diff --git a/src/JiShe.IoT.Application/Workshop/ProductionWorkshopService.cs b/src/JiShe.IoT.Application/OneNETAggregation/OneNETAggregationService.cs similarity index 63% rename from src/JiShe.IoT.Application/Workshop/ProductionWorkshopService.cs rename to src/JiShe.IoT.Application/OneNETAggregation/OneNETAggregationService.cs index 51f876b..cb55f01 100644 --- a/src/JiShe.IoT.Application/Workshop/ProductionWorkshopService.cs +++ b/src/JiShe.IoT.Application/OneNETAggregation/OneNETAggregationService.cs @@ -1,34 +1,39 @@ -using JiShe.IoT.Workshop.Dto; +using JiShe.IoT.OneNETAggregation.Dto; using JiShe.ServicePro; using JiShe.ServicePro.Core; -using JiShe.ServicePro.DeviceManagement.Focuses; -using JiShe.ServicePro.DeviceManagement.Focuses.Dto; -using JiShe.ServicePro.DeviceManagement.Meters; -using JiShe.ServicePro.DeviceManagement.Meters.Dto; +using JiShe.ServicePro.DeviceManagement.DeivceInfos; +using JiShe.ServicePro.DeviceManagement.DeivceInfos.Dto; using JiShe.ServicePro.Encrypt; using JiShe.ServicePro.Enums; +using JiShe.ServicePro.Kafka.Consts; +using JiShe.ServicePro.Kafka.Producer; using JiShe.ServicePro.OneNETManagement.OneNETDevices; using JiShe.ServicePro.OneNETManagement.OneNETProducts; using JiShe.ServicePro.ServerOptions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace JiShe.IoT.Workshop +namespace JiShe.IoT.OneNETAggregation { /// - /// 生产车间服务 + /// 生产车间聚合服务 /// - public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOneNETDeviceService oneNETDeviceService, IOptions options, ILogger logger) : IoTAppService, IProductionWorkshopService + /// 设备管理信息服务 + /// OneNET设备操作服务 + /// Kafka数据生产服务 + /// 服务配置 + /// + public class OneNETAggregationService(IDeviceAppService deviceAppService, IOneNETDeviceService oneNETDeviceService, IKafkaProducerService _producerService, IOptions options, ILogger logger) : IoTAppService, IOneNETAggregationService { ServerApplicationOptions srverOptions = options.Value; /// - /// 接收车间生产设备信息 + /// 接收车间生产信息 /// /// /// [AllowAnonymous] - public async Task ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input) + public async Task ReceiveWorkshopProductionInfoAsync(OpenApiRequest input) { try @@ -75,31 +80,22 @@ namespace JiShe.IoT.Workshop { return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -108, ResponeResultEnum.Fail); } - - CreateFocusInput focusInfoEntity = new CreateFocusInput() + + CreateDeviceInput meterInfoEntity = new CreateDeviceInput() { - FocusAddress = productionEquipmentMessageBody.DeviceAddress, - IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId, - IoTPlatform = IoTPlatformTypeEnum.OneNET, - IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo, - PlatformPassword = productInfo.ProductAccesskey, - }; - - CreateMeterInput meterInfoEntity = new CreateMeterInput() - { - MeterAddress = productionEquipmentMessageBody.DeviceAddress, + DeviceAddress = productionEquipmentMessageBody.DeviceAddress, Password = productInfo.ProductAccesskey, IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId, IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo, - FocusAddress = productionEquipmentMessageBody.DeviceAddress,//todo: 集中器地址 + DeviceName = productionEquipmentMessageBody.DeviceOpenInfo }; //创建本地设备信息 - await focusAppService.CreateAsync(focusInfoEntity); - await meterAppService.CreateAsync(meterInfoEntity); + await deviceAppService.CreateAsync(meterInfoEntity); //推送至OneNET平台 - await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput() { + await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput() + { DeviceName = productionEquipmentMessageBody.DeviceOpenInfo, ProductId = productionEquipmentMessageBody.IoTPlatformProductId, OneNETAccountId = productInfo.OneNETAccountId, @@ -110,16 +106,16 @@ namespace JiShe.IoT.Workshop } catch (Exception ex) { - logger.LogError($"{nameof(ReceiveOneNetProductionEquipmentInfoAsync)} 生产车间数据推送发生异常:{ex.Serialize()}"); + logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} 生产车间数据推送发生异常:{ex.Serialize()}"); return HttpDataResultExtensions.Failed("生产车间数据推送发生异常", -101, ResponeResultEnum.Exception); } } /// - /// 生产车间获取OneNET产品列表 + /// 获取OneNET产品列表 /// [AllowAnonymous] - public async Task>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input) + public async Task>> GetProductListAsync(OpenApiRequest input) { try @@ -138,7 +134,39 @@ namespace JiShe.IoT.Workshop var pageList = await pageListQuery.ToListAsync(); - return HttpDataResultExtensions.Success>(pageList); + return HttpDataResultExtensions.Success(pageList); + } + catch (Exception) + { + + throw; + } + } + + /// + /// 接收业务系统指令信息,缓存进Kafka + /// + [AllowAnonymous] + public async Task ReceiveBusinessSystemCommandInfoAsync(OpenApiRequest input) + { + + try + { + bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.VerifySignatureToken); + if (verifySignatureReult == false)//签名校验失败 + { + return HttpDataResultExtensions.Failed>("签名校验失败", -101, ResponeResultEnum.NotAllowed); + } + + if (string.IsNullOrWhiteSpace(input.Message)) + { + return HttpDataResultExtensions.Failed>("指令下发内容不能为空", -102, ResponeResultEnum.Fail); + } + + //将指令存储Kafka中 + await _producerService.ProduceAsync(KafkaTopicConsts.OneNETCommandIssuedEventName, $"{GuidGenerator.Create()}", input); + + return HttpDataResultExtensions.Success("指令下发Kafka成功"); } catch (Exception) { diff --git a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs index c205cfe..9e83a1c 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs @@ -2,9 +2,8 @@ using JiShe.ServicePro.BasicManagement.UserRefreshTokens; using JiShe.ServicePro.CTWingManagement.CTWingAccount; using JiShe.ServicePro.CTWingManagement.CTWingProduct; using JiShe.ServicePro.CTWingManagement.EntityFrameworkCore; +using JiShe.ServicePro.DeviceManagement.DeivceInfos; using JiShe.ServicePro.DeviceManagement.EntityFrameworkCore; -using JiShe.ServicePro.DeviceManagement.Focuses; -using JiShe.ServicePro.DeviceManagement.Meters; using JiShe.ServicePro.DynamicMenuManagement.EntityFrameworkCore; using JiShe.ServicePro.DynamicMenuManagement.Menus; using JiShe.ServicePro.FileManagement.EntityFrameworkCore; @@ -66,8 +65,7 @@ namespace JiShe.IoT.EntityFrameworkCore public DbSet FileObjects { get; set; } // 设备管理 - public DbSet FocusInfo { get; set; } - public DbSet MeterInfo { get; set; } + public DbSet DeviceManagementInfo { get; set; } // CTWing管理 public DbSet CTWingAccountInfo { get; set; } diff --git a/src/JiShe.IoT.HttpApi/Controllers/OneNETAggregationController.cs b/src/JiShe.IoT.HttpApi/Controllers/OneNETAggregationController.cs new file mode 100644 index 0000000..8df9d2d --- /dev/null +++ b/src/JiShe.IoT.HttpApi/Controllers/OneNETAggregationController.cs @@ -0,0 +1,60 @@ +using JiShe.IoT.CommonServices; +using JiShe.IoT.CommonServices.Dto; +using JiShe.IoT.OneNETAggregation; +using JiShe.IoT.OneNETAggregation.Dto; +using JiShe.ServicePro; +using JiShe.ServicePro.Commons; +using JiShe.ServicePro.OneNETManagement.OneNETProducts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.IoT.Controllers +{ + /// + /// OneNET聚合服务 + /// + [Route("/Aggregation/OneNET")] + public class OneNETAggregationController : IoTController + { + private readonly IOneNETAggregationService _oneNETAggregationServiceService; + public OneNETAggregationController(IOneNETAggregationService oneNETAggregationServiceService) + { + _oneNETAggregationServiceService = oneNETAggregationServiceService; + } + + /// + /// 接收车间生产信息 + /// + /// + /// + [HttpPost(nameof(ReceiveWorkshopProductionInfoAsync))] + [SwaggerOperation(summary: "接收车间生产信息", Tags = new[] { "AggregationOneNET" })] + public async Task ReceiveWorkshopProductionInfoAsync(OpenApiRequest input) + { + await _oneNETAggregationServiceService.ReceiveWorkshopProductionInfoAsync(input); + } + + /// + /// 获取OneNET产品列表 + /// + [HttpPost(nameof(GetProductListAsync))] + [SwaggerOperation(summary: "获取OneNET产品列表", Tags = new[] { "AggregationOneNET" })] + public async Task>> GetProductListAsync(OpenApiRequest input) + { + return await _oneNETAggregationServiceService.GetProductListAsync(input); + } + + /// + /// 接收业务系统指令信息 + /// + [HttpPost(nameof(ReceiveBusinessSystemCommandInfoAsync))] + [SwaggerOperation(summary: "接收业务系统指令信息", Tags = new[] { "AggregationOneNET" })] + public async Task ReceiveBusinessSystemCommandInfoAsync(OpenApiRequest input) + { + return await _oneNETAggregationServiceService.ReceiveBusinessSystemCommandInfoAsync(input); + } + } +} diff --git a/src/JiShe.IoT.HttpApi/Controllers/ProductionWorkshopController.cs b/src/JiShe.IoT.HttpApi/Controllers/ProductionWorkshopController.cs deleted file mode 100644 index 61dc36e..0000000 --- a/src/JiShe.IoT.HttpApi/Controllers/ProductionWorkshopController.cs +++ /dev/null @@ -1,50 +0,0 @@ -using JiShe.IoT.CommonServices; -using JiShe.IoT.CommonServices.Dto; -using JiShe.IoT.Workshop; -using JiShe.IoT.Workshop.Dto; -using JiShe.ServicePro; -using JiShe.ServicePro.Commons; -using JiShe.ServicePro.OneNETManagement.OneNETProducts; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.Controllers -{ - /// - /// 车间管理服务 - /// - [Route("Workshop")] - public class ProductionWorkshopController : IoTController - { - private readonly IProductionWorkshopService _productionWorkshopService; - public ProductionWorkshopController(IProductionWorkshopService productionWorkshopService) - { - _productionWorkshopService = productionWorkshopService; - } - - /// - /// 接收车间生产OneNET设备信息 - /// - /// - /// - [HttpPost(nameof(ReceiveOneNetProductionEquipmentInfoAsync))] - [SwaggerOperation(summary: "接收车间生产OneNET设备信息", Tags = new[] { "Workshop" })] - public async Task ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input) - { - await _productionWorkshopService.ReceiveOneNetProductionEquipmentInfoAsync(input); - } - - /// - /// 生产车间获取OneNET产品列表 - /// - [HttpPost(nameof(GetOneNetProductListAsync))] - [SwaggerOperation(summary: "生产车间获取OneNET产品列表", Tags = new[] { "Workshop" })] - public async Task>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input) - { - return await _productionWorkshopService.GetOneNetProductListAsync(input); - } - } -}