Compare commits

..

No commits in common. "9380c6e6b15813bce74bdec906297fa26d465092" and "6e70b026c98a1baa77f271439102eb3fc821c4d1" have entirely different histories.

16 changed files with 125 additions and 461 deletions

@ -1 +1 @@
Subproject commit ae4ef2a2f28f374199d0b0bc0f61be527f2965f0
Subproject commit cf3eff7465d5f3d89b4f95d372a0a7e797f4dec0

View File

@ -1,46 +0,0 @@
using JiShe.ServicePro;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.CTWingAggregation.Dto
{
/// <summary>
/// 生产车间获取CTWing产品列表
/// </summary>
public class CTWingWorkshopProductListOutput : OpenApiRequest
{
/// <summary>
/// 产品数据Id
/// </summary>
[SwaggerSchema("产品数据Id")]
public Guid ProductDataId { get; set; }
/// <summary>
/// 产品名称
/// </summary>
[SwaggerSchema("产品名称")]
public string ProductName { get; set; }
/// <summary>
/// 设备访问密钥
/// </summary>
[SwaggerSchema("设备访问密钥")]
public string ProductAccesskey { get; set; }
/// <summary>
/// 通讯服务地址
/// </summary>
[SwaggerSchema("通讯服务地址")]
public string CommunicationAddress { get; set; }
/// <summary>
/// TLS通讯服务地址
/// </summary>
[SwaggerSchema("TLS通讯服务地址")]
public string CommunicationAddressTLS { get; set; }
}
}

View File

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

View File

@ -11,13 +11,19 @@ namespace JiShe.IoT.OneNETAggregation.Dto
/// <summary>
/// 生产车间获取OneNET产品列表
/// </summary>
public class OneNetWorkshopProductListOutput
public class OneNetWorkshopProductListOutput: OpenApiRequest
{
/// <summary>
/// 产品数据Id
/// OneNET账户Id
/// </summary>
[SwaggerSchema("产品数据Id")]
public Guid ProductDataId { get; set; }
[SwaggerSchema("OneNET账户Id")]
public string OneNETAccountId { get; set; }
/// <summary>
/// 物联网平台对应的产品Id
/// </summary>
[SwaggerSchema("物联网平台对应的产品Id")]
public string IoTPlatformProductId { get; set; }
/// <summary>
/// 产品名称

View File

@ -0,0 +1,40 @@
using JiShe.ServicePro;
using JiShe.ServicePro.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace JiShe.IoT.OneNETAggregation.Dto
{
/// <summary>
/// 生产设备详情
/// </summary>
public class ProductionEquipmentMessageBody
{
/// <summary>
/// 表计类型
/// 电表= 1,水表= 2,燃气表= 3,热能表= 4,水表流量计=5燃气表流量计=6,特殊电表=7
/// </summary>
public DeviceTypeEnum? MeterType { get; set; }
/// <summary>
/// 设备地址
/// </summary>
public string DeviceAddress { get; set; }
/// <summary>
/// 物联网平台唯一设备标识
/// CTWing唯一设备标识为设备Id=CTWing产品Id+推送的设备序列号(集中器地址)
/// OneNET唯一设备标识为推送的设备名称为了保持统一因此推送的设备名称=OneNET产品Id+推送的设备序列号(集中器地址)
/// </summary>
public string DeviceOpenInfo { get; set; }
/// <summary>
/// 物联网平台对应的产品Id
/// </summary>
public string IoTPlatformProductId { get; set; }
}
}

View File

@ -24,6 +24,6 @@ namespace JiShe.IoT.OneNETAggregation
/// <summary>
/// 获取OneNET产品列表
/// </summary>
Task<HttpDataResult> GetProductListAsync(OpenApiRequest input);
Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input);
}
}

View File

@ -1,27 +0,0 @@
using JiShe.ServicePro;
using JiShe.ServicePro.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace JiShe.IoT.Workshops
{
/// <summary>
/// 生产设备详情
/// </summary>
public class ProductionEquipmentMessageBody
{
/// <summary>
/// 设备地址
/// </summary>
public string DeviceAddress { get; set; }
/// <summary>
/// 物联网平台对应的产品Id
/// </summary>
public string IoTPlatformProductId { get; set; }
}
}

View File

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

View File

@ -69,7 +69,7 @@ namespace JiShe.IoT.DeviceAggregation
CreateDeviceInput createDeviceInput = input.Adapt<CreateDeviceInput>();
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
.Where(e => e.IoTPlatformProductId == input.IoTPlatformProductId)//此处不需要过滤产品状态,方便测试产品配置信息是否准确,避免跟车间生产搞混
.Where(e => e.IsEnabled == true && e.IoTPlatformProductId == input.IoTPlatformProductId)
.FirstAsync();
if (productInfo == null)
@ -113,7 +113,6 @@ namespace JiShe.IoT.DeviceAggregation
UpdateDeviceInput updateDeviceInput = insertResult.Adapt<UpdateDeviceInput>();
updateDeviceInput.IoTPlatformResponse = pushResult.Serialize();
updateDeviceInput.IsPlatformPushSuccess = true;
var updateResult = await deviceAppService.UpdateAsync(updateDeviceInput);
if (updateResult == null)
@ -125,7 +124,6 @@ namespace JiShe.IoT.DeviceAggregation
//设备数据缓存到Redis
DeviceCacheInfos deviceCacheInfos = insertResult.Adapt<DeviceCacheInfos>();
deviceCacheInfos.IoTPlatformResponse = updateDeviceInput.IoTPlatformResponse;
RedisProvider.Instance.HSet<DeviceCacheInfos>(RedisConst.CacheAllDeviceInfoHashKey, insertResult.DeviceAddress, deviceCacheInfos);
return true;

View File

@ -1,5 +1,4 @@
using JiShe.IoT.OneNETAggregation.Dto;
using JiShe.IoT.Workshops;
using JiShe.ServicePro;
using JiShe.ServicePro.Core;
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
@ -49,17 +48,31 @@ namespace JiShe.IoT.OneNETAggregation
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
if (productionEquipmentMessageBody.MeterType.HasValue == false)
{
return HttpDataResultExtensions.Failed("设备类型不能为空", -103, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
{
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -102, ResponeResultEnum.Fail);
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -104, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
{
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -105, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceAddress))
{
return HttpDataResultExtensions.Failed("设备地址不能为空", -103, ResponeResultEnum.Fail);
return HttpDataResultExtensions.Failed("设备地址不能为空", -106, ResponeResultEnum.Fail);
}
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceOpenInfo))
{
return HttpDataResultExtensions.Failed("物联网平台唯一设备标识,不能为空", -107, ResponeResultEnum.Fail);
}
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
.Where(e => e.IsEnabled == true && e.IoTPlatformProductId == productionEquipmentMessageBody.IoTPlatformProductId)
@ -67,34 +80,34 @@ namespace JiShe.IoT.OneNETAggregation
if (productInfo == null)
{
return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -104, ResponeResultEnum.Fail);
return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -108, ResponeResultEnum.Fail);
}
CreateDeviceInput deviceInsertInput = new CreateDeviceInput()
CreateDeviceInput meterInfoEntity = new CreateDeviceInput()
{
DeviceAddress = productionEquipmentMessageBody.DeviceAddress,
PlatformPassword = productInfo.ProductAccesskey,
IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId,
IoTPlatformDeviceOpenInfo = $"{productionEquipmentMessageBody.IoTPlatformProductId}{productionEquipmentMessageBody.DeviceAddress}",
DeviceName = productionEquipmentMessageBody.DeviceAddress
IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo,
DeviceName = productionEquipmentMessageBody.DeviceOpenInfo
};
//创建本地设备信息
var insertResult = await deviceAppService.CreateAsync(deviceInsertInput);
var insertResult = await deviceAppService.CreateAsync(meterInfoEntity);
//推送至OneNET平台
var pushResult = await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput()
{
DeviceName = deviceInsertInput.IoTPlatformDeviceOpenInfo,
DeviceName = productionEquipmentMessageBody.DeviceOpenInfo,
ProductId = productionEquipmentMessageBody.IoTPlatformProductId,
OneNETAccountId = productInfo.OneNETAccountId,
Description = deviceInsertInput.IoTPlatformDeviceOpenInfo,
Description = productionEquipmentMessageBody.DeviceOpenInfo,
});
if (pushResult == null || pushResult.Code != ServicePro.Enums.ResponeResultEnum.Success)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} 推送设备信息失败:{pushResult.Serialize()}");
return HttpDataResultExtensions.Failed("推送设备信息OneNET失败", -105, ResponeResultEnum.Fail);
return HttpDataResultExtensions.Failed("推送设备信息OneNET失败", -109, ResponeResultEnum.Fail);
}
UpdateDeviceInput updateDeviceInput = insertResult.Adapt<UpdateDeviceInput>();
@ -104,7 +117,7 @@ namespace JiShe.IoT.OneNETAggregation
if (updateResult == null)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} OneNET返回的设备信息更新失败{input.Serialize()}");
return HttpDataResultExtensions.Failed("OneNET返回的设备信息更新失败", -106, ResponeResultEnum.Fail);
return HttpDataResultExtensions.Failed("OneNET返回的设备信息更新失败", -110, ResponeResultEnum.Fail);
}
//设备数据缓存到Redis
@ -113,13 +126,12 @@ namespace JiShe.IoT.OneNETAggregation
RedisProvider.Instance.HSet<DeviceCacheInfos>(RedisConst.CacheAllDeviceInfoHashKey, insertResult.DeviceAddress, deviceCacheInfos);
return HttpDataResultExtensions.Success("推送设备成功!");
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
}
catch (Exception ex)
{
logger.LogError($"{nameof(ReceiveWorkshopProductionInfoAsync)} 生产车间数据推送发生异常:{ex.Serialize()}");
return HttpDataResultExtensions.Failed("生产车间数据推送发生异常", -107, ResponeResultEnum.Exception);
return HttpDataResultExtensions.Failed("生产车间数据推送发生异常", -101, ResponeResultEnum.Exception);
}
}
@ -127,7 +139,7 @@ namespace JiShe.IoT.OneNETAggregation
/// 获取OneNET产品列表
/// </summary>
[AllowAnonymous]
public async Task<HttpDataResult> GetProductListAsync(OpenApiRequest input)
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input)
{
try
@ -135,31 +147,18 @@ namespace JiShe.IoT.OneNETAggregation
bool verifySignatureReult = EncryptUtil.OpenApiVerifySignature(input.Message, input.Nonce, input.Timestamp, input.Signature, srverOptions.VerifySignatureToken);
if (verifySignatureReult == false)//签名校验失败
{
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
return HttpDataResultExtensions.Failed<List<OneNetWorkshopProductListOutput>>("签名校验失败", -101, ResponeResultEnum.NotAllowed);
}
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
var pageListQuery = FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
.Where(e => e.IsEnabled == true)
.OrderByDescending(e => e.CreationTime);
var pageList = await pageListQuery.ToListAsync(d => new OneNetWorkshopProductListOutput
{
ProductDataId = d.Id,
ProductName = d.ProductName,
CommunicationAddress = d.CommunicationAddress,
ProductAccesskey = d.ProductAccesskey,
CommunicationAddressTLS = d.CommunicationAddressTLS
});
var pageList = await pageListQuery.ToListAsync<OneNetWorkshopProductListOutput>();
if (pageList == null || pageList.Count <= 0)
{
return HttpDataResultExtensions.Failed("获取OneNET产品失败", -102, ResponeResultEnum.NotAllowed);
}
var rawMessage = pageList.Serialize();
var signatureResult = EncryptUtil.OpenApiSignature(rawMessage, srverOptions.VerifySignatureToken);
return HttpDataResultExtensions.Success(rawMessage, signatureResult.Item1, signatureResult.Item2);
return HttpDataResultExtensions.Success(pageList);
}
catch (Exception)
{

View File

@ -21,6 +21,9 @@
# 更新dotnet tools
> dotnet tool update --global dotnet-ef
> 这个项目不能删除,初始化最基础的证书,以及《项目管理》的连接字符串加密都需要这个处理
> 生成SQL语句 Script-Migration -From 20220307064411_handlerMealPackage202203071443 -To 20220311084146_alterDevice202203111636 -Context ConsumerSystemDbContext
> Add-Migration alterAuditLogs202107011013 -c ConsumerSystemDbContext

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ namespace JiShe.IoT.Controllers
/// </summary>
[HttpPost(nameof(GetProductListAsync))]
[SwaggerOperation(summary: "获取OneNET产品列表", Tags = new[] { "AggregationOneNET" })]
public async Task<HttpDataResult> GetProductListAsync(OpenApiRequest input)
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetProductListAsync(OpenApiRequest input)
{
return await _oneNETAggregationServiceService.GetProductListAsync(input);
}