Compare commits

..

No commits in common. "efa9c6a33277897b41800b7c3cfdf649792aad21" and "3229ac917f090e200736df98b4a4300912388ad9" have entirely different histories.

3 changed files with 17 additions and 32 deletions

View File

@ -1,7 +1,7 @@
{
"App": {
"SelfUrl": "http://localhost:44315",
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.10.104:4200"
"CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200"
},
"ConnectionStrings": {
//"Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB386;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;"

View File

@ -20,7 +20,6 @@ using Microsoft.Extensions.Options;
using System.Linq;
using Volo.Abp;
using Volo.Abp.Auditing;
using static FreeSql.Internal.GlobalFilter;
using static Volo.Abp.Ui.LayoutHooks.LayoutHooks;
namespace JiShe.IoT.BusinessSystemAggregation
@ -222,7 +221,9 @@ namespace JiShe.IoT.BusinessSystemAggregation
{
return HttpDataResultExtensions.Failed<Dictionary<string, object>>("设备不存在", -106, ResponeResultEnum.Fail);
}
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), messageBody.Commands.Serialize());
//将指令存储IoTDB数据库和Redis发布通道
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)
{
@ -234,11 +235,10 @@ namespace JiShe.IoT.BusinessSystemAggregation
{
return HttpDataResultExtensions.Failed<Dictionary<string, object>>($"业务系统推送指令时设备{deviceInfo.DeviceAddress}的平台端物模型信息不存在。", -107, ResponeResultEnum.Fail);
}
Dictionary<string, object> commands = new Dictionary<string, object>;
foreach (var item in messageBody.Commands)
{
var tempPlatformThingModelInfo = platformThingModelInfo.Where(d => d.StandardFieldName == item.Key).FirstOrDefault();
var tempPlatformThingModelInfo = platformThingModelInfo.Where(d => d.IoTPlatformRawFieldName == item.Key).FirstOrDefault();
if (tempPlatformThingModelInfo == null)
{
_logger.LogError($"业务系统推送指令时设备设备{deviceInfo.DeviceAddress}平台端物模型信息不存在属性标识符{item.Key}。");
@ -260,23 +260,18 @@ namespace JiShe.IoT.BusinessSystemAggregation
messageBody.Commands.RemoveAll(d => d.Key == item.Key);
continue;
}
commands.Add(item.Key,item.Value);
}
if (commands == null || commands.Count <= 0)
{
_logger.LogError($"业务系统推送指令时设备{deviceInfo.DeviceAddress}未匹配到具体数据模型,被禁止。");
return HttpDataResultExtensions.Failed<Dictionary<string, object>>("获取数据失败,未匹配到具体数据模型", -108);
}
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), commands.Serialize());
//数据写入遥测任务数据存储通道
await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo));
var queryResult = await DevicePropertyValueToOneNET(deviceInfo, new DevicePropertyValueForApiInput() { PropertyList = commands.Select(d => d.Key).ToList() });
if (messageBody.Commands == null || messageBody.Commands.Count <= 0)
{
return HttpDataResultExtensions.Failed<Dictionary<string, object>>("获取数据失败OneNET平台未返回数据", -108);
}
var queryResult = await DevicePropertyValueToOneNET(deviceInfo, new DevicePropertyValueForApiInput() { PropertyList = messageBody.Commands.Select(d => d.Key).ToList() });
if (queryResult == null || queryResult.Count <= 0)
{

View File

@ -18,9 +18,9 @@ namespace JiShe.IoT.Controllers
/// <summary>
/// 接收业务系统指令信息
/// </summary>
[HttpPost(nameof(ReceiveSetCommandInfoAsync))]
[HttpPost(nameof(ReceiveCommandInfoAsync))]
[SwaggerOperation(summary: "接收业务系统指令信息", Tags = new[] { "AggregationBusiness" })]
public async Task<HttpDataResult> ReceiveSetCommandInfoAsync(OpenApiRequest input)
public async Task<HttpDataResult> ReceiveCommandInfoAsync(OpenApiRequest input)
{
return await _businessSystemAggregationService.ReceiveSetCommandInfoAsync(input);
}
@ -44,16 +44,6 @@ namespace JiShe.IoT.Controllers
public async Task<HttpDataResult> BatchCreateDeviceInfoAsync(OpenApiRequest input)
{
return await _businessSystemAggregationService.BatchCreateDeviceInfoAsync(input);
}
/// <summary>
/// 接收业务系统获取属性指令信息
/// </summary>
[HttpPost(nameof(ReceiveGetCommandInfoAsync))]
[SwaggerOperation(summary: "接收业务系统获取属性指令信息", Tags = new[] { "AggregationBusiness" })]
public async Task<HttpDataResult> ReceiveGetCommandInfoAsync(OpenApiRequest input)
{
return await _businessSystemAggregationService.ReceiveGetCommandInfoAsync(input);
}
}
}
}