diff --git a/.gitignore b/.gitignore index 0b0b735..32b88a0 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ /test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Release/net9.0 /test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Release/net9.0 /test/JiShe.IoT.TestBase/bin/Release/net9.0 +/host/JiShe.IoT.HttpApi.Host/UploadFile/20250729/host/abp-file-management diff --git a/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json b/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json index 832d9ee..db1ef18 100644 --- a/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json +++ b/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json @@ -1,7 +1,7 @@ { "App": { "SelfUrl": "http://localhost:44315", - "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://localhost" + "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.70.11:4200" }, "ConnectionStrings": { "Default": "Data Source=47.110.60.222;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;", diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.Designer.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.Designer.cs similarity index 98% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.Designer.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.Designer.cs index be658c1..8014fd2 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.Designer.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace JiShe.IoT.Migrations { [DbContext(typeof(IoTDbContext))] - [Migration("20250725092548_InitialCreate")] + [Migration("20250729024912_InitialCreate")] partial class InitialCreate { /// @@ -307,8 +307,8 @@ namespace JiShe.IoT.Migrations .HasColumnName("LastModifierId"); b.Property("MasterKey") - .HasMaxLength(128) - .HasColumnType("varchar(128)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("主密钥"); b.Property("NetworkType") @@ -1204,8 +1204,8 @@ namespace JiShe.IoT.Migrations b.Property("AccountAccesskey") .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("账户通信密钥,平台可以重置密钥"); b.Property("AccountName") @@ -1311,10 +1311,12 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("AccessProtocol") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("接入协议"); b.Property("Brand") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品品牌"); b.Property("CommunicationAddress") .HasMaxLength(256) @@ -1342,7 +1344,8 @@ namespace JiShe.IoT.Migrations .HasColumnName("CreatorId"); b.Property("DataProtocol") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("数据协议"); b.Property("DeleterId") .HasColumnType("char(36)") @@ -1352,10 +1355,15 @@ namespace JiShe.IoT.Migrations .HasColumnType("datetime(6)") .HasColumnName("DeletionTime"); - b.Property("DeviceThingModelUrl") + b.Property("DeviceThingModelFileId") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("设备物模型文件Id"); + + b.Property("DeviceThingModelFileName") .HasMaxLength(256) .HasColumnType("varchar(256)") - .HasComment("设备物模型文件管理地址"); + .HasComment("设备物模型文件名称"); b.Property("ExtraProperties") .HasColumnType("longtext") @@ -1377,9 +1385,6 @@ namespace JiShe.IoT.Migrations b.Property("IsEnabled") .HasColumnType("tinyint(1)"); - b.Property("IsEncrypted") - .HasColumnType("tinyint(1)"); - b.Property("LastModificationTime") .HasColumnType("datetime(6)") .HasColumnName("LastModificationTime"); @@ -1389,19 +1394,24 @@ namespace JiShe.IoT.Migrations .HasColumnName("LastModifierId"); b.Property("Manufacturer") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品厂商"); b.Property("Model") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品型号"); b.Property("Network") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("联网方式"); b.Property("NodeType") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("节点类型"); b.Property("NotActiveDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("未激活设备数"); b.Property("OSACreatorId") .HasColumnType("int") @@ -1416,7 +1426,8 @@ namespace JiShe.IoT.Migrations .HasComment("旧系统授权最后修改者Id"); b.Property("OfflineDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("离线设备数"); b.Property("OneNETAccountId") .IsRequired() @@ -1425,19 +1436,22 @@ namespace JiShe.IoT.Migrations .HasComment("账户Id"); b.Property("OnlineDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("在线设备总数"); b.Property("OwnDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("自有设备总数"); b.Property("ProductAccesskey") .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("产品访问密钥"); b.Property("ProductCreateTime") - .HasColumnType("datetime(6)"); + .HasColumnType("datetime(6)") + .HasComment("产品创建时间"); b.Property("ProductName") .HasMaxLength(128) @@ -1445,14 +1459,16 @@ namespace JiShe.IoT.Migrations .HasComment("产品名称"); b.Property("ProductUpdateTime") - .HasColumnType("datetime(6)"); + .HasColumnType("datetime(6)") + .HasComment("最近修改时间"); b.Property("Remark") .HasColumnType("longtext") .HasComment("备注"); b.Property("Status") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("开发状态"); b.Property("TenantId") .HasColumnType("char(36)") @@ -1463,6 +1479,9 @@ namespace JiShe.IoT.Migrations b.HasIndex("CreationTime"); + b.HasIndex("IoTPlatformProductId") + .IsUnique(); + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "ProductName", "CreationTime" }, "IX_ServiceProOneNETProductInfo_IsNotUniqueKey") .IsDescending(); diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.cs similarity index 98% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.cs index 2a0628a..062d8ea 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250725092548_InitialCreate.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250729024912_InitialCreate.cs @@ -792,7 +792,7 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"), CommunicationAddress = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "通讯服务地址") .Annotation("MySql:CharSet", "utf8mb4"), - MasterKey = table.Column(type: "varchar(128)", maxLength: 128, nullable: true, comment: "主密钥") + MasterKey = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true, comment: "主密钥") .Annotation("MySql:CharSet", "utf8mb4"), IoTPlatformProductId = table.Column(type: "int", nullable: false), ProductName = table.Column(type: "varchar(128)", maxLength: 128, nullable: true, comment: "产品名称") @@ -949,7 +949,7 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"), PhoneNumber = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "手机号码") .Annotation("MySql:CharSet", "utf8mb4"), - AccountAccesskey = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "账户通信密钥,平台可以重置密钥") + AccountAccesskey = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "账户通信密钥,平台可以重置密钥") .Annotation("MySql:CharSet", "utf8mb4"), ProductCount = table.Column(type: "int", nullable: false), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) @@ -988,30 +988,31 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"), ProductName = table.Column(type: "varchar(128)", maxLength: 128, nullable: true, comment: "产品名称") .Annotation("MySql:CharSet", "utf8mb4"), - ProductAccesskey = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "产品访问密钥") + ProductAccesskey = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "产品访问密钥") .Annotation("MySql:CharSet", "utf8mb4"), - DeviceThingModelUrl = table.Column(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件管理地址") + DeviceThingModelFileId = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, comment: "设备物模型文件Id") + .Annotation("MySql:CharSet", "utf8mb4"), + DeviceThingModelFileName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称") .Annotation("MySql:CharSet", "utf8mb4"), - IsEncrypted = table.Column(type: "tinyint(1)", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), - AccessProtocol = table.Column(type: "int", nullable: false), - DataProtocol = table.Column(type: "int", nullable: false), - NodeType = table.Column(type: "int", nullable: false), - ProductCreateTime = table.Column(type: "datetime(6)", nullable: false), - ProductUpdateTime = table.Column(type: "datetime(6)", nullable: false), - Network = table.Column(type: "longtext", nullable: true) + AccessProtocol = table.Column(type: "int", nullable: false, comment: "接入协议"), + DataProtocol = table.Column(type: "int", nullable: false, comment: "数据协议"), + NodeType = table.Column(type: "int", nullable: false, comment: "节点类型"), + ProductCreateTime = table.Column(type: "datetime(6)", nullable: false, comment: "产品创建时间"), + ProductUpdateTime = table.Column(type: "datetime(6)", nullable: false, comment: "最近修改时间"), + Network = table.Column(type: "longtext", nullable: true, comment: "联网方式") .Annotation("MySql:CharSet", "utf8mb4"), - Manufacturer = table.Column(type: "longtext", nullable: true) + Manufacturer = table.Column(type: "longtext", nullable: true, comment: "产品厂商") .Annotation("MySql:CharSet", "utf8mb4"), - Model = table.Column(type: "longtext", nullable: true) + Model = table.Column(type: "longtext", nullable: true, comment: "产品型号") .Annotation("MySql:CharSet", "utf8mb4"), - Brand = table.Column(type: "longtext", nullable: true) + Brand = table.Column(type: "longtext", nullable: true, comment: "产品品牌") .Annotation("MySql:CharSet", "utf8mb4"), - Status = table.Column(type: "int", nullable: false), - OwnDeviceCount = table.Column(type: "int", nullable: false), - OnlineDeviceCount = table.Column(type: "int", nullable: false), - OfflineDeviceCount = table.Column(type: "int", nullable: false), - NotActiveDeviceCount = table.Column(type: "int", nullable: false), + Status = table.Column(type: "int", nullable: false, comment: "开发状态"), + OwnDeviceCount = table.Column(type: "int", nullable: false, comment: "自有设备总数"), + OnlineDeviceCount = table.Column(type: "int", nullable: false, comment: "在线设备总数"), + OfflineDeviceCount = table.Column(type: "int", nullable: false, comment: "离线设备数"), + NotActiveDeviceCount = table.Column(type: "int", nullable: false, comment: "未激活设备数"), CommunicationAddress = table.Column(type: "varchar(256)", maxLength: 256, nullable: true, comment: "通讯服务地址") .Annotation("MySql:CharSet", "utf8mb4"), CommunicationAddressTLS = table.Column(type: "varchar(256)", maxLength: 256, nullable: true, comment: "TLS通讯服务地址") @@ -1725,6 +1726,12 @@ namespace JiShe.IoT.Migrations table: "ServiceProOneNETProductInfo", column: "CreationTime"); + migrationBuilder.CreateIndex( + name: "IX_ServiceProOneNETProductInfo_IoTPlatformProductId", + table: "ServiceProOneNETProductInfo", + column: "IoTPlatformProductId", + unique: true); + migrationBuilder.CreateIndex( name: "IX_ServiceProOneNETProductInfo_IsNotUniqueKey", table: "ServiceProOneNETProductInfo", diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs index 43830d9..bfb4682 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs @@ -304,8 +304,8 @@ namespace JiShe.IoT.Migrations .HasColumnName("LastModifierId"); b.Property("MasterKey") - .HasMaxLength(128) - .HasColumnType("varchar(128)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("主密钥"); b.Property("NetworkType") @@ -1201,8 +1201,8 @@ namespace JiShe.IoT.Migrations b.Property("AccountAccesskey") .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("账户通信密钥,平台可以重置密钥"); b.Property("AccountName") @@ -1308,10 +1308,12 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("AccessProtocol") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("接入协议"); b.Property("Brand") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品品牌"); b.Property("CommunicationAddress") .HasMaxLength(256) @@ -1339,7 +1341,8 @@ namespace JiShe.IoT.Migrations .HasColumnName("CreatorId"); b.Property("DataProtocol") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("数据协议"); b.Property("DeleterId") .HasColumnType("char(36)") @@ -1349,10 +1352,15 @@ namespace JiShe.IoT.Migrations .HasColumnType("datetime(6)") .HasColumnName("DeletionTime"); - b.Property("DeviceThingModelUrl") + b.Property("DeviceThingModelFileId") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("设备物模型文件Id"); + + b.Property("DeviceThingModelFileName") .HasMaxLength(256) .HasColumnType("varchar(256)") - .HasComment("设备物模型文件管理地址"); + .HasComment("设备物模型文件名称"); b.Property("ExtraProperties") .HasColumnType("longtext") @@ -1374,9 +1382,6 @@ namespace JiShe.IoT.Migrations b.Property("IsEnabled") .HasColumnType("tinyint(1)"); - b.Property("IsEncrypted") - .HasColumnType("tinyint(1)"); - b.Property("LastModificationTime") .HasColumnType("datetime(6)") .HasColumnName("LastModificationTime"); @@ -1386,19 +1391,24 @@ namespace JiShe.IoT.Migrations .HasColumnName("LastModifierId"); b.Property("Manufacturer") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品厂商"); b.Property("Model") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("产品型号"); b.Property("Network") - .HasColumnType("longtext"); + .HasColumnType("longtext") + .HasComment("联网方式"); b.Property("NodeType") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("节点类型"); b.Property("NotActiveDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("未激活设备数"); b.Property("OSACreatorId") .HasColumnType("int") @@ -1413,7 +1423,8 @@ namespace JiShe.IoT.Migrations .HasComment("旧系统授权最后修改者Id"); b.Property("OfflineDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("离线设备数"); b.Property("OneNETAccountId") .IsRequired() @@ -1422,19 +1433,22 @@ namespace JiShe.IoT.Migrations .HasComment("账户Id"); b.Property("OnlineDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("在线设备总数"); b.Property("OwnDeviceCount") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("自有设备总数"); b.Property("ProductAccesskey") .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") .HasComment("产品访问密钥"); b.Property("ProductCreateTime") - .HasColumnType("datetime(6)"); + .HasColumnType("datetime(6)") + .HasComment("产品创建时间"); b.Property("ProductName") .HasMaxLength(128) @@ -1442,14 +1456,16 @@ namespace JiShe.IoT.Migrations .HasComment("产品名称"); b.Property("ProductUpdateTime") - .HasColumnType("datetime(6)"); + .HasColumnType("datetime(6)") + .HasComment("最近修改时间"); b.Property("Remark") .HasColumnType("longtext") .HasComment("备注"); b.Property("Status") - .HasColumnType("int"); + .HasColumnType("int") + .HasComment("开发状态"); b.Property("TenantId") .HasColumnType("char(36)") @@ -1460,6 +1476,9 @@ namespace JiShe.IoT.Migrations b.HasIndex("CreationTime"); + b.HasIndex("IoTPlatformProductId") + .IsUnique(); + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "ProductName", "CreationTime" }, "IX_ServiceProOneNETProductInfo_IsNotUniqueKey") .IsDescending();