CTWing账号管理,产品管理,设备服务接口框架定义

This commit is contained in:
ChenYi 2025-07-30 11:09:12 +08:00
parent 6e70b026c9
commit 000f9752ea
10 changed files with 394 additions and 26 deletions

@ -1 +1 @@
Subproject commit cf3eff7465d5f3d89b4f95d372a0a7e797f4dec0 Subproject commit 5562b1a3c43e34f663b4f58415698b1c9d0190d6

View File

@ -0,0 +1,52 @@
using JiShe.ServicePro;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.CTWingAggregation.Dto
{
/// <summary>
/// 生产车间获取CTWing产品列表
/// </summary>
public class CTWingWorkshopProductListOutput : OpenApiRequest
{
/// <summary>
/// CTWing账户Id
/// </summary>
[SwaggerSchema("CTWing账户Id")]
public string CTWingAccountId { get; set; }
/// <summary>
/// 物联网平台对应的产品Id
/// </summary>
[SwaggerSchema("物联网平台对应的产品Id")]
public string IoTPlatformProductId { get; set; }
/// <summary>
/// 产品名称
/// </summary>
[SwaggerSchema("产品名称")]
public string ProductName { get; set; }
/// <summary>
/// 设备访问密钥
/// </summary>
[SwaggerSchema("设备访问密钥")]
public string FeatureAccesskey { get; set; }
/// <summary>
/// 通讯服务地址
/// </summary>
[SwaggerSchema("通讯服务地址")]
public string CommunicationAddress { get; set; }
/// <summary>
/// TLS通讯服务地址
/// </summary>
[SwaggerSchema("TLS通讯服务地址")]
public string CommunicationAddressTLS { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using JiShe.IoT.CTWingAggregation.Dto;
using JiShe.IoT.OneNETAggregation.Dto;
using JiShe.ServicePro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.CTWingAggregation
{
public interface ICTWingAggregationService : IApplicationService
{
/// <summary>
/// 接收车间生产信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<HttpDataResult> ReceiveWorkshopProductionInfoAsync(OpenApiRequest input);
/// <summary>
/// 获取CTWing产品列表
/// </summary>
Task<HttpDataResult<List<CTWingWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input);
}
}

View File

@ -7,7 +7,7 @@ using System.Text;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace JiShe.IoT.OneNETAggregation.Dto namespace JiShe.IoT.Workshops
{ {
/// <summary> /// <summary>
/// 生产设备详情 /// 生产设备详情

View File

@ -0,0 +1,166 @@
using JiShe.IoT.CTWingAggregation.Dto;
using JiShe.IoT.Workshops;
using JiShe.ServicePro;
using JiShe.ServicePro.Core;
using JiShe.ServicePro.CTWingManagement.CTWingDevices;
using JiShe.ServicePro.CTWingManagement.CTWingProduct;
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
using JiShe.ServicePro.DeviceManagement.DeviceInfos.Dto;
using JiShe.ServicePro.Encrypt;
using JiShe.ServicePro.Enums;
using JiShe.ServicePro.FreeRedisProvider;
using JiShe.ServicePro.ServerOptions;
using Mapster;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace JiShe.IoT.CTWingAggregation
{
/// <summary>
/// CTWing聚合服务
/// </summary>
/// <param name="deviceAppService"></param>
/// <param name="ctwingDeviceService"></param>
/// <param name="options"></param>
/// <param name="logger"></param>
public class CTWingAggregationService(IDeviceAppService deviceAppService, ICTWingDeviceService ctwingDeviceService, IOptions<ServerApplicationOptions> options, ILogger<CTWingAggregationService> logger) : IoTAppService, ICTWingAggregationService
{
ServerApplicationOptions srverOptions = options.Value;
/// <summary>
/// 接收车间生产信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[AllowAnonymous]
public async Task<HttpDataResult> ReceiveWorkshopProductionInfoAsync(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);
}
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
if (productionEquipmentMessageBody.MeterType.HasValue == false)
{
return HttpDataResultExtensions.Failed("设备类型不能为空", -103, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
{
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -104, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
{
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -105, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceAddress))
{
return HttpDataResultExtensions.Failed("设备地址不能为空", -106, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceOpenInfo))
{
return HttpDataResultExtensions.Failed("物联网平台唯一设备标识,不能为空", -107, ResponeResultEnum.Fail);
}
var productInfo = await FreeSqlDbContext.Instance.Select<CTWingPrivateProductInfo>()
.Where(e => e.IsEnabled == true && e.IoTPlatformProductId == productionEquipmentMessageBody.IoTPlatformProductId)
.FirstAsync();
if (productInfo == null)
{
return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -108, ResponeResultEnum.Fail);
}
CreateDeviceInput meterInfoEntity = new CreateDeviceInput()
{
DeviceAddress = productionEquipmentMessageBody.DeviceAddress,
PlatformPassword = productInfo.MasterKey,
IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId,
IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo,
DeviceName = productionEquipmentMessageBody.DeviceOpenInfo
};
//创建本地设备信息
var insertResult = await deviceAppService.CreateAsync(meterInfoEntity);
//推送至CTWing平台
var pushResult = await ctwingDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput()
{
//DeviceName = productionEquipmentMessageBody.DeviceOpenInfo,
//ProductId = productionEquipmentMessageBody.IoTPlatformProductId,
//CTWingAccountId = productInfo.CTWingAccountId,
//Description = productionEquipmentMessageBody.DeviceOpenInfo,
});
if (pushResult == null || pushResult.Code != ServicePro.Enums.ResponeResultEnum.Success)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} 推送设备信息失败:{pushResult.Serialize()}");
return HttpDataResultExtensions.Failed("推送设备信息CTWing失败", -109, ResponeResultEnum.Fail);
}
UpdateDeviceInput updateDeviceInput = insertResult.Adapt<UpdateDeviceInput>();
updateDeviceInput.IoTPlatformResponse = pushResult.Serialize();
var updateResult = await deviceAppService.UpdateAsync(updateDeviceInput);
if (updateResult == null)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} CTWing返回的设备信息更新失败{input.Serialize()}");
return HttpDataResultExtensions.Failed("CTWing返回的设备信息更新失败", -110, ResponeResultEnum.Fail);
}
//设备数据缓存到Redis
DeviceCacheInfos deviceCacheInfos = insertResult.Adapt<DeviceCacheInfos>();
deviceCacheInfos.IoTPlatformResponse = updateDeviceInput.IoTPlatformResponse;
RedisProvider.Instance.HSet<DeviceCacheInfos>(RedisConst.CacheAllDeviceInfoHashKey, insertResult.DeviceAddress, deviceCacheInfos);
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
}
catch (Exception ex)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} 生产车间数据推送发生异常:{ex.Serialize()}");
return HttpDataResultExtensions.Failed("生产车间数据推送发生异常", -101, ResponeResultEnum.Exception);
}
}
/// <summary>
/// 获取CTWing产品列表
/// </summary>
[AllowAnonymous]
public async Task<HttpDataResult<List<CTWingWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input)
{
try
{
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.VerifySignatureToken);
if (verifySignatureReult == false)//签名校验失败
{
return HttpDataResultExtensions.Failed<List<CTWingWorkshopProductListOutput>>("签名校验失败", -101, ResponeResultEnum.NotAllowed);
}
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
var pageListQuery = FreeSqlDbContext.Instance.Select<CTWingPrivateProductInfo>()
.Where(e => e.IsEnabled == true)
.OrderByDescending(e => e.CreationTime);
var pageList = await pageListQuery.ToListAsync<CTWingWorkshopProductListOutput>();
return HttpDataResultExtensions.Success(pageList);
}
catch (Exception)
{
throw;
}
}
}
}

View File

@ -1,4 +1,5 @@
using JiShe.IoT.OneNETAggregation.Dto; using JiShe.IoT.OneNETAggregation.Dto;
using JiShe.IoT.Workshops;
using JiShe.ServicePro; using JiShe.ServicePro;
using JiShe.ServicePro.Core; using JiShe.ServicePro.Core;
using JiShe.ServicePro.DeviceManagement.DeviceInfos; using JiShe.ServicePro.DeviceManagement.DeviceInfos;

View File

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace JiShe.IoT.Migrations namespace JiShe.IoT.Migrations
{ {
[DbContext(typeof(IoTDbContext))] [DbContext(typeof(IoTDbContext))]
[Migration("20250729024912_InitialCreate")] [Migration("20250730030313_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -129,6 +129,24 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(128)") .HasColumnType("varchar(128)")
.HasComment("账号名称"); .HasComment("账号名称");
b.Property<string>("AppId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("应用 ID");
b.Property<string>("AppKey")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("应用 AppKey");
b.Property<string>("AppSecret")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("应用 AppSecret");
b.Property<string>("CommunicationAddress") b.Property<string>("CommunicationAddress")
.HasMaxLength(128) .HasMaxLength(128)
.HasColumnType("varchar(128)") .HasColumnType("varchar(128)")
@ -276,18 +294,30 @@ namespace JiShe.IoT.Migrations
b.Property<int>("DeviceCount") b.Property<int>("DeviceCount")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("DeviceThingModelUrl") b.Property<string>("DeviceThingModelFileId")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("varchar(256)") .HasColumnType("varchar(256)")
.HasComment("设备物模型文件管理地址"); .HasComment("设备物模型文件名称");
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<int>("IoTPlatformProductId") b.Property<string>("FeatureAccesskey")
.HasColumnType("int"); .HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasComment("设备访问密钥");
b.Property<string>("IoTPlatformProductId")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("产品ID");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -296,7 +326,8 @@ namespace JiShe.IoT.Migrations
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsEnabled") b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)")
.HasComment("是否启用");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -307,9 +338,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<string>("MasterKey") b.Property<string>("MasterKey")
.HasMaxLength(1024) .HasMaxLength(256)
.HasColumnType("varchar(1024)") .HasColumnType("varchar(256)")
.HasComment("主密钥"); .HasComment("OpenAPI 通信主密钥");
b.Property<int>("NetworkType") b.Property<int>("NetworkType")
.HasColumnType("int"); .HasColumnType("int");
@ -594,6 +625,9 @@ namespace JiShe.IoT.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsPlatformPushSuccess")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime"); .HasColumnName("LastModificationTime");
@ -1281,7 +1315,8 @@ namespace JiShe.IoT.Migrations
.HasComment("手机号码"); .HasComment("手机号码");
b.Property<int>("ProductCount") b.Property<int>("ProductCount")
.HasColumnType("int"); .HasColumnType("int")
.HasComment("产品数量");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")

View File

@ -751,6 +751,12 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
AccountId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "账号ID") AccountId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "账号ID")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
AppId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "应用 ID")
.Annotation("MySql:CharSet", "utf8mb4"),
AppKey = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "应用 AppKey")
.Annotation("MySql:CharSet", "utf8mb4"),
AppSecret = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "应用 AppSecret")
.Annotation("MySql:CharSet", "utf8mb4"),
PlatformTenantId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "平台租户ID") PlatformTenantId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "平台租户ID")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CommunicationAddress = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "通讯服务地址") CommunicationAddress = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "通讯服务地址")
@ -792,9 +798,12 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CommunicationAddress = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "通讯服务地址") CommunicationAddress = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "通讯服务地址")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
MasterKey = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true, comment: "主密钥") MasterKey = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "OpenAPI 通信主密钥")
.Annotation("MySql:CharSet", "utf8mb4"),
FeatureAccesskey = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备访问密钥")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformProductId = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "产品ID")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformProductId = table.Column<int>(type: "int", nullable: false),
ProductName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "产品名称") ProductName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "产品名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
Protocol = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "通讯协议") Protocol = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "通讯协议")
@ -817,9 +826,11 @@ namespace JiShe.IoT.Migrations
TupDeviceModel = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "设备型号") TupDeviceModel = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "设备型号")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DeviceCount = table.Column<int>(type: "int", nullable: false), DeviceCount = table.Column<int>(type: "int", nullable: false),
DeviceThingModelUrl = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件管理地址") DeviceThingModelFileId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "设备物模型文件Id")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false), DeviceThingModelFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
@ -865,6 +876,7 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformResponse = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: false, comment: "物联网平台返回的响应信息") IoTPlatformResponse = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: false, comment: "物联网平台返回的响应信息")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsPlatformPushSuccess = table.Column<bool>(type: "tinyint(1)", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
@ -951,7 +963,7 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
AccountAccesskey = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "账户通信密钥,平台可以重置密钥") AccountAccesskey = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "账户通信密钥,平台可以重置密钥")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
ProductCount = table.Column<int>(type: "int", nullable: false), ProductCount = table.Column<int>(type: "int", nullable: false, comment: "产品数量"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),

View File

@ -126,6 +126,24 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(128)") .HasColumnType("varchar(128)")
.HasComment("账号名称"); .HasComment("账号名称");
b.Property<string>("AppId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("应用 ID");
b.Property<string>("AppKey")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("应用 AppKey");
b.Property<string>("AppSecret")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("应用 AppSecret");
b.Property<string>("CommunicationAddress") b.Property<string>("CommunicationAddress")
.HasMaxLength(128) .HasMaxLength(128)
.HasColumnType("varchar(128)") .HasColumnType("varchar(128)")
@ -273,18 +291,30 @@ namespace JiShe.IoT.Migrations
b.Property<int>("DeviceCount") b.Property<int>("DeviceCount")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("DeviceThingModelUrl") b.Property<string>("DeviceThingModelFileId")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("varchar(256)") .HasColumnType("varchar(256)")
.HasComment("设备物模型文件管理地址"); .HasComment("设备物模型文件名称");
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<int>("IoTPlatformProductId") b.Property<string>("FeatureAccesskey")
.HasColumnType("int"); .HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasComment("设备访问密钥");
b.Property<string>("IoTPlatformProductId")
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("产品ID");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -293,7 +323,8 @@ namespace JiShe.IoT.Migrations
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsEnabled") b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)")
.HasComment("是否启用");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -304,9 +335,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<string>("MasterKey") b.Property<string>("MasterKey")
.HasMaxLength(1024) .HasMaxLength(256)
.HasColumnType("varchar(1024)") .HasColumnType("varchar(256)")
.HasComment("主密钥"); .HasComment("OpenAPI 通信主密钥");
b.Property<int>("NetworkType") b.Property<int>("NetworkType")
.HasColumnType("int"); .HasColumnType("int");
@ -591,6 +622,9 @@ namespace JiShe.IoT.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<bool>("IsPlatformPushSuccess")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime") b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime"); .HasColumnName("LastModificationTime");
@ -1278,7 +1312,8 @@ namespace JiShe.IoT.Migrations
.HasComment("手机号码"); .HasComment("手机号码");
b.Property<int>("ProductCount") b.Property<int>("ProductCount")
.HasColumnType("int"); .HasColumnType("int")
.HasComment("产品数量");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")

View File

@ -0,0 +1,41 @@
using JiShe.IoT.CTWingAggregation;
using JiShe.IoT.CTWingAggregation.Dto;
using JiShe.ServicePro;
namespace JiShe.IoT.Controllers
{
/// <summary>
/// CTWing聚合服务
/// </summary>
[Route("/Aggregation/CTWing")]
public class CTWingAggregationController : IoTController
{
private readonly ICTWingAggregationService _CTWingAggregationServiceService;
public CTWingAggregationController(ICTWingAggregationService CTWingAggregationServiceService)
{
_CTWingAggregationServiceService = CTWingAggregationServiceService;
}
/// <summary>
/// 接收车间生产信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(ReceiveWorkshopProductionInfoAsync))]
[SwaggerOperation(summary: "接收车间生产信息", Tags = new[] { "AggregationCTWing" })]
public async Task ReceiveWorkshopProductionInfoAsync(OpenApiRequest input)
{
await _CTWingAggregationServiceService.ReceiveWorkshopProductionInfoAsync(input);
}
/// <summary>
/// 获取CTWing产品列表
/// </summary>
[HttpPost(nameof(GetProductListAsync))]
[SwaggerOperation(summary: "获取CTWing产品列表", Tags = new[] { "AggregationCTWing" })]
public async Task<HttpDataResult<List<CTWingWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input)
{
return await _CTWingAggregationServiceService.GetProductListAsync(input);
}
}
}