字典明细新增扩展字段,新增设备物模型管理表
This commit is contained in:
parent
a3f3399ac4
commit
21dd36de64
@ -1 +1 @@
|
|||||||
Subproject commit 4ffdef6823df61822903a7e087553260fa7254ae
|
Subproject commit 5eee6ae6ecdae8325f89c8a1bff2007062388dd8
|
||||||
@ -24,7 +24,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BusinessSystemAggregationService(IOptions<ServerApplicationOptions> options, IReliableRedisPubSubService redisPubSubService, IDeviceAppService deviceAppService, IIoTDBDataChannelManageService ioTDBDataChannelManageService, IOptions<IoTDBOptions> _ioTDBOptions, ITreeModelService treeModelService, IDeviceAggregationService deviceAggregationService, ILogger<BusinessSystemAggregationService> _logger) : IoTAppService, IBusinessSystemAggregationService
|
public class BusinessSystemAggregationService(IOptions<ServerApplicationOptions> options, IReliableRedisPubSubService redisPubSubService, IDeviceAppService deviceAppService, IIoTDBDataChannelManageService ioTDBDataChannelManageService, IOptions<IoTDBOptions> _ioTDBOptions, ITreeModelService treeModelService, IDeviceAggregationService deviceAggregationService, ILogger<BusinessSystemAggregationService> _logger) : IoTAppService, IBusinessSystemAggregationService
|
||||||
{
|
{
|
||||||
ServerApplicationOptions srverOptions = options.Value;
|
ServerApplicationOptions serverOptions = options.Value;
|
||||||
IoTDBOptions ioTDBOptions = _ioTDBOptions.Value;
|
IoTDBOptions ioTDBOptions = _ioTDBOptions.Value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -37,7 +37,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
var handleResult = HandleOpenApiRequest<ReceiveCommandInfoDto>(input);
|
var handleResult = HandleOpenApiRequest<ReceiveCommandInfoDto>(input, serverOptions);
|
||||||
if (handleResult.Success == false)
|
if (handleResult.Success == false)
|
||||||
{
|
{
|
||||||
return handleResult;
|
return handleResult;
|
||||||
@ -127,7 +127,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var handleResult = HandleOpenApiRequest<BatchQueryDeviceInfoInput>(input);
|
var handleResult = HandleOpenApiRequest<BatchQueryDeviceInfoInput>(input, serverOptions);
|
||||||
if (handleResult.Success == false)
|
if (handleResult.Success == false)
|
||||||
{
|
{
|
||||||
return HttpDataResultExtensions.Failed<List<IoTDBDynamicObject>>(null, handleResult.Message, handleResult.LocationCode);
|
return HttpDataResultExtensions.Failed<List<IoTDBDynamicObject>>(null, handleResult.Message, handleResult.LocationCode);
|
||||||
@ -214,7 +214,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var handleResult = HandleOpenApiRequest<BatchCreateDeviceInfoInput>(input);
|
var handleResult = HandleOpenApiRequest<BatchCreateDeviceInfoInput>(input, serverOptions);
|
||||||
if (handleResult.Success == false)
|
if (handleResult.Success == false)
|
||||||
{
|
{
|
||||||
return HttpDataResultExtensions.Failed(handleResult.Message, handleResult.LocationCode);
|
return HttpDataResultExtensions.Failed(handleResult.Message, handleResult.LocationCode);
|
||||||
@ -246,54 +246,6 @@ namespace JiShe.IoT.BusinessSystemAggregation
|
|||||||
{
|
{
|
||||||
return HttpDataResultExtensions.Failed($"查询设备数据失败,发送异常:{ex.Message}", -106);
|
return HttpDataResultExtensions.Failed($"查询设备数据失败,发送异常:{ex.Message}", -106);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 处理开放接口请求
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private HttpDataResult<T> HandleOpenApiRequest<T>(OpenApiRequest input) where T : class
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(input.Message) || string.IsNullOrWhiteSpace(input.Message) || string.IsNullOrWhiteSpace(input.Signature))
|
|
||||||
{
|
|
||||||
return HttpDataResultExtensions.Failed<T>(null, "请求参数不能为空", -1101);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.Timestamp <= 946656000000)//时间戳小于2000年,视为错误
|
|
||||||
{
|
|
||||||
return HttpDataResultExtensions.Failed<T>(null, "时间戳异常", -1102);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.SignatureToken);
|
|
||||||
if (verifySignatureReult == false)//签名校验失败
|
|
||||||
{
|
|
||||||
return HttpDataResultExtensions.Failed<T>(null, "签名校验失败", -1103);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//判断是否需要解密
|
|
||||||
T messageBody = default;
|
|
||||||
string tempMessageBody = null;
|
|
||||||
if (srverOptions.IsAesEncrypted && !string.IsNullOrWhiteSpace(srverOptions.AesSecurityKey))
|
|
||||||
{
|
|
||||||
tempMessageBody = EncryptUtil.OpenApiDecrypto(input.Message, srverOptions.AesSecurityKey);
|
|
||||||
messageBody = tempMessageBody.Deserialize<T>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tempMessageBody = input.Message;
|
|
||||||
messageBody = input.Message.Deserialize<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (messageBody == null)
|
|
||||||
{
|
|
||||||
return HttpDataResultExtensions.Failed<T>(null, "获取数据体失败", -1104);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HttpDataResultExtensions.Success(messageBody, tempMessageBody);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,12 @@ using JiShe.ServicePro.ApacheIoTDB.Provider.Options;
|
|||||||
using JiShe.ServicePro.Consts;
|
using JiShe.ServicePro.Consts;
|
||||||
using JiShe.ServicePro.Core;
|
using JiShe.ServicePro.Core;
|
||||||
using JiShe.ServicePro.Dto;
|
using JiShe.ServicePro.Dto;
|
||||||
|
using JiShe.ServicePro.Encrypt;
|
||||||
using JiShe.ServicePro.Enums;
|
using JiShe.ServicePro.Enums;
|
||||||
using JiShe.ServicePro.FreeRedisProvider;
|
using JiShe.ServicePro.FreeRedisProvider;
|
||||||
using JiShe.ServicePro.FreeSqlProvider;
|
using JiShe.ServicePro.FreeSqlProvider;
|
||||||
using JiShe.ServicePro.IoTDBManagement.TableModels;
|
using JiShe.ServicePro.IoTDBManagement.TableModels;
|
||||||
|
using System.Xml.Linq;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
|
|
||||||
namespace JiShe.IoT
|
namespace JiShe.IoT
|
||||||
@ -71,5 +73,53 @@ namespace JiShe.IoT
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理开放接口请求
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="input">接口请求体</param>
|
||||||
|
/// <param name="serverOptions">服务配置</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected HttpDataResult<T> HandleOpenApiRequest<T>(OpenApiRequest input, ServerApplicationOptions serverOptions) where T : class
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Message) || string.IsNullOrWhiteSpace(input.Nonce) || string.IsNullOrWhiteSpace(input.Signature))
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed<T>(null, "请求参数不能为空", -1101);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.Timestamp <= 946656000000)//时间戳小于2000年,视为错误
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed<T>(null, "时间戳异常", -1102);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, serverOptions.SignatureToken);
|
||||||
|
if (verifySignatureReult == false)//签名校验失败
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed<T>(null, "签名校验失败", -1103);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//判断是否需要解密
|
||||||
|
T messageBody = default;
|
||||||
|
string tempMessageBody = null;
|
||||||
|
if (serverOptions.IsAesEncrypted && !string.IsNullOrWhiteSpace(serverOptions.AesSecurityKey))
|
||||||
|
{
|
||||||
|
tempMessageBody = EncryptUtil.OpenApiDecrypto(input.Message, serverOptions.AesSecurityKey);
|
||||||
|
messageBody = tempMessageBody.Deserialize<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempMessageBody = input.Message;
|
||||||
|
messageBody = input.Message.Deserialize<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messageBody == null)
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed<T>(null, "获取数据体失败", -1104);
|
||||||
|
}
|
||||||
|
|
||||||
|
return HttpDataResultExtensions.Success(messageBody, tempMessageBody);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,7 +127,8 @@ namespace JiShe.IoT.OneNETAggregation
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rawMessage = pageList.Serialize();
|
var rawMessage = pageList.Serialize();
|
||||||
var signatureResult = EncryptUtil.OpenApiSignature(rawMessage, DateTimeOffset.UtcNow.AddSeconds(3).ToUnixTimeMilliseconds(), serverOptions.SignatureToken);
|
long timestamp = serverOptions.GetOpenApiSignatureTimeStamp();
|
||||||
|
var signatureResult = EncryptUtil.OpenApiSignature(rawMessage, timestamp, serverOptions.SignatureToken);
|
||||||
|
|
||||||
return HttpDataResultExtensions.Success(rawMessage, signatureResult.Item1, signatureResult.Item2);
|
return HttpDataResultExtensions.Success(rawMessage, signatureResult.Item1, signatureResult.Item2);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ namespace JiShe.IoT.EntityFrameworkCore
|
|||||||
|
|
||||||
// 设备管理
|
// 设备管理
|
||||||
public DbSet<DeviceManagementInfo> DeviceManagementInfo { get; set; }
|
public DbSet<DeviceManagementInfo> DeviceManagementInfo { get; set; }
|
||||||
|
public DbSet<DeviceThingModelInfo> DeviceThingModelInfo { get; set; }
|
||||||
|
|
||||||
// CTWing管理
|
// CTWing管理
|
||||||
public DbSet<CTWingAccountInfo> CTWingAccountInfo { get; set; }
|
public DbSet<CTWingAccountInfo> CTWingAccountInfo { get; set; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user