diff --git a/Waste.Application/ResultInfos/Dtos/ResultDto.cs b/Waste.Application/ResultInfos/Dtos/ResultDto.cs index d55274c..5697cee 100644 --- a/Waste.Application/ResultInfos/Dtos/ResultDto.cs +++ b/Waste.Application/ResultInfos/Dtos/ResultDto.cs @@ -195,7 +195,7 @@ namespace Waste.Application public int Len { get; set; } = 0; /// - /// IMEI + /// IMEI/设备编号 /// public string IMEI { get; set; } = string.Empty; @@ -337,6 +337,7 @@ namespace Waste.Application public string ID6 { get; set; } = string.Empty; public string ID7 { get; set; } = string.Empty; public string ID8 { get; set; } = string.Empty; + public string DataHash { get; set; } = ""; } /// diff --git a/Waste.Application/ResultInfos/ResultService.cs b/Waste.Application/ResultInfos/ResultService.cs index 6a81cec..803d54a 100644 --- a/Waste.Application/ResultInfos/ResultService.cs +++ b/Waste.Application/ResultInfos/ResultService.cs @@ -468,6 +468,9 @@ namespace Waste.Application ID6 = myPackage.ID6, ID7 = myPackage.ID7, ID8 = myPackage.ID8, + + CreatedTime = DateTime.Now, + DataHash = myPackage.DataHash }).ExecuteCommandAsync(); } await SendMessageToThird(new SendThirdMessageSubscribeS2SDto diff --git a/Waste.Application/SubscribeInfo/SubscribeService.cs b/Waste.Application/SubscribeInfo/SubscribeService.cs index 81442a4..79b5cde 100644 --- a/Waste.Application/SubscribeInfo/SubscribeService.cs +++ b/Waste.Application/SubscribeInfo/SubscribeService.cs @@ -308,7 +308,9 @@ namespace Waste.Application.SubscribeInfo var services = scope.ServiceProvider; var mresultrep = services.GetService>(); //如果uuid不为空,并且以存在记录,则忽略 - if (!myPackage.IsHeart && !myPackage.UUID.IsEmpty() && await mresultrep.AnyAsync(x => x.UUID == myPackage.UUID)) + if (!myPackage.IsHeart && !myPackage.UUID.IsEmpty() && await mresultrep + .Where(x => x.CreatedTime > DateTime.Now.AddMinutes(-1) && x.DataHash == myPackage.DataHash)//1分钟内不能重复 + .AnyAsync()) { return; } diff --git a/Waste.Application/Waste.Application.xml b/Waste.Application/Waste.Application.xml index bb7ac0f..c32341e 100644 --- a/Waste.Application/Waste.Application.xml +++ b/Waste.Application/Waste.Application.xml @@ -1764,7 +1764,7 @@ - IMEI + IMEI/设备编号 diff --git a/Waste.Domain/DataModel/W_MeasureResult.cs b/Waste.Domain/DataModel/W_MeasureResult.cs index 3f52799..58cfafb 100644 --- a/Waste.Domain/DataModel/W_MeasureResult.cs +++ b/Waste.Domain/DataModel/W_MeasureResult.cs @@ -39,12 +39,11 @@ namespace Waste.Domain [SugarColumn(ColumnDescription = "操作员", ColumnDataType = "nvarchar(100)")] public string OpUser { get; set; } /// - /// 唯一消息ID + /// 消息ID /// - [SugarColumn(ColumnDescription = "唯一消息ID", ColumnDataType = "varchar(50)",IndexGroupNameList =new string[] { "index_uuid"})] + [SugarColumn(ColumnDescription = "消息ID", ColumnDataType = "varchar(50)",IndexGroupNameList =new string[] { "index_uuid"})] public string UUID { get; set; } - /// /// 设备出厂序列号/设备出厂编号 /// @@ -73,5 +72,7 @@ namespace Waste.Domain public string ID6 { get; set; } public string ID7 { get; set; } public string ID8 { get; set; } + public DateTime? CreatedTime { get; set; } + public string DataHash { get; set; } } } diff --git a/Waste.SocketService.cs/MyPackage.cs b/Waste.SocketService.cs/MyPackage.cs index 35e22f5..4de9eb5 100644 --- a/Waste.SocketService.cs/MyPackage.cs +++ b/Waste.SocketService.cs/MyPackage.cs @@ -21,7 +21,7 @@ namespace Waste.SocketService /// public int Len { get; set; } = 0; /// - /// IMEI + /// IMEI/设备编号 /// public string IMEI { get; set; } = ""; /// @@ -146,5 +146,6 @@ namespace Waste.SocketService public string ID6 { get; set; } public string ID7 { get; set; } public string ID8 { get; set; } + public string DataHash { get; set; } = ""; } } diff --git a/Waste.SocketService.cs/Program.cs b/Waste.SocketService.cs/Program.cs index 8508d01..3f4c0c2 100644 --- a/Waste.SocketService.cs/Program.cs +++ b/Waste.SocketService.cs/Program.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Furion.DataEncryption.Extensions; namespace Waste.SocketService { @@ -144,6 +145,7 @@ namespace Waste.SocketService _logger.Information(msg); if (package.Key == "A8") { + package.DataHash = $"{package.Str}".ToMD5Encrypt(); await _capBus.PublishAsync("result.service.inserta84g", package); if (!session.Channel.IsClosed) { diff --git a/Waste.Web.Entry/Program.cs b/Waste.Web.Entry/Program.cs index d81e7a2..4920f1f 100644 --- a/Waste.Web.Entry/Program.cs +++ b/Waste.Web.Entry/Program.cs @@ -37,6 +37,11 @@ namespace Waste.Web.Entry new string('-', 50);//ģ ///1.restrictedToMinimumLevelLogEventLevel config + .Enrich.WithProperty("Application", typeof(Program).Assembly.GetName().Name) + .Enrich.WithProcessId() + .Enrich.WithProcessName() + .Enrich.WithMachineName() + .Enrich.WithEnvironmentUserName() .WriteTo.Seq("http://localhost:5341/") //.MinimumLevel.Debug() // SinkС¼ //.MinimumLevel.Override("Microsoft", LogEventLevel.Fatal) diff --git a/Waste.Web.Entry/Waste.Web.Entry.csproj b/Waste.Web.Entry/Waste.Web.Entry.csproj index 26406a3..c09d8ce 100644 --- a/Waste.Web.Entry/Waste.Web.Entry.csproj +++ b/Waste.Web.Entry/Waste.Web.Entry.csproj @@ -18,10 +18,13 @@ + + +