Compare commits

..

26 Commits

Author SHA1 Message Date
ChenYi
9f61d37129 绑定设备端物模型 2025-12-22 17:15:27 +08:00
ChenYi
2ba44b5d30 完善产品聚合服务 2025-12-22 15:36:35 +08:00
ChenYi
0bc946d1e9 设备端物模型管理接口对接 2025-12-19 16:35:31 +08:00
ChenYi
c324a12f75 优化设备端物模型属性表设计和函数构建逻辑 2025-12-18 17:15:31 +08:00
ChenYi
fb5c9eca52 平台产品聚合服务 2025-12-17 15:51:11 +08:00
ChenYi
8f9fb1816d 将设备端物模型函数编译并缓存到Redis 2025-12-16 15:50:37 +08:00
ChenYi
37ebc900a2 修改MapsterGlobalJsonToListConverter 2025-12-16 13:46:21 +08:00
ChenYi
a4adc39cc3 更新dockerfile 2025-12-16 11:31:47 +08:00
ChenYi
583c3b7a8a 更新dockerfile 2025-12-16 11:28:14 +08:00
ChenYi
d20b277ab0 设备端物模型函数动态解析构建和解析调用测试通过,消除CodeAnalysis警告 2025-12-16 11:20:55 +08:00
ChenYi
d76c18a1cf 优化函数测试接口,实现设备端物模型解析函数构建 2025-12-15 16:02:40 +08:00
ChenYi
f9ce67e98f 解析脚本测试 2025-12-12 16:44:29 +08:00
ChenYi
b160064154 解析脚本测试 2025-12-12 15:33:46 +08:00
ChenYi
e7b44d35d8 DynamicAnalyzerEngine应用 2025-12-12 14:24:12 +08:00
ChenYi
65bd35110a SpecialCommand获取原始报文实现 2025-12-11 15:23:34 +08:00
ChenYi
7dcc470018 完成设备属性标识符特殊结构体参数下发 2025-12-10 17:08:24 +08:00
ChenYi
c1423d549f 优化注释 2025-12-09 17:24:27 +08:00
ChenYi
180b654f26 设备端物模型结构体属性设置请求体封装、平台产品物模型信息结构体拆解函数 2025-12-09 17:19:34 +08:00
ChenYi
e63baad9da 设备物模型指令属性限制 2025-12-08 17:18:00 +08:00
ChenYi
7610eb77f5 缓存设备端物模型信息到Redis 2025-12-08 17:09:16 +08:00
ChenYi
a32518cfe3 解析脚本测试 2025-12-08 16:58:21 +08:00
ChenYi
8190de6eff 缓存设备端物模型信息 2025-12-08 16:27:42 +08:00
陈益
6d681f4b0f 迁移更新 2025-12-07 20:30:15 +08:00
陈益
f48c6e64eb 还原net9 2025-12-07 20:21:24 +08:00
陈益
94af3c9a7f Pomelo迁移失败 2025-12-07 11:03:48 +08:00
陈益
26d4db8f92 升级net10,编译成功 2025-12-05 23:48:20 +08:00
35 changed files with 723 additions and 172 deletions

1
.gitignore vendored
View File

@ -60,3 +60,4 @@
/gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0 /gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0 /host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0
/src/JiShe.IoT.Application/bin/Debug/net10.0 /src/JiShe.IoT.Application/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/UploadFile/20251210/host/abp-file-management

View File

@ -1,12 +1,12 @@
# FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base # FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
FROM registry.cn-qingdao.aliyuncs.com/jisheyun/aspnetcore:9.0.6_ub24_simsun_pdp_v341 AS base FROM registry.cn-qingdao.aliyuncs.com/jisheyun/aspnetcore:9.0.11_ub24_simsun_pdp_v350 AS base
WORKDIR /app WORKDIR /app
EXPOSE 10500 EXPOSE 10500
EXPOSE 443 EXPOSE 443
ENV TZ=Asia/Shanghai ENV TZ=Asia/Shanghai
ENV ASPNETCORE_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/sdk:9.0.308 AS build
COPY ["JiShe.IoT.Admin.sln", "."] COPY ["JiShe.IoT.Admin.sln", "."]
COPY ["Directory.Build.JiShe.targets", "."] COPY ["Directory.Build.JiShe.targets", "."]
COPY ["Directory.Build.Microsoft.targets", "."] COPY ["Directory.Build.Microsoft.targets", "."]

View File

@ -20,8 +20,11 @@
<PackageReference Update="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0"/> <PackageReference Update="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/> <PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.3.0"/> <PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.3.0"/>
<PackageReference Update="Microsoft.CSharp" Version="4.12.0"/> <PackageReference Update="Microsoft.CSharp" Version="4.14.0"/>
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.12.0"/> <PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Common " Version="4.14.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0"/> <PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,7 +7,7 @@
<VoloAbpVersion>9.3.4</VoloAbpVersion> <VoloAbpVersion>9.3.4</VoloAbpVersion>
<!--Dotnet 组件 版本--> <!--Dotnet 组件 版本-->
<DotnetInfoVersion>9.0.6</DotnetInfoVersion> <DotnetInfoVersion>9.0.11</DotnetInfoVersion>
<!--Dotnet 框架 版本--> <!--Dotnet 框架 版本-->
<DotnetTargetFrameworkVersion>net9.0</DotnetTargetFrameworkVersion> <DotnetTargetFrameworkVersion>net9.0</DotnetTargetFrameworkVersion>

View File

@ -23,11 +23,22 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<!-- Ocelot 网关--> <!-- Ocelot 网关-->
<PackageReference Update="Ocelot" Version="18.0.0"/> <PackageReference Update="Ocelot" Version="18.0.0"/>
<PackageReference Update="Ocelot.Provider.Consul" Version="18.0.0"/> <PackageReference Update="Ocelot.Provider.Consul" Version="18.0.0"/>
<PackageReference Update="Ocelot.Provider.Polly" Version="18.0.0"/> <PackageReference Update="Ocelot.Provider.Polly" Version="18.0.0"/>
<!--FreeRedis-->
<PackageReference Update="FreeRedis" Version="1.3.7"/>
<PackageReference Update="FreeRedis.DistributedCache" Version="1.3.7"/>
<!--FreeSql-->
<PackageReference Update="FreeSql.Cloud" Version="2.0.1" />
<PackageReference Update="FreeSql.Extensions.JsonMap" Version="3.5.303" />
<PackageReference Update="FreeSql" Version="3.5.303"/>
<PackageReference Update="FreeSql.Provider.MysqlConnector" Version="3.5.303"/>
<PackageReference Update="FreeSql.Provider.Sqlite" Version="3.5.303"/>
<PackageReference Update="FreeSql.Provider.SqlServer" Version="3.5.303" />
<!-- 单元测试包--> <!-- 单元测试包-->
<PackageReference Update="xunit" Version="2.9.3"/> <PackageReference Update="xunit" Version="2.9.3"/>
@ -69,8 +80,8 @@
<!-- Magicodes 导入导出Excel--> <!-- Magicodes 导入导出Excel-->
<PackageReference Update="Magicodes.IE.Excel" Version="2.7.5.2"/> <PackageReference Update="Magicodes.IE.Excel" Version="2.8.0"/>
<PackageReference Update="Magicodes.IE.Excel.AspNetCore" Version="2.7.5.2"/> <PackageReference Update="Magicodes.IE.Excel.AspNetCore" Version="2.8.0"/>
<!-- MiniProfiler 查看接口耗时,sql耗时--> <!-- MiniProfiler 查看接口耗时,sql耗时-->
<PackageReference Update="MiniProfiler.AspNetCore.Mvc" Version="4.5.4"/> <PackageReference Update="MiniProfiler.AspNetCore.Mvc" Version="4.5.4"/>
@ -104,8 +115,28 @@
<PackageReference Update="Otp.NET" Version="1.4.0" /> <PackageReference Update="Otp.NET" Version="1.4.0" />
<PackageReference Update="QRCoder" Version="1.6.0" /> <PackageReference Update="QRCoder" Version="1.6.0" />
<!--Flurl-->
<PackageReference Update="Flurl.Http" Version="4.0.2" />
<PackageReference Update="Mapster" Version="7.4.0" />
<!--Apache.IoTDB-->
<PackageReference Update="Apache.IoTDB" Version="2.0.2.12" />
<!--Kafka-->
<PackageReference Update="Confluent.Kafka" Version="2.11.0" />
<!--DotPulsar-->
<PackageReference Update="DotPulsar" Version="5.1.0" />
<PackageReference Update="K4os.Compression.LZ4" Version="1.3.8" />
<PackageReference Update="ZstdNet" Version="1.4.5" />
<PackageReference Update="ZstdSharp.Port" Version="0.8.6" />
<!--SixLabors.ImageSharp--> <!--SixLabors.ImageSharp-->
<PackageReference Update="SixLabors.ImageSharp" Version="3.1.12" /> <PackageReference Update="SixLabors.ImageSharp" Version="3.1.12" />
<!--SkiaSharp-->
<PackageReference Update="SkiaSharp" Version="3.119.1" />
</ItemGroup> </ItemGroup>

View File

@ -44,7 +44,7 @@
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": true, //Topic "EnableAutoCreation": true, //Topic
"TopicMode": "Static", //Dynamic "TopicMode": "Static", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Static" ], //Topic "AllowedTopicTypes": [ "Static" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //

View File

@ -44,7 +44,7 @@
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": false, //Topic "EnableAutoCreation": false, //Topic
"TopicMode": "Dynamic", //Dynamic "TopicMode": "Dynamic", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Dynamic" ], //Topic "AllowedTopicTypes": [ "Dynamic" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //

View File

@ -268,7 +268,7 @@ services:
- pulsar-net - pulsar-net
admin-api-service: admin-api-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1119.1155 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1216.1440
container_name: admin-api container_name: admin-api
hostname: admin-api hostname: admin-api
restart: always restart: always

View File

@ -27,6 +27,11 @@ services:
timeout: 10s timeout: 10s
retries: 5 retries: 5
start_period: 60s start_period: 60s
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
bookie: bookie:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.1.1 image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.1.1
@ -65,6 +70,11 @@ services:
timeout: 10s timeout: 10s
retries: 5 retries: 5
start_period: 60s start_period: 60s
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "3"
broker: broker:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.1.1 image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.1.1
@ -135,6 +145,11 @@ services:
timeout: 10s timeout: 10s
retries: 5 retries: 5
start_period: 60s start_period: 60s
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "3"
iotdb-standalone-service: iotdb-standalone-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/iotdb:2.0.5-standalone image: registry.cn-qingdao.aliyuncs.com/jisheyun/iotdb:2.0.5-standalone
@ -168,6 +183,11 @@ services:
- ./iotdb/logs:/iotdb/logs - ./iotdb/logs:/iotdb/logs
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "500m"
max-file: "5"
redis-service: redis-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/redis:8.0.2-alpine3.21 image: registry.cn-qingdao.aliyuncs.com/jisheyun/redis:8.0.2-alpine3.21
@ -189,6 +209,11 @@ services:
tty: true tty: true
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
mysql-service: mysql-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/mysql:8.4.6 image: registry.cn-qingdao.aliyuncs.com/jisheyun/mysql:8.4.6
@ -218,9 +243,14 @@ services:
tty: true tty: true
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
admin-api-service: admin-api-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1119.1155 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1216.1440
container_name: admin-api container_name: admin-api
hostname: admin-api hostname: admin-api
restart: always restart: always
@ -248,6 +278,11 @@ services:
condition: service_healthy condition: service_healthy
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
admin-web-service: admin-web-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.ui:2025.1030.0949 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.ui:2025.1030.0949
@ -268,6 +303,11 @@ services:
condition: service_started condition: service_started
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "2"
networks: networks:
pulsar-net: pulsar-net:

View File

@ -31,6 +31,11 @@ services:
- ./iotdb/logs:/iotdb/logs - ./iotdb/logs:/iotdb/logs
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "200m"
max-file: "5"
redis-service: redis-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/redis:8.0.2-alpine3.21 image: registry.cn-qingdao.aliyuncs.com/jisheyun/redis:8.0.2-alpine3.21
@ -52,6 +57,11 @@ services:
tty: true tty: true
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
mysql-service: mysql-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/mysql:8.4.6 image: registry.cn-qingdao.aliyuncs.com/jisheyun/mysql:8.4.6
@ -81,9 +91,14 @@ services:
tty: true tty: true
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
admin-api-service: admin-api-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1119.1155 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1216.1440
container_name: admin-api container_name: admin-api
hostname: admin-api hostname: admin-api
restart: always restart: always
@ -107,6 +122,11 @@ services:
condition: service_started condition: service_started
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
admin-web-service: admin-web-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.ui:2025.1030.0949 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.ui:2025.1030.0949
@ -127,6 +147,11 @@ services:
condition: service_started condition: service_started
networks: networks:
- pulsar-net - pulsar-net
logging:
driver: "json-file"
options:
max-size: "20m"
max-file: "2"
networks: networks:
pulsar-net: pulsar-net:

View File

@ -85,7 +85,7 @@ services:
- pulsar-net - pulsar-net
admin-api-service: admin-api-service:
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1119.1155 image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.1216.1440
container_name: admin-api container_name: admin-api
hostname: admin-api hostname: admin-api
restart: always restart: always

View File

@ -1 +1,5 @@
CREATE TABLE IF NOT EXISTS CTWingAepReceiveMessageEntity(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, PlatformTenantId STRING FIELD, ProductId STRING FIELD, ServiceId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD, IMSI STRING FIELD, IMEI STRING FIELD ) COMMENT 'CTWingAepReceiveMessageEntity';CREATE TABLE IF NOT EXISTS DeviceTelemetryPacketTaskInfo(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, IoTPlatformProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, IoTPlatformProductName STRING FIELD, IoTPlatformAccountId STRING FIELD, AccountPhoneNumber STRING FIELD, TelemetryType INT32 FIELD, IssueRawMessage STRING FIELD, IssuePayload STRING FIELD, ResponseRawMessage STRING FIELD, ResponsePayload STRING FIELD, TelemetrySource INT32 FIELD, IoTPlatform INT32 FIELD, RetryCount INT32 FIELD, LastIssueTime TIMESTAMP FIELD, IssueStatus INT32 FIELD ) COMMENT 'DeviceTelemetryPacketTaskInfo';CREATE TABLE IF NOT EXISTS OneNETReceiveMessageEntity(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, ProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, IsEncrypted BOOLEAN FIELD, PlaintextMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD ) COMMENT 'OneNETReceiveMessageEntity'; CREATE TABLE IF NOT EXISTS CTWingAepReceiveMessageEntity( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, PlatformTenantId STRING FIELD, ProductId STRING FIELD, ServiceId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD, IMSI STRING FIELD, IMEI STRING FIELD ) COMMENT 'CTWingAepReceiveMessageEntity';
CREATE TABLE IF NOT EXISTS DeviceTelemetryPacketTaskInfo( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, IoTPlatformProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, IoTPlatformProductName STRING FIELD, IoTPlatformAccountId STRING FIELD, AccountPhoneNumber STRING FIELD, IssueRawMessage STRING FIELD, IssuePayload STRING FIELD, ResponseRawMessage STRING FIELD, ResponsePayload STRING FIELD, TelemetrySource INT32 FIELD, IoTPlatform INT32 FIELD, RetryCount INT32 FIELD, LastIssueTime TIMESTAMP FIELD, IssueStatus INT32 FIELD ) COMMENT 'DeviceTelemetryPacketTaskInfo';
CREATE TABLE IF NOT EXISTS OneNETReceiveMessageEntity( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, ProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, IsEncrypted BOOLEAN FIELD, PlaintextMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD ) COMMENT 'OneNETReceiveMessageEntity';

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 18
VisualStudioVersion = 18.0.11217.181 d18.0 VisualStudioVersion = 18.0.11217.181
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IoT.Domain", "src\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.IoT.Domain", "src\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}"
EndProject EndProject
@ -291,6 +291,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DockerComposeShells", "Dock
DockerComposeShells\start-service-sub.sh = DockerComposeShells\start-service-sub.sh DockerComposeShells\start-service-sub.sh = DockerComposeShells\start-service-sub.sh
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.Shared.DynamicAnalyzerEngine", "JiShe.ServicePro\shared\JiShe.ServicePro.Shared.DynamicAnalyzerEngine\JiShe.ServicePro.Shared.DynamicAnalyzerEngine.csproj", "{539D0149-B52C-7FE1-373D-67EC401D5B47}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.DynamicAnalyzerEngine", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.DynamicAnalyzerEngine\JiShe.ServicePro.DynamicAnalyzerEngine.csproj", "{6CDFFB25-15FF-19C2-D4AB-921CF40DB056}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.ServicePro.DynamicAnalyzer.Provider", "JiShe.ServicePro\frameworks\src\JiShe.ServicePro.DynamicAnalyzer.Provider\JiShe.ServicePro.DynamicAnalyzer.Provider.csproj", "{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -753,6 +759,18 @@ Global
{C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Debug|Any CPU.Build.0 = Debug|Any CPU {C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Release|Any CPU.ActiveCfg = Release|Any CPU {C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Release|Any CPU.Build.0 = Release|Any CPU {C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273}.Release|Any CPU.Build.0 = Release|Any CPU
{539D0149-B52C-7FE1-373D-67EC401D5B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{539D0149-B52C-7FE1-373D-67EC401D5B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{539D0149-B52C-7FE1-373D-67EC401D5B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{539D0149-B52C-7FE1-373D-67EC401D5B47}.Release|Any CPU.Build.0 = Release|Any CPU
{6CDFFB25-15FF-19C2-D4AB-921CF40DB056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CDFFB25-15FF-19C2-D4AB-921CF40DB056}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CDFFB25-15FF-19C2-D4AB-921CF40DB056}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CDFFB25-15FF-19C2-D4AB-921CF40DB056}.Release|Any CPU.Build.0 = Release|Any CPU
{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -882,6 +900,9 @@ Global
{6A26D2DE-215B-CB11-F882-3984B2EE7AA6} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E} {6A26D2DE-215B-CB11-F882-3984B2EE7AA6} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E} {C51F35A8-5BF8-8E2F-96B2-B62E3BCF8273} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{8FE7CFC6-BA2A-4717-941C-0C227EB151B9} = {2C4A6DB8-8D9E-42E6-B7C3-1EDB7B3DE22E} {8FE7CFC6-BA2A-4717-941C-0C227EB151B9} = {2C4A6DB8-8D9E-42E6-B7C3-1EDB7B3DE22E}
{539D0149-B52C-7FE1-373D-67EC401D5B47} = {E10B1433-8E8E-4163-AC98-1058004980F9}
{6CDFFB25-15FF-19C2-D4AB-921CF40DB056} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
{516CAE8B-3EDC-8B5C-D15C-5BF9ABF971D8} = {72493AF2-CDAA-40A7-98AB-B8AA2B05965E}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

@ -1 +1 @@
Subproject commit 323492e10b2937a063c9e60b26bc40c6954503c7 Subproject commit 95a6f31a5a1546e612566198f63a2f5e6ce24748

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<packageSources> <packageSources>

View File

@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
<PackageReference Include="Volo.Abp.Account.Web" /> <PackageReference Include="Volo.Abp.Account.Web" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" />
@ -85,10 +85,7 @@
<Folder Include="UploadFile\" /> <Folder Include="UploadFile\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="configs\appsettings - 复制.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="configs\appsettings.Development.json"> <Content Update="configs\appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>

View File

@ -4,19 +4,19 @@
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200" "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB54;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
}, },
"Hangfire": { "Hangfire": {
"Redis": { "Redis": {
"Host": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#", "Host": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#",
"DB": "2" "DB": "2"
} }
}, },
"Redis": { "Redis": {
"Configuration": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#,defaultdatabase=5" "Configuration": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#,defaultdatabase=5"
}, },
"Kafka": { "Kafka": {
"BootstrapServers": "47.110.62.104:9094,47.110.53.196:9094,47.110.60.222:9094", "BootstrapServers": "47.110.62.104:9094,192.168.111.174:9094,47.110.60.222:9094",
"EnableFilter": true, "EnableFilter": true,
"EnableAuthorization": false, "EnableAuthorization": false,
"SaslUserName": "lixiao", "SaslUserName": "lixiao",
@ -26,8 +26,8 @@
"TaskThreadCount": -1 "TaskThreadCount": -1
}, },
"Pulsar": { "Pulsar": {
"ServiceUrl": "pulsar+ssl://iot-north-mq.heclouds.com:6651", //pulsar+ssl://iot-north-mq.heclouds.com:6651 pulsar://47.110.53.196:26974 "ServiceUrl": "pulsar://192.168.111.174:26974", //pulsar+ssl://iot-north-mq.heclouds.com:6651 pulsar://192.168.111.174:26974
"WebUrl": "http://47.110.53.196:9094", "WebUrl": "http://192.168.111.174:9094",
"UserName": "admin", "UserName": "admin",
"TenantName": "1YMVZZkAkRArjxSD8457", "TenantName": "1YMVZZkAkRArjxSD8457",
"Namespace": "OneNET", "Namespace": "OneNET",
@ -39,14 +39,14 @@
"ConnectionTimeout": 30, "ConnectionTimeout": 30,
"OperationTimeout": 30, "OperationTimeout": 30,
"KeepAliveInterval": 30, "KeepAliveInterval": 30,
"TaskThreadCount": 8, "TaskThreadCount": 1,
"IsSubscriber": true, "IsSubscriber": true,
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": false, //Topic "EnableAutoCreation": true, //Topic
"TopicMode": "Dynamic", //Dynamic "TopicMode": "Static", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Dynamic" ], //Topic "AllowedTopicTypes": [ "Static" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //
"AdminRoles": [ "admin" ], "AdminRoles": [ "admin" ],
"EnableConsumerIdleCleanup": true, "EnableConsumerIdleCleanup": true,
@ -57,10 +57,10 @@
"IoTDBOptions": { "IoTDBOptions": {
"UserName": "root", "UserName": "root",
"Password": "Lixiao@1980", "Password": "Lixiao@1980",
//"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ], //"TreeModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
//"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ], //"TableModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
"TreeModelClusterList": [ "47.110.53.196:30710" ], "TreeModelClusterList": [ "192.168.111.174:30710" ],
"TableModelClusterList": [ "47.110.53.196:30710" ], "TableModelClusterList": [ "192.168.111.174:30710" ],
"PoolSize": 32, "PoolSize": 32,
"DataBaseName": "jisheiotdata", "DataBaseName": "jisheiotdata",
"OpenDebugMode": true, "OpenDebugMode": true,
@ -97,7 +97,7 @@
} }
}, },
"FreeRedisOptions": { "FreeRedisOptions": {
"ConnectionString": "47.110.53.196:30712,password=1q3J@BGf!yhTaD46nS#,abortConnect=false,connectTimeout=30000,allowAdmin=true,maxPoolSize=500,defaultdatabase=14", "ConnectionString": "192.168.111.174:30712,password=1q3J@BGf!yhTaD46nS#,abortConnect=false,connectTimeout=30000,allowAdmin=true,maxPoolSize=500,defaultdatabase=14",
"UseDistributedCache": true "UseDistributedCache": true
}, },
"FreeSqlProviderOptions": { "FreeSqlProviderOptions": {

View File

@ -11,19 +11,9 @@ namespace JiShe.IoT.DeviceAggregation
public class DeviceCommandForApiInput:IdInput public class DeviceCommandForApiInput:IdInput
{ {
/// <summary> /// <summary>
/// 设备在物联网平台中发送的命令内容JSON格式 /// 设备在物联网平台中属性设置的参数键值对
/// </summary> /// </summary>
[Required(ErrorMessage = "命令内容不能为空")] [Required(ErrorMessage = "命令内容不能为空")]
public string CommandContent { get; set; } public Dictionary<string,object> CommandContent { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public DeviceTypeEnum? DeviceType { get; set; }
/// <summary>
/// 设备指令类型
/// </summary>
public DeviceTelemetryCommandTypeEnum? TelemetryType { get; set; }
} }
} }

View File

@ -0,0 +1,22 @@
using JiShe.ServicePro.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.IoTPlatformAggregation.Dto
{
/// <summary>
/// 产品信息输入
/// </summary>
public class IoTPlatformProductInfoInput
{
/// <summary>
/// 平台类型
/// </summary>
[Required]
public IoTPlatformTypeEnum IoTPlatformType { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using JiShe.ServicePro.Enums;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.IoTPlatformAggregation.Dto
{
/// <summary>
/// 平台产品信息
/// </summary>
public class IoTPlatformProductInfoOutput
{
/// <summary>
/// 物联网平台类型
/// </summary>
public IoTPlatformTypeEnum IoTPlatformType { get; set; }
/// <summary>
/// 物联网平台对应的产品Id
/// </summary>
public string IoTPlatformProductId { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductName { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using JiShe.ServicePro.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.IoTPlatformAggregation.Dto
{
/// <summary>
/// 产品属性信息输入
/// </summary>
public class IoTPlatformProductPropertyInfoInput
{
/// <summary>
/// 物联网平台类型,默认没有指定
/// </summary>
[Required]
public IoTPlatformTypeEnum IoTPlatformType { get; set; }
/// <summary>
/// 物联网平台中对应的产品Id
/// </summary>
[Required]
public string IoTPlatformProductId { get; set; }
}
}

View File

@ -0,0 +1,32 @@
using JiShe.IoT.IoTPlatformAggregation.Dto;
using JiShe.ServicePro.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.IoTPlatformAggregation
{
/// <summary>
/// 平台聚合服务
/// </summary>
public interface IIoTPlatformAggregationService
{
/// <summary>
/// 获取平台产品信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<List<IoTPlatformProductInfoOutput>> GetIoTPlatformProductInfoAsync(IoTPlatformProductInfoInput input
);
/// <summary>
/// 获取平台产品物模型属性信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<List<SelectResult>> GetIoTPlatformProductPropertyInfoAsync(IoTPlatformProductPropertyInfoInput input
);
}
}

View File

@ -45,7 +45,10 @@ namespace JiShe.IoT.BusinessSystemAggregation
return handleResult; return handleResult;
} }
var messageBody = handleResult.Data; var messageBody = handleResult.Data;
string tempMessageBody = null; if(messageBody== null || messageBody.Commands == null || messageBody.Commands.Count <= 0)
{
return HttpDataResultExtensions.Failed("设备指令不能为空", -103, ResponeResultEnum.Fail);
}
//限定来源类型必须为业务系统 //限定来源类型必须为业务系统
if (messageBody.SourceType != DeviceTelemetrySourceTypeEnum.BusinessSystem) if (messageBody.SourceType != DeviceTelemetrySourceTypeEnum.BusinessSystem)
@ -60,7 +63,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
return HttpDataResultExtensions.Failed("设备不存在", -1041, ResponeResultEnum.Fail); return HttpDataResultExtensions.Failed("设备不存在", -1041, ResponeResultEnum.Fail);
} }
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), tempMessageBody); var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), messageBody.Commands.Serialize());
//将指令存储IoTDB数据库和Redis发布通道 //将指令存储IoTDB数据库和Redis发布通道
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET) if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)

View File

@ -6,6 +6,7 @@ using JiShe.ServicePro.DataChannelManages;
using JiShe.ServicePro.DeviceManagement.DeviceInfos; using JiShe.ServicePro.DeviceManagement.DeviceInfos;
using JiShe.ServicePro.DeviceManagement.DeviceInfos.Dto; using JiShe.ServicePro.DeviceManagement.DeviceInfos.Dto;
using JiShe.ServicePro.DeviceManagement.Permissions; using JiShe.ServicePro.DeviceManagement.Permissions;
using JiShe.ServicePro.DeviceManagement.ThingModels;
using JiShe.ServicePro.Dto; using JiShe.ServicePro.Dto;
using JiShe.ServicePro.Enums; using JiShe.ServicePro.Enums;
using JiShe.ServicePro.FreeRedisProvider; using JiShe.ServicePro.FreeRedisProvider;
@ -29,7 +30,9 @@ namespace JiShe.IoT.DeviceAggregation
/// <param name="redisPubSubService">Redis发布订阅服务</param> /// <param name="redisPubSubService">Redis发布订阅服务</param>
/// <param name="ioTDBDataChannelManageService">数据通道</param> /// <param name="ioTDBDataChannelManageService">数据通道</param>
/// <param name="_ioTDBOptions">IoTDBOptions</param> /// <param name="_ioTDBOptions">IoTDBOptions</param>
public class DeviceAggregationService(ILogger<DeviceAggregationService> logger, IDeviceAppService deviceAppService, IOneNETDeviceService oneNETDeviceService, IReliableRedisPubSubService redisPubSubService, IIoTDBDataChannelManageService ioTDBDataChannelManageService,IOptions<IoTDBOptions> _ioTDBOptions) : IoTAppService, IDeviceAggregationService /// <param name="oneNETProductService">OneNET产品服务</param>
/// <param name="deviceThingModelService">设备端物模型服务</param>
public class DeviceAggregationService(ILogger<DeviceAggregationService> logger, IDeviceAppService deviceAppService, IOneNETDeviceService oneNETDeviceService, IReliableRedisPubSubService redisPubSubService, IIoTDBDataChannelManageService ioTDBDataChannelManageService,IOptions<IoTDBOptions> _ioTDBOptions, IOneNETProductService oneNETProductService, IDeviceThingModelManagementAppService deviceThingModelService) : IoTAppService, IDeviceAggregationService
{ {
IoTDBOptions ioTDBOptions = _ioTDBOptions.Value; IoTDBOptions ioTDBOptions = _ioTDBOptions.Value;
@ -288,47 +291,45 @@ namespace JiShe.IoT.DeviceAggregation
{ {
try try
{ {
if (input.CommandContent == null || input.CommandContent.Keys.Count <=0)
{
throw new UserFriendlyException($"指令参数异常");
}
var deviceInfo = await deviceAppService.FindByIdAsync(input); var deviceInfo = await deviceAppService.FindByIdAsync(input);
if (deviceInfo == null) if (deviceInfo == null)
{ {
throw new UserFriendlyException($"设备不存在"); throw new UserFriendlyException($"设备不存在");
} }
//将指令存储
var commandRequest = new OpenApiRequest()
{
Message = new ReceiveCommandInfoDto()
{
DeviceAddress = deviceInfo.DeviceAddress,
Commands = input.CommandContent.Deserialize<Dictionary<string,object>>(),
DeviceType = input.DeviceType ?? DeviceTypeEnum.GATEWAY,//todo 设备类型 需要跟设备统一什么情况下知道具体设备类型
SourceType = DeviceTelemetrySourceTypeEnum.AdminSystem,
TelemetryType = input.TelemetryType ?? DeviceTelemetryCommandTypeEnum.,
IoTPlatform = deviceInfo.IoTPlatform,
}.Serialize(),
};
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), commandRequest.Message); //将指令存储
var receiveCommandInfoDto = new ReceiveCommandInfoDto()
{
DeviceAddress = deviceInfo.DeviceAddress,
Commands = input.CommandContent,
DeviceType = deviceInfo.DeviceType,
SourceType = DeviceTelemetrySourceTypeEnum.AdminSystem,
IoTPlatform = deviceInfo.IoTPlatform,
};
//数据写入遥测任务数据存储通道 //数据写入遥测任务数据存储通道
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET) if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)
{ {
await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo)); return await DeviceCommandInfoToOneNET(deviceInfo, receiveCommandInfoDto);
return await DeviceCommandInfoToOneNET(deviceInfo, packetTaskInfo);
} }
else if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.CTWing) else if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.CTWing)
{ {
await redisPubSubService.PublishReliableAsync(DistributedMessageCenterConst.CTWingAepCommandIssuedEventName,commandRequest); //await redisPubSubService.PublishReliableAsync(DistributedMessageCenterConst.CTWingAepCommandIssuedEventName,commandRequest);
return true; //return true;
throw new UserFriendlyException($"发送设备指令信息失败CTWing暂未实现。");
} }
else else
{ {
throw new UserFriendlyException($"创建设备失败,未找到对应的产品配置信息。"); throw new UserFriendlyException($"发送设备指令信息失败,未找到对应的产品配置信息。");
} }
} }
catch (Exception) catch (Exception)
{ {
throw; throw;
} }
} }
@ -387,15 +388,17 @@ namespace JiShe.IoT.DeviceAggregation
try try
{ {
CreateDeviceInput createDeviceInput = input.Adapt<CreateDeviceInput>(); CreateDeviceInput createDeviceInput = input.Adapt<CreateDeviceInput>();
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>() var productInfo = await oneNETProductService.GetProductInfoAsync(new IdInput<string>() { Id = input.IoTPlatformProductId });
.Where(e => e.IoTPlatformProductId == input.IoTPlatformProductId)//此处不需要过滤产品状态,方便测试产品配置信息是否准确,避免跟车间生产搞混
.WhereIf(input.DeviceSourceTypeEnum == DeviceSourceTypeEnum.Workshop, e => e.IsEnabled == true)
.FirstAsync();
if (productInfo == null) if (productInfo == null)
{ {
throw new UserFriendlyException($"创建设备失败,未找到对应的产品配置信息。"); throw new UserFriendlyException($"OneNET创建设备失败未找到对应的产品配置信息。");
}
if (input.DeviceSourceTypeEnum == DeviceSourceTypeEnum.Workshop && !productInfo.IsEnabled) //车间生产推送,必须是已经启用的产品才可以
{
throw new UserFriendlyException($"车间生产推送OneNET创建设备失败产品未启用。");
} }
createDeviceInput.DeviceName = input.DeviceAddress; createDeviceInput.DeviceName = input.DeviceAddress;
@ -532,35 +535,26 @@ namespace JiShe.IoT.DeviceAggregation
public async Task<DeviceManagementInfoDto> RepushDeviceInfoToOneNET(DeviceManagementInfoDto input) public async Task<DeviceManagementInfoDto> RepushDeviceInfoToOneNET(DeviceManagementInfoDto input)
{ {
try try
{ {
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
.Where(e => e.IoTPlatformProductId == input.IoTPlatformProductId)
.FirstAsync();
if (productInfo == null)
{
throw new UserFriendlyException($"推送失败,未找到对应的产品配置信息。");
}
//检查OneNET平台设备是否已经存在 //检查OneNET平台设备是否已经存在
var oneNETDeviceInfoResult = await oneNETDeviceService.DeviceInfoDetailAsync(new DeviceInfoDetailInput() var oneNETDeviceInfoResult = await oneNETDeviceService.DeviceInfoDetailAsync(new DeviceInfoDetailInput()
{ {
DeviceName = input.IoTPlatformDeviceOpenInfo, DeviceName = input.IoTPlatformDeviceOpenInfo,
ProductId = productInfo.IoTPlatformProductId, ProductId = input.IoTPlatformProductId,
OneNETAccountId = productInfo.OneNETAccountId, OneNETAccountId = input.IoTPlatformAccountId,
}); });
if (oneNETDeviceInfoResult != null && oneNETDeviceInfoResult.Code == ServicePro.Enums.ResponeResultEnum.Success) if (oneNETDeviceInfoResult != null && oneNETDeviceInfoResult.Code == ServicePro.Enums.ResponeResultEnum.Success)
{ {
throw new UserFriendlyException($"推送失败OneNET账号{productInfo.AccountPhoneNumber}的产品下{productInfo.ProductName}已经存在该设备{input.DeviceAddress}。"); throw new UserFriendlyException($"OneNET推送失败账号产品下{input.IoTPlatformProductId}已经存在该设备{input.DeviceAddress}。");
} }
//推送至OneNET平台 //推送至OneNET平台
var pushResult = await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput() var pushResult = await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput()
{ {
DeviceName = input.IoTPlatformDeviceOpenInfo, DeviceName = input.IoTPlatformDeviceOpenInfo,
ProductId = productInfo.IoTPlatformProductId, ProductId = input.IoTPlatformProductId,
OneNETAccountId = productInfo.OneNETAccountId, OneNETAccountId = input.IoTPlatformAccountId,
Description = input.DeviceAddress, Description = input.DeviceAddress,
}); });
@ -589,23 +583,13 @@ namespace JiShe.IoT.DeviceAggregation
public async Task<bool> DeleteDeviceInfoToOneNET(DeviceManagementInfoDto input) public async Task<bool> DeleteDeviceInfoToOneNET(DeviceManagementInfoDto input)
{ {
try try
{ {
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
.Where(e => e.IoTPlatformProductId == input.IoTPlatformProductId)
.FirstAsync();
if (productInfo == null)
{
throw new UserFriendlyException($"删除失败,未找到对应的产品配置信息。");
}
//删除OneNET平台设备信息 //删除OneNET平台设备信息
var deleteResult = await oneNETDeviceService.DeleteDeviceInfoAsync(new DeleteDeviceInfoInput() var deleteResult = await oneNETDeviceService.DeleteDeviceInfoAsync(new DeleteDeviceInfoInput()
{ {
DeviceName = input.IoTPlatformDeviceOpenInfo, DeviceName = input.IoTPlatformDeviceOpenInfo,
ProductId = productInfo.IoTPlatformProductId, ProductId = input.IoTPlatformProductId,
OneNETAccountId = productInfo.OneNETAccountId, OneNETAccountId = input.IoTPlatformAccountId,
}); });
if (deleteResult == null || deleteResult.Code != ServicePro.Enums.ResponeResultEnum.Success) if (deleteResult == null || deleteResult.Code != ServicePro.Enums.ResponeResultEnum.Success)
@ -634,13 +618,39 @@ namespace JiShe.IoT.DeviceAggregation
/// 发送OneNET平台设备指令 /// 发送OneNET平台设备指令
/// </summary> /// </summary>
/// <param name="deviceInfo"></param> /// <param name="deviceInfo"></param>
/// <param name="packetTaskInfo"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="UserFriendlyException"></exception> /// <exception cref="UserFriendlyException"></exception>
public async Task<bool> DeviceCommandInfoToOneNET(DeviceManagementInfoDto deviceInfo, DeviceTelemetryPacketTaskInfo packetTaskInfo) public async Task<bool> DeviceCommandInfoToOneNET(DeviceManagementInfoDto deviceInfo, ReceiveCommandInfoDto input)
{ {
try try
{ {
//检查设备是否有配置设备端物模型信息
//如果有配置就检查指令字典中是否有SpecialCommand标识符
//如果有就需要构建 SpecialCommand 的特别指令
if (deviceInfo.IsNeedConfigDevicMdoel && deviceInfo.DeviceThingModelDataId.HasValue && input.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand))
{
var propertyInfo = await oneNETProductService.GetProductThingModelSpecialCommandDataTypeListAsync(new IdInput<string>() { Id = deviceInfo.IoTPlatformProductId });
if (propertyInfo == null)
{
throw new UserFriendlyException($"{nameof(DeviceCommandInfoToOneNET)} OneNET设备属性设置失败产品Id{deviceInfo.IoTPlatformProductId}未找到对应的属性信息。");
}
Dictionary<string, string> tempSpecialCommand = await deviceThingModelService.BuildThingModelSpecialCommandAsync(propertyInfo, deviceInfo.DeviceThingModelDataId.Value);
input.Commands[ThingModelFixedTypeConst.SpecialCommand] = tempSpecialCommand;
}
var commandRequest = new OpenApiRequest()
{
Message = input.Serialize(),
};
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), input.Commands.Serialize());
await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo));
//检查下设备是否在线 //检查下设备是否在线
var deviceOnlineStatus = await oneNETDeviceService.DeviceInfoDetailAsync(new DeviceInfoDetailInput() var deviceOnlineStatus = await oneNETDeviceService.DeviceInfoDetailAsync(new DeviceInfoDetailInput()
{ {

View File

@ -52,8 +52,8 @@ namespace JiShe.IoT
DeviceType = $"{commandIssueInfo.DeviceType}", DeviceType = $"{commandIssueInfo.DeviceType}",
DeviceAddress = commandIssueInfo.DeviceAddress, DeviceAddress = commandIssueInfo.DeviceAddress,
IssueRawMessage = input.Serialize(), IssueRawMessage = input.Serialize(),
IssuePayload = messageBody,
IoTDataType = IoTDBDataTypeConst.Command, IoTDataType = IoTDBDataTypeConst.Command,
TelemetryType = (int)commandIssueInfo.TelemetryType,
TelemetrySource = (int)commandIssueInfo.SourceType, TelemetrySource = (int)commandIssueInfo.SourceType,
IoTPlatform = (int)commandIssueInfo.IoTPlatform, IoTPlatform = (int)commandIssueInfo.IoTPlatform,
IoTPlatformProductId = deviceInfo.IoTPlatformProductId, IoTPlatformProductId = deviceInfo.IoTPlatformProductId,
@ -61,7 +61,6 @@ namespace JiShe.IoT
IoTPlatformAccountId = deviceInfo.IoTPlatformAccountId, IoTPlatformAccountId = deviceInfo.IoTPlatformAccountId,
AccountPhoneNumber = deviceInfo.AccountPhoneNumber, AccountPhoneNumber = deviceInfo.AccountPhoneNumber,
IoTPlatformProductName = deviceInfo.IoTPlatformProductName, IoTPlatformProductName = deviceInfo.IoTPlatformProductName,
IssuePayload = messageBody,
RetryCount = 0, RetryCount = 0,
IssueStatus = (int)DeviceCommandIssueStatusEnum.Unprocessed, IssueStatus = (int)DeviceCommandIssueStatusEnum.Unprocessed,
LastIssueTime = DateTime.Now LastIssueTime = DateTime.Now

View File

@ -0,0 +1,179 @@
using Castle.Core.Logging;
using JiShe.IoT.IoTPlatformAggregation.Dto;
using JiShe.ServicePro.Commons;
using JiShe.ServicePro.Core;
using JiShe.ServicePro.CTWingManagement.CTWingProducts;
using JiShe.ServicePro.Enums;
using JiShe.ServicePro.FreeRedisProvider;
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
namespace JiShe.IoT.IoTPlatformAggregation
{
/// <summary>
/// 平台聚合服务
/// </summary>
public class IoTPlatformAggregationService : IoTAppService, IIoTPlatformAggregationService
{
private readonly ILogger<IoTPlatformAggregationService> _logger;
private readonly ICTWingProductService _ctwingProductService;
private readonly IOneNETProductService _oneNetProductService;
public IoTPlatformAggregationService(ILogger<IoTPlatformAggregationService> logger,
ICTWingProductService ctwingProductService,
IOneNETProductService oneNetProductService)
{
_logger = logger;
_ctwingProductService = ctwingProductService;
_oneNetProductService = oneNetProductService;
}
/// <summary>
/// 获取平台产品信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<List<IoTPlatformProductInfoOutput>> GetIoTPlatformProductInfoAsync(IoTPlatformProductInfoInput input
)
{
try
{
if (input == null)
{
throw new UserFriendlyException($"{nameof(GetIoTPlatformProductInfoAsync)} 平台产品聚合服务获取产品信息失败,参数异常");
}
List<IoTPlatformProductInfoOutput> ioTPlatformProductInfoOutputs = new List<IoTPlatformProductInfoOutput>();
if (input.IoTPlatformType == IoTPlatformTypeEnum.CTWing)
{
var ctwingProductInfos = await _ctwingProductService.GetAllListAsync();
if (ctwingProductInfos == null)
{
return ioTPlatformProductInfoOutputs;
}
foreach (var ctwingProductInfo in ctwingProductInfos)
{
ioTPlatformProductInfoOutputs.Add(new IoTPlatformProductInfoOutput
{
IoTPlatformType = IoTPlatformTypeEnum.CTWing,
IoTPlatformProductId = ctwingProductInfo.IoTPlatformProductId,
ProductName = ctwingProductInfo.ProductName
});
}
}
if (input.IoTPlatformType == IoTPlatformTypeEnum.OneNET)
{
var oneNetProductInfos = await _oneNetProductService.GetAllListAsync();
if (oneNetProductInfos == null)
{
return ioTPlatformProductInfoOutputs;
}
foreach (var oneNetProductInfo in oneNetProductInfos)
{
ioTPlatformProductInfoOutputs.Add(new IoTPlatformProductInfoOutput
{
IoTPlatformType = IoTPlatformTypeEnum.OneNET,
IoTPlatformProductId = oneNetProductInfo.IoTPlatformProductId,
ProductName = oneNetProductInfo.ProductName
});
}
}
return ioTPlatformProductInfoOutputs;
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 获取平台产品物模型属性信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<List<SelectResult>> GetIoTPlatformProductPropertyInfoAsync(IoTPlatformProductPropertyInfoInput input)
{
try
{
if (input == null)
{
throw new UserFriendlyException($"{nameof(GetIoTPlatformProductPropertyInfoAsync)} 平台产品聚合服务获取产品属性信息失败,参数异常");
}
var key = string.Format($"{RedisConst.CachePlatformProductThingModelInfoKey}", input.IoTPlatformType);
List<SelectResult> selectResults = new List<SelectResult>();
List<IoTPlatformProductInfoOutput> ioTPlatformProductInfoOutputs = new List<IoTPlatformProductInfoOutput>();
if (input.IoTPlatformType == IoTPlatformTypeEnum.CTWing)
{
//var ctwingProductInfos = await _ctwingProductService.GetAllListAsync();
//if (ctwingProductInfos == null)
//{
// return ioTPlatformProductInfoOutputs;
//}
//foreach (var ctwingProductInfo in ctwingProductInfos)
//{
// ioTPlatformProductInfoOutputs.Add(new IoTPlatformProductInfoOutput
// {
// IoTPlatformType = IoTPlatformTypeEnum.CTWing,
// IoTPlatformProductId = ctwingProductInfo.IoTPlatformProductId,
// ProductName = ctwingProductInfo.ProductName
// });
//}
_logger.LogError($"{nameof(GetIoTPlatformProductPropertyInfoAsync)}产品聚合服务暂不支持CTWing产品物模型属性信息查询");
return selectResults;
}
if (input.IoTPlatformType == IoTPlatformTypeEnum.OneNET)
{
var oneNETAllThingModel = FreeRedisProvider.Instance.HGet<OneNETAllThingModel>(key, input.IoTPlatformProductId);
if (oneNETAllThingModel != null)
{
return OneNETAllThingModel.GetAllPropertiesSelectResult(oneNETAllThingModel.Properties);
}
var oneNetProductInfos = await _oneNetProductService.GetProductInfoAsync(new IdInput<string>() { Id = input.IoTPlatformProductId });
if (oneNetProductInfos == null || string.IsNullOrWhiteSpace(oneNetProductInfos.ThingModelInfos))
{
return selectResults;
}
oneNETAllThingModel = oneNetProductInfos.ThingModelInfos.Deserialize<OneNETAllThingModel>();
if (oneNETAllThingModel == null)
{
return selectResults;
}
await FreeRedisProvider.Instance.HSetAsync<OneNETAllThingModel>(key, input.IoTPlatformProductId, oneNETAllThingModel);
return OneNETAllThingModel.GetAllPropertiesSelectResult(oneNETAllThingModel.Properties);
}
return selectResults;
}
catch (Exception)
{
throw;
}
}
}
}

View File

@ -38,7 +38,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" /> <PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,14 +1,14 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=33306;Database=JiSheIoTProDB54;uid=root;pwd=123456789;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"
}, },
"IoTDBOptions": { "IoTDBOptions": {
"UserName": "root", "UserName": "root",
"Password": "Lixiao@1980", "Password": "Lixiao@1980",
//"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ], //"TreeModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
//"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ], //"TableModelClusterList": [ "192.168.111.174:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
"TreeModelClusterList": [ "47.110.53.196:30710" ], "TreeModelClusterList": [ "192.168.111.174:30710" ],
"TableModelClusterList": [ "47.110.53.196:30710" ], "TableModelClusterList": [ "192.168.111.174:30710" ],
"PoolSize": 32, "PoolSize": 32,
"DataBaseName": "jisheiotdata", "DataBaseName": "jisheiotdata",
"OpenDebugMode": false, "OpenDebugMode": false,

View File

@ -23,6 +23,7 @@
<ProjectReference Include="..\..\JiShe.ServicePro\modules\TemplateManagement\src\JiShe.ServicePro.TemplateManagement.Domain.Shared\JiShe.ServicePro.TemplateManagement.Domain.Shared.csproj" /> <ProjectReference Include="..\..\JiShe.ServicePro\modules\TemplateManagement\src\JiShe.ServicePro.TemplateManagement.Domain.Shared\JiShe.ServicePro.TemplateManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\JiShe.ServicePro\modules\OneNETManagement\src\JiShe.ServicePro.OneNETManagement.Domain.Shared\JiShe.ServicePro.OneNETManagement.Domain.Shared.csproj" /> <ProjectReference Include="..\..\JiShe.ServicePro\modules\OneNETManagement\src\JiShe.ServicePro.OneNETManagement.Domain.Shared\JiShe.ServicePro.OneNETManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\JiShe.ServicePro\frameworks\src\JiShe.ServicePro.Core\JiShe.ServicePro.Core.csproj" /> <ProjectReference Include="..\..\JiShe.ServicePro\frameworks\src\JiShe.ServicePro.Core\JiShe.ServicePro.Core.csproj" />
<ProjectReference Include="..\..\JiShe.ServicePro\shared\JiShe.ServicePro.Shared.DynamicAnalyzerEngine\JiShe.ServicePro.Shared.DynamicAnalyzerEngine.csproj" />
</ItemGroup> </ItemGroup>
@ -39,10 +40,11 @@
<PackageReference Include="JiShe.ServicePro.Core" /> <PackageReference Include="JiShe.ServicePro.Core" />
<PackageReference Include="JiShe.ServicePro.CTWingManagement.Domain.Shared" /> <PackageReference Include="JiShe.ServicePro.CTWingManagement.Domain.Shared" />
<PackageReference Include="JiShe.ServicePro.OneNETManagement.Domain.Shared" /> <PackageReference Include="JiShe.ServicePro.OneNETManagement.Domain.Shared" />
<PackageReference Include="JiShe.ServicePro.Shared.DynamicAnalyzerEngine" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Core" /> <PackageReference Include="Volo.Abp.Core" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,6 +7,9 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj" /> <ProjectReference Include="..\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL.Pomelo" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL.Pomelo" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'" Label="Debug"> <ItemGroup Condition=" '$(Configuration)' == 'Debug'" Label="Debug">

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("20251207055002_InitialCreate")] [Migration("20251222073841_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -22,7 +22,7 @@ namespace JiShe.IoT.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "9.0.6") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64); .HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@ -887,7 +887,6 @@ namespace JiShe.IoT.Migrations
.HasComment("函数解析标记默认为false 不能解析"); .HasComment("函数解析标记默认为false 不能解析");
b.Property<string>("FunctionScript") b.Property<string>("FunctionScript")
.IsRequired()
.HasColumnType("text") .HasColumnType("text")
.HasComment("脚本函数体"); .HasComment("脚本函数体");
@ -927,10 +926,6 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权最后修改者Id"); .HasComment("旧系统授权最后修改者Id");
b.Property<int>("ParsingSequence")
.HasColumnType("int")
.HasComment("解析顺序1234或者3412(高低位反转)");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("备注"); .HasComment("备注");
@ -1016,7 +1011,6 @@ namespace JiShe.IoT.Migrations
.HasComment("物联网平台中对应的产品Id"); .HasComment("物联网平台中对应的产品Id");
b.Property<string>("IoTPlatformRawFieldDataType") b.Property<string>("IoTPlatformRawFieldDataType")
.IsRequired()
.HasMaxLength(20) .HasMaxLength(20)
.HasColumnType("varchar(20)") .HasColumnType("varchar(20)")
.HasComment("物联网平台中对应的产品物模型属性或者事件数据类型"); .HasComment("物联网平台中对应的产品物模型属性或者事件数据类型");
@ -1027,6 +1021,10 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(64)") .HasColumnType("varchar(64)")
.HasComment("物联网平台中对应的产品物模型属性或者事件名称"); .HasComment("物联网平台中对应的产品物模型属性或者事件名称");
b.Property<Guid>("IoTPlatformThingModelDataId")
.HasColumnType("char(36)")
.HasComment("系统中平台端物模型数据Id");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit(1)") .HasColumnType("bit(1)")
@ -1045,6 +1043,14 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<int>("NativeSkipNumber")
.HasColumnType("int")
.HasComment("正序跳过数量");
b.Property<int>("NativeTakeNumber")
.HasColumnType("int")
.HasComment("正序获取数量");
b.Property<int?>("OSACreatorId") b.Property<int?>("OSACreatorId")
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权创建者Id"); .HasComment("旧系统授权创建者Id");
@ -1057,13 +1063,21 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权最后修改者Id"); .HasComment("旧系统授权最后修改者Id");
b.Property<int>("ParsingSequence")
.HasColumnType("int")
.HasComment("解析顺序1234或者3412(高低反转)");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("备注"); .HasComment("备注");
b.Property<int>("SkipNumber") b.Property<int?>("ReversalSkipNumber")
.HasColumnType("int") .HasColumnType("int")
.HasComment("跳过数量"); .HasComment("反转跳过数量");
b.Property<int?>("ReversalTakeNumber")
.HasColumnType("int")
.HasComment("反转获取数量");
b.Property<string>("StandardFieldDisplayName") b.Property<string>("StandardFieldDisplayName")
.IsRequired() .IsRequired()
@ -1083,10 +1097,6 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(20)") .HasColumnType("varchar(20)")
.HasComment("标准物模型字段值类型"); .HasComment("标准物模型字段值类型");
b.Property<int>("TakeNumber")
.HasColumnType("int")
.HasComment("获取数量");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasColumnName("TenantId") .HasColumnName("TenantId")
@ -1157,6 +1167,15 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品Id"); .HasComment("物联网平台中对应的产品Id");
b.Property<string>("IoTPlatformRawFieldDataType")
.HasMaxLength(64)
.HasColumnType("varchar(64)")
.HasComment("物联网平台中对应的产品物模型属性或者事件数据类型");
b.Property<string>("IoTPlatformRawFieldExtension")
.HasColumnType("text")
.HasComment("物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型");
b.Property<string>("IoTPlatformRawFieldName") b.Property<string>("IoTPlatformRawFieldName")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -1169,6 +1188,10 @@ namespace JiShe.IoT.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<sbyte>("IsSpecialIdentifier")
.HasColumnType("tinyint(1)")
.HasComment("是否是特殊物模型标识符");
b.Property<sbyte>("IsValueNeedConvert") b.Property<sbyte>("IsValueNeedConvert")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasComment("是否需要值类型转换"); .HasComment("是否需要值类型转换");

View File

@ -984,9 +984,8 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
ScriptName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "脚本函数名称") ScriptName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "脚本函数名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
FunctionScript = table.Column<string>(type: "text", nullable: false, comment: "脚本函数体") FunctionScript = table.Column<string>(type: "text", nullable: true, comment: "脚本函数体")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
ParsingSequence = table.Column<int>(type: "int", nullable: false, comment: "解析顺序1234或者3412(高低位反转)"),
FunctionAnalysisFlag = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "函数解析标记默认为false 不能解析"), FunctionAnalysisFlag = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "函数解析标记默认为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"),
@ -1022,11 +1021,12 @@ namespace JiShe.IoT.Migrations
IoTPlatform = table.Column<int>(type: "int", nullable: false, comment: "物联网平台类型"), IoTPlatform = table.Column<int>(type: "int", nullable: false, comment: "物联网平台类型"),
IoTPlatformProductId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id") IoTPlatformProductId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformThingModelDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "系统中平台端物模型数据Id", collation: "ascii_general_ci"),
FiledType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型") FiledType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称") IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件数据类型") IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
@ -1035,8 +1035,11 @@ namespace JiShe.IoT.Migrations
StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"), IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"),
SkipNumber = table.Column<int>(type: "int", nullable: false, comment: "跳过数量"), NativeSkipNumber = table.Column<int>(type: "int", nullable: false, comment: "正序跳过数量"),
TakeNumber = table.Column<int>(type: "int", nullable: false, comment: "获取数量"), NativeTakeNumber = table.Column<int>(type: "int", nullable: false, comment: "正序获取数量"),
ParsingSequence = table.Column<int>(type: "int", nullable: false, comment: "解析顺序1234或者3412(高低反转)"),
ReversalSkipNumber = table.Column<int>(type: "int", nullable: true, comment: "反转跳过数量"),
ReversalTakeNumber = table.Column<int>(type: "int", nullable: true, 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),
@ -1074,6 +1077,8 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称") IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true, comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldValueType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "标准物模型字段值类型") StandardFieldValueType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "标准物模型字段值类型")
@ -1081,6 +1086,9 @@ namespace JiShe.IoT.Migrations
StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"), IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"),
IsSpecialIdentifier = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否是特殊物模型标识符"),
IoTPlatformRawFieldExtension = table.Column<string>(type: "text", nullable: true, comment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型")
.Annotation("MySql:CharSet", "utf8mb4"),
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

@ -19,7 +19,7 @@ namespace JiShe.IoT.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "9.0.6") .HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64); .HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@ -884,7 +884,6 @@ namespace JiShe.IoT.Migrations
.HasComment("函数解析标记默认为false 不能解析"); .HasComment("函数解析标记默认为false 不能解析");
b.Property<string>("FunctionScript") b.Property<string>("FunctionScript")
.IsRequired()
.HasColumnType("text") .HasColumnType("text")
.HasComment("脚本函数体"); .HasComment("脚本函数体");
@ -924,10 +923,6 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权最后修改者Id"); .HasComment("旧系统授权最后修改者Id");
b.Property<int>("ParsingSequence")
.HasColumnType("int")
.HasComment("解析顺序1234或者3412(高低位反转)");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("备注"); .HasComment("备注");
@ -1013,7 +1008,6 @@ namespace JiShe.IoT.Migrations
.HasComment("物联网平台中对应的产品Id"); .HasComment("物联网平台中对应的产品Id");
b.Property<string>("IoTPlatformRawFieldDataType") b.Property<string>("IoTPlatformRawFieldDataType")
.IsRequired()
.HasMaxLength(20) .HasMaxLength(20)
.HasColumnType("varchar(20)") .HasColumnType("varchar(20)")
.HasComment("物联网平台中对应的产品物模型属性或者事件数据类型"); .HasComment("物联网平台中对应的产品物模型属性或者事件数据类型");
@ -1024,6 +1018,10 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(64)") .HasColumnType("varchar(64)")
.HasComment("物联网平台中对应的产品物模型属性或者事件名称"); .HasComment("物联网平台中对应的产品物模型属性或者事件名称");
b.Property<Guid>("IoTPlatformThingModelDataId")
.HasColumnType("char(36)")
.HasComment("系统中平台端物模型数据Id");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit(1)") .HasColumnType("bit(1)")
@ -1042,6 +1040,14 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<int>("NativeSkipNumber")
.HasColumnType("int")
.HasComment("正序跳过数量");
b.Property<int>("NativeTakeNumber")
.HasColumnType("int")
.HasComment("正序获取数量");
b.Property<int?>("OSACreatorId") b.Property<int?>("OSACreatorId")
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权创建者Id"); .HasComment("旧系统授权创建者Id");
@ -1054,13 +1060,21 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("旧系统授权最后修改者Id"); .HasComment("旧系统授权最后修改者Id");
b.Property<int>("ParsingSequence")
.HasColumnType("int")
.HasComment("解析顺序1234或者3412(高低反转)");
b.Property<string>("Remark") b.Property<string>("Remark")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("备注"); .HasComment("备注");
b.Property<int>("SkipNumber") b.Property<int?>("ReversalSkipNumber")
.HasColumnType("int") .HasColumnType("int")
.HasComment("跳过数量"); .HasComment("反转跳过数量");
b.Property<int?>("ReversalTakeNumber")
.HasColumnType("int")
.HasComment("反转获取数量");
b.Property<string>("StandardFieldDisplayName") b.Property<string>("StandardFieldDisplayName")
.IsRequired() .IsRequired()
@ -1080,10 +1094,6 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(20)") .HasColumnType("varchar(20)")
.HasComment("标准物模型字段值类型"); .HasComment("标准物模型字段值类型");
b.Property<int>("TakeNumber")
.HasColumnType("int")
.HasComment("获取数量");
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasColumnName("TenantId") .HasColumnName("TenantId")
@ -1154,6 +1164,15 @@ namespace JiShe.IoT.Migrations
.HasColumnType("varchar(50)") .HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品Id"); .HasComment("物联网平台中对应的产品Id");
b.Property<string>("IoTPlatformRawFieldDataType")
.HasMaxLength(64)
.HasColumnType("varchar(64)")
.HasComment("物联网平台中对应的产品物模型属性或者事件数据类型");
b.Property<string>("IoTPlatformRawFieldExtension")
.HasColumnType("text")
.HasComment("物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型");
b.Property<string>("IoTPlatformRawFieldName") b.Property<string>("IoTPlatformRawFieldName")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -1166,6 +1185,10 @@ namespace JiShe.IoT.Migrations
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnName("IsDeleted"); .HasColumnName("IsDeleted");
b.Property<sbyte>("IsSpecialIdentifier")
.HasColumnType("tinyint(1)")
.HasComment("是否是特殊物模型标识符");
b.Property<sbyte>("IsValueNeedConvert") b.Property<sbyte>("IsValueNeedConvert")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasComment("是否需要值类型转换"); .HasComment("是否需要值类型转换");

View File

@ -0,0 +1,49 @@
using JiShe.IoT.DeviceAggregation;
using JiShe.IoT.DeviceAggregation.Dto;
using JiShe.IoT.IoTPlatformAggregation;
using JiShe.IoT.IoTPlatformAggregation.Dto;
using JiShe.ServicePro;
using JiShe.ServicePro.Commons;
using JiShe.ServicePro.Core;
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
namespace JiShe.IoT.Controllers
{
/// <summary>
/// 平台产品聚合服务
/// </summary>
[Route("/Aggregation/IoTPlatform")]
public class IoTPlatformAggregationController : IoTController
{
private readonly IIoTPlatformAggregationService _iotPlatformAggregationService;
public IoTPlatformAggregationController(IIoTPlatformAggregationService deviceAggregationService)
{
_iotPlatformAggregationService = deviceAggregationService;
}
/// <summary>
/// 获取平台产品信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(GetIoTPlatformProductInfoAsync))]
[SwaggerOperation(summary: "获取平台产品信息", Tags = new[] { "AggregationIoTPlatform" })]
public async Task<List<IoTPlatformProductInfoOutput>> GetIoTPlatformProductInfoAsync(IoTPlatformProductInfoInput input)
{
return await _iotPlatformAggregationService.GetIoTPlatformProductInfoAsync(input);
}
/// <summary>
/// 获取平台产品物模型属性信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(GetIoTPlatformProductPropertyInfoAsync))]
[SwaggerOperation(summary: "获取平台产品物模型属性信息", Tags = new[] { "AggregationIoTPlatform" })]
public async Task<List<SelectResult>> GetIoTPlatformProductPropertyInfoAsync(IoTPlatformProductPropertyInfoInput input)
{
return await _iotPlatformAggregationService.GetIoTPlatformProductPropertyInfoAsync(input);
}
}
}